示例#1
0
        private static void Watcher_Changed(object sender, FileSystemEventArgs e)
        {
            var n        = Directory.GetFiles(SavePath, "*.ars").Length;
            var filename = string.Format("1_ArSa{0}", n);

            var source = SavePath + "\\" + SaveFilter;
            var dest   = SavePath + "\\" + filename + ".ars";

            try
            {
                File.Copy(source, dest);
                Console.WriteLine(string.Format("{0} created", dest));

                var save = new SaveEntry
                {
                    DisplayName = (DateTime.Now.ToString() + '\0').ToCharArray(),
                    Filename    = (filename + '\0').ToCharArray()
                };

                SaveList.Add(save);
            }
            catch (IOException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
示例#2
0
        private static void ReadSaveEntries()
        {
            SaveList = new List <SaveEntry>();
            using (var reader = new BinaryReader(File.OpenRead(SaveEntries)))
            {
                uint n = reader.ReadUInt32();
                for (int i = 0; i < n; i++)
                {
                    // Display name is duplicated, skipping it
                    reader.ReadChars(reader.ReadInt32());

                    var save = new SaveEntry()
                    {
                        DisplayName = reader.ReadChars(reader.ReadInt32()),
                        Filename    = reader.ReadChars(reader.ReadInt32()),
                    };
                    SaveList.Add(save);
                }
            }
        }