예제 #1
0
        static void ParseCommandLineArgs(string[] args, out string cvtPathFilename, out string outPathFilename, out bool ignoreFileSignature)
        {
            // <filename>                    ... Commodore disk image filename with path ... fix position parameter (at first position)
            // [-i]                          ... ignore file signature
            // [-o <filename>]               ... filename with path of output file       ... option with one value (required)
            const string OPTION_OUTFILENAME    = "-o";
            const string IGNORE_FILE_SIGNATURE = "-i";

            cvtPathFilename     = "";
            outPathFilename     = "";
            ignoreFileSignature = false;

            Dictionary <String, int[]> arguments = new Dictionary <string, int[]>();

            CmdLineArgsParser.AddArgument(ref arguments, "first", true, true, true, 0);
            CmdLineArgsParser.AddArgument(ref arguments, IGNORE_FILE_SIGNATURE, false, false, false, 0);
            CmdLineArgsParser.AddArgument(ref arguments, OPTION_OUTFILENAME, false, true, true, 0);
            String firstArgValue;
            Dictionary <string, string> optionList = CmdLineArgsParser.Parse(args, arguments, out firstArgValue);

            cvtPathFilename = firstArgValue;
            if (optionList.ContainsKey(OPTION_OUTFILENAME))
            {
                outPathFilename = optionList[OPTION_OUTFILENAME];
            }
            if (optionList.ContainsKey(IGNORE_FILE_SIGNATURE))
            {
                ignoreFileSignature = true;
            }
        }
        static void ParseCommandLineArgs(string[] args, out string cvtPathFilename)
        {
            // <filename>                    ... Commodore disk image filename with path ... fix position parameter (at first position)
            cvtPathFilename = "";

            Dictionary <String, int[]> arguments = new Dictionary <string, int[]>();

            CmdLineArgsParser.AddArgument(ref arguments, "first", true, true, true, 0);

            String firstArgValue;
            Dictionary <string, string> optionList = CmdLineArgsParser.Parse(args, arguments, out firstArgValue);

            cvtPathFilename = firstArgValue;
        }
        static void ParseCommandLineArgs(string[] args, out string imagePathFilename, out int dirIndex, out string asciiCbmFilename, out string outPathFilename)
        {
            // <filename>                    ... Commodore disk image filename with path ... fix position parameter (at first position)
            // -i <index> | -f <fielename>   ... Commodore DOS filename in ascii         ... option with one value (-i or -f is required)
            // [-o <filename>]               ... filename with path of output file       ... option with one value (optional)
            const string OPTION_INDEX       = "-i";
            const string OPTION_FILENAME    = "-f";
            const string OPTION_OUTFILENAME = "-o";

            imagePathFilename = "";
            dirIndex          = 0;
            asciiCbmFilename  = "";
            outPathFilename   = "";

            Dictionary <String, int[]> arguments = new Dictionary <string, int[]>();

            CmdLineArgsParser.AddArgument(ref arguments, "first", true, true, true, 0);
            CmdLineArgsParser.AddArgument(ref arguments, OPTION_INDEX, false, false, true, 1);
            CmdLineArgsParser.AddArgument(ref arguments, OPTION_FILENAME, false, false, true, 1);
            CmdLineArgsParser.AddArgument(ref arguments, OPTION_OUTFILENAME, false, false, true, 0);
            String firstArgValue;
            Dictionary <string, string> optionList = CmdLineArgsParser.Parse(args, arguments, out firstArgValue);

            imagePathFilename = firstArgValue;
            if (optionList.ContainsKey(OPTION_INDEX))
            {
                try
                {
                    dirIndex = Int32.Parse(optionList[OPTION_INDEX]);
                }
                catch
                {
                    throw new Exception(String.Format("The Option {0} requires a numeric value!", OPTION_INDEX));
                }
            }
            if (optionList.ContainsKey(OPTION_FILENAME))
            {
                asciiCbmFilename = optionList[OPTION_FILENAME];
            }
            if (optionList.ContainsKey(OPTION_OUTFILENAME))
            {
                outPathFilename = optionList[OPTION_OUTFILENAME];
            }
        }