minor optimizations

This commit is contained in:
Sean Kaim
2017-04-14 16:19:39 -04:00
parent e87a49796f
commit 95dacdd6da

View File

@@ -148,14 +148,11 @@ namespace mRemoteNG.Config.Serializers
{
if (_confVersion >= 2.6)
{
BlockCipherEngines engine;
Enum.TryParse(connectionsRootElement?.Attributes["EncryptionEngine"].Value, out engine);
Enum.TryParse(connectionsRootElement?.Attributes["EncryptionEngine"].Value, out BlockCipherEngines engine);
BlockCipherModes mode;
Enum.TryParse(connectionsRootElement?.Attributes["BlockCipherMode"].Value, out mode);
Enum.TryParse(connectionsRootElement?.Attributes["BlockCipherMode"].Value, out BlockCipherModes mode);
int keyDerivationIterations;
int.TryParse(connectionsRootElement?.Attributes["KdfIterations"].Value, out keyDerivationIterations);
int.TryParse(connectionsRootElement?.Attributes["KdfIterations"].Value, out int keyDerivationIterations);
_decryptor = new XmlConnectionsDecryptor(engine, mode, rootNodeInfo)
{
@@ -179,22 +176,24 @@ namespace mRemoteNG.Config.Serializers
var treeNodeTypeString = xmlNode.Attributes?["Type"].Value ?? "connection";
var nodeType = (TreeNodeType)Enum.Parse(typeof(TreeNodeType), treeNodeTypeString, true);
if (nodeType == TreeNodeType.Connection)
// ReSharper disable once SwitchStatementMissingSomeCases
switch (nodeType)
{
var connectionInfo = GetConnectionInfoFromXml(xmlNode);
parentContainer.AddChild(connectionInfo);
}
else if (nodeType == TreeNodeType.Container)
{
var containerInfo = new ContainerInfo();
case TreeNodeType.Connection:
var connectionInfo = GetConnectionInfoFromXml(xmlNode);
parentContainer.AddChild(connectionInfo);
break;
case TreeNodeType.Container:
var containerInfo = new ContainerInfo();
if (_confVersion >= 0.9)
containerInfo.CopyFrom(GetConnectionInfoFromXml(xmlNode));
if (_confVersion >= 0.8)
containerInfo.IsExpanded = xmlNode.Attributes?["Expanded"].Value == "True";
if (_confVersion >= 0.9)
containerInfo.CopyFrom(GetConnectionInfoFromXml(xmlNode));
if (_confVersion >= 0.8)
containerInfo.IsExpanded = xmlNode.Attributes?["Expanded"].Value == "True";
parentContainer.AddChild(containerInfo);
AddNodesFromXmlRecursive(xmlNode, containerInfo);
parentContainer.AddChild(containerInfo);
AddNodesFromXmlRecursive(xmlNode, containerInfo);
break;
}
}
}
@@ -331,7 +330,9 @@ namespace mRemoteNG.Config.Serializers
case 3:
connectionInfo.Colors = ProtocolRDP.RDPColors.Colors32Bit;
break;
// ReSharper disable once RedundantCaseLabel
case 4:
default:
connectionInfo.Colors = ProtocolRDP.RDPColors.Colors15Bit;
break;
}