Пример #1
0
 internal SaveFile(
     [NotNull]   ISaveFolder folder,
     [NotNull]   SaveFileName saveFileName,
     [CanBeNull] TData data = default
     ) : base(
         folder,
         saveFileName.Rendered.MustNotBeBlank(),
         data
         )
 {
     _saveFileName = saveFileName ?? throw new ArgumentNullException(nameof(saveFileName));
 }
Пример #2
0
 public SaveFile(
     [NotNull]   ISaveFolder folder,
     [NotNull]   FileInfo fileInfo,
     [CanBeNull] TData data = default
     ) : base(
         folder,
         fileInfo,
         data
         )
 {
     _saveFileName = SaveFileName.Parse(fileInfo);
 }
Пример #3
0
        public IOrderedEnumerable <SaveFile <TData> > EnumerateSaveFiles(string?nickname = "*")
        {
            nickname ??= "*";
            var searchPattern = new SaveFileName()
            {
                Nickname      = nickname,
                FullExtension = Settings.SaveFileExtension
            }.GetFileSearchPattern();

            return(SaveFolder.Directory.EnumerateFiles(searchPattern, SearchOption.TopDirectoryOnly)
                   .Where(it => it.BaseName().Matches(SaveFileName.BaseFileNamePattern))
                   .Select(it => new SaveFile <TData>(SaveFolder, it))
                   .OrderByDescending(it => it.TimeStamp));
        }