private void Uninstall_QXD(string path, _File file) { try { QXD_File binaryFile = (QXD_File)GetParsedFile <QXD_File>(path, false); QXD_File cpkBinFile = (QXD_File)GetParsedFile <QXD_File>(path, true); Section questSection = file.GetSection(Sections.QXD_Quest); Section chara1Section = file.GetSection(Sections.QXD_Character1); Section chara2Section = file.GetSection(Sections.QXD_Character2); Section collectionSection = file.GetSection(Sections.QXD_Collection); if (questSection != null) { UninstallEntries(binaryFile.Quests, (cpkBinFile != null) ? cpkBinFile.Quests : null, questSection.IDs); } if (chara1Section != null) { UninstallEntries(binaryFile.Characters1, (cpkBinFile != null) ? cpkBinFile.Characters1 : null, chara1Section.IDs); } if (chara2Section != null) { UninstallEntries(binaryFile.Characters2, (cpkBinFile != null) ? cpkBinFile.Characters2 : null, chara2Section.IDs); } if (collectionSection != null) { UninstallEntries(binaryFile.Collections, (cpkBinFile != null) ? cpkBinFile.Collections : null, collectionSection.IDs); } } catch (Exception ex) { string error = string.Format("Failed at {0} uninstall phase ({1}).", ErrorCode.QXD, path); throw new Exception(error, ex); } }
private void Uninstall_TNL(string path, _File file) { try { TNL_File binaryFile = (TNL_File)GetParsedFile <TNL_File>(path, false); TNL_File cpkBinFile = (TNL_File)GetParsedFile <TNL_File>(path, true); Section charaSection = file.GetSection(Sections.TNL_Character); Section teacherSection = file.GetSection(Sections.TNL_Teacher); Section objectSection = file.GetSection(Sections.TNL_Object); Section actionSection = file.GetSection(Sections.TNL_Action); if (charaSection != null) { UninstallEntries(binaryFile.Characters, (cpkBinFile != null) ? cpkBinFile.Characters : null, charaSection.IDs); } if (teacherSection != null) { UninstallEntries(binaryFile.Teachers, (cpkBinFile != null) ? cpkBinFile.Teachers : null, teacherSection.IDs); } if (objectSection != null) { UninstallEntries(binaryFile.Objects, (cpkBinFile != null) ? cpkBinFile.Objects : null, objectSection.IDs); } if (actionSection != null) { UninstallEntries(binaryFile.Actions, (cpkBinFile != null) ? cpkBinFile.Actions : null, actionSection.IDs); } } catch (Exception ex) { string error = string.Format("Failed at {0} uninstall phase ({1}).", ErrorCode.TNL, path); throw new Exception(error, ex); } }
private void Uninstall_AUR(string path, _File file) { try { AUR_File binaryFile = (AUR_File)GetParsedFile <AUR_File>(path, false); AUR_File cpkBinFile = (AUR_File)GetParsedFile <AUR_File>(path, true); Section aurSection = file.GetSection(Sections.AUR_Aura); Section charaSection = file.GetSection(Sections.AUR_Chara); if (aurSection != null) { UninstallEntries(binaryFile.Auras, (cpkBinFile != null) ? cpkBinFile.Auras : null, aurSection.IDs); } if (charaSection != null) { UninstallEntries(binaryFile.CharacterAuras, (cpkBinFile != null) ? cpkBinFile.CharacterAuras : null, charaSection.IDs); } } catch (Exception ex) { string error = string.Format("Failed at {0} uninstall phase ({1}).", ErrorCode.AUR, path); throw new Exception(error, ex); } }
private void Uninstall_EEPK(string path, _File file) { #if !DEBUG try #endif { EepkToolInterlop.TextureImportMatchNames = true; EepkToolInterlop.AssetReuseMatchName = true; EffectContainerFile binaryFile = (EffectContainerFile)GetParsedFile <EffectContainerFile>(path, false); EffectContainerFile cpkBinFile = (EffectContainerFile)GetParsedFile <EffectContainerFile>(path, true); Section section = file.GetSection(Sections.EEPK_Effect); if (section != null) { binaryFile.UninstallEffects(section.IDs, cpkBinFile); } } #if !DEBUG catch (Exception ex) { string error = string.Format("Failed at {0} uninstall phase ({1}).", ErrorCode.EEPK, path); throw new Exception(error, ex); } #endif }
private void Uninstall_BDM(string path, _File file) { try { BDM_File binaryFile = (BDM_File)GetParsedFile <BDM_File>(path, false); BDM_File cpkBinFile = (BDM_File)GetParsedFile <BDM_File>(path, true, false); binaryFile.ConvertToXv2(); if (cpkBinFile != null) { cpkBinFile.ConvertToXv2(); } Section section = file.GetSection(Sections.BDM_Entries); if (section != null) { UninstallEntries(binaryFile.BDM_Entries, (cpkBinFile != null) ? cpkBinFile.BDM_Entries : null, section.IDs); } } catch (Exception ex) { string error = string.Format("Failed at {0} uninstall phase ({1}).", ErrorCode.BDM, path); throw new Exception(error, ex); } }
private void Uninstall_TSD(string path, _File file) { try { TSD_File binaryFile = (TSD_File)GetParsedFile <TSD_File>(path, false); TSD_File cpkBinFile = (TSD_File)GetParsedFile <TSD_File>(path, true); Section triggerSection = file.GetSection(Sections.TSD_Trigger); Section constantSection = file.GetSection(Sections.TSD_Constant); Section zoneSection = file.GetSection(Sections.TSD_Zone); Section globalSection = file.GetSection(Sections.TSD_Global); Section eventSection = file.GetSection(Sections.TSD_Event); if (triggerSection != null) { UninstallEntries(binaryFile.Triggers, (cpkBinFile != null) ? cpkBinFile.Triggers : null, triggerSection.IDs); } if (constantSection != null) { UninstallEntries(binaryFile.Constants, (cpkBinFile != null) ? cpkBinFile.Constants : null, constantSection.IDs); } if (zoneSection != null) { UninstallEntries(binaryFile.Zones, (cpkBinFile != null) ? cpkBinFile.Zones : null, zoneSection.IDs); } if (globalSection != null) { UninstallEntries(binaryFile.Globals, (cpkBinFile != null) ? cpkBinFile.Globals : null, globalSection.IDs); } if (eventSection != null) { UninstallEntries(binaryFile.Events, (cpkBinFile != null) ? cpkBinFile.Events : null, eventSection.IDs); } } catch (Exception ex) { string error = string.Format("Failed at {0} uninstall phase ({1}).", ErrorCode.TSD, path); throw new Exception(error, ex); } }
private void Uninstall_BCS(string path, _File file) { try { BCS_File binaryFile = (BCS_File)GetParsedFile <BCS_File>(path, false); BCS_File cpkBinFile = (BCS_File)GetParsedFile <BCS_File>(path, true, false); Section partSetSection = file.GetSection(Sections.BCS_PartSets); Section bodiesSection = file.GetSection(Sections.BCS_Bodies); if (partSetSection != null) { UninstallEntries(binaryFile.PartSets, (cpkBinFile != null) ? cpkBinFile.PartSets : null, partSetSection.IDs); } if (binaryFile.Part_Colors != null) { foreach (var section in binaryFile.Part_Colors) { Section partColorSection = file.GetSection(Sections.GetBcsPartColor(section.Index)); if (partColorSection != null) { var cpkSection = (cpkBinFile != null) ? cpkBinFile.GetPartColors(section.Index, section.Str_00) : null; UninstallEntries(section._Colors, (cpkSection != null) ? cpkSection._Colors : null, partColorSection.IDs); } } } if (bodiesSection != null) { UninstallEntries(binaryFile.Bodies, (cpkBinFile != null) ? cpkBinFile.Bodies : null, bodiesSection.IDs); } } catch (Exception ex) { string error = string.Format("Failed at {0} uninstall phase ({1}).", ErrorCode.BCS, path); throw new Exception(error, ex); } }
private void Uninstall_EMB(string path, _File file) { try { EMB_File binaryFile = (EMB_File)GetParsedFile <EMB_File>(path, false); EMB_File cpkBinFile = (EMB_File)GetParsedFile <EMB_File>(path, true); Section section = file.GetSection(Sections.EMB_Entry); if (section != null) { for (int i = 0; i < section.IDs.Count; i++) { int idNum; if (int.TryParse(section.IDs[i], out idNum)) { //ID is number (index) EmbEntry original = (cpkBinFile != null) ? cpkBinFile.GetEntry(idNum) : null; binaryFile.RemoveEntry(section.IDs[i], original); } else { //ID is string (name) EmbEntry original = (cpkBinFile != null) ? cpkBinFile.GetEntry(section.IDs[i]) : null; var existingEntry = binaryFile.Entry.FirstOrDefault(x => x.Name == section.IDs[i]); if (existingEntry != null) { binaryFile.RemoveEntry(binaryFile.Entry.IndexOf(existingEntry).ToString(), original); } } } binaryFile.TrimNullEntries(); } } catch (Exception ex) { string error = string.Format("Failed at {0} uninstall phase ({1}).", ErrorCode.EMB, path); throw new Exception(error, ex); } }
private void Uninstall_PAL(string path, _File file) { try { PAL_File binaryFile = (PAL_File)GetParsedFile <PAL_File>(path, false); PAL_File cpkBinFile = (PAL_File)GetParsedFile <PAL_File>(path, true); Section section = file.GetSection(Sections.PAL_Entry); if (section != null) { UninstallEntries(binaryFile.PalEntries, (cpkBinFile != null) ? cpkBinFile.PalEntries : null, section.IDs); } } catch (Exception ex) { string error = string.Format("Failed at PAL uninstall phase ({0}).", path); throw new Exception(error, ex); } }
private void Uninstall_MSG(string path, _File file) { try { MSG_File binaryFile = (MSG_File)GetParsedFile <MSG_File>(path, false); MSG_File cpkBinFile = (MSG_File)GetParsedFile <MSG_File>(path, true); Section section = file.GetSection(Sections.MSG_Entries); if (section != null) { UninstallEntries(binaryFile.MSG_Entries, (cpkBinFile != null) ? cpkBinFile.MSG_Entries : null, section.IDs); } } catch (Exception ex) { string error = string.Format("Failed at {0} uninstall phase ({1}).", ErrorCode.MSG, path); throw new Exception(error, ex); } }
private void Uninstall_EAN(string path, _File file) { try { EAN_File binaryFile = (EAN_File)GetParsedFile <EAN_File>(path, false); EAN_File cpkBinFile = (EAN_File)GetParsedFile <EAN_File>(path, true); Section section = file.GetSection(Sections.EAN_Entries); if (section != null) { UninstallEntries(binaryFile.Animations, (cpkBinFile != null) ? cpkBinFile.Animations : null, section.IDs); } } catch (Exception ex) { string error = string.Format("Failed at EAN uninstall phase ({0}).", path); throw new Exception(error, ex); } }
private void Uninstall_BAC(string path, _File file) { try { BAC_File binaryFile = (BAC_File)GetParsedFile <BAC_File>(path, false); BAC_File cpkBinFile = (BAC_File)GetParsedFile <BAC_File>(path, true, false); Section section = file.GetSection(Sections.BAC_Entries); if (section != null) { UninstallEntries(binaryFile.BacEntries, (cpkBinFile != null) ? cpkBinFile.BacEntries : null, section.IDs); } } catch (Exception ex) { string error = string.Format("Failed at BAC uninstall phase ({0}).", path); throw new Exception(error, ex); } }
private void Uninstall_CUS(string path, _File file) { try { CUS_File binaryFile = (CUS_File)GetParsedFile <CUS_File>(path, false); CUS_File cpkBinFile = (CUS_File)GetParsedFile <CUS_File>(path, true); Section skillsetSection = file.GetSection(Sections.CUS_Skillsets); Section superSection = file.GetSection(Sections.CUS_SuperSkills); Section ultimateSection = file.GetSection(Sections.CUS_UltimateSkills); Section evasiveSection = file.GetSection(Sections.CUS_EvasiveSkills); Section blastSection = file.GetSection(Sections.CUS_BlastSkills); Section awokenSection = file.GetSection(Sections.CUS_AwokenSkills); if (skillsetSection != null) { UninstallEntries(binaryFile.Skillsets, (cpkBinFile != null) ? cpkBinFile.Skillsets : null, skillsetSection.IDs); } if (superSection != null) { UninstallEntries(binaryFile.SuperSkills, (cpkBinFile != null) ? cpkBinFile.SuperSkills : null, superSection.IDs); } if (ultimateSection != null) { UninstallEntries(binaryFile.UltimateSkills, (cpkBinFile != null) ? cpkBinFile.UltimateSkills : null, ultimateSection.IDs); } if (evasiveSection != null) { UninstallEntries(binaryFile.EvasiveSkills, (cpkBinFile != null) ? cpkBinFile.EvasiveSkills : null, evasiveSection.IDs); } if (blastSection != null) { UninstallEntries(binaryFile.BlastSkills, (cpkBinFile != null) ? cpkBinFile.BlastSkills : null, blastSection.IDs); } if (awokenSection != null) { UninstallEntries(binaryFile.AwokenSkills, (cpkBinFile != null) ? cpkBinFile.AwokenSkills : null, awokenSection.IDs); } } catch (Exception ex) { string error = string.Format("Failed at {0} uninstall phase ({1}).", ErrorCode.CUS, path); throw new Exception(error, ex); } }
private void Uninstall_CharaSlots(_File file) { try { CharaSlotsFile charaSlotsFile = (CharaSlotsFile)GetParsedFile <CharaSlotsFile>(CharaSlotsFile.FILE_NAME_BIN, false, false); if (charaSlotsFile == null) { return; } Section section = file.GetSection(Sections.CharaSlotEntry); if (section != null) { charaSlotsFile.UninstallEntries(section.IDs); } } catch (Exception ex) { string error = string.Format("Failed at CharaSlots uninstall phase ({0}).", CharaSlotsFile.FILE_NAME_BIN); throw new Exception(error, ex); } }
private void Uninstall_PSC(string path, _File file) { try { PSC_File binaryFile = (PSC_File)GetParsedFile <PSC_File>(path, false); PSC_File cpkBinFile = (PSC_File)GetParsedFile <PSC_File>(path, true); for (int i = binaryFile.Configurations.Count - 1; i >= 0; i--) { PSC_Configuration cpkConfig = (cpkBinFile != null) ? cpkBinFile.GetConfiguration(binaryFile.Configurations[i].Index) : null; for (int a = binaryFile.Configurations[i].PscEntries.Count - 1; a >= 0; a--) { PSC_Entry cpkPscEntry = (cpkConfig != null) ? cpkConfig.GetPscEntry(binaryFile.Configurations[i].PscEntries[a].Index) : null; //Check if mod has SPec Entries installed for this PSC Entry Section section = file.GetSection(Sections.GetPscEntry(binaryFile.Configurations[i].PscEntries[a].Index)); if (section != null) { //It does, so uninstall them. UninstallEntries(binaryFile.Configurations[i].PscEntries[a].PscSpecEntries, (cpkPscEntry != null) ? cpkPscEntry.PscSpecEntries : null, section.IDs); } //If PSC Entry now has 0 Spec entries, then remove it if (binaryFile.Configurations[i].PscEntries[a].PscSpecEntries.Count == 0) { binaryFile.Configurations[i].PscEntries.RemoveAt(a); } } } } catch (Exception ex) { string error = string.Format("Failed at {0} uninstall phase ({1}).", ErrorCode.PSC, path); throw new Exception(error, ex); } }