ArtOfWords.Models.FileSelector.BackupFilesManager.GetAttr C# (CSharp) Method

GetAttr() private static method

ファイル名から属性を抽出する
private static GetAttr ( string path ) : SemiAutoSaveFileAttr
path string
return SemiAutoSaveFileAttr
        private static SemiAutoSaveFileAttr GetAttr(string path)
        {
            string fileName = Path.GetFileName(path);

            const int DATE_TIME_LENGTH = 14;

            if (fileName == null || fileName.Count() <= DATE_TIME_LENGTH + 1)
            {
                return null;
            }

            if (!fileName.Contains(".") || fileName.IndexOf(".") == 0)
            {
                return null;
            }

            string dateStr = fileName.Substring(fileName.Count() - DATE_TIME_LENGTH, DATE_TIME_LENGTH);

            DateTime date;
            if (!DateTime.TryParseExact(dateStr, "yyyyMMddHHmmss", null, System.Globalization.DateTimeStyles.AllowWhiteSpaces, out date))
            {
                return null;
            }

            string fileNameWithoutExtension = fileName.Substring(0, fileName.IndexOf("."));

            return new SemiAutoSaveFileAttr() { CreatedDate = date, FileName = fileNameWithoutExtension, FullPath = path };
        }