Ejemplo n.º 1
0
 /// <summary>
 /// Checks if a command-line parameter exists in the stream.
 /// </summary>
 public static bool Param(string str, string param)
 {
     using (FStringUnsafe strUnsafe = new FStringUnsafe(str))
         using (FStringUnsafe paramUnsafe = new FStringUnsafe(param))
         {
             return(Native_FParse.Param(ref strUnsafe.Array, ref paramUnsafe.Array));
         }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Parses a uint16.
 /// </summary>
 public static bool Value(string str, string match, ref ushort value)
 {
     using (FStringUnsafe strUnsafe = new FStringUnsafe(str))
         using (FStringUnsafe matchUnsafe = new FStringUnsafe(match))
         {
             return(Native_FParse.Value_UInt16(ref strUnsafe.Array, ref matchUnsafe.Array, ref value));
         }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Get next command.  Skips past comments and cr's.
 /// </summary>
 public static void Next(ref string str)
 {
     using (FStringUnsafe strUnsafe = new FStringUnsafe(str))
         using (FStringUnsafe strResultUnsafe = new FStringUnsafe())
         {
             Native_FParse.Next(ref strUnsafe.Array, ref strResultUnsafe.Array);
             str = strResultUnsafe.Value;
         }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Parse a quoted string token.
 /// </summary>
 public static bool QuotedString(string str, out string value, out int numCharsRead)
 {
     using (FStringUnsafe strUnsafe = new FStringUnsafe(str))
         using (FStringUnsafe resultUnsafe = new FStringUnsafe())
         {
             csbool result = Native_FParse.QuotedString(ref strUnsafe.Array, ref resultUnsafe.Array, out numCharsRead);
             value = resultUnsafe.Value;
             return(result);
         }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Sees if Stream starts with the named command.  If it does,
 /// skips through the command and blanks past it.  Returns true of match.
 /// </summary>
 /// <param name="str"></param>
 /// <param name="match"></param>
 /// <param name="parseMightTriggerExecution">true: Caller guarantees this is only part of parsing and no execution happens without further parsing (good for "DumpConsoleCommands").</param>
 /// <returns></returns>
 public static bool Command(ref string str, string match, bool parseMightTriggerExecution = true)
 {
     using (FStringUnsafe strUnsafe = new FStringUnsafe(str))
         using (FStringUnsafe matchUnsafe = new FStringUnsafe(match))
             using (FStringUnsafe strResultUnsafe = new FStringUnsafe())
             {
                 bool result = Native_FParse.Command(ref strUnsafe.Array, ref matchUnsafe.Array, parseMightTriggerExecution, ref strResultUnsafe.Array);
                 str = strResultUnsafe.Value;
                 return(result);
             }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Parses a boolean value.
 /// </summary>
 public static bool Value(string str, string match, ref bool value)
 {
     using (FStringUnsafe strUnsafe = new FStringUnsafe(str))
         using (FStringUnsafe matchUnsafe = new FStringUnsafe(match))
         {
             csbool val    = false;
             bool   result = Native_FParse.Bool(ref strUnsafe.Array, ref matchUnsafe.Array, ref val);
             value = val;
             return(result);
         }
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Parses a string.
 /// </summary>
 public static bool Value(string str, string match, out string value, bool shouldStopOnSeparator = true)
 {
     using (FStringUnsafe strUnsafe = new FStringUnsafe(str))
         using (FStringUnsafe matchUnsafe = new FStringUnsafe(match))
             using (FStringUnsafe valueUnsafe = new FStringUnsafe())
             {
                 bool result = Native_FParse.Value_Str(ref strUnsafe.Array, ref matchUnsafe.Array, ref valueUnsafe.Array, shouldStopOnSeparator);
                 value = valueUnsafe.Value;
                 return(result);
             }
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Grabs the next alpha-numeric space-delimited token from the input stream.
 /// </summary>
 public static bool AlnumToken(ref string str, out string arg)
 {
     using (FStringUnsafe strUnsafe = new FStringUnsafe(str))
         using (FStringUnsafe strResultUnsafe = new FStringUnsafe())
             using (FStringUnsafe resultUnsafe = new FStringUnsafe())
             {
                 bool success = Native_FParse.AlnumToken(ref strUnsafe.Array, ref resultUnsafe.Array, ref strResultUnsafe.Array);
                 str = strResultUnsafe.Value;
                 arg = resultUnsafe.Value;
                 return(success);
             }
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Get a line of Stream, with support for extending beyond that line with certain characters, e.g. {} and \
 /// the out character array will not include the ignored endlines
 /// </summary>
 public static bool LineExtended(ref string str, out string result, out int linesConsumed, bool exact = false)
 {
     using (FStringUnsafe strUnsafe = new FStringUnsafe(str))
         using (FStringUnsafe strResultUnsafe = new FStringUnsafe())
             using (FStringUnsafe resultUnsafe = new FStringUnsafe())
             {
                 bool success = Native_FParse.LineExtended(ref strUnsafe.Array, ref resultUnsafe.Array, out linesConsumed, exact, ref strResultUnsafe.Array);
                 str    = strResultUnsafe.Value;
                 result = resultUnsafe.Value;
                 return(success);
             }
 }