No Thread.Sleep update
This commit is contained in:
parent
73dbb09be9
commit
492c058e9b
|
@ -9,6 +9,7 @@ namespace Galactic_Colors_Control_Common
|
|||
private static string inputBuffer = "";
|
||||
private static List<ColorStrings> outputBuffer = new List<ColorStrings>();
|
||||
public static string Title { get { return Cons.Title; } set { Cons.Title = value; } }
|
||||
private static object locker = new object();
|
||||
|
||||
public static void Write(ColorStrings Text)
|
||||
{
|
||||
|
@ -34,6 +35,7 @@ namespace Galactic_Colors_Control_Common
|
|||
inputBuffer += key.KeyChar;
|
||||
break;
|
||||
}
|
||||
Update();
|
||||
key = Cons.ReadKey();
|
||||
}
|
||||
Cons.WriteLine();
|
||||
|
@ -44,13 +46,16 @@ namespace Galactic_Colors_Control_Common
|
|||
|
||||
private static void Update()
|
||||
{
|
||||
Cons.Clear();
|
||||
Cons.SetCursorPosition(0, 0);
|
||||
foreach (ColorStrings output in outputBuffer) { output.Write(); }
|
||||
SetInputPos();
|
||||
Cons.ForegroundColor = ConsoleColor.White;
|
||||
Cons.BackgroundColor = ConsoleColor.Black;
|
||||
Cons.Write("> " + inputBuffer);
|
||||
lock (locker)
|
||||
{
|
||||
Cons.Clear();
|
||||
Cons.SetCursorPosition(0, 0);
|
||||
foreach (ColorStrings output in outputBuffer) { output.Write(); }
|
||||
SetInputPos();
|
||||
Cons.ForegroundColor = ConsoleColor.White;
|
||||
Cons.BackgroundColor = ConsoleColor.Black;
|
||||
Cons.Write("> " + inputBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetInputPos()
|
||||
|
|
|
@ -164,7 +164,6 @@ namespace Galactic_Colors_Control_Common
|
|||
}
|
||||
toWriteLogs.Remove(log);
|
||||
}
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,17 +27,15 @@ namespace Galactic_Colors_Control
|
|||
{
|
||||
public int resultsBuffer; //Max amount of waiting results
|
||||
public int timeout; //Request timeout in ms
|
||||
public int refresh; //Threads sleep in ms
|
||||
|
||||
public CoreConfig(int buffer, int time, int speed)
|
||||
public CoreConfig(int buffer, int time)
|
||||
{
|
||||
resultsBuffer = buffer;
|
||||
timeout = time;
|
||||
refresh = speed;
|
||||
}
|
||||
}
|
||||
|
||||
public CoreConfig config = new CoreConfig(20, 2000, 200); //Set default config
|
||||
public CoreConfig config = new CoreConfig(20, 2000); //Set default config
|
||||
|
||||
private int _errorCount = 0; //Leave if > 5
|
||||
|
||||
|
@ -222,7 +220,6 @@ namespace Galactic_Colors_Control
|
|||
}
|
||||
}
|
||||
}
|
||||
Thread.Sleep(config.refresh);
|
||||
}
|
||||
return new ResultData(req.id, ResultTypes.Error, Common.Strings("Timeout"));
|
||||
}
|
||||
|
@ -313,7 +310,6 @@ namespace Galactic_Colors_Control
|
|||
break;
|
||||
}
|
||||
}
|
||||
Thread.Sleep(config.refresh);
|
||||
}
|
||||
//TODOOutput.Add("/*exit*/");
|
||||
}
|
||||
|
|
Reference in New Issue