public static void Read(string filepath) { if (opened) { Close(); } opened = true; file = filepath; mpq = MPQ.Archive.OpenForUdate(file); if (listfile != null) { listfile.TrimExcess(); listfile = null; } listfile = MPQ.Archive.ListFile(mpq); Settings.Ini.Write(Settings.KeyName(new { Settings.LastMap }), file, Settings.INI_SECTION_GENERAL); Settings.LastMap = file; Jass.Read(); WTS.Read(); W3I.Read(); IMP.Read(); SLK.Read(); byte[] mapPreview = MPQ.File.Read(WAR3_PREVIEW, mpq); if (null != mapPreview) { SetPreview(Paloma.TargaImage.LoadTargaImage(new MemoryStream(mapPreview))); } }
private static void ReadFileTypes() { SLK.LoadList(ref SLK.list, "AbilityData.slk"); /*File.Create(Settings.FOLDER_PATH + "AbilityData.slk").Dispose(); * StreamWriter writer = new StreamWriter(Settings.FOLDER_PATH + "AbilityData.slk"); * * foreach (string line in SLK.list) * writer.WriteLine(line); * * writer.Dispose();*/ //Abilities strings SLK.LoadList(ref StringList, "CampaignAbilityStrings.txt"); SLK.LoadList(ref StringList, "CommonAbilityStrings.txt"); SLK.LoadList(ref StringList, "HumanAbilityStrings.txt"); SLK.LoadList(ref StringList, "ItemAbilityStrings.txt"); SLK.LoadList(ref StringList, "NeutralAbilityStrings.txt"); SLK.LoadList(ref StringList, "NightElfAbilityStrings.txt"); SLK.LoadList(ref StringList, "OrcAbilityStrings.txt"); SLK.LoadList(ref StringList, "UndeadAbilityStrings.txt"); //Abilities func SLK.LoadList(ref fncList, "CampaignAbilityFunc.txt"); SLK.LoadList(ref fncList, "CommonAbilityFunc.txt"); SLK.LoadList(ref fncList, "HumanAbilityFunc.txt"); SLK.LoadList(ref fncList, "ItemAbilityFunc.txt"); SLK.LoadList(ref fncList, "NeutralAbilityFunc.txt"); SLK.LoadList(ref fncList, "NightElfAbilityFunc.txt"); SLK.LoadList(ref fncList, "OrcAbilityFunc.txt"); SLK.LoadList(ref fncList, "UndeadAbilityFunc.txt"); }
public static void Read() { ReadFileTypes(); table = new string[SLK.GetSizeX(SLK.list) + 1, SLK.GetSizeY(SLK.list) + 1]; sizeY = 0; foreach (string line in SLK.list) { sizeX = SLK.GetLineX(line); if (0 != SLK.GetLineY(line)) { sizeY = SLK.GetLineY(line); } if (line.StartsWith("C;") && sizeY > 1) { table[sizeX, sizeY] = line.After(";K"); if (sizeX == Field.InBeta) { codeId.Add(table[sizeX, sizeY]); id.Add(sizeY); string folderPath = table[Field.race, sizeY].Replace("\"", null).Substring(0, 1).ToUpper() + table[Field.race, sizeY].Replace("\"", null).Substring(1); string subFolder = "Units"; if (table[Field.hero, sizeY] == "1" && table[Field.item, sizeY] == "0") { subFolder = "Heroes"; } else if (table[Field.hero, sizeY] == "0" && table[Field.item, sizeY] == "1") { subFolder = "Items"; } folderPath = folderPath + @"\" + subFolder; //if (!Wc3Engine.StandarAbilitiesTab.FolderExist(folderPath)) //Wc3Engine.StandarAbilitiesTab.CreateFolder(folderPath); string objectId = table[Field.code, sizeY].Replace("\"", null); //string abilityPath = folderPath + @"\" + DataField.GetValue(objectId, DataField.Name, StringList); Ability.Create(folderPath + @"\" + DataField.GetValue(objectId, DataField.Name, StringList), DataField.GetValue(objectId, DataField.Name, StringList), DataField.GetValue(objectId, DataField.EditorSuffix, StringList), objectId.ToIntObjectId()); //Wc3Engine.StandarAbilitiesTab.CreateItem(folderPath + @"\" + DataField.GetValue(objectId, DataField.Name, StringList), objectId.ToIntObjectId()); } } } SLK.list.Clear(); }