private void buttonCheckErrors_Click(object sender, EventArgs e) { Globals.LogHelper.Info(string.Format("Beginning Error Checking for character: {0}.", _CurrentFighter.nameHuman)); string baseDirectory = Globals.PathHelper.FolderCharSlotsMods + _CurrentFighter.name + Path.DirectorySeparatorChar; string[] kamiFiles = Directory.GetFiles(baseDirectory, "kamimod.xml", SearchOption.AllDirectories); for (int i = 0; i < kamiFiles.Length; ++i) { string modPath = kamiFiles[i].Replace("kamimod.xml", String.Empty); TextureIDFix.CheckForErrors(modPath); CharacterSlotModXML xml = Globals.Utils.DeserializeXML <CharacterSlotModXML>(kamiFiles[i]); if (xml == null) { Globals.LogHelper.Error(String.Format("There was a problem opening the xml file of mod {0}.", xml.DisplayName)); continue; } if (xml.UseCustomName) { if (string.IsNullOrEmpty(xml.CharacterName)) { Globals.LogHelper.Warning(String.Format("Custom Name of mod {0} is empty. Mods which have Use Custom Name enabled must have a Custom Name!", xml.DisplayName)); } if (string.IsNullOrEmpty(xml.BoxingRingText)) { Globals.LogHelper.Warning(String.Format("Boxing Ring Text of mod {0} is empty. Mods which have Use Custom Name enabled must have Boxing Ring Text!", xml.DisplayName)); } } } Globals.LogHelper.Info(string.Format("Finished Error Checking for character: {0}.", _CurrentFighter.nameHuman)); }
private void ChangeTextureID() { try { XMLData.TextureID = int.Parse(textBoxTextureID.Text); } catch (Exception e) { MessageBox.Show(String.Format("TextureID is invalid! Must be an integer between 0 and 255.\n{0}", e.Message)); LogHelper.Info("TextureID is invalid! Must be an integer between 0 and 255."); textBoxTextureID.Text = XMLData.TextureID.ToString(); return; } if (XMLData.TextureID < 0) { XMLData.TextureID = 0; } if (XMLData.TextureID > 255) { XMLData.TextureID = 255; } textBoxTextureID.Text = XMLData.TextureID.ToString(); TextureIDFix.ChangeTextureID(ModPath + Path.DirectorySeparatorChar + "model", _SmashProjectManager._CharacterModsPage.CurrentFighter.id, (ushort)XMLData.TextureID); LogHelper.Info(String.Format("Changed Texture ID of {0} to {1} successfully.", ModPath, XMLData.TextureID)); }
private void buttonTextureIDFixAll_Click(object sender, EventArgs e) { Globals.LogHelper.Info(string.Format("Beginning Texture ID Fixing for character: {0}.", _CurrentFighter.nameHuman)); List <ushort> usedIDs = new List <ushort>(); foreach (CharacterSlotMod slot in CurrentFighterActiveSlotMods) { string kamiPath = Globals.PathHelper.GetCharacterSlotModKamiPath(_CurrentFighter.name, slot.FolderName); string modPath = Globals.PathHelper.GetCharacterSlotModPath(_CurrentFighter.name, slot.FolderName); CharacterSlotModXML xml = Globals.Utils.DeserializeXML <CharacterSlotModXML>(kamiPath); ushort currentID = (ushort)xml.TextureID; if ((currentID % 4 == 0 && currentID < 128) || usedIDs.Contains(currentID)) { xml.TextureID = 255; while (usedIDs.Contains((ushort)xml.TextureID)) { --xml.TextureID; if (xml.TextureID < 1) { Globals.LogHelper.Error(Globals.UIStrings.TEXTURE_ID_FIX_NO_IDS_AVAILABLE); return; } } TextureIDFix.ChangeTextureID(modPath + "model", _CurrentFighter.id, (ushort)xml.TextureID); Globals.Utils.SerializeXMLToFile(xml, kamiPath); Globals.LogHelper.Info(String.Format("Changed Texture ID of {0} to {1} successfully.", slot.FolderName, xml.TextureID)); } usedIDs.Add((ushort)xml.TextureID); } Globals.LogHelper.Info(string.Format("Finished Texture ID Fixing for character: {0}.", _CurrentFighter.nameHuman)); }