Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Versioning of XML PR #208

Merged
merged 2 commits into from
Dec 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion BHoMUpgrader/Upgrader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ private BsonDocument Upgrade(BsonDocument document, Converter converter)
else
result = UpgradeObject(document, converter);
}
else if(document.Contains("k") && document.Contains("v"))
{
result = UpgradeObject(document, converter);
}


return result;
}
Expand Down Expand Up @@ -258,7 +263,12 @@ private string UpgradeType(string type, Converter converter)
private BsonDocument UpgradeObject(BsonDocument document, Converter converter)
{
//Get the old type
string oldType = CleanTypeString(document["_t"].AsString);
string oldType = "";
try
{
oldType = CleanTypeString(document["_t"].AsString);
}
catch { }

// Check if the object type is classified as deleted or without update
CheckForNoUpgrade(converter, oldType, "object type");
Expand Down
11 changes: 11 additions & 0 deletions BHoMUpgrader60/Converter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public Converter() : base()
ToNewObject.Add("BH.oM.Adapters.Revit.RevitMaterialTakeOff", UpgradeRevitMaterialTakeoff);
ToNewObject.Add("BH.oM.LadybugTools.ExternalComfortShelter", UpgradeShelter);
ToNewObject.Add("BH.oM.LadybugTools.ExternalComfortTypology", UpgradeTypology);
ToNewObject.Add("BH.oM.XML.Bluebeam.Markup", UpdateBluebeamMarkdown);
}

/***************************************************/
Expand Down Expand Up @@ -134,5 +135,15 @@ public static Dictionary<string, object> UpgradeTypology(Dictionary<string, obje
}

/***************************************************/

public static Dictionary<string, object> UpdateBluebeamMarkdown(Dictionary<string, object> oldVersion)
{
Dictionary<string, object> newVersion = new Dictionary<string, object>(oldVersion);
newVersion["Depth"] = oldVersion["Depth"].ToString();

return newVersion;
}

/***************************************************/
}
}