示例#1
0
        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);
                }
            }
        }
示例#2
0
        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;
            }
        }
示例#3
0
        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);
                }
            }
        }
示例#4
0
        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;
            }
        }