Esempio n. 1
0
        private int?GetMaxVersionFile(bool getVersion = false)
        {
            string currentHash = GetMD5(SubscriberInfo.FullName);

            FileInfo fileInfoMaxEdited = null;
            DateTime dateTimeMaxEdited = DateTime.MinValue;

            foreach (FileInfo file in GetFilesInDirectoryVersion())
            {
                if (dateTimeMaxEdited <= file.LastWriteTime)
                {
                    fileInfoMaxEdited = file;
                    dateTimeMaxEdited = file.LastWriteTime;
                }
                ;
            }

            DateVersion = dateTimeMaxEdited;

            if (fileInfoMaxEdited == null)
            {
                return(0);
            }

            if (!getVersion)
            {
                if (GetMD5(fileInfoMaxEdited.FullName) == currentHash)
                {
                    return(null);
                }
            }

            return(DirFile.GetNumberVersion(fileInfoMaxEdited.Name));
        }
 public ListVersion(string path, string fileName, DateTime dateModified, CommentsVersion commentVersion)
 {
     _path         = path;
     _fileName     = fileName;
     _dateModified = dateModified;
     _comment      = commentVersion?.Comment;
     _dateComment  = commentVersion?.DateTime;
     _version      = DirFile.GetNumberVersion(_fileName);
 }