Ejemplo n.º 1
0
 /// <summary>
 /// Generates a debug string for this entity.
 /// </summary>
 public string GetDebugLabel()
 {
     using var writer = new EscapingTextWriter();
     writer.WriteLabel(Label.Value);
     writer.Write('=');
     WriteQuotedId(writer);
     return(writer.ToString());
 }
Ejemplo n.º 2
0
 public void DefineLabel(TextWriter trapFile, Extractor extractor)
 {
     trapFile.WriteLabel(this);
     trapFile.Write("=");
     using var escaping = new EscapingTextWriter(trapFile);
     try
     {
         WriteQuotedId(escaping);
     }
     catch (Exception ex)  // lgtm[cs/catch-of-all-exceptions]
     {
         trapFile.WriteLine("\"");
         extractor.Message(new Message($"Unhandled exception generating id: {ex.Message}", ToString() ?? "", null, ex.StackTrace));
     }
     trapFile.WriteLine();
 }
Ejemplo n.º 3
0
 public virtual void WriteQuotedId(EscapingTextWriter trapFile)
 {
     trapFile.WriteUnescaped("@\"");
     WriteId(trapFile);
     trapFile.WriteUnescaped('\"');
 }
Ejemplo n.º 4
0
 public abstract void WriteId(EscapingTextWriter trapFile);
Ejemplo n.º 5
0
 public sealed override void WriteQuotedId(EscapingTextWriter writer)
 {
     writer.Write('*');
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Appends a [comma] separated list to a trap builder.
 /// </summary>
 /// <typeparam name="T">The type of the list.</typeparam>
 /// <param name="trapFile">The trap builder to append to.</param>
 /// <param name="separator">The separator string (e.g. ",")</param>
 /// <param name="items">The list of items.</param>
 /// <returns>The original trap builder (fluent interface).</returns>
 public static TextWriter AppendList <T>(this EscapingTextWriter trapFile, string separator, IEnumerable <T> items) where T : IEntity
 {
     return(trapFile.BuildList(separator, items, x => trapFile.WriteSubId(x)));
 }