public string CsvRow() { StringBuilder builder = new StringBuilder(); builder.Append($"{Name}").Append(CSV_SEP); builder.Append($"{FullName}").Append(CSV_SEP); builder.Append($"\"{Description}\"").Append(CSV_SEP); builder.Append($"{Size}").Append(CSV_SEP); builder.Append($"{Private}").Append(CSV_SEP); builder.Append($"{Language}").Append(CSV_SEP); if (License != null) { builder.Append($"{License.Name}").Append(CSV_SEP); } else { builder.Append($"").Append(CSV_SEP); } if (Readme != null) { builder.Append($"{Readme.Name}").Append(CSV_SEP); } else { builder.Append($"").Append(CSV_SEP); } builder.Append($"{ReleaseCount}").Append(CSV_SEP); builder.Append($"{OpenIssuesCount}").Append(CSV_SEP); builder.Append($"{Fork}").Append(CSV_SEP); if (ParentName != null && ParentName.Equals("<None>")) { // Leave it blank for <None> builder.Append($"").Append(CSV_SEP); } else { builder.Append($"{ParentName}").Append(CSV_SEP); } builder.Append($"{ForksCount}").Append(CSV_SEP); builder.Append($"{StarCount}").Append(CSV_SEP); builder.Append($"{Watchers}").Append(CSV_SEP); builder.Append($"{CreatedAt.ToLocalTime()}").Append(CSV_SEP); builder.Append($"{UpdatedAt.ToLocalTime()}").Append(CSV_SEP); if (PushedAt.HasValue) { builder.Append($"{PushedAt.Value.ToLocalTime()}").Append(CSV_SEP); } else { builder.Append($"").Append(CSV_SEP); } // Remove the last separator string line = builder.ToString(); line = line.Substring(0, line.Length - CSV_SEP.Length); return(line); }
public override string ToString() { StringBuilder builder = new StringBuilder(); builder.AppendLine($"Name={Name}"); builder.AppendLine($" FullName={FullName}"); builder.AppendLine($" Description={Description}"); builder.AppendLine($" Size={Size} KB"); builder.AppendLine($" Private={Private}"); builder.AppendLine($" Language={Language}"); if (License != null) { builder.AppendLine($" License={License.Name}"); } else { builder.AppendLine($" License=<NA>"); } if (Readme != null) { builder.AppendLine($" Readme={Readme.Name}"); } else { builder.AppendLine($" Readme=<None>"); } builder.AppendLine($" ReleaseCount={ReleaseCount}"); builder.AppendLine($" OpenIssuesCount={OpenIssuesCount}"); builder.AppendLine($" Fork={Fork}"); // This appears to always be null //builder.AppendLine($" Parent={Parent}"); builder.AppendLine($" ParentName={ParentName}"); builder.AppendLine($" ForksCount={ForksCount}"); builder.AppendLine($" StarCount={StarCount}"); builder.AppendLine($" Watchers={Watchers}"); //builder.AppendLine($" HomePage={HomePage}"); builder.AppendLine($" CreatedAt={CreatedAt.ToLocalTime()}"); builder.AppendLine($" UpdatedAt={UpdatedAt.ToLocalTime()}"); if (PushedAt.HasValue) { builder.AppendLine($" PushedAt={PushedAt.Value.ToLocalTime()}"); } else { builder.AppendLine($" PushedAt=Never"); } return(builder.ToString()); }
/// <summary> /// Override the base ToString method /// </summary> /// <returns>Formatted string with the MachineId, the Id and the updated audit fields</returns> public override string ToString() { return($"WebSocketStream MachineId: {StreamEvent?.Payload?.MachineId ?? "N.A."} " + $"EventId: {StreamEvent?.Payload?.Id ?? "N.A."} UpdatedAt: {UpdatedAt.ToLocalTime()} UpdatedBy {UpdatedBy}"); }