21
21
*/
22
22
23
23
using System ;
24
- using System . Collections ;
25
24
using System . Collections . Generic ;
26
- using System . ComponentModel ;
27
- using System . Linq ;
28
- using System . Text ;
29
- using BH . Upgrader . Base ;
30
- using System . Threading . Tasks ;
31
- using System . Xml . Linq ;
32
25
33
26
namespace BH . Upgrader . v82
34
27
{
@@ -42,6 +35,7 @@ public Converter() : base()
42
35
{
43
36
PreviousVersion = "8.1" ;
44
37
ToNewObject . Add ( "BH.oM.Security.Elements.CameraDevice" , UpgradeCameraDevice ) ;
38
+ ToNewObject . Add ( "BH.oM.Adapters.Revit.Parameters.RevitParameter" , UpgradeRevitParameter ) ;
45
39
}
46
40
47
41
/***************************************************/
@@ -65,8 +59,8 @@ private static Dictionary<string, object> UpgradeCameraDevice(Dictionary<string,
65
59
66
60
if ( oldVersion . ContainsKey ( "EyePosition" ) && oldVersion . ContainsKey ( "TargetPosition" ) )
67
61
{
68
- var ptA = oldVersion [ "EyePosition" ] as Dictionary < string , object > ;
69
- var ptB = oldVersion [ "TargetPosition" ] as Dictionary < string , object > ;
62
+ Dictionary < string , object > ptA = oldVersion [ "EyePosition" ] as Dictionary < string , object > ;
63
+ Dictionary < string , object > ptB = oldVersion [ "TargetPosition" ] as Dictionary < string , object > ;
70
64
if ( ptA != null && ptB != null )
71
65
distance = DistanceBetweenPoints ( ptA , ptB ) ;
72
66
}
@@ -97,5 +91,32 @@ private static double DistanceBetweenPoints(Dictionary<string, object> pt1, Dict
97
91
}
98
92
99
93
/***************************************************/
94
+
95
+ private static Dictionary < string , object > UpgradeRevitParameter ( Dictionary < string , object > oldVersion )
96
+ {
97
+ Dictionary < string , object > newVersion = new Dictionary < string , object > ( oldVersion ) ;
98
+ if ( newVersion . ContainsKey ( "UnitType" ) )
99
+ {
100
+ newVersion [ "Quantity" ] = newVersion [ "UnitType" ] ;
101
+ newVersion . Remove ( "UnitType" ) ;
102
+ }
103
+ else
104
+ newVersion [ "Quantity" ] = "" ;
105
+
106
+ newVersion [ "Unit" ] = "" ;
107
+
108
+ if ( ! newVersion . ContainsKey ( "Name" ) )
109
+ newVersion [ "Name" ] = "" ;
110
+
111
+ if ( ! newVersion . ContainsKey ( "Value" ) )
112
+ newVersion [ "Value" ] = null ;
113
+
114
+ if ( ! newVersion . ContainsKey ( "IsReadOnly" ) )
115
+ newVersion [ "IsReadOnly" ] = false ;
116
+
117
+ return newVersion ;
118
+ }
119
+
120
+ /***************************************************/
100
121
}
101
122
}
0 commit comments