internal static string PostprocessStacktrace(string oldString, bool stripEngineInternalInformation)
{
string result;
if (oldString == null)
{
result = string.Empty;
}
else
{
string[] array = oldString.Split(new char[]
{
'\n'
});
StringBuilder stringBuilder = new StringBuilder(oldString.Length);
for (int i = 0; i < array.Length; i++)
{
array[i] = array[i].Trim();
}
for (int j = 0; j < array.Length; j++)
{
string text = array[j];
if (text.Length != 0 && text[0] != '\n')
{
if (!text.StartsWith("in (unmanaged)"))
{
if (stripEngineInternalInformation && text.StartsWith("UnityEditor.EditorGUIUtility:RenderGameViewCameras"))
{
break;
}
if (stripEngineInternalInformation && j < array.Length - 1 && StackTraceUtility.IsSystemStacktraceType(text))
{
if (StackTraceUtility.IsSystemStacktraceType(array[j + 1]))
{
goto IL_297;
}
int num = text.IndexOf(" (at");
if (num != -1)
{
text = text.Substring(0, num);
}
}
if (text.IndexOf("(wrapper managed-to-native)") == -1)
{
if (text.IndexOf("(wrapper delegate-invoke)") == -1)
{
if (text.IndexOf("at <0x00000> <unknown method>") == -1)
{
if (!stripEngineInternalInformation || !text.StartsWith("[") || !text.EndsWith("]"))
{
if (text.StartsWith("at "))
{
text = text.Remove(0, 3);
}
int num2 = text.IndexOf("[0x");
int num3 = -1;
if (num2 != -1)
{
num3 = text.IndexOf("]", num2);
}
if (num2 != -1 && num3 > num2)
{
text = text.Remove(num2, num3 - num2 + 1);
}
text = text.Replace(" in <filename unknown>:0", "");
text = text.Replace("\\", "/");
if (!string.IsNullOrEmpty(StackTraceUtility.projectFolder))
{
text = text.Replace(StackTraceUtility.projectFolder, "");
}
text = text.Replace('\\', '/');
int num4 = text.LastIndexOf(" in ");
if (num4 != -1)
{
text = text.Remove(num4, 5);
text = text.Insert(num4, " (at ");
text = text.Insert(text.Length, ")");
}
stringBuilder.Append(text + "\n");
}
}
}
}
}
}
IL_297 :;
}
result = stringBuilder.ToString();
}
return(result);
}