Skip to content

Commit 4c0b0f8

Browse files
committed
Added loading/saving of BoolNode.
Added loading/saving of FunctionNode.
1 parent 29f1e2d commit 4c0b0f8

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

DataExchange/ReClassNetFile.Read.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,17 @@ private IEnumerable<BaseNode> ReadNodeElements(IEnumerable<XElement> elements, C
171171
TryGetAttributeValue(element, XmlBitsAttribute, out bits, logger);
172172
bitFieldNode.Bits = bits;
173173
}
174+
var functionNode = node as FunctionNode;
175+
if (functionNode != null)
176+
{
177+
functionNode.Signature = element.Attribute(XmlSignatureAttribute)?.Value ?? string.Empty;
178+
179+
var reference = NodeUuid.FromBase64String(element.Attribute(XmlReferenceAttribute)?.Value, false);
180+
if (project.ContainsClass(reference))
181+
{
182+
functionNode.BelongsToClass = project.GetClassByUuid(reference);
183+
}
184+
}
174185

175186
yield return node;
176187
}

DataExchange/ReClassNetFile.Write.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@ private IEnumerable<XElement> CreateNodeElements(IEnumerable<BaseNode> nodes, IL
120120
{
121121
element.SetAttributeValue(XmlBitsAttribute, bitFieldNode.Bits);
122122
}
123+
var functionNode = node as FunctionNode;
124+
if (functionNode != null)
125+
{
126+
var uuid = functionNode.BelongsToClass == null ? NodeUuid.Zero : functionNode.BelongsToClass.Uuid;
127+
element.SetAttributeValue(XmlReferenceAttribute, uuid.ToBase64String());
128+
element.SetAttributeValue(XmlSignatureAttribute, functionNode.Signature);
129+
}
123130

124131
yield return element;
125132
}

DataExchange/ReClassNetFile.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public partial class ReClassNetFile : IReClassImport, IReClassExport
3737
public const string XmlCountAttribute = "count";
3838
public const string XmlBitsAttribute = "bits";
3939
public const string XmlLengthAttribute = "length";
40+
public const string XmlSignatureAttribute = "signature";
4041

4142
private ReClassNetProject project;
4243

@@ -49,13 +50,15 @@ public ReClassNetFile(ReClassNetProject project)
4950

5051
private static Dictionary<string, Type> BuildInStringToTypeMap = new Type[]
5152
{
53+
typeof(BoolNode),
5254
typeof(BitFieldNode),
5355
typeof(ClassInstanceArrayNode),
5456
typeof(ClassInstanceNode),
5557
typeof(ClassPtrArrayNode),
5658
typeof(ClassPtrNode),
5759
typeof(DoubleNode),
5860
typeof(FloatNode),
61+
typeof(FunctionNode),
5962
typeof(FunctionPtrNode),
6063
typeof(Hex8Node),
6164
typeof(Hex16Node),

0 commit comments

Comments
 (0)