Пример #1
0
        public static IEnumerable <SaveFileInfo> GetDescriptions()
        {
            var files = Folder.GetFilenames().Where(x => x.EndsWith(".savegame"));
            var index = Folder.Has(IndexFile) ? ReadIndex() : new SaveGameIndex();

            var indexModified = false;

            foreach (var filename in files)
            {
                if (!index.Entries.ContainsKey(filename))
                {
                    var saveGameFile = Read(filename);
                    var info         = new SaveFileInfo(filename, saveGameFile.Header.Description, saveGameFile.CreatedAt.Value);

                    index.Entries[filename] = info;
                    yield return(info);

                    indexModified = true;
                }
                else
                {
                    yield return(index.Entries[filename]);
                }
            }

            if (indexModified)
            {
                WriteIndex(index);
            }
        }
Пример #2
0
        public static IEnumerable<SaveFileInfo> GetDescriptions()
        {
            var files = Folder.GetFilenames().Where(x => x.EndsWith(".savegame"));
              var index = Folder.Has(IndexFile) ? ReadIndex() : new SaveGameIndex();

              var indexModified = false;

              foreach (var filename in files)
              {
            if (!index.Entries.ContainsKey(filename))
            {
              var saveGameFile = Read(filename);
              var info = new SaveFileInfo(filename, saveGameFile.Header.Description, saveGameFile.CreatedAt.Value);

              index.Entries[filename] = info;
              yield return info;

              indexModified = true;
            }
            else
            {
              yield return index.Entries[filename];
            }
              }

              if (indexModified)
            WriteIndex(index);
        }