Created
April 17, 2019 20:29
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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