Skip to content

Commit

Permalink
Removal of unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
Astul-Betizagasti committed Jul 7, 2020
1 parent 1319780 commit c78dfe9
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 140 deletions.
17 changes: 0 additions & 17 deletions src/DynamoCore/Graph/Workspaces/CustomNodeWorkspaceModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,22 +315,5 @@ public override void Save(string newPath, bool isBackup = false, EngineControlle

base.Save(newPath, isBackup, engine);
}

protected override bool PopulateXmlDocument(XmlDocument document)
{
if (!base.PopulateXmlDocument(document))
return false;

var root = document.DocumentElement;
if (root == null)
return false;

var guid = CustomNodeDefinition != null ? CustomNodeDefinition.FunctionId : Guid.NewGuid();
root.SetAttribute("ID", guid.ToString());
root.SetAttribute("Description", Description);
root.SetAttribute("Category", Category);

return true;
}
}
}
16 changes: 0 additions & 16 deletions src/DynamoCore/Graph/Workspaces/HomeWorkspaceModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -460,22 +460,6 @@ internal void StopPeriodicEvaluation()

#endregion

protected override bool PopulateXmlDocument(XmlDocument document)
{
if (!base.PopulateXmlDocument(document))
return false;

var root = document.DocumentElement;
if (root == null)
return false;

root.SetAttribute("RunType", RunSettings.RunType.ToString());
root.SetAttribute("RunPeriod", RunSettings.RunPeriod.ToString(CultureInfo.InvariantCulture));
root.SetAttribute("HasRunWithoutCrash", HasRunWithoutCrash.ToString(CultureInfo.InvariantCulture));

return true;
}

private void PulseMakerRunStarted()
{
var nodesToUpdate = Nodes.Where(n => n.CanUpdatePeriodically);
Expand Down
107 changes: 0 additions & 107 deletions src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1499,113 +1499,6 @@ internal bool containsInvalidInputSymbols()
return this.Nodes.OfType<Nodes.CustomNodes.Symbol>().Any(node => !node.Parameter.NameIsValid);
}

private void SerializeElementResolver(XmlDocument xmlDoc)
{
Debug.Assert(xmlDoc != null);

var root = xmlDoc.DocumentElement;

var mapElement = xmlDoc.CreateElement("NamespaceResolutionMap");

foreach (var element in ElementResolver.ResolutionMap)
{
var resolverElement = xmlDoc.CreateElement("ClassMap");

resolverElement.SetAttribute("partialName", element.Key);
resolverElement.SetAttribute("resolvedName", element.Value.Key);
resolverElement.SetAttribute("assemblyName", element.Value.Value);

mapElement.AppendChild(resolverElement);
}
root.AppendChild(mapElement);
}

protected virtual bool PopulateXmlDocument(XmlDocument xmlDoc)
{
try
{
var root = xmlDoc.DocumentElement;
root.SetAttribute("Version", WorkspaceVersion.ToString());
root.SetAttribute("X", X.ToString(CultureInfo.InvariantCulture));
root.SetAttribute("Y", Y.ToString(CultureInfo.InvariantCulture));
root.SetAttribute("ScaleFactor", ScaleFactor.ToString(CultureInfo.InvariantCulture));
root.SetAttribute("Name", Name);
root.SetAttribute("Description", Description);

SerializeElementResolver(xmlDoc);

var elementList = xmlDoc.CreateElement("Elements");
//write the root element
root.AppendChild(elementList);

foreach (var dynEl in Nodes.Select(el => el.Serialize(xmlDoc, SaveContext.File)))
elementList.AppendChild(dynEl);

//write only the output connectors
var connectorList = xmlDoc.CreateElement("Connectors");
//write the root element
root.AppendChild(connectorList);

foreach (var el in Nodes)
{
foreach (var port in el.OutPorts)
{
foreach (
var c in
port.Connectors.Where(c => c.Start != null && c.End != null))
{
var connector = xmlDoc.CreateElement(c.GetType().ToString());
connectorList.AppendChild(connector);
connector.SetAttribute("start", c.Start.Owner.GUID.ToString());
connector.SetAttribute("start_index", c.Start.Index.ToString());
connector.SetAttribute("end", c.End.Owner.GUID.ToString());
connector.SetAttribute("end_index", c.End.Index.ToString());

if (c.End.PortType == PortType.Input)
connector.SetAttribute("portType", "0");
}
}
}

//save the notes
var noteList = xmlDoc.CreateElement("Notes"); //write the root element
root.AppendChild(noteList);
foreach (var n in Notes)
{
var note = n.Serialize(xmlDoc, SaveContext.File);
noteList.AppendChild(note);
}

//save the annotation
var annotationList = xmlDoc.CreateElement("Annotations");
root.AppendChild(annotationList);
foreach (var n in annotations)
{
var annotation = n.Serialize(xmlDoc, SaveContext.File);
annotationList.AppendChild(annotation);
}

//save the presets into the dyn file as a seperate element on the root
var presetsElement = xmlDoc.CreateElement("Presets");
root.AppendChild(presetsElement);
foreach (var preset in Presets)
{
var presetState = preset.Serialize(xmlDoc, SaveContext.File);
presetsElement.AppendChild(presetState);
}

OnSaving(xmlDoc);

return true;
}
catch (Exception ex)
{
Log(ex.Message);
Log(ex.StackTrace);
return false;
}
}

internal void SendModelEvent(Guid modelGuid, string eventName, int value)
{
var retrievedModel = GetModelInternal(modelGuid);
Expand Down

0 comments on commit c78dfe9

Please sign in to comment.