|
@@ -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);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- 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.Create();
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- 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);
|
|
|
-
|
|
|
}
|
|
|
else if (data["drive"].ToString() == "COS")
|
|
|
{
|