//--------------------------------------------------------------------- public bool IsDone() { while (QueCopyFile.Count > 0 && MapWWW.Count < 5) { string s1 = QueCopyFile.Dequeue(); var s2 = CasinosContext.Instance.PathMgr.CombineWWWStreamingAssetsPath(s1); MapWWW[s1] = new WWW(s2); } foreach (var i in MapWWW) { if (!i.Value.isDone) { continue; } ListFinished.Add(i.Key); var str = CasinosContext.Instance.PathMgr.CombinePersistentDataPath(i.Key); string d = Path.GetDirectoryName(str); if (!Directory.Exists(d)) { Directory.CreateDirectory(d); } using (FileStream fs = new FileStream(str, FileMode.Create)) { fs.Write(i.Value.bytes, 0, i.Value.bytes.Length); } i.Value.Dispose(); } foreach (var i in ListFinished) { MapWWW.Remove(i); } ListFinished.Clear(); if (!string.IsNullOrEmpty(DataFileListContent)) { var f = CasinosContext.Instance.PathMgr.CombinePersistentDataPath("DataFileList.txt"); File.WriteAllText(f, DataFileListContent); } LeftCount = QueCopyFile.Count; return(QueCopyFile.Count > 0 || MapWWW.Count > 0 ? false : true); }
//--------------------------------------------------------------------- public bool IsDone() { while (QueUpdateFile.Count > 0 && MapWWW.Count < 5) { string s1 = QueUpdateFile.Dequeue(); var s2 = Path.Combine(RemoteDataRootUrl, s1); UnityWebRequest web_request = UnityWebRequest.Get(s2); MapWWW[s1] = web_request; web_request.SendWebRequest(); } foreach (var i in MapWWW) { if (!i.Value.isDone) { continue; } ListFinished.Add(i.Key); var str = PersistentDataRootDir + i.Key; string d = Path.GetDirectoryName(str); if (!Directory.Exists(d)) { Directory.CreateDirectory(d); } using (FileStream fs = new FileStream(str, FileMode.Create)) { DownloadHandler dh = i.Value.downloadHandler; fs.Write(dh.data, 0, dh.data.Length); } i.Value.Dispose(); } foreach (var i in ListFinished) { MapWWW.Remove(i); } ListFinished.Clear(); LeftCount = QueUpdateFile.Count; return(QueUpdateFile.Count > 0 || MapWWW.Count > 0 ? false : true); }
//--------------------------------------------------------------------- public bool IsDone() { while (QueUpdateFile.Count > 0 && MapWWW.Count < 5) { string s1 = QueUpdateFile.Dequeue(); var s2 = Path.Combine(RemoteDataRootUrl, s1); MapWWW[s1] = new WWW(s2); } foreach (var i in MapWWW) { if (!i.Value.isDone) { continue; } ListFinished.Add(i.Key); var str = RemoteDataRootDir + i.Key; string d = Path.GetDirectoryName(str); if (!Directory.Exists(d)) { Directory.CreateDirectory(d); } using (FileStream fs = new FileStream(str, FileMode.Create)) { fs.Write(i.Value.bytes, 0, i.Value.bytes.Length); } i.Value.Dispose(); } foreach (var i in ListFinished) { MapWWW.Remove(i); } ListFinished.Clear(); LeftCount = QueUpdateFile.Count; return(QueUpdateFile.Count > 0 || MapWWW.Count > 0 ? false : true); }