Esempio n. 1
0
        private static byte[] __SyncReadBytesByPath(string originName, string destName, string path, VersionFile.Type fileType, bool removeImpurity = true)
        {
            if (instance == null || instance.platformLoader == null)
            {
                return(null);
            }

            byte[] data = null;
            if (fileType == VersionFile.Type.COMBINE_FILE)
            {
                CombineFile cf = CombineFileManager.GetInstance().GetCombineFile(destName);
                data = cf.Read(originName);
            }
            else
            {
                data = instance.platformLoader.SyncReadBytes(path);
            }

            if (data != null)
            {
                if (removeImpurity)
                {
                    DataDecode(data, data.Length);
                }
            }

            return(data);
        }
Esempio n. 2
0
        public static CombineFileManager GetInstance()
        {
            if (instance == null)
            {
                instance = new CombineFileManager();
            }

            return(instance);
        }
Esempio n. 3
0
        private static void __AsynReadBytesByPath(string originName, string destName, string path, VersionFile.Type fileType, EndReadBytes endRead, System.Object obj, bool cb_whatever = false, bool needRemoveImpurity = true)
        {
            if (instance == null || instance.platformLoader == null)
            {
                return;
            }

            byte[] arr = null;
            if (fileType == VersionFile.Type.COMBINE_FILE)
            {
                CombineFile cf = CombineFileManager.GetInstance().GetCombineFile(destName);
                arr = cf.Read(originName);
            }
            else
            {
                arr = instance.platformLoader.SyncReadBytes(path);
            }

            if (arr != null)
            {
                if (needRemoveImpurity)
                {
                    ThreadTask.RunAsync(() =>
                    {
                        DataDecode(arr, arr.Length);
                    },
                                        () =>
                    {
                        if (endRead != null)
                        {
                            endRead(arr, obj);
                        }
                    });
                }
                else
                {
                    if (endRead != null)
                    {
                        endRead(arr, obj);
                    }
                }
            }
            else
            {
                if (cb_whatever)
                {
                    if (endRead != null)
                    {
                        endRead(arr, obj);
                    }
                }
            }
        }
Esempio n. 4
0
        private void CreateAssetBundle(string originName, string destName, string path, Example.VersionFile.Type fileType, Request request, EndLoadBundle endLoad, System.Object ud, bool assetBundle)//, bool cb_whatever)
        {
            if (fileType == Example.VersionFile.Type.DEFAULT)
            {
                CoroutineHelper.CreateCoroutineHelper(CreateAssetBundle_Offset(originName, path, 0, request, endLoad, ud, assetBundle));
            }
            else if (fileType == Example.VersionFile.Type.COMBINE_FILE)
            {
                CombineFile cf = CombineFileManager.GetInstance().GetCombineFile(destName);
                int         offset;
                int         size;
                bool        encrypt;
                cf.GetFileDetail(originName, out offset, out size, out encrypt);

                if (encrypt)
                {
                    Debugger.LogError("asset bundle resource in combine file should not encrypt");
                    return;
                }

                CoroutineHelper.CreateCoroutineHelper(CreateAssetBundle_Offset(originName, path, (ulong)offset, request, endLoad, ud, assetBundle));
            }
        }