public override string ToString() { var parts = new List <string>(); if (Filter != null) { parts.Add($"Filter: {Filter}"); } if (FullText != null) { parts.Add($"FullText: '{FullText.Replace("'", "\'")}'"); } if (Skip > 0) { parts.Add($"Skip: {Skip}"); } if (Take < long.MaxValue) { parts.Add($"Take: {Take}"); } if (Sort.Count > 0) { parts.Add($"Sort: {string.Join(", ", Sort)}"); } return(string.Join("; ", parts)); }
public LoggedException(Exception exception) { Message = exception.Message; FullText = exception.ToString(); var cur = exception; while (cur != null) { if (cur.StackTrace != null) { FullText = FullText.Replace(cur.StackTrace, ""); } cur = cur.InnerException; } if (exception.InnerException != null) { InnerException = new LoggedException(exception.InnerException); } FullStackTrace = exception.StackTrace; if (FullStackTrace != null) { var stLines = FullStackTrace.Split(new[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries); var st = stLines.Where(l => l.Contains(ErrorNamespaceForStackTrace)) .ToList(); StackTrace = string.Join(Environment.NewLine, st); } }
public void SplitInLines() { //Here the Text is first split up in lines where ever the programmer put a @, But if the text is stil longer then the MaxChar that fits in the width of the textbox // It is split down even further Lines = FullText.Split((char)'@').ToList(); AllLines = new List <string> { }; foreach (string _Line in Lines) { string Templine = ""; Templine = _Line; if (_Line.Count() > CharPerLine) { int _AmountOfLines = _Line.Count() / CharPerLine; int x = 0; int CurrentIndex = CharPerLine; while (_AmountOfLines > 0) { if (_Line.ElementAtOrDefault(CurrentIndex) == ' ') { StringBuilder sb = new StringBuilder(Templine); sb[CurrentIndex] = '@'; Templine = sb.ToString(); _AmountOfLines -= 1; CurrentIndex += CharPerLine; } else { x++; CurrentIndex -= 1; } } AllLines.AddRange(Templine.Split((char)'@').ToList()); } else { AllLines.Add(_Line); } } foreach (string y in AllLines) { Console.WriteLine(y); } FullText = FullText.Replace("@", System.Environment.NewLine); }