Пример #1
0
        public static Platform GetPlatform()
        {
            ChoosePlatformDialog a = new ChoosePlatformDialog();

            a.ShowDialog();
            return(a.platform);
        }
Пример #2
0
 public static Platform GetPlatform()
 {
     using (var dialog = new ChoosePlatformDialog())
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             return(dialog.platform);
         }
     return(Platform.Unknown);
 }
        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;
        }