Downgrade to net standard 1.2

This commit is contained in:
Geoffroy BONNEVILLE
2020-03-23 18:35:00 +01:00
parent b8240d482f
commit 5067f81189
60 changed files with 1250 additions and 285 deletions

View File

@@ -21,11 +21,13 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
#if !KeePassUAP
#if ModernKeePassLib
using ModernKeePassLib.Cryptography.Hash;
#elif !KeePassUAP
using System.Security.Cryptography;
#endif
using ModernKeePassLib.Resources;
using ModernKeePassLib.Security;
using ModernKeePassLib.Utility;
@@ -163,5 +165,58 @@ namespace ModernKeePassLib.Cryptography.PasswordGenerator
psOut = pwd;
return PwgError.Success;
}
internal static string ErrorToString(PwgError e, bool bHeader)
{
if(e == PwgError.Success) { Debug.Assert(false); return string.Empty; }
if((e == PwgError.Unknown) && bHeader) return KLRes.PwGenFailed;
string str = KLRes.UnknownError;
switch(e)
{
// case PwgError.Success:
// break;
case PwgError.Unknown:
break;
case PwgError.TooFewCharacters:
str = KLRes.CharSetTooFewChars;
break;
case PwgError.UnknownAlgorithm:
str = KLRes.AlgorithmUnknown;
break;
case PwgError.InvalidCharSet:
str = KLRes.CharSetInvalid;
break;
case PwgError.InvalidPattern:
str = KLRes.PatternInvalid;
break;
default:
Debug.Assert(false);
break;
}
if(bHeader)
str = KLRes.PwGenFailed + MessageService.NewParagraph + str;
return str;
}
internal static string ErrorToString(Exception ex, bool bHeader)
{
string str = KLRes.UnknownError;
if((ex != null) && !string.IsNullOrEmpty(ex.Message))
str = ex.Message;
if(bHeader)
str = KLRes.PwGenFailed + MessageService.NewParagraph + str;
return str;
}
}
}