示例#1
0
        private void Option(string name, UciOptionType type, object defaultValue, int?min, int?max, List <object> options)
        {
            var opt = new UciOption
            {
                DefaultValue = defaultValue,
                Max          = max,
                Min          = min,
                Name         = name,
                Type         = type,
                Options      = options
            };

            Options.Add(opt);
        }
示例#2
0
        private void Option(string name, UciOptionType type, object defaultValue, int? min, int? max, List<object> options)
        {
            var opt = new UciOption
            {
                DefaultValue = defaultValue,
                Max = max,
                Min = min,
                Name = name,
                Type = type,
                Options = options
            };

            Options.Add(opt);
        }
示例#3
0
        public void Option(string name, UciOptionType type, object defaultValue, int?min, int?max, List <object> values)
        {
            var sb = new StringBuilder();

            sb.Append("option name ");
            sb.Append(name);
            sb.Append(" type ");
            sb.Append(type.ToString().ToLower());

            if (defaultValue != null)
            {
                sb.Append(" default ");

                if (defaultValue.GetType() == typeof(bool))
                {
                    sb.Append(defaultValue.ToString().ToLower());
                }
                else
                {
                    sb.Append(defaultValue.ToString());
                }
            }

            if (min != null)
            {
                sb.Append(" min ");

                if (min.GetType() == typeof(bool))
                {
                    sb.Append(min.ToString().ToLower());
                }
                else
                {
                    sb.Append(min.ToString());
                }
            }

            if (max != null)
            {
                sb.Append(" max ");

                if (max.GetType() == typeof(bool))
                {
                    sb.Append(max.ToString().ToLower());
                }
                else
                {
                    sb.Append(max.ToString());
                }
            }

            if (values != null)
            {
                foreach (var v in values)
                {
                    sb.Append(" var ");

                    if (v.GetType() == typeof(bool))
                    {
                        sb.Append(v.ToString().ToLower());
                    }
                    else
                    {
                        sb.Append(v.ToString());
                    }
                }
            }

            var output = sb.ToString();

            UciCallback(output);
        }