コード例 #1
0
        public BackupFileInfo GetBackupFileInfo(FileInfo fileInfo)
        {
            BackupFileInfo result = null;

            var typeInfo = GetTypeInfo(fileInfo.Name);

            if (typeInfo != null)
            {
                var      startTime = typeInfo.TimePeriodExtractor.GetTimestamp(fileInfo.Name);
                DateTime?endTime   = null;

                if (!startTime.HasValue)
                {
                    Log.ErrorFormat("File start time cannot be extracted from {0}, using creation time", fileInfo.Name);
                }
                else
                {
                    endTime = typeInfo.TimePeriodExtractor.GetPeriodEnd(fileInfo.Name);
                }

                result = new BackupFileInfo(typeInfo.BackupType, startTime, endTime, fileInfo);
            }

            return(result);
        }
コード例 #2
0
        public BackupFileFolderInfo GetContainingFolder(BackupFileInfo backupFile)
        {
            Check.DoRequireArgumentNotNull(backupFile, "backupFile");

            return(_backupFileFolders
                   .Where(f => f.DirectoryInfo.Name.Equals(backupFile.FileInfo.Directory.Name, StringComparison.InvariantCultureIgnoreCase))
                   .SingleOrDefault());
        }