Keep text for console data
This commit is contained in:
parent
25ae179a05
commit
c50f3dc86e
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -25,7 +25,24 @@ namespace Switch_Toolbox.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string ConsoleText = "";
|
private static readonly uint MAX_TEXT_LINE = 1000;
|
||||||
|
|
||||||
|
private static string consoleText;
|
||||||
|
private static string ConsoleText
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return consoleText;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
//Reset the text depending on max size prevent memory issues
|
||||||
|
if (value.Length > MAX_TEXT_LINE)
|
||||||
|
consoleText = "";
|
||||||
|
else
|
||||||
|
consoleText = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public STConsole()
|
public STConsole()
|
||||||
{
|
{
|
||||||
@ -41,9 +58,6 @@ namespace Switch_Toolbox.Library
|
|||||||
|
|
||||||
public static void WriteLine(object line, int ColorKeyIndex)
|
public static void WriteLine(object line, int ColorKeyIndex)
|
||||||
{
|
{
|
||||||
if (console == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (ColorKeyIndex == 0)
|
if (ColorKeyIndex == 0)
|
||||||
WriteLine(line.ToString(), Color.Red);
|
WriteLine(line.ToString(), Color.Red);
|
||||||
else if (ColorKeyIndex == 1)
|
else if (ColorKeyIndex == 1)
|
||||||
@ -54,9 +68,6 @@ namespace Switch_Toolbox.Library
|
|||||||
|
|
||||||
public static void WriteLine(string line, int ColorKeyIndex)
|
public static void WriteLine(string line, int ColorKeyIndex)
|
||||||
{
|
{
|
||||||
if (console == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (ColorKeyIndex == 0)
|
if (ColorKeyIndex == 0)
|
||||||
WriteLine(line.ToString(), Color.Red);
|
WriteLine(line.ToString(), Color.Red);
|
||||||
else if (ColorKeyIndex == 1)
|
else if (ColorKeyIndex == 1)
|
||||||
@ -67,21 +78,15 @@ namespace Switch_Toolbox.Library
|
|||||||
|
|
||||||
public static void WriteLine(object line, Color? color = null)
|
public static void WriteLine(object line, Color? color = null)
|
||||||
{
|
{
|
||||||
if (console == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
WriteLine(line.ToString(), color);
|
WriteLine(line.ToString(), color);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void WriteLine(string Line, Color? color = null)
|
public static void WriteLine(string Line, Color? color = null)
|
||||||
{
|
{
|
||||||
if (console == null)
|
ConsoleText += $"{Line}\n";
|
||||||
return;
|
|
||||||
|
|
||||||
Color ForeColor = color ?? FormThemes.BaseTheme.TextForeColor;
|
Color ForeColor = color ?? FormThemes.BaseTheme.TextForeColor;
|
||||||
|
|
||||||
ConsoleText += $"{Line}\n";
|
|
||||||
|
|
||||||
if (console != null && !console.Disposing && !console.IsDisposed)
|
if (console != null && !console.Disposing && !console.IsDisposed)
|
||||||
console.AppendTextData($"{Line}", ForeColor);
|
console.AppendTextData($"{Line}", ForeColor);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user