diff --git a/mRemoteV1/Config/Serializers/DataTableDeserializer.cs b/mRemoteV1/Config/Serializers/DataTableDeserializer.cs index 493e9da1e..31df1aa2b 100644 --- a/mRemoteV1/Config/Serializers/DataTableDeserializer.cs +++ b/mRemoteV1/Config/Serializers/DataTableDeserializer.cs @@ -43,10 +43,16 @@ namespace mRemoteNG.Config.Serializers var nodeList = new List(); foreach (DataRow row in _dataTable.Rows) { - if ((string)row["Type"] == "Connection") + // ReSharper disable once SwitchStatementMissingSomeCases + switch ((string)row["Type"]) + { + case "Connection": nodeList.Add(DeserializeConnectionInfo(row)); - else if ((string)row["Type"] == "Container") + break; + case "Container": nodeList.Add(DeserializeContainerInfo(row)); + break; + } } return nodeList; } @@ -69,8 +75,15 @@ namespace mRemoteNG.Config.Serializers { connectionInfo.Name = (string)dataRow["Name"]; connectionInfo.ConstantID = (string)dataRow["ConstantID"]; + + // This throws a NPE - Parent is a connectionInfo object which will be null at this point. + // The Parent object is linked properly later in CreateNodeHierarchy() //connectionInfo.Parent.ConstantID = (string)dataRow["ParentID"]; - //connectionInfo is ContainerInfo ? ((ContainerInfo)connectionInfo).IsExpanded.ToString() : "" = dataRow["Expanded"]; + + var info = connectionInfo as ContainerInfo; + if(info != null) + info.IsExpanded = (bool)dataRow["Expanded"]; + connectionInfo.Description = (string)dataRow["Description"]; connectionInfo.Icon = (string)dataRow["Icon"]; connectionInfo.Panel = (string)dataRow["Panel"];