2015-12-31 12:27:03 +09:00
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace arookas {
|
|
|
|
|
class CommandLineSettings {
|
|
|
|
|
string mInput, mOutput;
|
2016-03-02 16:44:47 +09:00
|
|
|
|
bool mOutputHeader, mOutputText, mOutputData, mOutputSym, mOutputVars;
|
2015-12-31 12:27:03 +09:00
|
|
|
|
|
|
|
|
|
public string Input { get { return mInput; } }
|
|
|
|
|
public string Output { get { return mOutput; } }
|
|
|
|
|
public bool OutputHeader { get { return mOutputHeader; } }
|
|
|
|
|
public bool OutputText { get { return mOutputText; } }
|
|
|
|
|
public bool OutputData { get { return mOutputData; } }
|
2016-03-02 16:02:53 +09:00
|
|
|
|
public bool OutputSym { get { return mOutputSym; } }
|
2016-03-02 16:44:47 +09:00
|
|
|
|
public bool OutputVars { get { return mOutputVars; } }
|
2015-12-31 12:27:03 +09:00
|
|
|
|
|
2016-02-13 12:53:18 +09:00
|
|
|
|
public CommandLineSettings(aCommandLine cmd) {
|
2015-12-31 12:27:03 +09:00
|
|
|
|
if (cmd == null) {
|
|
|
|
|
throw new ArgumentNullException("cmd");
|
|
|
|
|
}
|
|
|
|
|
foreach (var param in cmd) {
|
|
|
|
|
switch (param.Name) {
|
|
|
|
|
case "-in": mInput = param[0]; continue;
|
2016-01-26 15:08:53 +09:00
|
|
|
|
case "-out": mOutput = param[0]; continue;
|
2015-12-31 12:27:03 +09:00
|
|
|
|
case "-H": mOutputHeader = true; continue;
|
|
|
|
|
case "-h": mOutputHeader = false; continue;
|
|
|
|
|
case "-T": mOutputText = true; continue;
|
|
|
|
|
case "-t": mOutputText = false; continue;
|
|
|
|
|
case "-D": mOutputData = true; continue;
|
|
|
|
|
case "-d": mOutputData = false; continue;
|
2016-03-02 16:02:53 +09:00
|
|
|
|
case "-S": mOutputSym = true; continue;
|
|
|
|
|
case "-s": mOutputSym = false; continue;
|
2016-03-02 16:44:47 +09:00
|
|
|
|
case "-V": mOutputVars = true; continue;
|
|
|
|
|
case "-v": mOutputVars = false; continue;
|
2015-12-31 12:27:03 +09:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (mInput == null) {
|
|
|
|
|
throw new Exception("Missing input file setting.");
|
|
|
|
|
}
|
|
|
|
|
if (mOutput == null) {
|
|
|
|
|
mOutput = Path.ChangeExtension(mInput, ".txt");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|