Ejemplo n.º 1
0
        private static MiniOption GetOptionData()
        {
            var miniopt = new MiniOption();

            miniopt.AddOptionDefines(new MiniOption.DefineData[] {
                new MiniOption.DefineData(OptionType.Add, "a", "add", false),
                new MiniOption.DefineData(OptionType.Extract, "x", "extract", false),
                new MiniOption.DefineData(OptionType.List, "l", "list", false),
                new MiniOption.DefineData(OptionType.Delete, "d", "delete", false),

                new MiniOption.DefineData(OptionType.Go, "g", "go", true),
                new MiniOption.DefineData(OptionType.Read, "r", "read", true),
                new MiniOption.DefineData(OptionType.Ipl, "i", "ipl", true),


                new MiniOption.DefineData(OptionType.ImageType, null, "type", true),
                new MiniOption.DefineData(OptionType.Format, null, "format", false),
                new MiniOption.DefineData(OptionType.X1S, null, "x1s", false),
                new MiniOption.DefineData(OptionType.EntryName, null, "name", true),
                new MiniOption.DefineData(OptionType.Path, null, "path", true),
                new MiniOption.DefineData(OptionType.Verbose, "v", "verbose", false),
                new MiniOption.DefineData(OptionType.ForceAscii, null, "ascii", false),
                new MiniOption.DefineData(OptionType.ForceBinary, null, "binary", false),

                new MiniOption.DefineData(OptionType.Help, "h", "help", false),
                new MiniOption.DefineData(OptionType.Help, "?", null, false)
            });
            return(miniopt);
        }
Ejemplo n.º 2
0
        public bool CheckOption(MiniOption miniopt)
        {
            foreach (var o in miniopt.Result)
            {
                switch (o.Type)
                {
                case OptionType.Add:
                    RunMode = RunModeTypeEnum.Add;
                    break;

                case OptionType.Extract:
                    RunMode = RunModeTypeEnum.Extract;
                    break;

                case OptionType.List:
                    RunMode = RunModeTypeEnum.List;
                    break;

                case OptionType.Delete:
                    RunMode = RunModeTypeEnum.Delete;
                    break;

                case OptionType.Format:
                    RunMode             = RunModeTypeEnum.Add;
                    Setting.FormatImage = true;
                    break;

                case OptionType.Help:
                    Usage();
                    return(false);

                default:
                    if (!CheckOptionExternal(o))
                    {
                        return(false);
                    }
                    break;
                }
            }
            return(true);
        }