mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
70 lines
2.0 KiB
C#
70 lines
2.0 KiB
C#
using mRemoteNG.Connection.Protocol.Http;
|
|
using mRemoteNG.Connection.Protocol.ICA;
|
|
using mRemoteNG.Connection.Protocol.RAW;
|
|
using mRemoteNG.Connection.Protocol.RDP;
|
|
using mRemoteNG.Connection.Protocol.Rlogin;
|
|
using mRemoteNG.Connection.Protocol.SSH;
|
|
using mRemoteNG.Connection.Protocol.Telnet;
|
|
using mRemoteNG.Connection.Protocol.VNC;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace mRemoteNG.Connection.Protocol
|
|
{
|
|
public class ProtocolFactory
|
|
{
|
|
public ProtocolFactory()
|
|
{
|
|
|
|
}
|
|
|
|
public ProtocolBase CreateProtocol(ConnectionInfo connectionInfo)
|
|
{
|
|
ProtocolBase newProtocol = default(ProtocolBase);
|
|
switch (connectionInfo.Protocol)
|
|
{
|
|
case ProtocolType.RDP:
|
|
newProtocol = new ProtocolRDP();
|
|
((ProtocolRDP) newProtocol).tmrReconnect.Elapsed += ((ProtocolRDP) newProtocol).tmrReconnect_Elapsed;
|
|
break;
|
|
case ProtocolType.VNC:
|
|
newProtocol = new ProtocolVNC();
|
|
break;
|
|
case ProtocolType.SSH1:
|
|
newProtocol = new ProtocolSSH1();
|
|
break;
|
|
case ProtocolType.SSH2:
|
|
newProtocol = new ProtocolSSH2();
|
|
break;
|
|
case ProtocolType.Telnet:
|
|
newProtocol = new ProtocolTelnet();
|
|
break;
|
|
case ProtocolType.Rlogin:
|
|
newProtocol = new ProtocolRlogin();
|
|
break;
|
|
case ProtocolType.RAW:
|
|
newProtocol = new ProtocolRAW();
|
|
break;
|
|
case ProtocolType.HTTP:
|
|
newProtocol = new ProtocolHTTP(connectionInfo.RenderingEngine);
|
|
break;
|
|
case ProtocolType.HTTPS:
|
|
newProtocol = new ProtocolHTTPS(connectionInfo.RenderingEngine);
|
|
break;
|
|
case ProtocolType.ICA:
|
|
newProtocol = new ProtocolICA();
|
|
((ProtocolICA) newProtocol).tmrReconnect.Elapsed += ((ProtocolICA) newProtocol).tmrReconnect_Elapsed;
|
|
break;
|
|
case ProtocolType.IntApp:
|
|
newProtocol = new IntegratedProgram();
|
|
if (connectionInfo.ExtApp == "")
|
|
{
|
|
throw (new Exception(My.Language.strNoExtAppDefined));
|
|
}
|
|
break;
|
|
}
|
|
return newProtocol;
|
|
}
|
|
}
|
|
} |