コード例 #1
0
ファイル: Decompiler.cs プロジェクト: amorgun/decomp-cli
        private static void ProcessFile(string strFileName)
        {
            if (!File.Exists(Path.Combine(Common.InputPath, strFileName)))
            {
                Status = "File not found " + Common.InputPath + "/" + strFileName;
                return;
            }

            var sw      = Stopwatch.StartNew();
            var dblTime = sw.ElapsedTicks * 1000.0 / Stopwatch.Frequency;

            var fInput         = new Text(Path.Combine(Common.InputPath, strFileName));
            var strFirstString = fInput.GetString();

            if (strFirstString == null)
            {
                Status = "Unknown file format";
                return;
            }
            var bFirstNumber = Int32.TryParse(strFirstString, out var _);

            fInput.Close();

            if (strFirstString == "scriptsfile version 1")
            {
                Scripts.Decompile();
            }
            else if (strFirstString == "triggersfile version 1")
            {
                Triggers.Decompile();
            }
            else if (strFirstString == "simple_triggers_file version 1")
            {
                SimpleTriggers.Decompile();
            }
            else if (strFirstString == "dialogsfile version 2") //Warband dialogs file
            {
                Dialogs.Decompile();
            }
            else if (strFirstString == "dialogsfile version 1") //M&B v1.011/v1.010 dialogs file
            {
                Vanilla.Dialogs.Decompile();
            }
            else if (strFirstString == "menusfile version 1")
            {
                Menus.Decompile();
            }
            else if (strFirstString == "factionsfile version 1")
            {
                Factions.Decompile();
            }
            else if (strFirstString == "infopagesfile version 1")
            {
                InfoPages.Decompile();
            }
            else if (strFirstString == "itemsfile version 3") //Warband items file
            {
                Items.Decompile();
            }
            else if (strFirstString == "itemsfile version 2") //M&B v1.011/v1.010 items file
            {
                Vanilla.Items.Decompile();
            }
            else if (strFirstString == "map_icons_file version 1")
            {
                MapIcons.Decompile();
            }
            else if (strFirstString == "missionsfile version 1")
            {
                MissionTemplates.Decompile();
            }
            else if (strFirstString == "particle_systemsfile version 1")
            {
                ParticleSystems.Decompile();
            }
            else if (strFirstString == "partiesfile version 1")
            {
                Parties.Decompile();
            }
            else if (strFirstString == "partytemplatesfile version 1")
            {
                PartyTemplates.Decompile();
            }
            else if (strFirstString == "postfx_paramsfile version 1")
            {
                Postfx.Decompile();
            }
            else if (strFirstString == "presentationsfile version 1")
            {
                Presentations.Decompile();
            }
            else if (strFirstString == "questsfile version 1")
            {
                Quests.Decompile();
            }
            else if (strFirstString == "scene_propsfile version 1")
            {
                SceneProps.Decompile();
            }
            else if (strFirstString == "scenesfile version 1")
            {
                Scenes.Decompile();
            }
            else if (strFirstString == "skins_file version 1" && Common.SelectedMode == Mode.Caribbean) //Caribbean skins file
            {
                Caribbean.Skins.Decompile();
            }
            else if (strFirstString == "skins_file version 1") //Warband skins file
            {
                Skins.Decompile();
            }
            else if (strFirstString == "soundsfile version 3") //Warband sounds file
            {
                Sounds.Decompile();
            }
            else if (strFirstString == "soundsfile version 2") //M&B v1.011/v1.010 sounds file
            {
                Vanilla.Sounds.Decompile();
            }
            else if (strFirstString == "stringsfile version 1")
            {
                Strings.Decompile();
            }
            else if (strFirstString == "troopsfile version 2" && Common.SelectedMode == Mode.Caribbean) //Caribbean troops file
            {
                Caribbean.Troops.Decompile();
            }
            else if (strFirstString == "troopsfile version 2") //Warband troops file
            {
                Troops.Decompile();
            }
            else if (strFirstString == "troopsfile version 1") //M&B v1.011/v1.010 troops file
            {
                Vanilla.Troops.Decompile();
            }
            else if (bFirstNumber && strFileName == "tableau_materials.txt")
            {
                TableauMaterials.Decompile();
            }
            else if (bFirstNumber && strFileName == "skills.txt")
            {
                Skills.Decompile();
            }
            else if (bFirstNumber && strFileName == "music.txt")
            {
                Music.Decompile();
            }
            else if (bFirstNumber && strFileName == "actions.txt")
            {
                if (Common.IsVanillaMode)
                {
                    Vanilla.Animations.Decompile();
                }
                else
                {
                    Animations.Decompile();
                }
            }
            else if (bFirstNumber && strFileName == "meshes.txt")
            {
                Meshes.Decompile();
            }
            else if (bFirstNumber && strFileName == "flora_kinds.txt")
            {
                Flora.Decompile();
            }
            else if (strFileName == "ground_specs.txt")
            {
                GroundSpecs.Decompile();
            }
            else if (bFirstNumber && strFileName == "skyboxes.txt")
            {
                Skyboxes.Decompile();
            }
            else
            {
                Status = "Unknown format in " + Common.InputPath + "/" + strFileName;
            }
        }