private static void InitializeModuleData() { Status = $"Initializing scripts.txt"; Common.Procedures = Scripts.Initialize(); Status = "Initializing quick_strings.txt"; Common.QuickStrings = QuickStrings.Initialize(); Status = "Initializing strings.txt"; Common.Strings = Strings.Initialize(); Status = "Initializing item_kinds1.txt"; Common.Items = Text.GetFirstStringFromFile(Common.InputPath + "/item_kinds1.txt") == "itemsfile version 2" ? Vanilla.Items.GetIdFromFile(Common.InputPath + "/item_kinds1.txt") : Items.Initialize(); Status = "Initializing troops.txt"; Common.Troops = Text.GetFirstStringFromFile(Common.InputPath + "/troops.txt") == "troopsfile version 1" ? Vanilla.Troops.GetIdFromFile(Common.InputPath + "/troops.txt") : Troops.Initialize(); Status = "Initializing factions.txt"; Common.Factions = Factions.Initialize(); Status = "Initializing quests.txt"; Common.Quests = Quests.Initialize(); Status = "Initializing party_templates.txt"; Common.PTemps = PartyTemplates.Initialize(); Status = "Initializing parties.txt"; Common.Parties = Parties.Initialize(); Status = "Initializing menus.txt"; Common.Menus = Menus.Initialize(); Status = "Initializing sounds.txt"; Common.Sounds = Sounds.Initialize(); Status = "Initializing skills.txt"; Common.Skills = Skills.Initialize(); Status = "Initializing meshes.txt"; Common.Meshes = Meshes.Initialize(); Status = "Initializing variables.txt"; Common.Variables = Scripts.InitializeVariables(); Status = "Initializing dialog_states.txt"; Common.DialogStates = Dialogs.Initialize(); Status = "Initializing scenes.txt"; Common.Scenes = Scenes.Initialize(); Status = "Initializing mission_templates.txt"; Common.MissionTemplates = MissionTemplates.Initialize(); Status = "Initializing particle_systems.txt"; Common.ParticleSystems = ParticleSystems.Initialize(); Status = "Initializing scene_props.txt"; Common.SceneProps = SceneProps.Initialize(); Status = "Initializing map_icons.txt"; Common.MapIcons = MapIcons.Initialize(); Status = "Initializing presentations.txt"; Common.Presentations = Presentations.Initialize(); Status = "Initializing tableau_materials.txt"; Common.Tableaus = TableauMaterials.Initialize(); Status = "Initializing actions.txt"; Common.Animations = Common.IsVanillaMode ? Vanilla.Animations.GetIdFromFile(Common.InputPath + "/actions.txt") : Animations.Initialize(); Status = "Initializing music.txt"; Common.Music = Music.Initialize(); Status = "Initializing skins.txt"; Common.Skins = Skins.Initialize(); Status = "Initializing finished"; }
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; } }