コード例 #1
0
 void LoadZDOOM(aCommandLineParameter param)
 {
     if (param.Count > 0)
     {
         DOOMWADCorrupter.Warning("-zdoom option has extra arguments.");
     }
     ZDOOM = true;
 }
コード例 #2
0
 void LoadStart(aCommandLineParameter param)
 {
     if (param.Count == 0)
     {
         DOOMWADCorrupter.Warning("Missing argument for -start option.");
         return;
     }
     if (param[0] == "??")
     {
         if (param.Count < 3)
         {
             DOOMWADCorrupter.Warning("Missing argument for -start option.");
             return;
         }
         else if (param.Count > 3)
         {
             DOOMWADCorrupter.Warning("-start option has extra arguments.");
         }
         int min, max;
         if (!ParseInt(param[1], 0, Int32.MaxValue, out min))
         {
             DOOMWADCorrupter.Warning("Invalid argument '{0}' for -start option.", param[1]);
             return;
         }
         if (!ParseInt(param[2], 0, Int32.MaxValue, out max))
         {
             DOOMWADCorrupter.Warning("Invalid argument '{0}' for -start option.", param[2]);
             return;
         }
         if (min == max)
         {
             Start = min;
         }
         else if (max < min)
         {
             Start = max + (rnd % min + 1);
         }
         else
         {
             Start = min + (rnd % max + 1);
         }
     }
     else
     {
         int value;
         if (!ParseInt(param[0], 0, Int32.MaxValue, out value))
         {
             DOOMWADCorrupter.Warning("Invalid argument '{0}' for -start option.", param[2]);
             return;
         }
         Start = value;
     }
 }
コード例 #3
0
 void LoadOnly(aCommandLineParameter param)
 {
     if (param.Count == 0)
     {
         DOOMWADCorrupter.Warning("-only has no filters.");
     }
     else
     {
         Filter.Only(param);
     }
 }
コード例 #4
0
 void LoadSkip(aCommandLineParameter param)
 {
     if (param.Count == 0)
     {
         DOOMWADCorrupter.Warning("-skip has no filters.");
     }
     else
     {
         Filter.Skip(param);
     }
 }
コード例 #5
0
        void LoadMode(aCommandLineParameter param)
        {
            if (param.Count == 0)
            {
                DOOMWADCorrupter.Warning("Missing argument for -mode option.");
                return;
            }
            if (param[0] == "??")
            {
                if (param.Count != 1)
                {
                    DOOMWADCorrupter.Warning("-mode option has extra arguments.");
                }
                return;
            }
            else if (param.Count > 2)
            {
                DOOMWADCorrupter.Warning("-mode option has extra arguments.");
            }

            CorruptMode mode;
            if (!Enum.TryParse(param[0], true, out mode))
            {
                DOOMWADCorrupter.Warning("Invalid argument '{0}' for -mode option.", param[0]);
                return;
            }
            CorruptMode = mode;
            if (mode == CorruptMode.NOT && param.Count > 1)
            {
                DOOMWADCorrupter.Warning("-mode option has extra arguments.");
                return;
            }
            if (param[1] == "??")
            {
                return;
            }
            int value;
            if (!ParseInt(param[1], 0, 255, out value))
            {
                DOOMWADCorrupter.Warning("Invalid argument '{0}' for -mode option.", param[1]);
                return;
            }
            CorruptValue = (byte)value;
        }