MyC.Io.ParseArgs C# (CSharp) Method

ParseArgs() private method

private ParseArgs ( ) : void
return void
void ParseArgs()
  {
  int i = 1;

  if (args.Length < 2)
    {
    Abort("myc [/debug] [/nodebug] [/list] [/dll] [/exe] [/outdir:path] filename.myc\n");
    }

  while (true)
    {
    if (args[i][0] != '/')
      break;
    if (args[i].Equals("/?"))
      {
      Console.WriteLine("Compiler options:\n  myc [/debug] [/nodebug] [/list] [/dll] [/exe] [/outdir:path] filename.myc\n");
      Environment.Exit(1);
      }
    if (args[i].Equals("/debug"))
      {
      gendebug = true;
      i++;
      continue;
      }
    if (args[i].Equals("/nodebug"))
      {
      gendebug = false;
      i++;
      continue;
      }
    if (args[i].Equals("/exe"))
      {
      genexe = true;
      gendll = false;
      i++;
      continue;
      }
    if (args[i].Equals("/dll"))
      {
      gendll = true;
      genexe = false;
      i++;
      continue;
      }
    if (args[i].Equals("/list"))
      {
      genlist = true;
      i++;
      continue;
      }
    if (args[i].Length > 8 && args[i].Substring(0,8).Equals("/outdir:"))
      {
      genpath = args[i].Substring(8);
      i++;
      continue;
      }
    /*
     * exit if no switch matched
     */
    Abort("Unmatched switch = '"+args[i]+"'\nArguments are:\nmyc [/debug] [/nodebug] [/list] [/dll] [/exe] [/outdir:path] filename.myc\n");
    }

  if (args.Length-i != 1)
    {
    Abort("myc [/debug] [/nodebug] [/list] [/dll] [/exe] [/outdir:path] filename.myc\n");
    }
  ifilename = args[args.Length-1]; // filename is last
  }