Example #1
0
        /// <summary>
        /// コマンドライン引数 (<paramref name="args"/>) を解析し、nec-encの機能プロパティを取得します
        /// </summary>
        /// <param name="args">コマンドライン引数</param>
        /// <param name="props">nec-encの機能プロパティ</param>
        public void Init_args_Aes(string[] args, int arg_idx, ref Tools.Aes.Properties subprops)
        {
            for (int i = arg_idx; i < args.Length; i++)
            {
                if (args[i].StartsWith("-"))
                {
                    switch (args[i].Replace("-", ""))
                    {
                    case "d":                                   // decryption mode
                        subprops.decrypt = true;
                        break;

                    case "K":                                   // aes key (hex)
                        subprops.hex_key = true;
                        goto case "k";

                    case "k":                                   // aes key (text)

                        if (ArgMap.Set_StrParamFromArgs(args, i, ref subprops.key) == 0)
                        {
                            i++;
                        }
                        break;

                    case "l":                                   // length
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref subprops.len) == 0)
                        {
                            i++;
                        }
                        break;

                    case "O":                                   // offset
                        string offset = null;
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref offset) == 0 &&
                            Program.StrToInt(offset, out int conv_offset,
                                             System.Globalization.NumberStyles.None))
                        {
                            subprops.offset = conv_offset;
                            i++;
                        }
                        break;

                    case "s":                                   // key length (short, 128)
                        subprops.keylen = 128;
                        break;

                    case "V":                                   // aes iv (hex)
                        subprops.hex_iv = true;
                        goto case "v";

                    case "v":                                   // aes iv (text)
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref subprops.iv) == 0)
                        {
                            i++;
                        }
                        break;
                    }
                }
            }
        }
        /// <summary>
        /// コマンドライン引数 (<paramref name="args"/>) を解析し、xorimageの機能プロパティを取得します
        /// </summary>
        /// <param name="args">コマンドライン引数</param>
        /// <param name="props">xorimageの機能プロパティ</param>
        public void Init_args_BinCut(string[] args, int arg_idx, ref Tools.BinCut.Properties subprops)
        {
            for (int i = arg_idx; i < args.Length; i++)
            {
                if (args[i].StartsWith("-"))
                {
                    switch (args[i].Replace("-", ""))
                    {
                    case "l":                                   // length
                        string length = null;
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref length) == 0 &&
                            Program.StrToLong(length, out long conv_length,
                                              NumberStyles.None))
                        {
                            subprops.len = conv_length;
                            i++;
                        }
                        break;

                    case "O":                                   // offset
                        string offset = null;
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref offset) == 0 &&
                            Program.StrToInt(offset, out int conv_offset,
                                             NumberStyles.None))
                        {
                            subprops.offset = conv_offset;
                            i++;
                        }
                        break;

                    case "p":                                   // padding
                        string pad = null;
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref pad) == 0 &&
                            Program.StrToInt(pad, out int conv_pad,
                                             NumberStyles.None))
                        {
                            subprops.pad = conv_pad;
                            i++;
                        }
                        break;

                    case "P":                                   // padding with blocksize
                        string padBS = null;
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref padBS) == 0 &&
                            Program.StrToInt(padBS, out int conv_padBS,
                                             NumberStyles.None))
                        {
                            subprops.padBS = conv_padBS;
                            i++;
                        }
                        break;
                    }
                }
            }
        }
Example #3
0
        /// <summary>
        /// コマンドライン引数 (<paramref name="args"/>) を解析し、mkedimaximgの機能プロパティを取得します
        /// </summary>
        /// <param name="args">コマンドライン引数</param>
        /// <param name="props">mkedimaximgの機能プロパティ</param>
        public void Init_args_MkEdimaxImg(string[] args, int arg_idx, ref Tools.MkEdimaxImg.Properties subprops)
        {
            for (int i = arg_idx; i < args.Length; i++)
            {
                if (args[i].StartsWith("-"))
                {
                    switch (args[i].Replace("-", ""))
                    {
                    case "s":
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref subprops.signature) == 0)
                        {
                            i++;
                        }
                        break;

                    case "m":
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref subprops.model) == 0)
                        {
                            i++;
                        }
                        break;

                    case "f":
                        string flash = null;
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref flash) == 0 &&
                            Program.StrToInt(flash, out int conv_flash,
                                             NumberStyles.None))
                        {
                            subprops.flash = conv_flash;
                            i++;
                        }
                        break;

                    case "S":
                        string start = null;
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref start) == 0 &&
                            Program.StrToInt(start, out int conv_start,
                                             NumberStyles.None))
                        {
                            subprops.start = conv_start;
                            i++;
                        }
                        break;

                    case "b":
                        subprops.isbe = true;
                        break;
                    }
                }
            }
        }
        /// <summary>
        /// コマンドライン引数 (<paramref name="args"/>) を解析し、xorimageの機能プロパティを取得します
        /// </summary>
        /// <param name="args">コマンドライン引数</param>
        /// <param name="props">xorimageの機能プロパティ</param>
        public void Init_args_Xorimage(string[] args, int arg_idx, ref Tools.XorImage.Properties subprops)
        {
            for (int i = arg_idx; i < args.Length; i++)
            {
                if (args[i].StartsWith("-"))
                {
                    switch (args[i].Replace("-", ""))
                    {
                    case "l":                                   // length
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref subprops.len) == 0)
                        {
                            i++;
                        }
                        break;

                    case "O":                                   // offset
                        string offset = null;
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref offset) == 0 &&
                            Program.StrToInt(offset, out int conv_offset,
                                             System.Globalization.NumberStyles.None))
                        {
                            subprops.offset = conv_offset;
                            i++;
                        }
                        break;

                    case "p":
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref subprops.pattern) == 0)
                        {
                            i++;
                        }
                        break;

                    case "r":
                        subprops.rewrite = true;
                        break;

                    case "x":
                        subprops.ishex = true;
                        break;
                    }
                }
            }
        }
Example #5
0
        /// <summary>
        /// コマンドライン引数 (<paramref name="args"/>) を解析し、nec-encの機能プロパティを取得します
        /// </summary>
        /// <param name="args">コマンドライン引数</param>
        /// <param name="props">nec-encの機能プロパティ</param>
        public void Init_args_NecEnc(string[] args, ref Tools.Nec_Enc.Properties subprops)
        {
            for (int i = 0; i < args.Length; i++)
            {
                if (args[i].StartsWith("-"))
                {
                    switch (args[i].Replace("-", ""))
                    {
                    case "k":
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref subprops.key) == 0)
                        {
                            i++;
                        }
                        break;

                    case "H":
                        subprops.half = true;
                        break;
                    }
                }
            }
        }
Example #6
0
        /// <summary>
        /// コマンドライン引数 (<paramref name="args"/>) を解析し、xorimageの機能プロパティを取得します
        /// </summary>
        /// <param name="args">コマンドライン引数</param>
        /// <param name="props">xorimageの機能プロパティ</param>
        public void Init_args_Xorimage(string[] args, ref Tools.XorImage.Properties subprops)
        {
            for (int i = 0; i < args.Length; i++)
            {
                if (args[i].StartsWith("-"))
                {
                    switch (args[i].Replace("-", ""))
                    {
                    case "p":
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref subprops.pattern) == 0)
                        {
                            i++;
                        }
                        break;

                    case "x":
                        subprops.ishex = true;
                        break;
                    }
                }
            }
        }
Example #7
0
        /// <summary>
        /// コマンドライン引数 (<paramref name="args"/>) を解析し、mkedimaximgの機能プロパティを取得します
        /// </summary>
        /// <param name="args">コマンドライン引数</param>
        /// <param name="props">mkedimaximgの機能プロパティ</param>
        public void Init_args_BuffaloEnc(string[] args, ref Tools.Buffalo_Enc.Properties subprops)
        {
            CultureInfo provider = CultureInfo.CurrentCulture;

            for (int i = 0; i < args.Length; i++)
            {
                if (args[i].StartsWith("-"))
                {
                    switch (args[i].Replace("-", ""))
                    {
                    case "d":
                        subprops.isde = true;
                        break;

                    case "l":
                        subprops.islong = true;
                        break;

                    case "k":
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref subprops.crypt_key) == 0)
                        {
                            i++;
                        }
                        break;

                    case "m":
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref subprops.magic) == 0)
                        {
                            i++;
                        }
                        break;

                    case "p":
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref subprops.product) == 0)
                        {
                            i++;
                        }
                        break;

                    case "v":
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref subprops.version) == 0)
                        {
                            i++;
                        }
                        break;

                    case "s":
                        string seed = null;
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref seed) == 0 &&
                            byte.TryParse((seed.StartsWith("0x") ? seed.Replace("0x", "") : seed),
                                          NumberStyles.HexNumber, provider, out byte conv_seed))
                        {
                            subprops.seed = conv_seed;
                            i++;
                        }
                        break;

                    case "F":
                        subprops.force = true;
                        break;

                    case "O":
                        string offset = null;
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref offset) == 0 &&
                            Program.StrToInt(offset, out int conv_offset, 0) == 0)
                        {
                            subprops.offset = conv_offset;
                            i++;
                        }
                        break;

                    case "S":
                        string size = null;
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref size) == 0 &&
                            Program.StrToInt(size, out int conv_size, 0) == 0)
                        {
                            subprops.size = conv_size;
                            i++;
                        }
                        break;
                    }
                }
            }
        }
Example #8
0
        /// <summary>
        /// コマンドライン引数 (<paramref name="args"/>) を解析し、mksenaofwの機能プロパティを取得します
        /// </summary>
        /// <param name="args">コマンドライン引数</param>
        /// <param name="props">mkedimaximgの機能プロパティ</param>
        public void Init_args_MkSenaoFw(string[] args, ref Tools.MkSenaoFw.Properties subprops)
        {
            CultureInfo provider = CultureInfo.CurrentCulture;

            for (int i = 0; i < args.Length; i++)
            {
                if (args[i].StartsWith("-"))
                {
                    switch (args[i].Replace("-", ""))
                    {
                    case "t":
                        string type = null;
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref type) == 0 &&
                            byte.TryParse(type, out byte conv_type))
                        {
                            subprops.fw_type = conv_type;
                            i++;
                        }
                        break;

                    case "v":
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref subprops.version) == 0)
                        {
                            i++;
                        }
                        break;

                    case "r":
                        string vendor = null;
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref vendor) == 0 &&
                            Program.StrToUInt(vendor, out uint conv_vendor, 0) == 0)
                        {
                            subprops.vendor = conv_vendor;
                            i++;
                        }
                        break;

                    case "p":
                        string product = null;
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref product) == 0 &&
                            Program.StrToUInt(product, out uint conv_product, 0) == 0)
                        {
                            subprops.product = conv_product;
                            i++;
                        }
                        break;

                    case "m":
                        string magic = null;
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref magic) == 0 &&
                            Program.StrToUInt(magic, out uint conv_magic, 0) == 0)
                        {
                            subprops.magic = conv_magic;
                            i++;
                        }
                        break;

                    case "z":
                        subprops.pad = true;
                        break;

                    case "b":
                        string bs = null;
                        if (ArgMap.Set_StrParamFromArgs(args, i, ref bs) == 0 &&
                            Int32.TryParse(bs, out int conv_bs))
                        {
                            subprops.bs = conv_bs;
                            i++;
                        }
                        break;

                    case "d":
                        subprops.isde = true;
                        break;
                    }
                }
            }
        }