Beispiel #1
0
        public bool Prepare(string[] args)
        {
            ResetOptions();

            if (args.Length == 0)
            {
                SetDefaultOptions();
            }
            else
            {
                if (!CommandLine.Parser.Default.ParseArguments(args, this))
                {
                    Console.WriteLine("Syntax error");
                    PrintUsage();
                    Error = true;
                    return(false);
                }
            }

            if (Help)
            {
                PrintUsage();
                return(false);
            }

            if (ListColors)
            {
                PrintColors();
                return(false);
            }

            if (ListPresets)
            {
                PrintPresets();
                return(false);
            }

            OutputPreset = GetPresetByName(PresetID);
            YuvColor     = GetColorByName(ColorID);
            ParseFrameSize();

            if (!Validate())
            {
                Console.WriteLine("\nRequired options are not set!");
                PrintUsage();
                Error = true;
                return(false);
            }

            // fix output file extension
            if (!string.IsNullOrEmpty(OutputFile))
            {
                OutputFile = Path.GetFileNameWithoutExtension(OutputFile) + "." + OutputPreset.Extension;
            }

            return(true);
        }
Beispiel #2
0
 void ResetOptions()
 {
     Help         = false;
     Error        = false;
     ListColors   = false;
     ListPresets  = false;
     OutputFile   = null;
     OutputPreset = null;
     YuvFile      = null;
     YuvWidth     = 0;
     YuvHeight    = 0;
     YuvFps       = 0.0;
     YuvColor     = null;
     ColorID      = null;
     PresetID     = null;
 }