mirror of
https://github.com/AdmiralCurtiss/WfcPatcher.git
synced 2026-03-21 18:04:23 -05:00
46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace WfcPatcher {
|
|
static class CommandLineArguments {
|
|
public static string[] Filenames { get; private set; }
|
|
public static string Domain = null;
|
|
|
|
public static bool ParseCommandLineArguments( string[] args ) {
|
|
bool parseSuccess = true;
|
|
|
|
try {
|
|
List<string> filenames = new List<string>();
|
|
|
|
for ( int i = 0; i < args.Length; ++i ) {
|
|
switch ( args[i] ) {
|
|
case "-d":
|
|
case "--domain":
|
|
string domain = args[++i];
|
|
int maxLength = "nintendowifi.net".Length;
|
|
if ( domain.Length <= maxLength ) {
|
|
Domain = domain;
|
|
} else {
|
|
Console.WriteLine( "Replacement domain cannot be longer than original domain ({0} characters).", maxLength );
|
|
parseSuccess = false;
|
|
}
|
|
break;
|
|
default:
|
|
filenames.Add( args[i] );
|
|
break;
|
|
}
|
|
}
|
|
|
|
Filenames = filenames.ToArray();
|
|
} catch ( IndexOutOfRangeException ) {
|
|
Console.WriteLine( "Last given option needs more parameters!" );
|
|
parseSuccess = false;
|
|
}
|
|
|
|
return parseSuccess;
|
|
}
|
|
}
|
|
}
|