Пример #1
0
        // Token: 0x06000174 RID: 372 RVA: 0x00015A58 File Offset: 0x00013C58
        public static void ExitApp()
        {
            bool started = Main.Started;

            if (started)
            {
                Main.MouseLookEnadbled = false;
                bool flag = Ground.CStack.nSavingChunks > 0;
                if (flag)
                {
                    Loader.SaveChunks(Ground.CStack.SavingChunks, Ground.CStack.nSavingChunks, false);
                    Ground.CStack.nSavingChunks = 0;
                }
                List <XEntity> XeLst = new List <XEntity>();

                foreach (Entity e in Ground.CStack.eList)
                {
                    bool flag2 = !e.IsDead || e.eType.IsPlayer;
                    if (flag2)
                    {
                        XeLst.Add(new XEntity(e));
                    }
                }

                XEntity.Save(Loader.FileEntity, XeLst);
                Loader.MInfo.PlayerPosition = Main.Player1.Position;
                Loader.MInfo.Save(Loader.MapInfoFile);
                Ground.CStack.ChunkList = null;
                Ground.CStack.eList     = null;
                Main.Game.ExitGame();
                GC.Collect();
            }
            Main.ExitProgram();
        }
Пример #2
0
        // Token: 0x0600021A RID: 538 RVA: 0x0001D790 File Offset: 0x0001B990
        public static void Save(string Path, List <XEntity> ELst)
        {
            XmlSerializer XWriter      = new XmlSerializer(typeof(List <XEntity>));
            StreamWriter  StreamWriter = new StreamWriter(Path);

            try
            {
                XWriter.Serialize(StreamWriter, ELst);
                StreamWriter.Close();
            }
            catch (Exception)
            {
                StreamWriter.Close();
                XEntity.Save(Path + "Backup", ELst);
                File.Copy(Path + "Backup", Path, true);
            }
            File.Copy(Path, Path + "Backup", true);
        }
Пример #3
0
        // Token: 0x0600021B RID: 539 RVA: 0x0001D83C File Offset: 0x0001BA3C
        public static List <XEntity> Load(string Path)
        {
            XmlSerializer  XWriter      = new XmlSerializer(typeof(List <XEntity>));
            StreamReader   StreamReader = new StreamReader(Path);
            List <XEntity> Out;

            try
            {
                Out = (List <XEntity>)XWriter.Deserialize(StreamReader);
                StreamReader.Close();
            }
            catch (Exception)
            {
                Out = new List <XEntity>();
                StreamReader.Close();
                bool flag = File.Exists(Path + "Backup");
                if (flag)
                {
                    File.Copy(Path + "Backup", Path, true);
                    Out = XEntity.Load(Path);
                }
            }
            return(Out);
        }