private void MergePIPT(Section_AHDR AHDR, Game game, Platform platform)
 {
     foreach (Asset a in assetDictionary.Values)
     {
         if (a is AssetPIPT PIPT)
         {
             PIPT.Merge(new AssetPIPT(AHDR, game, platform));
             return;
         }
     }
 }
示例#2
0
 private void MergePIPT(Section_AHDR AHDR)
 {
     foreach (Asset a in assetDictionary.Values)
     {
         if (a is AssetPIPT PIPT)
         {
             PIPT.Merge(new AssetPIPT(AHDR));
             return;
         }
     }
 }
示例#3
0
 private void MergePIPT(AssetPIPT asset)
 {
     foreach (Asset a in assetDictionary.Values)
     {
         if (a is AssetPIPT PIPT)
         {
             PIPT.Merge(asset);
             return;
         }
     }
 }
        public void OpenFile(string fileName, bool displayProgressBar, Platform platform, bool skipTexturesAndModels = false)
        {
            allowRender = false;

            Dispose();

            ProgressBar progressBar = new ProgressBar("Opening Archive");

            if (displayProgressBar)
            {
                progressBar.Show();
            }

            assetDictionary = new Dictionary <uint, Asset>();

            currentlySelectedAssets = new List <Asset>();
            currentlyOpenFilePath   = fileName;

            try
            {
                hipFile = new HipFile(fileName);
            }
            catch (Exception e)
            {
                progressBar.Close();
                throw e;
            }

            progressBar.SetProgressBar(0, DICT.ATOC.AHDRList.Count, 1);

            if (this.platform == Platform.Unknown)
            {
                hipFile.platform = platform;
            }
            while (this.platform == Platform.Unknown)
            {
                hipFile.platform = ChoosePlatformDialog.GetPlatform();
            }

            string assetsWithError = "";

            List <string> autoComplete = new List <string>(DICT.ATOC.AHDRList.Count);

            foreach (Section_AHDR AHDR in DICT.ATOC.AHDRList)
            {
                string error = AddAssetToDictionary(AHDR, true, skipTexturesAndModels || standalone, false);

                if (error != null)
                {
                    assetsWithError += error + "\n";
                }

                autoComplete.Add(AHDR.ADBG.assetName);

                progressBar.PerformStep();
            }

            if (assetsWithError != "")
            {
                MessageBox.Show("There was an error loading the following assets and editing has been disabled for them:\n" + assetsWithError);
            }

            autoCompleteSource.AddRange(autoComplete.ToArray());

            if (!(skipTexturesAndModels || standalone) && ContainsAssetWithType(AssetType.RWTX))
            {
                SetupTextureDisplay();
            }

            RecalculateAllMatrices();

            if (!skipTexturesAndModels && ContainsAssetWithType(AssetType.PIPT) && ContainsAssetWithType(AssetType.MODL))
            {
                foreach (var asset in assetDictionary.Values)
                {
                    if (asset is AssetPIPT PIPT)
                    {
                        PIPT.UpdateDictionary();
                    }
                }
            }

            progressBar.Close();

            allowRender = true;
        }