diff --git a/BHoMUpgrader82/Converter.cs b/BHoMUpgrader82/Converter.cs index ca4bca2..f9c44ff 100644 --- a/BHoMUpgrader82/Converter.cs +++ b/BHoMUpgrader82/Converter.cs @@ -21,14 +21,7 @@ */ using System; -using System.Collections; using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using BH.Upgrader.Base; -using System.Threading.Tasks; -using System.Xml.Linq; namespace BH.Upgrader.v82 { @@ -42,6 +35,7 @@ public Converter() : base() { PreviousVersion = "8.1"; ToNewObject.Add("BH.oM.Security.Elements.CameraDevice", UpgradeCameraDevice); + ToNewObject.Add("BH.oM.Adapters.Revit.Parameters.RevitParameter", UpgradeRevitParameter); } /***************************************************/ @@ -65,8 +59,8 @@ private static Dictionary UpgradeCameraDevice(Dictionary; - var ptB = oldVersion["TargetPosition"] as Dictionary; + Dictionary ptA = oldVersion["EyePosition"] as Dictionary; + Dictionary ptB = oldVersion["TargetPosition"] as Dictionary; if (ptA != null && ptB != null) distance = DistanceBetweenPoints(ptA, ptB); } @@ -97,5 +91,32 @@ private static double DistanceBetweenPoints(Dictionary pt1, Dict } /***************************************************/ + + private static Dictionary UpgradeRevitParameter(Dictionary oldVersion) + { + Dictionary newVersion = new Dictionary(oldVersion); + if (newVersion.ContainsKey("UnitType")) + { + newVersion["Quantity"] = newVersion["UnitType"]; + newVersion.Remove("UnitType"); + } + else + newVersion["Quantity"] = ""; + + newVersion["Unit"] = ""; + + if (!newVersion.ContainsKey("Name")) + newVersion["Name"] = ""; + + if (!newVersion.ContainsKey("Value")) + newVersion["Value"] = null; + + if (!newVersion.ContainsKey("IsReadOnly")) + newVersion["IsReadOnly"] = false; + + return newVersion; + } + + /***************************************************/ } }