1- using System ;
1+ using System ;
22using System . Collections . Generic ;
33using System . Diagnostics . Contracts ;
44using System . IO ;
@@ -104,7 +104,7 @@ public void Load(Stream input, ILogger logger)
104104 {
105105 var node = new ClassNode ( false )
106106 {
107- Uuid = NodeUuid . FromBase64String ( element . Attribute ( XmlUuidAttribute ) ? . Value , true ) ,
107+ Uuid = ParseUuid ( element . Attribute ( XmlUuidAttribute ) ? . Value ) ,
108108 Name = element . Attribute ( XmlNameAttribute ) ? . Value ?? string . Empty ,
109109 Comment = element . Attribute ( XmlCommentAttribute ) ? . Value ?? string . Empty ,
110110 AddressFormula = element . Attribute ( XmlAddressAttribute ) ? . Value ?? string . Empty
@@ -173,7 +173,7 @@ BaseNode CreateNode()
173173 {
174174 ClassNode GetClassNodeFromElementReference ( )
175175 {
176- var reference = NodeUuid . FromBase64String ( element . Attribute ( XmlReferenceAttribute ) ? . Value , false ) ;
176+ var reference = ParseUuid ( element . Attribute ( XmlReferenceAttribute ) ? . Value ) ;
177177 if ( ! project . ContainsClass ( reference ) )
178178 {
179179 logger . Log ( LogLevel . Error , $ "Skipping node with unknown reference: { reference } ") ;
@@ -286,7 +286,7 @@ ClassNode GetClassNodeFromElementReference()
286286 {
287287 functionNode . Signature = element . Attribute ( XmlSignatureAttribute ) ? . Value ?? string . Empty ;
288288
289- var reference = NodeUuid . FromBase64String ( element . Attribute ( XmlReferenceAttribute ) ? . Value , false ) ;
289+ var reference = ParseUuid ( element . Attribute ( XmlReferenceAttribute ) ? . Value ) ;
290290 if ( project . ContainsClass ( reference ) )
291291 {
292292 functionNode . BelongsToClass = project . GetClassByUuid ( reference ) ;
@@ -306,6 +306,12 @@ ClassNode GetClassNodeFromElementReference()
306306 return node ;
307307 }
308308
309+ private static Guid ParseUuid ( string raw ) => raw == null
310+ ? throw new ArgumentNullException ( )
311+ : raw . Length == 24
312+ ? new Guid ( Convert . FromBase64String ( raw ) )
313+ : Guid . Parse ( raw ) ;
314+
309315 public static Tuple < List < ClassNode > , List < BaseNode > > DeserializeNodesFromStream ( Stream input , ReClassNetProject templateProject , ILogger logger )
310316 {
311317 Contract . Requires ( input != null ) ;
0 commit comments