示例#1
0
        /// <summary>
        /// Get 'SpoolFile' hash code
        /// </summary>
        public static string GenerateCode(this SpoolFile file)
        {
            var source      = $"{file.FilePool}{file.TrainIndex}{file.Path}";
            var sourceBytes = Encoding.UTF8.GetBytes(source);

            using (var sha1 = SHA1.Create())
            {
                var hashBuffer = sha1.ComputeHash(sourceBytes);
                return(hashBuffer.Aggregate("", (current, b) => current + b.ToString("X2")));
            }
        }
示例#2
0
 /// <summary>Ctor
 /// </summary>
 public SpoolFileFuture(SpoolFile file, int timeoutSeconds)
 {
     BeginTime      = DateTime.Now;
     File           = file;
     TimeoutSeconds = timeoutSeconds;
 }