public static void SaveConfig() { Object[] ObjectType = { CVisualGlowObjectManager, CVisualChamsColor, CVisualMisc, CAim, CAimWeapon, CAimMisc, CMisc }; if (!Directory.Exists("Config")) { Directory.CreateDirectory("Config"); } foreach (object ObjectSave in ObjectType) { using (FileStream FileStream = new FileStream(ConfigPath(ObjectSave), FileMode.Create, FileAccess.Write)) { new XmlSerializer(ObjectSave.GetType()).Serialize(FileStream, ObjectSave); } } }
public static T LoadConfig <T>() { TryLoad: try { using (FileStream FileStream = new FileStream(ConfigPath <T>(), FileMode.Open, FileAccess.Read)) { return((T) new XmlSerializer(typeof(T)).Deserialize(FileStream)); } } catch { Object[] ObjectType = { CVisualGlowObjectManager, CVisualChamsColor, CVisualESP, CVisualMisc, CAim, CAimWeapon, CAimMisc, CTrigger, CMisc }; if (!Directory.Exists("Config")) { Directory.CreateDirectory("Config"); } using (FileStream FileStream = new FileStream(ConfigPath <T>(), FileMode.Create, FileAccess.Write)) { foreach (var ObjectSave in ObjectType) { if (typeof(T).Name == ObjectSave.GetType().Name) { new XmlSerializer(typeof(T)).Serialize(FileStream, ObjectSave); } } } goto TryLoad; } }
public static void SaveConfig() { object[] ObjectType = { CVisual, CSkinChanger, CSkinChangerWeapons }; if (!Directory.Exists("Config")) { Directory.CreateDirectory("Config"); } foreach (var ObjectSave in ObjectType) { using (FileStream FileStream = new FileStream(ConfigPath(ObjectSave), FileMode.Create, FileAccess.Write)) { new XmlSerializer(ObjectSave.GetType()).Serialize(FileStream, ObjectSave); } } }
public static T LoadConfig <T>() { TryLoad: try { using (FileStream FileStream = new FileStream(ConfigPath <T>(), FileMode.Open, FileAccess.Read)) { return((T) new XmlSerializer(typeof(T)).Deserialize(FileStream)); } } catch { object[] ObjectType = { CVisual, CSkinChanger, CSkinChangerWeapons }; if (!Directory.Exists("Config")) { Directory.CreateDirectory("Config"); } using (FileStream FileStream = new FileStream(ConfigPath <T>(), FileMode.Create, FileAccess.Write)) { foreach (var ObjectSave in ObjectType) { if (typeof(T).Name == ObjectSave.GetType().Name) { new XmlSerializer(typeof(T)).Serialize(FileStream, ObjectSave); } } } goto TryLoad; } }