Added new Stack Method

This commit is contained in:
Rich 2012-05-21 13:34:54 +00:00
parent ab1cd8af42
commit a9fed3b80d

View File

@ -20,11 +20,19 @@ namespace Volian.Base.Library
{
return StackToString();
}
public static string GetStack(bool showSame)
{
return StackToString(showSame);
}
public static void ShowStack()
{
Console.WriteLine(StackToString());
}
private static string StackToString()
{
return StackToString(true);
}
private static string StackToString(bool showSame)
{
StringBuilder sb = new StringBuilder();
StackTrace st = new StackTrace(true);
@ -35,7 +43,7 @@ namespace Volian.Base.Library
int imax = MatchingStackFrame(sfs);
foreach (StackFrame sf in sfs)
{
if (imax == 0)
if (showSame && imax == 0)
sb.Append(string.Format("\r\n{0}---------", "".PadLeft(ii++ * 2)));
imax--;
if (ii < 2) ii++;