/// <summary> /// Creates a new <see cref="HashResult"/>. /// </summary> /// <param name="hash"></param> /// <param name="message"></param> /// <param name="exception"></param> public HashResult(string?hash, string?message, Exception?exception) { if (hash == null || hash.Length == 0) { Hash = null; } else { Hash = hash; } if (hash == null) { ResultType = HashResultType.Error; } else if ((message != null && message.Length > 0) || exception != null) { ResultType = HashResultType.Warn; } else { ResultType = HashResultType.Success; } Exception = exception; Message = message; }
/// <summary> /// Creates a new <see cref="HashResult"/> with <see cref="HashResultType.Success"/>. /// </summary> /// <param name="hash"></param> public HashResult(string hash) { if (string.IsNullOrEmpty(hash)) { throw new ArgumentNullException(nameof(hash), "This constructor should only be used with a successful hash."); } Hash = hash; ResultType = HashResultType.Success; Exception = null; Message = null; }