bool INodeTypeResolver.Resolve(NodeEvent nodeEvent, ref Type currentType)
 {
     if (!string.IsNullOrEmpty(nodeEvent.Tag))
     {
         // If type could not be loaded, make sure to pass resolving
         // to the next resolver
         try
         {
             currentType = Type.GetType(nodeEvent.Tag.Substring(1), true);
             return true;
         }
         catch { }
     }
     return false;
 }
 private Type GetTypeFromEvent(NodeEvent nodeEvent, Type currentType)
 {
     foreach (var typeResolver in typeResolvers)
     {
         if (typeResolver.Resolve(nodeEvent, ref currentType))
         {
             break;
         }
     }
     return currentType;
 }
示例#3
0
 /// <summary>
 /// Loads the specified event.
 /// </summary>
 /// <param name="yamlEvent">The event.</param>
 /// <param name="state">The state of the document.</param>
 internal void Load(NodeEvent yamlEvent, DocumentLoadingState state)
 {
     Tag = yamlEvent.Tag;
     if (yamlEvent.Anchor != null)
     {
         Anchor = yamlEvent.Anchor;
         state.AddAnchor(this);
     }
     Start = yamlEvent.Start;
     End = yamlEvent.End;
 }