mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
extracted rdp error codes to new class
This commit is contained in:
@@ -304,7 +304,7 @@ namespace mRemoteNG.Connection
|
||||
|
||||
if (prot.InterfaceControl.Info.Protocol != ProtocolType.RDP) return;
|
||||
if (Convert.ToInt32(errorMessage) > -1)
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, string.Format(Language.strConnectionRdpErrorDetail, errorMessage, RdpProtocol.FatalErrors.GetError(errorMessage)));
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, string.Format(Language.strConnectionRdpErrorDetail, errorMessage, RdpErrorCodes.GetError(errorMessage)));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
43
mRemoteV1/Connection/Protocol/RDP/RdpErrorCodes.cs
Normal file
43
mRemoteV1/Connection/Protocol/RDP/RdpErrorCodes.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using mRemoteNG.App;
|
||||
|
||||
namespace mRemoteNG.Connection.Protocol.RDP
|
||||
{
|
||||
public static class RdpErrorCodes
|
||||
{
|
||||
private static Hashtable _description;
|
||||
|
||||
private static void InitDescription()
|
||||
{
|
||||
_description = new Hashtable
|
||||
{
|
||||
{"0", "Language.strRdpErrorUnknown"},
|
||||
{"1", "Language.strRdpErrorCode1"},
|
||||
{"2", "Language.strRdpErrorOutOfMemory"},
|
||||
{"3", "Language.strRdpErrorWindowCreation"},
|
||||
{"4", "Language.strRdpErrorCode2"},
|
||||
{"5", "Language.strRdpErrorCode3"},
|
||||
{"6", "Language.strRdpErrorCode4"},
|
||||
{"7", "Language.strRdpErrorConnection"},
|
||||
{"100", "Language.strRdpErrorWinsock"}
|
||||
};
|
||||
}
|
||||
|
||||
public static string GetError(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_description == null)
|
||||
InitDescription();
|
||||
|
||||
return (string)_description?[id];
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpErrorGetFailure, ex);
|
||||
return string.Format(Language.strRdpErrorUnknown, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
@@ -920,45 +919,6 @@ namespace mRemoteNG.Connection.Protocol.RDP
|
||||
public static readonly Version RDC81 = new Version(6, 3, 9600);
|
||||
}
|
||||
|
||||
#region Fatal Errors
|
||||
public static class FatalErrors
|
||||
{
|
||||
private static Hashtable _description;
|
||||
|
||||
private static void InitDescription()
|
||||
{
|
||||
_description = new Hashtable
|
||||
{
|
||||
{"0", "Language.strRdpErrorUnknown"},
|
||||
{"1", "Language.strRdpErrorCode1"},
|
||||
{"2", "Language.strRdpErrorOutOfMemory"},
|
||||
{"3", "Language.strRdpErrorWindowCreation"},
|
||||
{"4", "Language.strRdpErrorCode2"},
|
||||
{"5", "Language.strRdpErrorCode3"},
|
||||
{"6", "Language.strRdpErrorCode4"},
|
||||
{"7", "Language.strRdpErrorConnection"},
|
||||
{"100", "Language.strRdpErrorWinsock"}
|
||||
};
|
||||
}
|
||||
|
||||
public static string GetError(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_description == null)
|
||||
InitDescription();
|
||||
|
||||
return (string)_description?[id];
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpErrorGetFailure, ex);
|
||||
return string.Format(Language.strRdpErrorUnknown, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Reconnect Stuff
|
||||
public void tmrReconnect_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
|
||||
@@ -243,6 +243,7 @@
|
||||
<Compile Include="Connection\Protocol\Http\Connection.Protocol.HTTPS.CertEvent.cs" />
|
||||
<Compile Include="Connection\Protocol\ProtocolFactory.cs" />
|
||||
<Compile Include="Connection\Protocol\RDP\AzureLoadBalanceInfoEncoder.cs" />
|
||||
<Compile Include="Connection\Protocol\RDP\RdpErrorCodes.cs" />
|
||||
<Compile Include="Connection\Protocol\VNC\VNCEnum.cs" />
|
||||
<Compile Include="Connection\WebHelper.cs" />
|
||||
<Compile Include="Credential\PlaceholderCredentialRecord.cs" />
|
||||
|
||||
Reference in New Issue
Block a user