public static void CreateSosigIDFile(string path) { try { if (File.Exists(path + "/SosigIDs.txt")) { File.Delete(path + "/SosigIDs.txt"); } // Create a new file using (StreamWriter sw = File.CreateText(path + "/SosigIDs.txt")) { sw.WriteLine("#Available Sosig IDs for spawning"); foreach (SosigEnemyID ID in ManagerSingleton <IM> .Instance.odicSosigObjsByID.Keys) { sw.WriteLine(ID.ToString()); } sw.Close(); } } catch (Exception ex) { TNHTweakerLogger.LogError(ex.ToString()); } }
public static void CreateIconIDFile(string path, List <string> icons) { try { if (File.Exists(path + "/IconIDs.txt")) { File.Delete(path + "/IconIDs.txt"); } // Create a new file using (StreamWriter sw = File.CreateText(path + "/IconIDs.txt")) { sw.WriteLine("#Available Icons for equipment pools"); foreach (string icon in icons) { sw.WriteLine(icon); } sw.Close(); } } catch (Exception ex) { TNHTweakerLogger.LogError(ex.ToString()); } }
public static void CreatePopulatedCharacterTemplate(string path) { try { TNHTweakerLogger.Log("TNHTweaker -- Creating populated character template file", TNHTweakerLogger.LogType.File); path = path + "/PopulatedCharacterTemplate.json"; if (!File.Exists(path)) { File.Delete(path); } using (StreamWriter sw = File.CreateText(path)) { CustomCharacter character = new CustomCharacter(); string characterString = JsonConvert.SerializeObject(character, Formatting.Indented, new StringEnumConverter()); sw.WriteLine(characterString); sw.Close(); } } catch (Exception ex) { TNHTweakerLogger.LogError(ex.ToString()); } }
public static void CreateDefaultCharacterFiles(List <CustomCharacter> characters, string path) { try { TNHTweakerLogger.Log("TNHTweaker -- Creating default character template files", TNHTweakerLogger.LogType.File); path = path + "/DefaultCharacters"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } foreach (CustomCharacter charDef in characters) { if (File.Exists(path + "/" + charDef.DisplayName + ".json")) { File.Delete(path + "/" + charDef.DisplayName + ".json"); } // Create a new file using (StreamWriter sw = File.CreateText(path + "/" + charDef.DisplayName + ".json")) { string characterString = JsonConvert.SerializeObject(charDef, Formatting.Indented, new StringEnumConverter()); sw.WriteLine(characterString); sw.Close(); } } } catch (Exception ex) { TNHTweakerLogger.LogError(ex.ToString()); } }
public static void CreateJsonVaultFiles(string path) { try { path = path + "/VaultFiles"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string[] vaultFiles = ES2.GetFiles(string.Empty, "*.txt"); List <SavedGunSerializable> savedGuns = new List <SavedGunSerializable>(); foreach (string name in vaultFiles) { try { if (name.Contains("DONTREMOVETHISPARTOFFILENAMEV02a")) { if (ES2.Exists(name)) { using (ES2Reader reader = ES2Reader.Create(name)) { savedGuns.Add(new SavedGunSerializable(reader.Read <SavedGun>("SavedGun"))); } } } } catch (Exception e) { TNHTweakerLogger.LogError("Vault File could not be loaded"); } } foreach (SavedGunSerializable savedGun in savedGuns) { if (File.Exists(path + "/" + savedGun.FileName + ".json")) { File.Delete(path + "/" + savedGun.FileName + ".json"); } // Create a new file using (StreamWriter sw = File.CreateText(path + "/" + savedGun.FileName + ".json")) { string characterString = JsonConvert.SerializeObject(savedGun, Formatting.Indented, new StringEnumConverter()); sw.WriteLine(characterString); sw.Close(); } } } catch (Exception ex) { TNHTweakerLogger.LogError(ex.ToString()); } }
public static void CreateObjectIDFile(string path) { try { if (File.Exists(path + "/ObjectIDs.csv")) { File.Delete(path + "/ObjectIDs.csv"); } // Create a new file using (StreamWriter sw = File.CreateText(path + "/ObjectIDs.csv")) { sw.WriteLine("ObjectID,Category,Era,Set,Country of Origin,Attachment Feature,Firearm Action,Firearm Feed Option,Firing Modes,Firearm Mounts,Attachment Mount,Round Power,Size,Melee Handedness,Melee Style,Powerup Type,Thrown Damage Type,Thrown Type"); foreach (FVRObject obj in IM.OD.Values) { sw.WriteLine( obj.ItemID + "," + obj.Category + "," + obj.TagEra + "," + obj.TagSet + "," + obj.TagFirearmCountryOfOrigin + "," + obj.TagAttachmentFeature + "," + obj.TagFirearmAction + "," + string.Join("+", obj.TagFirearmFeedOption.Select(o => o.ToString()).ToArray()) + "," + string.Join("+", obj.TagFirearmFiringModes.Select(o => o.ToString()).ToArray()) + "," + string.Join("+", obj.TagFirearmMounts.Select(o => o.ToString()).ToArray()) + "," + obj.TagAttachmentMount + "," + obj.TagFirearmRoundPower + "," + obj.TagFirearmSize + "," + obj.TagMeleeHandedness + "," + obj.TagMeleeStyle + "," + obj.TagPowerupType + "," + obj.TagThrownDamageType + "," + obj.TagThrownType); } sw.Close(); } } catch (Exception ex) { TNHTweakerLogger.LogError(ex.ToString()); } }
public static void CreateDefaultSosigTemplateFiles(List <SosigEnemyTemplate> sosigs, string path) { try { TNHTweakerLogger.Log("TNHTweaker -- Creating default sosig template files", TNHTweakerLogger.LogType.File); path = path + "/DefaultSosigTemplates"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } foreach (SosigEnemyTemplate template in sosigs) { if (File.Exists(path + "/" + template.SosigEnemyID + ".json")) { File.Delete(path + "/" + template.SosigEnemyID + ".json"); } // Create a new file using (StreamWriter sw = File.CreateText(path + "/" + template.SosigEnemyID + ".json")) { SosigTemplate sosig = new SosigTemplate(template); string characterString = JsonConvert.SerializeObject(sosig, Formatting.Indented, new StringEnumConverter()); sw.WriteLine(characterString); sw.Close(); } } } catch (Exception ex) { TNHTweakerLogger.LogError(ex.ToString()); } }