mirror of
https://github.com/Stone-Red-Code/YesNt-Interpreter.git
synced 2026-09-09 16:06:08 +02:00
Improve code formatting
This commit is contained in:
@@ -38,12 +38,7 @@ namespace YesNt.Interpreter.Utilities
|
||||
{
|
||||
bool succ1 = parts[0].ToStandardizedNumber(out double part1);
|
||||
bool succ2 = parts[1].ToStandardizedNumber(out double part2);
|
||||
if (!succ1 || !succ2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return part1 >= part2;
|
||||
return succ1 && succ2 && part1 >= part2;
|
||||
}
|
||||
|
||||
parts = input.Split("<=");
|
||||
@@ -51,12 +46,7 @@ namespace YesNt.Interpreter.Utilities
|
||||
{
|
||||
bool succ1 = parts[0].ToStandardizedNumber(out double part1);
|
||||
bool succ2 = parts[1].ToStandardizedNumber(out double part2);
|
||||
if (!succ1 || !succ2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return part1 <= part2;
|
||||
return succ1 && succ2 && part1 <= part2;
|
||||
}
|
||||
|
||||
parts = input.Split(">");
|
||||
@@ -64,12 +54,7 @@ namespace YesNt.Interpreter.Utilities
|
||||
{
|
||||
bool succ1 = parts[0].ToStandardizedNumber(out double part1);
|
||||
bool succ2 = parts[1].ToStandardizedNumber(out double part2);
|
||||
if (!succ1 || !succ2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return part1 > part2;
|
||||
return succ1 && succ2 && part1 > part2;
|
||||
}
|
||||
|
||||
parts = input.Split("<");
|
||||
@@ -77,12 +62,7 @@ namespace YesNt.Interpreter.Utilities
|
||||
{
|
||||
bool succ1 = parts[0].ToStandardizedNumber(out double part1);
|
||||
bool succ2 = parts[1].ToStandardizedNumber(out double part2);
|
||||
if (!succ1 || !succ2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return part1 < part2;
|
||||
return succ1 && succ2 && part1 < part2;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace YesNt.Interpreter.Utilities
|
||||
DataReceivedEventArgs dataReceivedEventArgs = new DataReceivedEventArgs(data);
|
||||
if (SynchronizingObject != null && SynchronizingObject.InvokeRequired)
|
||||
{
|
||||
SynchronizingObject.Invoke(outputDataReceived, new object[]
|
||||
_ = SynchronizingObject.Invoke(outputDataReceived, new object[]
|
||||
{
|
||||
this,
|
||||
dataReceivedEventArgs
|
||||
@@ -61,7 +61,7 @@ namespace YesNt.Interpreter.Utilities
|
||||
DataReceivedEventArgs dataReceivedEventArgs = new DataReceivedEventArgs(data);
|
||||
if (SynchronizingObject != null && SynchronizingObject.InvokeRequired)
|
||||
{
|
||||
SynchronizingObject.Invoke(errorDataReceived, new object[]
|
||||
_ = SynchronizingObject.Invoke(errorDataReceived, new object[]
|
||||
{
|
||||
this,
|
||||
dataReceivedEventArgs
|
||||
@@ -160,7 +160,7 @@ namespace YesNt.Interpreter.Utilities
|
||||
if (sb == null)
|
||||
{
|
||||
sb = new StringBuilder(1024);
|
||||
stream.BeginRead(byteBuffer, 0, byteBuffer.Length, new AsyncCallback(ReadBuffer), null);
|
||||
_ = stream.BeginRead(byteBuffer, 0, byteBuffer.Length, new AsyncCallback(ReadBuffer), null);
|
||||
return;
|
||||
}
|
||||
FlushMessageQueue();
|
||||
@@ -204,13 +204,13 @@ namespace YesNt.Interpreter.Utilities
|
||||
}
|
||||
finally
|
||||
{
|
||||
eofEvent.Set();
|
||||
_ = eofEvent.Set();
|
||||
}
|
||||
}
|
||||
int chars = decoder.GetChars(byteBuffer, 0, num, charBuffer, 0);
|
||||
sb.Append(charBuffer, 0, chars);
|
||||
_ = sb.Append(charBuffer, 0, chars);
|
||||
GetLinesFromStringBuilder();
|
||||
stream.BeginRead(byteBuffer, 0, byteBuffer.Length, new AsyncCallback(ReadBuffer), null);
|
||||
_ = stream.BeginRead(byteBuffer, 0, byteBuffer.Length, new AsyncCallback(ReadBuffer), null);
|
||||
}
|
||||
|
||||
private void GetLinesFromStringBuilder()
|
||||
@@ -227,7 +227,7 @@ namespace YesNt.Interpreter.Utilities
|
||||
while (i < length)
|
||||
{
|
||||
char c = sb[i];
|
||||
if (c == '\r' || c == '\n')
|
||||
if (c is '\r' or '\n')
|
||||
{
|
||||
if (c == '\r' && i + 1 < length && sb[i + 1] == '\n')
|
||||
{
|
||||
@@ -261,7 +261,7 @@ namespace YesNt.Interpreter.Utilities
|
||||
}
|
||||
if (num < length)
|
||||
{
|
||||
sb.Remove(0, num);
|
||||
_ = sb.Remove(0, num);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -292,7 +292,7 @@ namespace YesNt.Interpreter.Utilities
|
||||
{
|
||||
if (eofEvent != null)
|
||||
{
|
||||
eofEvent.WaitOne();
|
||||
_ = eofEvent.WaitOne();
|
||||
eofEvent.Close();
|
||||
eofEvent = null;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace YesNt.Interpreter.Utilities
|
||||
StringBuilder output = new StringBuilder();
|
||||
foreach (char c in input)
|
||||
{
|
||||
output.Append($"\v{c}\v");
|
||||
_ = output.Append($"\v{c}\v");
|
||||
}
|
||||
return output.ToString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user