public object Print(object instance, Dictionary <object, int> visited, IndentHelperBase indents, string fieldName, DragonMLSettings settings) { var hmlNameTag = fieldName == null ? "" : $" hml:name=\"{fieldName}\""; try { // ReSharper disable once InvertIf if (!TargetMap.TryGetValue(instance.GetType(), out var target)) { target = instance.GetType().GenericTypeArguments.First().Name; TargetMap[instance.GetType()] = target; } var hmlIdTag = string.Empty; if (!visited.ContainsKey(instance)) { visited[instance] = visited.Count; } if (settings.UseRefId) { hmlIdTag = $" hml:id=\"{visited[instance]}\""; } return($"{indents}<tank:ref{hmlIdTag}{hmlNameTag} GUID=\"{instance}\" Target=\"{target}\"/>\n"); } catch { return(null); } }
protected bool Equals(IndentHelperBase other) => TabSize == other.TabSize && TabCharacter == other.TabCharacter;
public object Print(object instance, IReadOnlyDictionary <Type, ISerializer> custom, HashSet <object> visited, IndentHelperBase indent, string fieldName) { var hmlNameTag = fieldName == null ? "" : $" hml:name=\"{fieldName}\""; try { // ReSharper disable once InvertIf if (!TargetMap.TryGetValue(instance.GetType(), out var target)) { target = instance.GetType().GenericTypeArguments.First().Name; TargetMap[instance.GetType()] = target; } return($"{indent}<tank:ref hml:id=\"{instance.GetHashCode()}\"{hmlNameTag} GUID=\"{instance}\" Target=\"{target}\"/>\n"); } catch { return(null); } }
public object?Print(object?instance, Dictionary <object, int> visited, IndentHelperBase indent, string?name, DragonMLSettings settings) { return(instance?.ToString()); }
public object?Print(object?instance, Dictionary <object, int> visited, IndentHelperBase indent, string?name, DragonMarkupSettings settings) => instance?.ToString();