Exemplo n.º 1
0
        /// <summary>
        /// Assemble all preset settings
        /// </summary>
        /// <param name="preset">
        /// The preset.
        /// </param>
        /// <returns>
        /// Collection of all preset settings.
        /// </returns>
        public override IDictionary <string, int> GetPresetValues(int preset)
        {
            if (!this.Presets.Contains(preset))
            {
                throw new ArgumentNullException("preset");
            }

            var dd = new DosDefaults();

            return(new Dictionary <string, int>
            {
                { "bc", dd.BufCol[preset] },
                { "bl", dd.BufLin[preset] },
                { "wc", dd.WinCol[preset] },
                { "wl", dd.WinLin[preset] },
                { "in", (int)ModeFlag.States.True },
                { "qe", (int)ModeFlag.States.True }
            });
        }
Exemplo n.º 2
0
        /// <summary>
        /// Assemble all preset settings
        /// </summary>
        /// <param name="preset">
        /// The preset.
        /// </param>
        /// <returns>
        /// Collection of all preset settings.
        /// </returns>
        public override IDictionary<string, int> GetPresetValues(int preset)
        {
            if (!this.Presets.Contains(preset))
            {
                throw new ArgumentNullException("preset");
            }

            var dd = new DosDefaults();
            return new Dictionary<string, int>
                {
                    { "bc", dd.BufCol[preset] },
                    { "bl", dd.BufLin[preset] },
                    { "wc", dd.WinCol[preset] },
                    { "wl", dd.WinLin[preset] },
                    { "in", (int)ModeFlag.States.True },
                    { "qe", (int)ModeFlag.States.True }
                };
        }
Exemplo n.º 3
0
        /// <summary>
        /// Assemble multi command settings.
        /// </summary>
        /// <param name="tag">
        /// The option.
        /// </param>
        /// <param name="value">
        /// The value.
        /// </param>
        /// <returns>
        /// Collection of multi command option value pairs.
        /// </returns>
        public override IDictionary<string, int> GetMultiCommandSettings(string tag, string value)
        {
            // (1) option/value == ?? /{ 0, 1, 2, 3 }
            // (2) option/value == { W= | B= | L= | C= }/{ 0, 1, 2, 3 }
            // (3) option/value == { L= | C= }/{ nn } where (nn > ~25 or ~40)
            int optionValue;
            if (int.TryParse(value, out optionValue))
            {
                if (this.Presets.Contains(optionValue))
                {
                    // preset value
                    var dd = new DosDefaults();
                    switch (tag.ToLower())
                    {
                        case "w=":
                            return new Dictionary<string, int> { { "wl", dd.WinLin[optionValue] }, { "wc", dd.WinCol[optionValue] } };
                        case "b=":
                            return new Dictionary<string, int> { { "bl", dd.BufLin[optionValue] }, { "bc", dd.BufCol[optionValue] } };
                        case "l=":
                            return new Dictionary<string, int> { { "wl", dd.WinLin[optionValue] }, { "bl", dd.BufLin[optionValue] } };
                        case "c=":
                            return new Dictionary<string, int> { { "wc", dd.WinCol[optionValue] }, { "bc", dd.BufCol[optionValue] } };
                    }

                    if (string.IsNullOrEmpty(tag))
                    {
                        // preset command
                        return this.GetPresetValues(optionValue);
                    }
                }
                else
                {
                    // specific value
                    switch (tag.ToLower())
                    {
                        case "l=":
                            return new Dictionary<string, int> { { "wl", optionValue }, { "bl", optionValue } };
                        case "c=":
                            return new Dictionary<string, int> { { "wc", optionValue }, { "bc", optionValue } };
                    }
                }
            }

            return null;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Assemble detail command settings.
        /// </summary>
        /// <param name="option">
        /// The option.
        /// </param>
        /// <param name="value">
        /// The value.
        /// </param>
        /// <returns>
        /// One detail command option value pair.
        /// </returns>
        public override IDictionary<string, int> GetDetailCommandSetting(string option, string value)
        {
            int trueFalse;
            bool optionTrueFalse = this.OptionParse(value, out trueFalse);
            int optionValue;
            bool optionInt = int.TryParse(value, out optionValue);

            // (1) Detail command set one option using preset value, e.g. WL= | BL= | WC= | BC= | QE= | IN= with  0|1|2|3
            // (2) Detail command set one option using specific value, e.g. WL= | BL= | WC= | BC= | QE= | IN=
            if (optionInt || optionTrueFalse)
            {
                if (optionInt && this.Presets.Contains(optionValue))
                {
                    // preset value
                    var dd = new DosDefaults();
                    switch (option.ToLower())
                    {
                        case "wl=":
                            return new Dictionary<string, int> { { "wl", dd.WinLin[optionValue] } };
                        case "bl=":
                            return new Dictionary<string, int> { { "bl", dd.BufLin[optionValue] } };
                        case "wc=":
                            return new Dictionary<string, int> { { "wc", dd.WinCol[optionValue] } };
                        case "bc=":
                            return new Dictionary<string, int> { { "bc", dd.BufCol[optionValue] } };
                        case "qe=":
                            return new Dictionary<string, int> { { "qe", (int)ModeFlag.States.True } };
                        case "in=":
                            return new Dictionary<string, int> { { "in", (int)ModeFlag.States.True } };
                    }
                }
                else
                {
                    if (!optionTrueFalse)
                    {
                        // specific value
                        switch (option.ToLower())
                        {
                            case "wl=":
                                return new Dictionary<string, int> { { "wl", optionValue } };
                            case "bl=":
                                return new Dictionary<string, int> { { "bl", optionValue } };
                            case "wc=":
                                return new Dictionary<string, int> { { "wc", optionValue } };
                            case "bc=":
                                return new Dictionary<string, int> { { "bc", optionValue } };
                        }
                    }
                    else
                    {
                        // specific value
                        switch (option.ToLower())
                        {
                            case "qe=":
                                return new Dictionary<string, int> { { "qe", trueFalse } };
                            case "in=":
                                return new Dictionary<string, int> { { "in", trueFalse } };
                        }
                    }
                }
            }

            return new Dictionary<string, int>();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Assemble multi command settings.
        /// </summary>
        /// <param name="tag">
        /// The option.
        /// </param>
        /// <param name="value">
        /// The value.
        /// </param>
        /// <returns>
        /// Collection of multi command option value pairs.
        /// </returns>
        public override IDictionary <string, int> GetMultiCommandSettings(string tag, string value)
        {
            // (1) option/value == ?? /{ 0, 1, 2, 3 }
            // (2) option/value == { W= | B= | L= | C= }/{ 0, 1, 2, 3 }
            // (3) option/value == { L= | C= }/{ nn } where (nn > ~25 or ~40)
            int optionValue;

            if (int.TryParse(value, out optionValue))
            {
                if (this.Presets.Contains(optionValue))
                {
                    // preset value
                    var dd = new DosDefaults();
                    switch (tag.ToLower())
                    {
                    case "w=":
                        return(new Dictionary <string, int> {
                            { "wl", dd.WinLin[optionValue] }, { "wc", dd.WinCol[optionValue] }
                        });

                    case "b=":
                        return(new Dictionary <string, int> {
                            { "bl", dd.BufLin[optionValue] }, { "bc", dd.BufCol[optionValue] }
                        });

                    case "l=":
                        return(new Dictionary <string, int> {
                            { "wl", dd.WinLin[optionValue] }, { "bl", dd.BufLin[optionValue] }
                        });

                    case "c=":
                        return(new Dictionary <string, int> {
                            { "wc", dd.WinCol[optionValue] }, { "bc", dd.BufCol[optionValue] }
                        });
                    }

                    if (string.IsNullOrEmpty(tag))
                    {
                        // preset command
                        return(this.GetPresetValues(optionValue));
                    }
                }
                else
                {
                    // specific value
                    switch (tag.ToLower())
                    {
                    case "l=":
                        return(new Dictionary <string, int> {
                            { "wl", optionValue }, { "bl", optionValue }
                        });

                    case "c=":
                        return(new Dictionary <string, int> {
                            { "wc", optionValue }, { "bc", optionValue }
                        });
                    }
                }
            }

            return(null);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Assemble detail command settings.
        /// </summary>
        /// <param name="option">
        /// The option.
        /// </param>
        /// <param name="value">
        /// The value.
        /// </param>
        /// <returns>
        /// One detail command option value pair.
        /// </returns>
        public override IDictionary <string, int> GetDetailCommandSetting(string option, string value)
        {
            int  trueFalse;
            bool optionTrueFalse = this.OptionParse(value, out trueFalse);
            int  optionValue;
            bool optionInt = int.TryParse(value, out optionValue);

            // (1) Detail command set one option using preset value, e.g. WL= | BL= | WC= | BC= | QE= | IN= with  0|1|2|3
            // (2) Detail command set one option using specific value, e.g. WL= | BL= | WC= | BC= | QE= | IN=
            if (optionInt || optionTrueFalse)
            {
                if (optionInt && this.Presets.Contains(optionValue))
                {
                    // preset value
                    var dd = new DosDefaults();
                    switch (option.ToLower())
                    {
                    case "wl=":
                        return(new Dictionary <string, int> {
                            { "wl", dd.WinLin[optionValue] }
                        });

                    case "bl=":
                        return(new Dictionary <string, int> {
                            { "bl", dd.BufLin[optionValue] }
                        });

                    case "wc=":
                        return(new Dictionary <string, int> {
                            { "wc", dd.WinCol[optionValue] }
                        });

                    case "bc=":
                        return(new Dictionary <string, int> {
                            { "bc", dd.BufCol[optionValue] }
                        });

                    case "qe=":
                        return(new Dictionary <string, int> {
                            { "qe", (int)ModeFlag.States.True }
                        });

                    case "in=":
                        return(new Dictionary <string, int> {
                            { "in", (int)ModeFlag.States.True }
                        });
                    }
                }
                else
                {
                    if (!optionTrueFalse)
                    {
                        // specific value
                        switch (option.ToLower())
                        {
                        case "wl=":
                            return(new Dictionary <string, int> {
                                { "wl", optionValue }
                            });

                        case "bl=":
                            return(new Dictionary <string, int> {
                                { "bl", optionValue }
                            });

                        case "wc=":
                            return(new Dictionary <string, int> {
                                { "wc", optionValue }
                            });

                        case "bc=":
                            return(new Dictionary <string, int> {
                                { "bc", optionValue }
                            });
                        }
                    }
                    else
                    {
                        // specific value
                        switch (option.ToLower())
                        {
                        case "qe=":
                            return(new Dictionary <string, int> {
                                { "qe", trueFalse }
                            });

                        case "in=":
                            return(new Dictionary <string, int> {
                                { "in", trueFalse }
                            });
                        }
                    }
                }
            }

            return(new Dictionary <string, int>());
        }