Skip to content

Instantly share code, notes, and snippets.

@BlizzCrafter
Created April 17, 2019 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BlizzCrafter/ee7fab1a584c6c63e8c32c90f7be7dc4 to your computer and use it in GitHub Desktop.
Save BlizzCrafter/ee7fab1a584c6c63e8c32c90f7be7dc4 to your computer and use it in GitHub Desktop.
Create a custom Node for Node Editor Winforms: https://github.com/komorra/NodeEditorWinforms
[Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))]
public class NodeString : ISerializable
{
[DisplayName("Input")]
public string SetValue { get; set; }
public override string ToString()
{
return "String";
}
//NodeContext ctor
public NodeString() { }
public NodeString(string value)
{
SetValue = value;
}
private NodeString(SerializationInfo info, StreamingContext ctx)
{
foreach (SerializationEntry entry in info)
{
switch (entry.Name)
{
case "NodeString":
SetValue = info.GetString("NodeString"); break;
}
}
}
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (!string.IsNullOrEmpty(SetValue)) info.AddValue("NodeString", SetValue);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment