public new static void AddConstructor(string tag, YamlConstructor ctor) { if (!_yamlConstructors.ContainsKey(tag)) { _yamlConstructors.Add(tag, ctor); } }
public object ConstructObject(Node node) { if (node == null) { node = GetNullNode(); } if (_recursiveObjects.ContainsKey(node)) { return(new LinkNode(node)); } _recursiveObjects.Add(node, new List <RecursiveFixer>()); YamlConstructor ctor = GetYamlConstructor(node.Tag ?? node.DefaultTag); if (ctor == null) { bool through = true; foreach (string tagPrefix in GetYamlMultiRegexps()) { Regex reg = GetYamlMultiRegexp(tagPrefix); if (reg.IsMatch(node.Tag)) { string tagSuffix = node.Tag.Substring(tagPrefix.Length); ctor = yamlMultiAdapter(GetYamlMultiConstructor(tagPrefix), tagSuffix); through = false; break; } } if (through) { YamlMultiConstructor xctor = GetYamlMultiConstructor(""); if (null != xctor) { ctor = yamlMultiAdapter(xctor, node.Tag); } else { ctor = GetYamlConstructor(""); if (ctor == null) { ctor = (s, n) => s.ConstructPrimitive(n); } } } } object data = ctor(this, node); DoRecursionFix(node, data); return(data); }
public new static void AddConstructor(string tag, YamlConstructor ctor) { _yamlConstructors.Add(tag, ctor); }
public static void AddConstructor(string tag, YamlConstructor ctor) { _yamlConstructors.Add(tag, ctor); }