Пример #1
0
        private void _AsynReadBytesByName(string name, EndReadBytes endRead, System.Object obj, bool cb_whatever = false)
        {
            if (name == null || name == "")
            {
                return;
            }
            string destName;
            string path;
            int    size;
            bool   encrypt;

            VersionFile.Type fileType;
            ResUpdate.GetLoadDetails(name, out destName, out path, out size, out encrypt, out fileType);
            if (path == null)
            {
                if (cb_whatever)
                {
                    if (endRead != null)
                    {
                        endRead(null, obj);
                    }
                }
                return;
            }

            __AsynReadBytesByPath(name, destName, path, fileType, endRead, obj, cb_whatever, encrypt);
        }
Пример #2
0
        public static void AsynReadBytesByName(string name, EndReadBytes endRead, System.Object obj, bool cb_whatever = false)
        {
            if (instance == null || instance.platformLoader == null)
            {
                return;
            }

            instance._AsynReadBytesByName(name, endRead, obj, cb_whatever);
        }
Пример #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);
                    }
                }
            }
        }
Пример #4
0
 public static void AsynReadBytesByPath(string path, VersionFile.Type fileType, EndReadBytes endRead, System.Object obj, bool cb_whatever = false, bool needRemoveImpurity = true)
 {
     __AsynReadBytesByPath(null, null, path, VersionFile.Type.DEFAULT, endRead, obj, cb_whatever, needRemoveImpurity);
 }