Browse Source

修改下载的逻辑

胡佳骏 1 year ago
parent
commit
f0544a953c
1 changed files with 0 additions and 76 deletions
  1. 0 76
      Assets/DownLoadXR/DownLoadXRManager.cs

+ 0 - 76
Assets/DownLoadXR/DownLoadXRManager.cs

@@ -18,55 +18,8 @@ public class DownLoadXRManager
             string Url = data["url"].ToString();
             RoomFileMinio.Instance.getFile(bucket, objectName, (RoomFileMinio.RoomFileData roomFile) =>
             {
-                Debug.Log("RoomFile URL "+ roomFile.url);
-                Debug.Log("RoomFile Bytes Length " + roomFile.bytes.Length);
-
-
-                //文件流信息  
-                //StreamWriter sw;  
-                Stream sw;
-                string path = Application.persistentDataPath + "/DownLoadXR/" +Path.GetFileName(Url);
-                Debug.Log("准备存文件===》" + path);
-                FileInfo file = new FileInfo(path);
-                try
-                {
-
-                    if (file.Exists)
-                    {
-                        file.Delete();
-                    }
-                    if (!Directory.Exists(Application.persistentDataPath + "/DownLoadXR"))
-                    {
-                        Directory.CreateDirectory(Application.persistentDataPath + "/DownLoadXR");
-                    }
-                    //如果此文件存在则打开  
-                    //sw = file .Append();  
-                    //如果此文件不存在则创建  
-                    sw = file.Create();
-
-                    //以行的形式写入信息  
-                    //sw.WriteLine(info);  
-                    sw.Write(roomFile.bytes, 0, roomFile.bytes.Length);
-                    sw.Close();
-                    sw.Dispose();
-                }
-                catch
-                {
-                    /*
-                    JsonData data = new JsonData();
-                    data["type"] = "fileError";
-                    List<string> backTip = new List<string>();
-                    backTip.Add(data.ToJson());
-                    backTip.Add(data.ToJson());
-                    backTip.Add(data.ToJson());
-                    WindowsManager.Instance.show(WindowConfig.windowType.Error, false, WindowsManager.Instance.getErrorData("文件提示", "文件存储失败"+ path, Color.white, "icon", backTip, false, "", 5, "知道了.", "", "").ToJson());
-                    */
-                }
-                PlayerPrefs.SetString("DownLoadXR_" + Url, path);
                 bytes?.Invoke(roomFile.bytes);             
             });
-
-            return true;
         }
         else if (data["drive"].ToString() == "COS")
         {
@@ -93,21 +46,6 @@ public class DownLoadXRManager
         if (data["drive"].ToString() == "minio")
         {
             Url = data["url"].ToString();
-            if (PlayerPrefs.HasKey(Url))
-            {
-                bytes?.Invoke(PlayerPrefs.GetString("DownLoadXR_" + Url));
-                return true;
-            }
-            else
-            {
-               return DownLoadForBytes(msg, (byte[] callBackBytes) =>
-                {
-                    bytes?.Invoke(PlayerPrefs.GetString("DownLoadXR_" + Url));
-                }, presson);
-            }
-
-
-           
         }
         else if (data["drive"].ToString() == "COS")
         { 
@@ -193,20 +131,6 @@ public class DownLoadXRManager
         JsonData data = JsonMapper.ToObject(msg);
         if (data["drive"].ToString() == "minio")
         {
-            return DownLoadForBytes(msg, (byte[] fileBytes) =>
-            {
-                if (fileBytes != null)
-                {
-                    Texture2D tex = new Texture2D(10, 10);
-                    tex.LoadImage(fileBytes);
-                    bytes?.Invoke(tex);
-                }
-                else
-                {
-                    bytes?.Invoke(null);
-                }
-            },presson);
-         //   return false;
         }
         else if (data["drive"].ToString() == "COS")
         {