예제 #1
0
        void OnBackgroundComplete(bool is_error)
        {
            if (is_error)
            {
                var tips = Localization.Get("main_download_fail");
                SetProgressTxt(tips);
                UnityEngine.Events.UnityAction ReLoad = () => {
                    BackGroundDownload.instance.ReloadError();
                    BackGroundDownload.instance.Begin();
                    MessageBox.Destroy();
                };
                MessageBox.Show(tips, "", "", ReLoad);
            }
            else
            {
                if (remoteManifest != null)
                {
                    ManifestManager.SetUpdateFileManifest(remoteManifest);
                }
                remoteManifest = null;
                if (ManifestManager.CheckFirstLoad())
                {
                    ManifestManager.FinishFirstLoad();
                }

                FileHelper.DeletePersistentFile(UPDATED_LIST_NAME);  //删除旧文件
                FileHelper.ChangePersistentFileName(UPDATED_TEMP_LIST_NAME, UPDATED_LIST_NAME);

                FileHelper.DeletePersistentFile(VERSION_FILE_NAME);  //删除旧文件
                FileHelper.ChangePersistentFileName(VERSION_TEMP_FILE_NAME, VERSION_FILE_NAME);

                SetSliderProgress(Localization.Get("main_download_complete"), 4, 1);   //"更新完毕,进入游戏!"
                LoadBeginScene();
            }
        }
예제 #2
0
    public static void Generate(BuildTarget buildTarget)
    {
        string       path     = PathRouter.ProductPath + buildTarget;
        FileManifest manifest = new FileManifest();

        foreach (string file in Directory.EnumerateFiles(
                     path,
                     "*.*",
                     SearchOption.AllDirectories))
        {
            if (Path.GetExtension(file) == ".manifest")
            {
                continue;
            }

            string name = PathRouter.NormalizePath(file)
                          .Remove(0, path.Length + 1);
            byte[] bytes = File.ReadAllBytes(file);
            string md5   = FileManager.GetMd5Hash(bytes);
            manifest.files.Add(new FileEntry()
            {
                name = name,
                md5  = md5,
                size = bytes.Length
            });
        }

        File.WriteAllText(
            path + '/' + PathRouter.FileManifest,
            JsonUtility.ToJson(manifest, true),
            Encoding.UTF8);

        Debug.Log("Generate File Manifest for " + buildTarget);
    }
예제 #3
0
        public override void AddFilesToManifest(ref FileManifest Manifest, UEBuildBinary Binary)
        {
            // the binary will have all of the .so's in the output files, we need to trim down to the shared apk (which is what needs to go into the manifest)
            string ApkFile = Path.ChangeExtension(RemoveArchName(Binary.Config.OutputFilePaths[0]), ".apk");

            Manifest.AddFileName(ApkFile);
        }
예제 #4
0
        private void HandleSuccess(string fullPath, ArrayList queueSorted, FileManifest fileManifest)
        {
            MoveDocumentToPrinted(fullPath, fileManifest);
            RemoveDocumentFromQueues(fullPath, queueSorted);

            m_Utils.WriteEventLogEntry(string.Format("{0}\n    Document printed successfully.", Path.GetFileName(fullPath)),
                                       EventLogEntryType.Information, Utils.EVENT_LOG_SOURCE);
        }
예제 #5
0
        public override void AddFilesToManifest(ref FileManifest Manifest, UEBuildBinary Binary)
        {
            // we need to include the generated .mem file.
            string MemFile = Binary.Config.OutputFilePath + ".mem";

            // make sure we don't add mem files more than once.
            Manifest.AddBinaryNames(MemFile, null);
        }
예제 #6
0
 private void HandleAdobe(string fullPath, ArrayList queueSorted, FileManifest fileManifest)
 {
     //We cannot tell whether Adobe Reader has been successfully used to print the form or not,
     //since the process exit code is not informative (seems to always be 0x1) so we have to assume
     //it worked OK. Don't log anything, partly because of this, and partly because we are in
     //interactive mode anyway.
     MoveDocumentToPrinted(fullPath, fileManifest);
     RemoveDocumentFromQueues(fullPath, queueSorted);
 }
예제 #7
0
        private void HandleError(
            long dppPrintExitCode,
            string typeMsg,
            string fullPath,
            ArrayList queueSorted,
            bool doRetry,
            ref bool firstAttempt,
            FileManifest fileManifest)
        {
            string description = "The attempt to print has failed (see previous error message for details).";

            if (m_Utils.ReadStopServiceOnPrinterError())
            {
                StopPrinting();

                description += "\nPrinting has been stopped.";
                description += "\nPlease resolve the problem and check whether the file prints OK.";
                description += "\nThen restart the " + (m_Utils.ReadRunAsService() ? Utils.SERVICE_NAME : Utils.MANAGER_NAME);

                firstAttempt = true;
            }
            else
            {
                if (doRetry && firstAttempt)
                {
                    description += "\nResubmitting job.";
                    firstAttempt = false;
                }
                else
                {
                    MoveDocumentToFailed(fullPath, fileManifest);
                    RemoveDocumentFromQueues(fullPath, queueSorted);

                    description += "\nPlease resolve the problem and check whether the file prints OK.";
                    description += "\nIf the file does not print resubmit the print from the failed print tab in the Print Folder Manager.";

                    firstAttempt = true;
                }
            }

            // File name MUST always be first so that it appears correctly in the failed prints tab
            string message = Path.GetFileName(fullPath);

            message += "\n" + description;
            message += "\n" + typeMsg;

            if (dppPrintExitCode > 0)
            {
                message += "\nError code: " + dppPrintExitCode.ToString() + " (" + EvtMsg.GetShortDescriptionFromCode(dppPrintExitCode) + ")";
            }

            message.Replace("\n", "\n    ");

            m_Utils.WriteEventLogEntry(message, EventLogEntryType.Error, Utils.EVENT_LOG_SOURCE);
        }
예제 #8
0
        /// <summary>
        ///     Open an archive for adding files.
        /// </summary>
        /// <param name="rsa">RSA encryption/decryption provider</param>
        /// <param name="timeStamp">
        ///     Timestamp for zip file and its entries
        /// </param>
        /// <externalUnit/>
        /// <revision revisor="dev05" date="03/06/09" version="1.0.8.17">
        ///     Method created.
        /// </revision>
        /// <revision revisor="dev05" date="03/16/09" version="1.0.8.27">
        ///     Pass in timestamp.
        /// </revision>
        /// <revision revisor="dev05" date="03/16/09" version="1.0.8.27">
        ///     Added manifest to archive.
        /// </revision>
        public void OpenWrite(RSACryptoServiceProvider rsa, DateTime timeStamp)
        {
            this.rsaProvider  = rsa;
            this.timeStamp    = timeStamp;
            this.manifest     = new FileManifest(this.dataPath);
            this.outputStream = new ZipOutputStream(
                File.Create(this.archiveName));

            // 0-9, 9 being the highest compression
            this.outputStream.SetLevel(9);
            this.buffer = new byte[BufferLength];
        }
예제 #9
0
        //读取streamingAssets path里面的abinfo
        private static void ReadAssetToABInfos(string[] allBundles, FileManifest streamingManifest)
        {
            string title = "create crc list content ";

            var   allABInfos = new List <ABInfo>();
            float i          = 0;
            float allLen     = allBundles.Length;

            //忽略列表
            Dictionary <string, bool> ignore = new Dictionary <string, bool>();

            ignore.Add(CUtils.GetRightFileName(Common.CRC32_FILELIST_NAME), true);
            ignore.Add(CUtils.GetRightFileName(Common.CRC32_VER_FILENAME), true);
            ignore.Add(CUtils.GetRightFileName(CUtils.platform), true);

            string extension;

            foreach (var str in allBundles)
            {
                string url     = Path.Combine(Application.dataPath, str);
                uint   outCrc  = 0;
                uint   fileLen = 0;
                string abName  = str.Replace("\\", "/");
                string key     = EditorUtils.GetAssetBundleName(abName);
                //后缀替换
                extension = System.IO.Path.GetExtension(key);
                if (extension.Equals(Common.DOT_BYTES))//lua
                {
                    key = key.Replace(extension, Common.CHECK_ASSETBUNDLE_SUFFIX);
                }

                if (!ignore.ContainsKey(key))
                {
                    outCrc = CrcCheck.GetLocalFileCrc(url, out fileLen);
                    var extendsABinfo = streamingManifest.GetABInfo(key);
                    if (extendsABinfo == null)
                    {
                        extendsABinfo = new ABInfo(key, outCrc, fileLen, 0);
                        streamingManifest.Add(extendsABinfo);
                    }
                    extendsABinfo.priority  = 0;
                    extendsABinfo.crc32     = outCrc;
                    extendsABinfo.size      = fileLen;
                    extendsABinfo.assetPath = str;
                    allABInfos.Add(extendsABinfo);
                }
                EditorUtility.DisplayProgressBar(title, title + "=>" + i.ToString() + "/" + allLen.ToString(), i / allLen);
                i++;
            }

            EditorUtility.ClearProgressBar();
        }
예제 #10
0
        public void Run(HotResGenSharedData sharedata)
        {
            FileManifest firstCrcDict      = null;                                                                  //首包
            FileManifest streamingManifest = null;                                                                  //streamingAsset
            FileManifest manualFileList    = ScriptableObject.CreateInstance(typeof(FileManifest)) as FileManifest; //后置下载

            bool firstExists = SplitPackage.ReadFirst(m_allBundles, out firstCrcDict, out streamingManifest, manualFileList);

            sharedata.firstExists       = firstExists;
            sharedata.firstCrcDict      = firstCrcDict;
            sharedata.streamingManifest = streamingManifest;
            sharedata.manualFileList    = manualFileList;
        }
        /// <summary>
        ///     Opens to write to zip.
        /// </summary>
        /// <param name="timeStamp">The time stamp.</param>
        /// <param name="autoSign">if set to <c>true</c> [auto sign].</param>
        /// <externalUnit/>
        /// <revision revisor="dev13" date="11/17/2009" version="1.1.3.5">
        ///     Added documentation header
        /// </revision>
        public void OpenWriteToZip(DateTime timeStamp, bool autoSign)
        {
            this.writeToZip = true;
            this.autoSign   = autoSign;
            this.timeStamp  = timeStamp;
            this.manifest   = new FileManifest(this.dataPath);

            this.outputStream = new ZipOutputStream(
                File.Create(this.archiveName));

            this.outputStream.SetLevel(9); // 0-9, 9 being the highest compression
            this.buffer = new byte[BufferLength];
        }
        /// <summary>
        ///     Opens to write.
        /// </summary>
        /// <param name="timeStamp">The time stamp.</param>
        /// <param name="autoSign">if set to <c>true</c> [auto sign].</param>
        /// <externalUnit/>
        /// <revision revisor="dev13" date="11/17/2009" version="1.1.3.5">
        ///     Added documentation header
        /// </revision>
        public void OpenWrite(DateTime timeStamp, bool autoSign)
        {
            this.autoSign  = autoSign;
            this.timeStamp = timeStamp;
            this.manifest  = new FileManifest(this.dataPath);

            this.baseZipStream = new MemoryStream();

            this.outputStream = new ZipOutputStream(this.baseZipStream);

            this.outputStream.SetLevel(9); // 0-9, 9 being the highest compression
            this.buffer = new byte[BufferLength];
        }
        /// <summary>
        ///     Extracts all files.
        /// </summary>
        /// <param name="deleteFiles">if set to <c>true</c> [delete files].</param>
        /// <returns>
        ///     An <see cref="OperationResult" /> containing the results
        ///     of the operation.
        /// </returns>
        /// <externalUnit/>
        /// <revision revisor="dev13" date="11/17/2009" version="1.1.3.5">
        ///     Added documentation header
        /// </revision>
        private OperationResult ExtractAllFiles(bool deleteFiles)
        {
            var    result   = new OperationResult(true); // Returned result
            string fileName = String.Empty;              // Current file name

            // List of archive filenames, not including signature files.
            List <string> fileNames = new List <string>();

            while (this.ExtractFile(ref fileName))
            {
                if (fileName == "Manifest.xml")
                {
                    // Recreate the manifest from the XML file.
                    this.manifest = FileManifest.FromXmlFile(
                        Path.Combine(this.dataPath, "Manifest.xml"));
                }
                else
                {
                    fileNames.Add(fileName);
                }
            }

            if (this.manifest == null)
            {
                string error = String.Format(
                    "Manifest missing for encrypted archive {0}",
                    this.archiveName);

                // We should have a manifest
                result = new OperationResult(false, error);
            }

            // Delete signature files, plus optionally the data files.
            foreach (string name in fileNames)
            {
                string pathName = Path.Combine(this.dataPath, name);

                if (deleteFiles)
                {
                    File.Delete(pathName);
                }

                // The .sig file has done its job, so delete it.
                File.Delete(pathName + ".sig");
            }

            //File.Delete(Path.Combine(this.dataPath, "Manifest.xml"));
            File.Delete(Path.Combine(this.dataPath, "Manifest.xml.sig"));

            return(result);
        }
예제 #14
0
        /// <summary>
        /// Checks for available updates by comparing the settings version with the file manifest.
        /// </summary>
        /// <returns>True if an update is found.</returns>
        public bool CheckForUpdates()
        {
            Manifest = GetFileManifest();
            PrepareUpdater();
            Utils.Log($"Current version is: {SettingsFile.CurrentVersion}");
            Utils.Log($"Available version is: {Manifest.TargetVersion}");
            Version Target  = new Version(Manifest.TargetVersion);
            Version Current = new Version(SettingsFile.CurrentVersion);

            if (Target > Current)
            {
                Utils.Log($"Found {Manifest.Files.Count.ToString()} file(s) to update.");
                return(true);
            }
            else
            {
                Utils.Log($"No update available.");
                return(false);
            }
        }
예제 #15
0
        public void ManifestTest()
        {
            this.CleanTempPath(true);
            this.PopulateTempPath();

            var manifest = new FileManifest(this.tempPath);

            manifest.AddFile("Ballots.xml");
            manifest.AddFile("Cards.xml");
            manifest.AddFile("Faces.xml");

            manifest.ToXmlFile(Path.Combine(this.tempPath, "Manifest.xml"));

            manifest = FileManifest.FromXmlFile(
                Path.Combine(this.tempPath, "Manifest.xml"));

            string          fileName = String.Empty;
            OperationResult result   = manifest.IsValid();

            Assert.IsTrue(result.Succeeded);
        }
예제 #16
0
        public static void CopyChangeFileToSplitFolder(bool firstExists, FileManifest firstCrcDict, FileManifest currCrcDict, FileManifest diffCrcDict, FileManifest manualFileList)
        {
            Dictionary <string, ABInfo> updateList = new Dictionary <string, ABInfo>();

            bool copyManual = HugulaSetting.instance.spliteExtensionFolder;

            if (firstExists) //没有首包不copy资源
            {
                Debug.LogFormat("copy diffCrcDict.count={0}", diffCrcDict.Count);

                var infos = diffCrcDict.allAbInfo;
                foreach (var ab in infos)
                {
                    updateList[ab.abName] = ab;// Debug.Log(ab);
                }
            }

            if (copyManual)//copy 手动下载列表
            {
                Debug.LogFormat("copy manualFileList.count={0},currCrcDict.count={1}", manualFileList.Count, currCrcDict.Count);
                if (manualFileList.Count > 0)
                {
                    var infos = manualFileList.allAbInfo;
                    foreach (var ab in infos)
                    {
                        var ckAb = currCrcDict.GetABInfo(ab.abName);
                        if (ckAb != null)
                        {
                            updateList[ab.abName] = ckAb;
                        }
                    }
                }
            }

            CopyFileToSplitFolder(updateList);

            AssetDatabase.Refresh();
        }
예제 #17
0
        /// <summary>
        /// 2 Creates the content of the crc list.
        /// </summary>
        /// <returns>The crc list content.</returns>
        /// <param name="allBundles">All bundles.</param>
        /// <param name="manualFileList">manual file list.</param>
        public static List <ABInfo>[] CreateCrcListContent(FileManifest firstCrcDict, FileManifest streamingManifest, FileManifest manualFileList)
        {
            string title = "create crc list content ";

            List <ABInfo>[] abInfoArray  = new List <ABInfo> [2];
            var             diffManifest = new List <ABInfo>();

            abInfoArray[0] = diffManifest;

            var   allBundles = streamingManifest.allAbInfo;
            float i          = 0;
            float allLen     = allBundles.Count;

            foreach (var extendsABinfo in allBundles)
            {
                if (firstCrcDict != null)
                {
                    ABInfo localFirstInfo = null;
                    if (!firstCrcDict.CheckABCrc(extendsABinfo))
                    {
                        var newAbinfo = extendsABinfo.Clone();
                        newAbinfo.assetPath = extendsABinfo.assetPath;
                        diffManifest.Add(newAbinfo);
                    }
                    else if ((localFirstInfo = firstCrcDict.GetABInfo(extendsABinfo.abName)) != null && !extendsABinfo.EqualsDependencies(localFirstInfo)) //dependencies change
                    {
                        var newAbinfo = extendsABinfo.Clone();
                        newAbinfo.assetPath = extendsABinfo.assetPath;
                        diffManifest.Add(newAbinfo);
                    }
                }
                EditorUtility.DisplayProgressBar(title, title + "=>" + i.ToString() + "/" + allLen.ToString(), i / allLen);
                i++;
            }

            EditorUtility.ClearProgressBar();
            return(abInfoArray);
        }
예제 #18
0
        private void MoveDocument(string fullPath, bool success, FileManifest fileManifest)
        {
            try
            {
                string strParentDirectory = Directory.GetParent(fullPath).FullName;
                if (success)
                {
                    strParentDirectory += "\\Printed Documents";
                }
                else
                {
                    strParentDirectory += "\\Failed Documents";
                }

                if (!Directory.Exists(strParentDirectory))
                {
                    Directory.CreateDirectory(strParentDirectory);
                }

                if (Directory.Exists(strParentDirectory))
                {
                    string destFullName = strParentDirectory + "\\" + Path.GetFileName(fullPath);
                    if (File.Exists(destFullName))
                    {
                        File.Delete(destFullName);
                    }

                    File.Move(fullPath, destFullName);
                }
            }
            catch (Exception ex)
            {
                //Catch and log errors.
                string strMessage = string.Format("Unexpected error moving document.\n    {0}\n    {1}", ex.Message, ex.StackTrace);
                m_Utils.WriteEventLogEntry(strMessage, EventLogEntryType.Error, Utils.EVENT_LOG_SOURCE);
            }
        }
예제 #19
0
        /// <summary>
        /// Creates the streaming crc list.
        /// </summary>
        /// <param name="sb">Sb.</param>
        public static uint CreateStreamingCrcList(FileManifest sb, string fileListName, bool firstExists = false, bool copyToResFolder = false)
        {
            sb.appNumVersion = CodeVersion.APP_NUMBER;
            var    crc32filename = CUtils.GetAssetName(fileListName);
            string tmpPath       = BuildScript.GetAssetTmpPath();// Path.Combine(Application.dataPath, BuildScript.TmpPath);

            ExportResources.CheckDirectory(tmpPath);

            string assetPath = "Assets/" + BuildScript.TmpPath + crc32filename + ".asset";

            EditorUtility.DisplayProgressBar("Generate streaming crc file list", "write file to " + assetPath, 0.99f);
            AssetDatabase.CreateAsset(sb, assetPath);

            string crc32outfilename = CUtils.GetRightFileName(fileListName);
            // Debug.Log("write to path=" + outPath);
            //读取crc
            string abPath     = string.Empty;
            string resOutPath = null;
            uint   fileSize   = 0;
            uint   fileCrc    = 0;

            if (copyToResFolder)
            {
                resOutPath = tmpPath;//Path.Combine(tmpPath, ResFolderName); //Path.Combine(SplitPackage.UpdateOutPath, ResFolderName);
                abPath     = Path.Combine(resOutPath, crc32outfilename);
                BuildScript.BuildABs(new string[] { assetPath }, resOutPath, crc32outfilename, DefaultBuildAssetBundleOptions);
                fileCrc = CrcCheck.GetLocalFileCrc(abPath, out fileSize);

                //copy crc list
                FileInfo finfo   = new FileInfo(abPath);
                var      resType = HugulaSetting.instance.backupResType;
                if (resType == CopyResType.VerResFolder)
                {
                    string verPath = Path.Combine(UpdateOutVersionPath, ResFolderName);//特定版本资源目录用于资源备份
                    string newName = Path.Combine(verPath, InsertAssetBundleName(crc32outfilename, "_" + fileCrc.ToString()));
                    FileHelper.CheckCreateFilePathDirectory(newName);
                    if (File.Exists(newName))
                    {
                        File.Delete(newName);
                    }
                    finfo.CopyTo(newName);
                }

                if (resType == CopyResType.OneResFolder)
                {
                    string updateOutPath = Path.Combine(UpdateOutPath, ResFolderName);//总的资源目录
                    string newName       = Path.Combine(updateOutPath, InsertAssetBundleName(crc32outfilename, "_" + fileCrc.ToString()));
                    FileHelper.CheckCreateFilePathDirectory(newName);
                    if (File.Exists(newName))
                    {
                        File.Delete(newName);
                    }
                    finfo.CopyTo(newName);
                }
            }
            else
            {
                abPath = Path.Combine(CUtils.realStreamingAssetsPath, crc32outfilename);
                BuildScript.BuildABs(new string[] { assetPath }, null, crc32outfilename, DefaultBuildAssetBundleOptions);
                fileCrc = CrcCheck.GetLocalFileCrc(abPath, out fileSize);
            }
            // CrcCheck.Clear();

            //copy first crc list
            if (!firstExists && File.Exists(abPath)) //如果没有首包 copy first package
            {
                string crc32FirstOutName = CUtils.InsertAssetBundleName(crc32outfilename, "_v" + CodeVersion.CODE_VERSION.ToString());
                string destFirst         = Path.Combine(UpdateOutPath, crc32FirstOutName);
                Debug.LogFormat("abpath={0},destFirst={1}:", abPath, destFirst);
                File.Copy(abPath, destFirst, true);
            }

            EditorUtility.ClearProgressBar();
            // File.Delete(assetPath);

            Debug.Log("Crc file list assetbunle build complate! " + fileCrc.ToString() + abPath);

            return(fileCrc);
        }
예제 #20
0
        /// <summary>
        /// 2 Creates the content of the crc list.
        /// </summary>
        /// <returns>The crc list content.</returns>
        /// <param name="allBundles">All bundles.</param>
        /// <param name="manualFileList">manual file list.</param>
        public static List <ABInfo>[] CreateCrcListContent(string[] allBundles, FileManifest firstCrcDict, FileManifest streamingManifest, FileManifest manualFileList)
        {
            string title = "create crc list content ";

            List <ABInfo>[] abInfoArray  = new List <ABInfo> [2];
            var             diffManifest = new List <ABInfo>();

            abInfoArray[0] = diffManifest;

            float i      = 0;
            float allLen = allBundles.Length;

            //忽略列表
            Dictionary <string, bool> ignore = new Dictionary <string, bool>();

            ignore.Add(CUtils.GetRightFileName(Common.CRC32_FILELIST_NAME), true);
            ignore.Add(CUtils.GetRightFileName(Common.CRC32_VER_FILENAME), true);
            ignore.Add(CUtils.GetRightFileName(CUtils.platform), true);

            string extension;

            foreach (var str in allBundles)
            {
                string url     = Path.Combine(Application.dataPath, str);
                uint   outCrc  = 0;
                uint   fileLen = 0;
                string abName  = str.Replace("\\", "/");
                string key     = BuildScript.GetAssetBundleName(abName);
                //后缀替换
                extension = System.IO.Path.GetExtension(key);
                if (string.IsNullOrEmpty(extension))
                {
                    key = key + Common.CHECK_ASSETBUNDLE_SUFFIX;
                }
                else if (extension.Equals(Common.DOT_BYTES))
                {
                    key = key.Replace(extension, Common.CHECK_ASSETBUNDLE_SUFFIX);
                }

                if (!ignore.ContainsKey(key))
                {
                    outCrc = CrcCheck.GetLocalFileCrc(url, out fileLen);
                    var extendsABinfo = streamingManifest.GetABInfo(key);
                    if (extendsABinfo == null)
                    {
                        extendsABinfo = new ABInfo(key, outCrc, fileLen, 0);
                        streamingManifest.Add(extendsABinfo);
                    }

                    extendsABinfo.crc32     = outCrc;
                    extendsABinfo.size      = fileLen;
                    extendsABinfo.assetPath = str;

                    if (firstCrcDict != null)
                    {
                        ABInfo localFirstInfo = null;
                        if (!firstCrcDict.CheckABCrc(extendsABinfo))
                        {
                            var newAbinfo = extendsABinfo.Clone();
                            newAbinfo.assetPath = str;
                            diffManifest.Add(newAbinfo);
                        }
                        else if ((localFirstInfo = firstCrcDict.GetABInfo(extendsABinfo.abName)) != null && !extendsABinfo.EqualsDependencies(localFirstInfo)) //dependencies change
                        {
                            var newAbinfo = extendsABinfo.Clone();
                            newAbinfo.assetPath = str;
                            diffManifest.Add(newAbinfo);
                        }
                    }
                }
                EditorUtility.DisplayProgressBar(title, title + "=>" + i.ToString() + "/" + allLen.ToString(), i / allLen);
                i++;
            }

            // CrcCheck.Clear();
            EditorUtility.ClearProgressBar();
            return(abInfoArray);
        }
예제 #21
0
        /// <summary>
        /// 1 读取首包,找出忽略文件
        /// </summary>
        /// <param name="ignoreFiles">Ignore files.</param>
        public static bool ReadFirst(out FileManifest firstCrcDict, out FileManifest streamingManifest, FileManifest extensionFileManifest)
        {
            // string title = "read first crc file list";
            bool firstExists = false;

            firstCrcDict = null;
            HugulaExtensionFolderEditor.instance = null;

            string readPath      = Path.Combine(FirstOutReleasePath, CUtils.platform);
            string firstFileName = CUtils.InsertAssetBundleName(CUtils.GetRightFileName(Common.CRC32_FILELIST_NAME), "_v" + CodeVersion.CODE_VERSION.ToString());

            readPath = Path.Combine(readPath, firstFileName);
            Debug.Log(readPath);

            //check tmp directory
            if (!Directory.Exists("Assets/Tmp"))
            {
                Directory.CreateDirectory("Assets/Tmp");
            }

            // extensionFileManifest.Clear();
            //读取首包
            WWW abload = new WWW("file://" + readPath);

            if (string.IsNullOrEmpty(abload.error) && abload.assetBundle != null)
            {
                var      ab     = abload.assetBundle;
                Object[] assets = ab.LoadAllAssets();
                foreach (Object o in assets)
                {
                    if (o is FileManifest)
                    {
                        firstCrcDict = o as FileManifest;
                        firstExists  = true;
                        firstCrcDict.WriteToFile("Assets/Tmp/firstManifest.txt");
                        Debug.Log(firstCrcDict.Count);
                    }
                }
                ab.Unload(false);
            }
            else
            {
                Debug.LogWarning(abload.error + "no frist packeage in " + readPath);
            }
            abload.Dispose();

            //读取本地AB包AssetBundleManifest
            var fileListName = Common.CRC32_FILELIST_NAME;
            var url          = CUtils.PathCombine(CUtils.GetRealStreamingAssetsPath(), CUtils.GetRightFileName(fileListName));

            Debug.Log(url);
            // url = CUtils.GetAndroidABLoadPath(url);
            AssetBundle assetbundle = AssetBundle.LoadFromFile(url);
            var         assets1     = assetbundle.LoadAllAssets <FileManifest>();
            uint        len         = 0;
            var         crc32       = CrcCheck.GetLocalFileCrc(url, out len);

            var streamingManifest1 = assets1[0];

            assetbundle.Unload(false);
            streamingManifest        = streamingManifest1;
            streamingManifest1.crc32 = crc32;
            Debug.Log(streamingManifest1.appNumVersion);
            Debug.Log(streamingManifest1.crc32);

            //读取忽略扩展包
            System.Action <string, int> AddExtensionFileManifest = (string ab, int priority1) =>
            {
                var abinfo = streamingManifest1.GetABInfo(ab);
                if (abinfo == null)
                {
                    abinfo = new ABInfo(ab, 0, 0, priority1);
                    streamingManifest1.Add(abinfo);
                }

                abinfo.priority = priority1;
                extensionFileManifest.Add(abinfo);
            };


            //读取忽略别名后缀
            // priority = FileManifestOptions.StreamingAssetsPriority;
            // var inclusionVariants = HugulaSetting.instance.inclusionVariants;
            // var allVariants = HugulaSetting.instance.allVariants;
            // string pattern = "";
            // string sp = "";
            // foreach (var s in allVariants)
            // {
            //     if (!inclusionVariants.Contains(s))
            //     {
            //         pattern += sp + @"\." + s + "$";
            //         sp = "|";
            //     }
            // }

            // if (!string.IsNullOrEmpty(pattern))
            // {
            //     // Debug.Log(pattern);
            //     var u3dList = ExportResources.getAllChildFiles(dinfo.FullName, pattern, null, true);
            //     foreach (var s in u3dList)
            //     {
            //         priority++;
            //         string ab = CUtils.GetAssetBundleName(s);
            //         ab = ab.Replace("\\", "/");
            //         AddExtensionFileManifest(ab, priority);
            //     }
            // }

            //读取手动加载排除资源
            string        firstStreamingPath = CUtils.realStreamingAssetsPath;
            DirectoryInfo dinfo    = new DirectoryInfo(firstStreamingPath);
            var           dircs    = dinfo.GetDirectories();
            var           priority = FileManifestOptions.ManualPriority;

            Debug.LogFormat("ManualPriority.priority={0}", priority);
            foreach (var dir in dircs)
            {
                var u3dList = ExportResources.getAllChildFiles(dir.FullName, @"\.meta$|\.manifest$|\.DS_Store$", null, false);
                foreach (var s in u3dList)
                {
                    priority++;
                    string ab = CUtils.GetAssetBundleName(s);
                    ab = ab.Replace("\\", "/");
                    AddExtensionFileManifest(ab, priority);
                }
            }

            //读取首包排除资源
            var firstLoadFiles = HugulaExtensionFolderEditor.instance.FirstLoadFiles;

            priority = FileManifestOptions.FirstLoadPriority;
            Debug.LogFormat("FirstLoadPriority.priority={0}", priority);
            var needLoadFirst = false;

            foreach (var s in firstLoadFiles)
            {
                var ab = CUtils.GetRightFileName(s);
                priority++;
                AddExtensionFileManifest(ab, priority);
                needLoadFirst = true;
            }

            if (!HugulaSetting.instance.spliteExtensionFolder)
            {
                needLoadFirst = false;
            }
            streamingManifest.hasFirstLoad = needLoadFirst;
            // AssetDatabase.SaveAssets();

            //读取自动下载资源
            var extensionFiles = HugulaExtensionFolderEditor.instance.ExtensionFiles;

            priority = FileManifestOptions.AutoHotPriority;
            Debug.LogFormat("AutoHotPriority.priority={0}", priority);

            foreach (var s in extensionFiles)
            {
                var ab = CUtils.GetRightFileName(s);
                priority++;
                AddExtensionFileManifest(ab, priority);
            }

            streamingManifest.WriteToFile("Assets/Tmp/streamingManifest0.txt");
            extensionFileManifest.WriteToFile("Assets/Tmp/manualFileList0.txt");
            EditorUtility.ClearProgressBar();
            return(firstExists);
        }
예제 #22
0
        //TODO: Refactor handling of processes into a ProntProcess class
        private void PrintFileUsingDppPrint(string fullPath, string printerName, short duplexMode, ArrayList queueSorted, ref bool firstAttempt, FileManifest fileManifest)
        {
            //Call CPAT via the dpp_print process.
            int  timeoutInMinutes = m_Utils.ReadTimeout();
            bool timedOut         = false;
            int  dppPrintExitCode = 0;

            try
            {
                lock (this)
                {
                    m_processDppPrint = new Process();

                    m_processDppPrint.StartInfo.FileName         = m_strDppPrintExePath;
                    m_processDppPrint.StartInfo.UseShellExecute  = false;
                    m_processDppPrint.StartInfo.Arguments        = GetDppPrintArguments(fullPath, printerName, duplexMode);
                    m_processDppPrint.StartInfo.WorkingDirectory = m_Utils.ReadInstallDirectory();
                    m_processDppPrint.StartInfo.CreateNoWindow   = true;

                    if (logAllEvents)
                    {
                        string message = string.Format("Launching CPAT: {0} {1} in folder {2}",
                                                       m_processDppPrint.StartInfo.FileName, m_processDppPrint.StartInfo.Arguments, m_strPrintDirectory);
                        m_Utils.WriteEventLogEntry(message, EventLogEntryType.Information, Utils.EVENT_LOG_SOURCE);
                    }

                    m_processDppPrint.Start();
                    m_processAborted = false;
                }

                if (timeoutInMinutes == 0)
                {
                    //No timeout.
                    m_processDppPrint.WaitForExit();
                }
                else if (!m_processDppPrint.WaitForExit(timeoutInMinutes * 60000))
                {
                    timedOut         = true;
                    dppPrintExitCode = -1; // Not a dppPrint print error.
                    HandleTimeout(dppPrintExitCode, fullPath, queueSorted, ref firstAttempt, timeoutInMinutes, fileManifest);
                }

                if (!timedOut)
                {
                    lock (this)
                    {
                        if (!m_processAborted)
                        {
                            dppPrintExitCode = m_processDppPrint.ExitCode;
                            HandleDppPrintExitCode(dppPrintExitCode, fullPath, queueSorted, ref firstAttempt, fileManifest);
                        }
                    }
                }
            }
            finally
            {
                lock (this)
                {
                    if (m_processDppPrint != null)
                    {
                        m_processDppPrint.Dispose();
                        m_processDppPrint = null;
                    }
                }
            }
        }
예제 #23
0
        private void HandleDppPrintExitCode(long dppPrintExitCode, string fullPath, ArrayList queueSorted, ref bool firstAttempt, FileManifest fileManifest)
        {
            long bitmask = 0xffffffffL << 32;

            dppPrintExitCode = dppPrintExitCode & ~bitmask;
            if (Utils.ExitCodeIsSuccess(dppPrintExitCode))
            {
                HandleSuccess(fullPath, queueSorted, fileManifest);
            }
            else if (Utils.ExitCodeIsFatalError(dppPrintExitCode))
            {
                HandleFatalError(dppPrintExitCode, fullPath, queueSorted, ref firstAttempt, fileManifest);
            }
            else if (Utils.ExitCodeIsPrinterError(dppPrintExitCode))
            {
                HandlePrinterError(dppPrintExitCode, fullPath, queueSorted, ref firstAttempt, fileManifest);
            }
            else if (Utils.ExitCodeIsDataError(dppPrintExitCode))
            {
                HandleDataError(dppPrintExitCode, fullPath, queueSorted, ref firstAttempt, fileManifest);
            }
            else if (Utils.ExitCodeIsParameterError(dppPrintExitCode))
            {
                HandleParameterError(dppPrintExitCode, fullPath, queueSorted, ref firstAttempt, fileManifest);
            }
            else if (Utils.ExitCodeIsUnknownError(dppPrintExitCode) || Utils.ExitCodeIsNotUsed(dppPrintExitCode))
            {
                HandleUnknownError(dppPrintExitCode, fullPath, queueSorted, ref firstAttempt, fileManifest);
            }
            else
            {
                HandleUnexpectedError(dppPrintExitCode, fullPath, queueSorted, ref firstAttempt, fileManifest);
            }
        }
예제 #24
0
 public virtual void AddFilesToManifest(ref FileManifest manifest, UEBuildBinary Binary)
 {
 }
예제 #25
0
        private void HandleTimeout(long dppPrintExitCode, string fullPath, ArrayList queueSorted, ref bool firstAttempt, int timeoutInMinutes, FileManifest fileManifest)
        {
            string message = string.Format("Timed out after {0} minutes", timeoutInMinutes);

            bool doRetry = true;

            HandleError(dppPrintExitCode, message, fullPath, queueSorted, doRetry, ref firstAttempt, fileManifest);
        }
예제 #26
0
        private void HandleDataError(long dppPrintExitCode, string fullPath, ArrayList queueSorted, ref bool firstAttempt, FileManifest fileManifest)
        {
            //Duff Xfdf or Pdf.
            bool doRetry = false;

            HandleError(dppPrintExitCode, "Data format error", fullPath, queueSorted, doRetry, ref firstAttempt, fileManifest);
        }
예제 #27
0
        private void HandleFatalError(long dppPrintExitCode, string fullPath, ArrayList queueSorted, ref bool firstAttempt, FileManifest fileManifest)
        {
            bool doRetry = true;

            HandleError(dppPrintExitCode, "Fatal configuration error", fullPath, queueSorted, doRetry, ref firstAttempt, fileManifest);
        }
예제 #28
0
        /// <summary>
        /// 1 读取首包,找出忽略文件
        /// </summary>
        /// <param name="ignoreFiles">Ignore files.</param>
        public static bool ReadFirst(string[] allBundles, out FileManifest firstCrcDict, out FileManifest streamingManifest, FileManifest extensionFileManifest)
        {
            // string title = "read first crc file list";
            bool firstExists = false;

            firstCrcDict = null;
            HugulaExtensionFolderEditor.instance = null;

            string readPath      = Path.Combine(FirstOutReleasePath, CUtils.platform);
            string firstFileName = CUtils.InsertAssetBundleName(CUtils.GetRightFileName(Common.CRC32_FILELIST_NAME), "_v" + CodeVersion.CODE_VERSION.ToString());

            readPath = Path.Combine(readPath, firstFileName);
            Debug.Log(readPath);

            //check tmp directory
            if (!Directory.Exists("Assets/Tmp"))
            {
                Directory.CreateDirectory("Assets/Tmp");
            }

            // extensionFileManifest.Clear();
            //读取首包
            WWW abload = new WWW("file://" + readPath);

            if (string.IsNullOrEmpty(abload.error) && abload.assetBundle != null)
            {
                var      ab     = abload.assetBundle;
                Object[] assets = ab.LoadAllAssets();
                foreach (Object o in assets)
                {
                    if (o is FileManifest)
                    {
                        firstCrcDict = o as FileManifest;
                        firstExists  = true;
                        firstCrcDict.WriteToFile("Assets/Tmp/firstPackageManifest.txt");
                        Debug.Log(firstCrcDict.Count);
                    }
                }
                ab.Unload(false);
            }
            else
            {
                Debug.LogWarning(abload.error + "no frist packeage in " + readPath);
            }
            abload.Dispose();

            //读取本地AB包AssetBundleManifest
            var         fileListName = Common.CRC32_FILELIST_NAME;
            var         url          = CUtils.PathCombine(CUtils.GetRealStreamingAssetsPath(), CUtils.GetRightFileName(fileListName));
            AssetBundle assetbundle  = AssetBundle.LoadFromFile(url);
            var         assets1      = assetbundle.LoadAllAssets <FileManifest>();
            uint        len          = 0;
            var         crc32        = CrcCheck.GetLocalFileCrc(url, out len);

            var streamingManifest1 = assets1[0];

            assetbundle.Unload(false);
            // streamingManifest = streamingManifest1;
            streamingManifest1.crc32 = crc32;
            Debug.Log(streamingManifest1.appNumVersion);
            Debug.Log(streamingManifest1.crc32);

            //读取assetbundle的crc和size
            ReadAssetToABInfos(allBundles, streamingManifest1);

            if (!HugulaSetting.instance.spliteExtensionFolder)//如果不分离文件
            {
                streamingManifest = streamingManifest1;
                streamingManifest.hasFirstLoad = false;
                streamingManifest.WriteToFile("Assets/Tmp/StreamingAssetsManifest.txt");
                extensionFileManifest.WriteToFile("Assets/Tmp/ExtensionFileManifest.txt");
                return(firstExists);
            }

            //读取忽略扩展包
            System.Action <string, int> AddExtensionFileManifest = (string ab, int priority1) =>
            {
                var abinfo = streamingManifest1.GetABInfo(ab);
                if (abinfo == null)
                {
                    Debug.LogWarningFormat("the file {0} is not exists. please check ExtenionFolder.txt", ab);
                    //  abinfo = new ABInfo(ab, 0, 0, priority1);
                    //  streamingManifest1.Add(abinfo);
                    return;
                }

                abinfo.priority = priority1;
                extensionFileManifest.Add(abinfo);
            };


            string firstStreamingPath = CUtils.realStreamingAssetsPath;
            var    needLoadFirst      = false;

            var onlyInclusionFiles      = HugulaExtensionFolderEditor.instance.OnlyInclusionFiles;//只包涵
            var onlyInclusionRightFiles = new List <string>();

            foreach (var f in onlyInclusionFiles)
            {
                onlyInclusionRightFiles.Add(CUtils.GetRightFileName(f));
            }

            var firstPriority       = FileManifestOptions.FirstLoadPriority;
            var firstLoadFiles      = HugulaExtensionFolderEditor.instance.FirstLoadFiles;//读取首包资源
            var firstLoadRightFiles = new List <string>();

            foreach (var f in firstLoadFiles)
            {
                firstLoadRightFiles.Add(CUtils.GetRightFileName(f));
            }


            var manualPriority      = FileManifestOptions.ManualPriority;
            var extensionFiles      = HugulaExtensionFolderEditor.instance.ExtensionFiles;//读取扩展文件资源
            var extensionRightFiles = new List <string>();

            foreach (var f in extensionFiles)
            {
                extensionRightFiles.Add(CUtils.GetRightFileName(f));
            }

            var autoPriority = FileManifestOptions.AutoHotPriority;
            Dictionary <int, int> priorityDic = new Dictionary <int, int>();

            priorityDic[firstPriority]  = firstPriority;
            priorityDic[manualPriority] = manualPriority;
            priorityDic[autoPriority]   = autoPriority;
            priorityDic[FileManifestOptions.StreamingAssetsPriority] = FileManifestOptions.StreamingAssetsPriority;

            //streamingAssets目录下的文件夹默认为手动加载
            DirectoryInfo dinfo = new DirectoryInfo(firstStreamingPath);
            var           dircs = dinfo.GetDirectories();

            foreach (var dir in dircs)
            {
                var u3dList = EditorUtils.getAllChildFiles(dir.FullName, @"\.meta$|\.manifest$|\.DS_Store$", null, false);
                foreach (var s in u3dList)
                {
                    string ab = CUtils.GetAssetBundleName(s);
                    ab = ab.Replace("\\", "/");
                    extensionRightFiles.Add(ab);
                }
            }

            var allAbInfos = streamingManifest1.allAbInfo;

            bool shouldInclude       = false;
            bool elseShouldInAutoHot = onlyInclusionRightFiles.Count > 0 && false;
            bool elseShouldInFirst   = onlyInclusionRightFiles.Count > 0;

            foreach (var abInfo in allAbInfos)
            {
                shouldInclude = onlyInclusionRightFiles.Contains(abInfo.abName);

                if (!shouldInclude && firstLoadRightFiles.Contains(abInfo.abName))//首次启动加载包
                {
                    priorityDic[firstPriority]++;
                    AddExtensionFileManifest(abInfo.abName, priorityDic[firstPriority]);
                    needLoadFirst = true;
                }
                else if (!shouldInclude && extensionRightFiles.Contains(abInfo.abName)) //手动加载
                {
                    priorityDic[manualPriority]++;
                    AddExtensionFileManifest(abInfo.abName, priorityDic[manualPriority]);
                }
                else if (!shouldInclude && elseShouldInAutoHot) //放入自动热更新包
                {
                    priorityDic[autoPriority]++;
                    AddExtensionFileManifest(abInfo.abName, priorityDic[autoPriority]);
                }
                else if (!shouldInclude && elseShouldInFirst)
                {
                    priorityDic[firstPriority]++;
                    AddExtensionFileManifest(abInfo.abName, priorityDic[firstPriority]);
                    needLoadFirst = true;
                }
            }

            if (!HugulaSetting.instance.spliteExtensionFolder)
            {
                needLoadFirst = false;
            }

            streamingManifest = streamingManifest1;
            streamingManifest.hasFirstLoad = needLoadFirst;
            streamingManifest.WriteToFile("Assets/Tmp/StreamingAssetsManifest.txt");
            extensionFileManifest.WriteToFile("Assets/Tmp/ExtensionFileManifest.txt");
            EditorUtility.ClearProgressBar();
            return(firstExists);
        }
예제 #29
0
        private void HandleParameterError(long dppPrintExitCode, string fullPath, ArrayList queueSorted, ref bool firstAttempt, FileManifest fileManifest)
        {
            bool doRetry = false;

            HandleError(dppPrintExitCode, "Invalid parameter error", fullPath, queueSorted, doRetry, ref firstAttempt, fileManifest);
        }
예제 #30
0
        private void HandleUnexpectedError(long dppPrintExitCode, string fullPath, ArrayList queueSorted, ref bool firstAttempt, FileManifest fileManifest)
        {
            bool doRetry = true;

            HandleError(dppPrintExitCode, "Unexpected error", fullPath, queueSorted, doRetry, ref firstAttempt, fileManifest);
        }
예제 #31
0
 void XGEDeleteBuildProducts(FileManifest Manifest)
 {
     foreach (string Item in Manifest.FileManifestItems)
     {
         DeleteFile(Item);
     }
 }