Put in improved terminal filtering

This commit is contained in:
Lars Brubaker 2019-03-25 14:23:45 -07:00 committed by LarsBrubaker
parent 2cb8d521af
commit e7fe7bb8da
9 changed files with 269 additions and 145 deletions

View file

@ -127,9 +127,14 @@ namespace MatterControl.Printing
}
public static bool GetFirstNumberAfter(string stringToCheckAfter, string stringWithNumber, ref int readValue, int startIndex = 0, string stopCheckingString = ";")
{
return GetFirstNumberAfter(stringToCheckAfter, stringWithNumber, ref readValue, out _, startIndex, stopCheckingString);
}
public static bool GetFirstNumberAfter(string stringToCheckAfter, string stringWithNumber, ref int readValue, out int numberEnd, int startIndex = 0, string stopCheckingString = ";")
{
double doubleValue = readValue;
if(GetFirstNumberAfter(stringToCheckAfter, stringWithNumber, ref doubleValue, startIndex, stopCheckingString))
if(GetFirstNumberAfter(stringToCheckAfter, stringWithNumber, ref doubleValue, out numberEnd, startIndex, stopCheckingString))
{
readValue = (int)doubleValue;
return true;
@ -139,6 +144,11 @@ namespace MatterControl.Printing
}
public static bool GetFirstNumberAfter(string stringToCheckAfter, string stringWithNumber, ref double readValue, int startIndex = 0, string stopCheckingString = ";")
{
return GetFirstNumberAfter(stringToCheckAfter, stringWithNumber, ref readValue, out _, startIndex, stopCheckingString);
}
public static bool GetFirstNumberAfter(string stringToCheckAfter, string stringWithNumber, ref double readValue, out int numberEnd, int startIndex = 0, string stopCheckingString = ";")
{
int stringPos = stringWithNumber.IndexOf(stringToCheckAfter, Math.Min(stringWithNumber.Length, startIndex));
int stopPos = stringWithNumber.IndexOf(stopCheckingString);
@ -147,10 +157,12 @@ namespace MatterControl.Printing
{
stringPos += stringToCheckAfter.Length;
readValue = agg_basics.ParseDouble(stringWithNumber, ref stringPos, true);
numberEnd = stringPos;
return true;
}
numberEnd = -1;
return false;
}