Ejemplo n.º 1
0
        /// <summary>
        /// returns a string that can be used with String.Format() for displaying ConfigOption values and names in tabbed columns.
        /// Calculates what indendation to use for each column by looking at the max length of the variable names/values
        /// </summary>
        /// <returns>a string in the format "\t{0, -XX} {1, -XX} {2, 2} {3, -XX} {4, -10}" where XX is calculated</returns>
        internal string GetFormatString(ModInfo info)
        {
            int longestNameLength      = 0;
            int longestVarLength       = Settings.Count > 0 ? Settings.Select(s => s.ID.Length).Max() + 3 : 0; // use LINQ to get max length of a setting variable ID
            int longestValueNameLength = 4;                                                                    // length of 'True'

            // loop over each setting and get the max length of the variable name and variables value name
            foreach (var config in Settings)
            {
                ConfigOption configOption = info.Options.FirstOrDefault(o => o.ID == config.ID);
                if (configOption?.Name.Length > longestNameLength)
                {
                    longestNameLength = configOption.Name.Length;
                }

                if (configOption?.Type == OptionType.List)
                {
                    string value = configOption.Values.Where(o => o.Value == config.Value).Select(o => o.Name).FirstOrDefault();
                    if (value?.Length > longestValueNameLength)
                    {
                        longestValueNameLength = value.Length;
                    }
                }
            }

            longestNameLength      += 3; // add 3 to account for the quotes wrapping name and space e.g. "Aerith"
            longestValueNameLength += 3;

            string format = "\t{0, -" + longestNameLength.ToString() + "} {1, -" + longestVarLength + "} {2, 2} {3, -" + longestValueNameLength + "} {4, -10}";

            return(format);
        }
Ejemplo n.º 2
0
        public virtual string Compile(ConfigOption member)
        {
            string privateName          = member.Name.ToLowerCamelCase();
            string serializationOptions = "null";

            MetaAttribute configOptionAttribute = member.Attributes.Find(delegate(MetaAttribute attr) { return(attr.Type.Equals("ConfigOption")); });

            if (configOptionAttribute != null && configOptionAttribute.Value.IsNotEmpty())
            {
                serializationOptions = "new SerializationOptions({0})".FormatWith(configOptionAttribute.Value);
            }

            var obj = new
            {
                Name                 = member.Name,
                PrivateName          = privateName.IsReservedWord() ? "_" + privateName : privateName,
                LowerCamelName       = privateName,
                Type                 = member.Type,
                DefaultValue         = member.DefaultValue ?? "null",
                PrivateValue         = member.PrivateValue ?? "null",
                Summary              = member.Summary,
                Modifier             = member.Modifier.ToString().ToLower(),
                SerializationOptions = serializationOptions
            };

            string template = member.DefaultValue != null ? member.Type : "instance";

            if (member.Template.IsNotEmpty())
            {
                template = member.Template;
            }

            return(this.Compile(obj, template));
        }
Ejemplo n.º 3
0
        private ServiceProvider BuildContainer(ConfigOption option)
        {
            var service = new ServiceCollection();

            service.AddLogging(x =>
            {
                x.AddConsole();
                x.AddDebug();
            });

            service.AddSingleton(option);

            service.AddSingleton <ListActivity>();
            service.AddSingleton <GetActivity>();
            service.AddSingleton <DeleteActivity>();
            service.AddSingleton <SetActivity>();

            service.AddSingleton <DeleteCommand>();
            service.AddSingleton <ListCommand>();
            service.AddSingleton <GetCommand>();
            service.AddSingleton <SetCommand>();

            //service.AddHttpClient<IArtifactClient, ArtifactClient>(http =>
            //{
            //    http.BaseAddress = new Uri(option.ArtifactUrl);
            //    http.DefaultRequestHeaders.Add(Constants.ApiKeyName, option.ApiKey);
            //});

            return(service.BuildServiceProvider());
        }
Ejemplo n.º 4
0
 ////新增或修改数据
 public string EditOrUpdateOption(ConfigOption option)
 {
     if (option.OptionId != 0)
     {
         if (Limits.Contains(2))
         {
             DbOp.Update(option);
         }
         else
         {
             return("你没有权限进行修改");
         }
     }
     else
     {
         if (Limits.Contains(3))
         {
             DbOp.Add(option);
         }
         else
         {
             return("你没有权限新增数据");
         }
     }
     return("True");
 }
Ejemplo n.º 5
0
        public static IApplicationBuilder UseFastApiMiddleware(this IApplicationBuilder app, Action <ConfigOption> optionsAction)
        {
            var options = new ConfigOption();

            optionsAction(options);
            return(app.UseMiddleware <FastApiHandler>(options));
        }
Ejemplo n.º 6
0
        private void _configOptionChanged(string name, string value)
        {
            LogManager.Instance.Write("OpenGL : RenderSystem Option: {0} = {1}", name, value);

            if (name == "Video Mode")
            {
                _refreshConfig();
            }

            if (name == "Full Screen")
            {
                ConfigOption opt = ConfigOptions["Display Frequency"];
                if (value == "No")
                {
                    opt.Value     = "N/A";
                    opt.Immutable = true;
                }
                else
                {
                    opt.Immutable = false;
                    if (opt.PossibleValues.Count > 0)
                    {
                        opt.Value = opt.PossibleValues.Values[opt.PossibleValues.Count - 1];
                    }
                }
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// </summary>
        protected void RefreshConfig()
        {
            ConfigOption optVideoMode        = ConfigOptions["Video Mode"];
            ConfigOption optDisplayFrequency = ConfigOptions["Display Frequency"];

            int vidIndex  = 0;
            int freqIndex = 0;
            int addIndex  = 0;

            while (vidIndex < optVideoMode.PossibleValues.Count && freqIndex < optDisplayFrequency.PossibleValues.Count)
            {
                optDisplayFrequency.PossibleValues.Clear();
                foreach (var value in this._videoModes)
                {
                    string mode = value.Key.Width + " x " + value.Key.Height;
                    if (mode == optVideoMode.Value)
                    {
                        string frequenzy = value.Value.ToString() + " MHz";
                        optDisplayFrequency.PossibleValues.Add(addIndex++, frequenzy);
                    }
                }
                if (optDisplayFrequency.PossibleValues.Count > 0)
                {
                    optDisplayFrequency.Value = optDisplayFrequency.PossibleValues[0];
                }
                else
                {
                    optVideoMode.Value        = this._videoModes[0].Key.Width + " x " + this._videoModes[0].Key.Height;
                    optDisplayFrequency.Value = this._videoModes[0].Value.ToString() + " MHz";
                }
                vidIndex++;
                freqIndex++;
            }
        }
Ejemplo n.º 8
0
        private void ApplySettingsToUI()
        {
            DisplayConfig      config       = settings.renderSystem.ConfigOptions;
            List <DisplayMode> displayModes = config.FullscreenModes;

            validModes = new List <DisplayMode>();
            for (int i = 0; i < displayModes.Count; ++i)
            {
                if (displayModes[i].Width >= settings.minScreenWidth && displayModes[i].Height >= settings.minScreenHeight)
                {
                    DisplayMode mode = displayModes[i];
                    validModes.Add(mode);
                    videoModeComboBox.Items.Add(GetDisplayString(mode));
                }
            }
            DisplayMode displayMode = settings.displayMode;
            int         index       = videoModeComboBox.Items.IndexOf(GetDisplayString(displayMode));

            if (index < 0)
            {
                videoModeComboBox.SelectedIndex = 0;
            }
            else
            {
                videoModeComboBox.SelectedIndex = index;
            }
            setRadioButtonPair(fullScreenYesButton, displayMode.Fullscreen, fullScreenNoButton);
            fullScreenGroupBox.Visible = settings.allowFullScreen;
            setRadioButtonPair(vsyncYesButton, settings.vSync, vsyncNoButton);
            setRadioButtonPair(nvPerfHUDYesButton, settings.allowNVPerfHUD, nvPerfHUDNoButton);

            Dictionary <string, ConfigOption> rsConfigOptions = settings.renderSystem.GetConfigOptions();

            string currentAAVal = "None";

            if (rsConfigOptions.ContainsKey("Anti Aliasing"))
            {
                ConfigOption aaConfig = rsConfigOptions["Anti Aliasing"];
                // add the possible values to the combo box
                foreach (string s in aaConfig.possibleValues)
                {
                    aaComboBox.Items.Add(s);
                }

                // if current value from settings is valid, use it, otherwise default to None
                if (aaConfig.possibleValues.Contains(settings.antiAliasing))
                {
                    currentAAVal = settings.antiAliasing;
                }
            }
            else
            {
                // render system doesn't have AA settings
                aaComboBox.Items.Add("None");
            }
            aaComboBox.SelectedIndex = aaComboBox.Items.IndexOf(currentAAVal);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 保存配置信息
        /// </summary>
        /// <param name="value">配置信息</param>
        public JsonBaseModel <string> Save(OptionViewModel value)
        {
            JsonBaseModel <string> result = new JsonBaseModel <string>();

            result.HasError = true;
            string GroupType = value.Group.GroupType;

            if (value.Group == null || string.IsNullOrEmpty(GroupType) || value.ListOptions == null)
            {
                result.Message = "保存参数配置时发生参数空异常";
                return(result);
            }
            //调用保存前处理事件
            ConfigOption curConfigOption = AllConfig.First(e => e.GroupType.Equals(GroupType, StringComparison.OrdinalIgnoreCase));

            if (curConfigOption == null)
            {
                //如果没有找到匹配项
                result.Message = string.Format("当前保存配置信息{0}不对应后台的任务配置类", GroupType);
                return(result);
            }
            if (!curConfigOption.BeforeSave(value))
            {
                result.Message = "当前配置项不允许保存";
                return(result);
            }

            //保存数据

            try
            {
                //删除原有数据
                SQLHelper.ExecuteNonQuery("Delete from t_Configuration WHERE OptionType=@OptionType", new { OptionType = GroupType });
                //保存数据
                foreach (var item in value.ListOptions)
                {
                    item.OptionId = Guid.NewGuid().ToString("N");
                    SQLHelper.ExecuteNonQuery(@"INSERT INTO t_Configuration(OptionId,OptionType,OptionName,`Key`,`Value`,ValueType) 
                    select @OptionId,@OptionType,@OptionName,@Key,@Value,@ValueType", item);
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("系统参数配置保存异常", ex);
                result.Message = ex.Message;
                return(result);
            }

            //对当前配置项进行赋值
            SetValue(curConfigOption, value.ListOptions);

            //调用保存后处理事件
            curConfigOption.AfterSave(curConfigOption);
            result.HasError = false;
            return(result);
        }
Ejemplo n.º 10
0
        private void _refreshConfig()
        {
            ConfigOption optVideoMode        = ConfigOptions["Video Mode"];
            ConfigOption optColorDepth       = ConfigOptions["Color Depth"];
            ConfigOption optDisplayFrequency = ConfigOptions["Display Frequency"];
            ConfigOption optFullScreen       = ConfigOptions["Full Screen"];

            string val = optVideoMode.Value;

            int pos = val.IndexOf('x');

            if (pos == -1)
            {
                throw new Exception("Invalid Video Mode provided");
            }
            int width  = Int32.Parse(val.Substring(0, pos));
            int height = Int32.Parse(val.Substring(pos + 1));

            DisplayDevice dev = DisplayDevice.Default;

            optColorDepth.PossibleValues.Clear();
            for (int q = 0; q < dev.AvailableResolutions.Count; q++)
            {
                DisplayResolution item = dev.AvailableResolutions[q];
                if (item.Width == width && item.Height == height && item.BitsPerPixel >= 16)
                {
                    if (!optColorDepth.PossibleValues.ContainsValue(item.BitsPerPixel.ToString()))
                    {
                        optColorDepth.PossibleValues.Add(optColorDepth.PossibleValues.Values.Count, item.BitsPerPixel.ToString());
                    }
                    if (!optDisplayFrequency.PossibleValues.ContainsValue(item.RefreshRate.ToString()))
                    {
                        optDisplayFrequency.PossibleValues.Add(optDisplayFrequency.PossibleValues.Values.Count, item.RefreshRate.ToString());
                    }
                }
            }

            if (optFullScreen.Value == "No")
            {
                optDisplayFrequency.Value     = "N/A";
                optDisplayFrequency.Immutable = true;
            }
            else
            {
                optDisplayFrequency.Immutable = false;
                optDisplayFrequency.Value     = optDisplayFrequency.PossibleValues.Values[optDisplayFrequency.PossibleValues.Count - 1];
            }
            if (optColorDepth.PossibleValues.Values.Count > 0)
            {
                optColorDepth.Value = optColorDepth.PossibleValues.Values[0];
            }
            if (optDisplayFrequency.Value != "N/A")
            {
                optDisplayFrequency.Value = optDisplayFrequency.PossibleValues.Values[optDisplayFrequency.PossibleValues.Count - 1];
            }
        }
Ejemplo n.º 11
0
 public ConfigDialog()
 {
     _currentSystem = Root.Instance.RenderSystems[0];
     _renderSystems = new ConfigOption("Render System", _currentSystem.Name, false);
     foreach (Axiom.Graphics.RenderSystem rs in Root.Instance.RenderSystems)
     {
         _renderSystems.PossibleValues.Add(_renderSystems.PossibleValues.Count, rs.ToString());
     }
     BuildOptions();
 }
Ejemplo n.º 12
0
        public override bool Execute()
        {
            var r = new Exec
            {
                BuildEngine      = BuildEngine,
                Command          = $"git config --file {File} --list",
                ConsoleToMSBuild = true
            };

            if (!r.Execute())
            {
                return(false);
            }

            var options = r.ConsoleOutput
                          .Select(item => ConfigOption.Parse(item.ItemSpec))
                          .ToArray();

            SubmoduleConfiguration = options
                                     .Where(o => o.Section == "submodule")
                                     .GroupBy(o => o.Subsection)
                                     .Select(g =>
            {
                string path = g.FirstOrDefault(o => o.Name == "path")?.Value;
                string url  = g.FirstOrDefault(o => o.Name == "url")?.Value;

                if (string.IsNullOrEmpty(path) ||
                    string.IsNullOrEmpty(url))
                {
                    return(null);
                }

                string branch = g.FirstOrDefault(o => o.Name == "branch")?.Value ?? string.Empty;

                // "git --list" converts entries to lowercase, but camelCase is standard
                // capitalization within the config file.
                string versionToolsAutoUpdate = g
                                                .FirstOrDefault(o => string.Equals(o.Name, "versionToolsAutoUpdate", StringComparison.OrdinalIgnoreCase))
                                                ?.Value ?? string.Empty;

                return(new TaskItem(
                           g.Key,
                           new Dictionary <string, string>
                {
                    ["Path"] = path,
                    ["Url"] = url,
                    ["Branch"] = branch,
                    ["VersionToolsAutoUpdate"] = versionToolsAutoUpdate
                }));
            })
                                     .Where(item => item != null)
                                     .ToArray();

            return(true);
        }
Ejemplo n.º 13
0
        public RedisHelper(ConfigOption _config)
        {
            config = _config;
            RedisClient client = new RedisClient();

            if (config.ConnectionString == null || string.IsNullOrWhiteSpace(config.ConnectionString))
            {
                throw new ApplicationException("配置文件中未找到RedisServer的有效配置!");
            }
            database = client.GetDatabase(config.ConnectionString, config.DbIndex);
        }
Ejemplo n.º 14
0
        public IList <ConfigOption> Select(ConfigOption data)
        {
            IList <ConfigOption> datos = new List <ConfigOption>();

            datos = GetHsql(data).List <ConfigOption>();
            if (!Factory.IsTransactional)
            {
                Factory.Commit();
            }
            return(datos);
        }
Ejemplo n.º 15
0
 public int InsertUpdateConfigOptions(ConfigOption item)
 {
     using (SqlCommand cmd = new SqlCommand("DevTrkr..InsertUpdateConfigOptions"))
     {
         cmd.Parameters.AddWithValue("@ID", item.ID);
         cmd.Parameters.AddWithValue("@Name", item.Name);
         cmd.Parameters.AddWithValue("@Value", item.Value);
         cmd.Parameters.AddWithValue("@Description", item.Description);
         return(UpdateDatabase(cmd));
     }
 }
Ejemplo n.º 16
0
 public Result Config(ConfigOption option)
 {
     if (_useWinSqlite)
     {
         return((Result)WinSQLite3.Config(option));
     }
     else
     {
         return((Result)SQLite3.Config(option));
     }
 }
        /// <summary>
        /// gets option enum values as a typed enum values option
        /// </summary>
        /// <typeparam name="T">type of the enum values option wrapper from IConfigEnumOption,ConfigEnumOption</typeparam>
        /// <param name="configOption">config option</param>
        /// <param name="projectId">optional project id related to the option</param>
        /// <param name="userId">optional user id related to the option</param>
        /// <returns>json of option enum values mapped to typed enum values option</returns>
        public T ConfigGetEnum <T>(ConfigOption configOption, int?projectId = null, int?userId = null)
            where T : ConfigEnumOption, IConfigEnumOption, new()
        {
            var r = ConfigGet(new List <string>()
            {
                configOption + ""
            }, projectId, userId);

            return((r == null || r.Configs.Count == 0)
                ? null
                : GetConfigEnumOption <T>(r.Configs.First()));
        }
Ejemplo n.º 18
0
        public UnitOfWork(IOptionsSnapshot <ConfigOption> options)
        {
            _dbOpion = options.Get("CzarCms");
            if (_dbOpion == null)
            {
                throw new ArgumentNullException(nameof(ConfigOption));
            }

            addEntities    = new Dictionary <object, Action>();
            updateEntities = new Dictionary <object, Action>();
            deleteEntities = new Dictionary <object, Action>();
        }
Ejemplo n.º 19
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="autoCreateWindow"></param>
        /// <param name="renderSystem"></param>
        /// <param name="windowTitle"></param>
        /// <returns></returns>
        public override RenderWindow CreateWindow(bool autoCreateWindow, GLRenderSystem renderSystem, string windowTitle)
        {
            RenderWindow autoWindow = null;

            if (autoCreateWindow)
            {
                int  width      = 800;
                int  height     = 600;
                int  bpp        = 32;
                bool fullScreen = false;

                ConfigOption optVM = ConfigOptions["Video Mode"];
                string       vm    = optVM.Value;
                int          pos   = vm.IndexOf('x');
                if (pos == -1)
                {
                    throw new Exception("Invalid Video Mode provided");
                }
                width  = int.Parse(vm.Substring(0, vm.IndexOf("x")));
                height = int.Parse(vm.Substring(vm.IndexOf("x") + 1));

                fullScreen = (ConfigOptions["Full Screen"].Value == "Yes");

                var          miscParams = new NamedParameterList();
                ConfigOption opt;

                opt = ConfigOptions["Color Depth"];
                if (opt != null && opt.Value != null && opt.Value.Length > 0)
                {
                    miscParams.Add("colorDepth", opt.Value);
                }

                opt = ConfigOptions["VSync"];
                if (opt != null && opt.Value != null && opt.Value.Length > 0)
                {
                    miscParams.Add("vsync", opt.Value);
                    //TODO : renderSystem.WaitForVerticalBlank = (bool)opt.Value;
                }

                opt = ConfigOptions["FSAA"];
                if (opt != null && opt.Value != null && opt.Value.Length > 0)
                {
                    miscParams.Add("fsaa", opt.Value);
                }

                miscParams.Add("title", windowTitle);

                // create the window with the default form as the target
                autoWindow = renderSystem.CreateRenderWindow(windowTitle, width, height, fullScreen, miscParams);
            }

            return(autoWindow);
        }
Ejemplo n.º 20
0
    public int GetIntValue(ConfigOption option)
    {
        for (uint i = 0; i < ConfigOptionCount; i++)
        {
            var o = GetOption(i);
            if (o->OptionID == option)
            {
                return(GetIntValue(i));
            }
        }

        return(0);
    }
Ejemplo n.º 21
0
    public Option *GetOption(ConfigOption option)
    {
        for (uint i = 0; i < ConfigOptionCount; i++)
        {
            var o = GetOption(i);
            if (o->OptionID == option)
            {
                return(o);
            }
        }

        return(null);
    }
Ejemplo n.º 22
0
 public void SetOption(ConfigOption option, int value)
 {
     for (uint i = 0; i < ConfigOptionCount; i++)
     {
         var o = GetOption(i);
         if (o->OptionID != option)
         {
             continue;
         }
         SetOption(i, value);
         return;
     }
 }
        public ConfigOptionViewModel(ConfigOption option)
        {
            Option     = option;
            OptionName = option.Name;
            IsSelected = false;
            IsExpanded = false;
            Children   = new List <ConfigOptionViewModel>();

            if (OptionName.StartsWith("==="))
            {
                OptionName = OptionName.Trim('=');
            }
        }
Ejemplo n.º 24
0
    public AtkValue *GetValue(ConfigOption option)
    {
        for (uint i = 0; i < ConfigOptionCount; i++)
        {
            var o = GetOption(i);
            if (o->OptionID == option)
            {
                return(GetValue(i));
            }
        }

        return(null);
    }
Ejemplo n.º 25
0
        private void _refreshConfig()
        {
            ConfigOption optVideoMode        = ConfigOptions["Video Mode"];
            ConfigOption optColorDepth       = ConfigOptions["Color Depth"];
            ConfigOption optDisplayFrequency = ConfigOptions["Display Frequency"];
            ConfigOption optFullScreen       = ConfigOptions["Full Screen"];

            string val = optVideoMode.Value;

            int pos = val.IndexOf('x');

            if (pos == -1)
            {
                throw new Exception("Invalid Video Mode provided");
            }
            int width  = Int32.Parse(val.Substring(0, pos));
            int height = Int32.Parse(val.Substring(pos + 1));

            foreach (Gdi.DEVMODE devMode in _deviceModes)
            {
                if (devMode.dmPelsWidth != width || devMode.dmPelsHeight != height)
                {
                    continue;
                }
                if (!optColorDepth.PossibleValues.Keys.Contains(devMode.dmBitsPerPel))
                {
                    optColorDepth.PossibleValues.Add(devMode.dmBitsPerPel, devMode.dmBitsPerPel.ToString());
                }
                if (!optDisplayFrequency.PossibleValues.Keys.Contains(devMode.dmDisplayFrequency))
                {
                    optDisplayFrequency.PossibleValues.Add(devMode.dmDisplayFrequency, devMode.dmDisplayFrequency.ToString());
                }
            }

            if (optFullScreen.Value == "No")
            {
                optDisplayFrequency.Value     = "N/A";
                optDisplayFrequency.Immutable = true;
            }
            else
            {
                optDisplayFrequency.Immutable = false;
                optDisplayFrequency.Value     = optDisplayFrequency.PossibleValues.Values[optDisplayFrequency.PossibleValues.Count - 1];
            }

            optColorDepth.Value = optColorDepth.PossibleValues.Values[optColorDepth.PossibleValues.Values.Count - 1];
            if (optDisplayFrequency.Value != "N/A")
            {
                optDisplayFrequency.Value = optDisplayFrequency.PossibleValues.Values[optDisplayFrequency.PossibleValues.Count - 1];
            }
        }
Ejemplo n.º 26
0
    public uint?GetIndex(ConfigOption option)
    {
        for (uint i = 0; i < ConfigOptionCount; i++)
        {
            var o = GetOption(i);
            if (o->OptionID != option)
            {
                continue;
            }
            return(i);
        }

        return(null);
    }
Ejemplo n.º 27
0
            internal static ConfigData Read(NetworkReader reader)
            {
                int count = reader.ReadInt32();
                Dictionary <string, ConfigOption> data = new Dictionary <string, ConfigOption>(count);

                for (int i = 0; i < count; i++)
                {
                    var keyString = reader.ReadString();
                    data[keyString] = ConfigOption.Read(reader);
                }

                return(new ConfigData {
                    data = data
                });
            }
Ejemplo n.º 28
0
        public override void AddConfig()
        {
            var optFullsreen        = new ConfigOption("Full Screen", "No", false);
            var optVideoMode        = new ConfigOption("Video Mode", "640 x 320", false);
            var optDisplayFrequenzy = new ConfigOption("Display Frequency", "60", false);
            var optFSAA             = new ConfigOption("FSAA", "1", false);
            var optRTTMode          = new ConfigOption("RTT Preferred Mode", "FBO", false);

            optFullsreen.PossibleValues.Add(0, "Yes");
            optFullsreen.PossibleValues.Add(1, "No");

            optFullsreen.Value = optFullsreen.PossibleValues[0];
            int index = 0;

            foreach (var mode in this._videoModes)
            {
                string resolution = mode.Key.Width + " x " + mode.Key.Height;
                if (!optVideoMode.PossibleValues.ContainsValue(resolution))
                {
                    optVideoMode.PossibleValues.Add(index++, resolution);
                }
            }
            index = 0;
            optVideoMode.Value = this._currentMode.Key.Width + " x " + this._currentMode.Key.Height;

            if (this._sampleLevels.Count > 0)
            {
                foreach (string fssa in this._sampleLevels)
                {
                    optFSAA.PossibleValues.Add(index++, fssa);
                }

                optFSAA.Value = optFSAA.PossibleValues[0];
            }

            optRTTMode.PossibleValues.Add(0, "FBO");
            optRTTMode.PossibleValues.Add(1, "PBuffer");
            optRTTMode.PossibleValues.Add(2, "Copy");
            optRTTMode.Value = optRTTMode.PossibleValues[0];

            _options[optFullsreen.Name]        = optFullsreen;
            _options[optVideoMode.Name]        = optVideoMode;
            _options[optDisplayFrequenzy.Name] = optDisplayFrequenzy;
            _options[optFSAA.Name]             = optFSAA;
            _options[optRTTMode.Name]          = optRTTMode;

            RefreshConfig();
        }
Ejemplo n.º 29
0
        public DeleteCommand(ConfigOption configOption, IServiceProvider serviceProvider, ILogger <DeleteCommand> logger)
            : base("delete", "Delete artifact")
        {
            AddArgument(new Argument <string>("id", "ID to delete"));

            Handler = CommandHandler.Create(async(string id, CancellationToken token) =>
            {
                if (!configOption.IsValid(logger))
                {
                    return(1);
                }

                await serviceProvider.GetRequiredService <DeleteActivity>().Delete(id, token);
                return(0);
            });
        }
Ejemplo n.º 30
0
        public ListCommand(ConfigOption configOption, IServiceProvider serviceProvider, ILogger <ListCommand> logger)
            : base("list", "List artifacts")
        {
            AddArgument(new Argument <string>("nameSpace", "Namespace to list"));

            Handler = CommandHandler.Create(async(string nameSpace, CancellationToken token) =>
            {
                if (!configOption.IsValid(logger))
                {
                    return(1);
                }

                await serviceProvider.GetRequiredService <ListActivity>().List(nameSpace, token);
                return(0);
            });
        }
 public static extern Result sqlite3_config(ConfigOption option);
Ejemplo n.º 32
0
 public Result Config(ConfigOption option)
 {
     return SQLiteApiWin32Internal.sqlite3_config(option);
 }
 public Result Config(ConfigOption option)
 {
     return SQLiteApiAndroidCipherInternal.sqlite3_config (option);
 }
Ejemplo n.º 34
0
        public void ProcessFile(FileInfo file)
        {
            string[] lines = File.ReadAllLines(file.FullName);

            Class cls = null;
            string line = "";
            bool isMetaOrConfigOption = false;

            List<string> comments = new List<string>();
            List<MetaAttribute> attributes = new List<MetaAttribute>();

            for (int i = 0; i < lines.Length; i++)
            {
                line = lines[i].Trim();

                if (Utils.IsComment(line))
                {
                    comments.Add(line.RightOf("///").Trim());
                    continue;
                }

                if (Utils.IsAttribute(line))
                {
                    MetaAttribute attr = new MetaAttribute(line);
                    attributes.Add(attr);

                    if (attr.Type == "Meta" || attr.Type == "ConfigOption")
                    {
                        isMetaOrConfigOption = true;
                    }

                    continue;
                }

                if (Utils.IsClass(line))
                {
                    if (cls != null)
                    {
                        this.Root.Classes.Add(cls);
                    }

                    cls = new Class(line);

                    cls.RawComments = comments;
                    cls.Attributes = attributes;

                    comments = new List<string>();
                    attributes = new List<MetaAttribute>();

                    continue;
                }

                /* This is only required for Ext.Net.API.Meta.Parser.exe which is currently not in use.
                 * So, commented out for now and review when Ext.Net.API.Meta.Parser will be in use again if ever.

                if (Utils.IsXType(line))
                {
                    var temp = lines[i + 4].Trim();

                    if (temp.StartsWith("return"))
                    {
                        cls.XType = temp.RightOf('"').Replace("\"", "").Replace(" ", "").Replace(";", "").Replace(":", ",").Trim();
                    }

                    continue;
                }

                if (Utils.IsInstanceOf(line))
                {
                    var temp = lines[i + 4].Trim();

                    if (temp.StartsWith("return"))
                    {
                        cls.InstanceOf = temp.RightOf('"').Replace("\"", "").Replace(" ", "").Replace(";", "").Replace(":", ",").Trim();
                    }

                    continue;
                }
                */

                if (cls != null && isMetaOrConfigOption)
                {
                    isMetaOrConfigOption = false;

                    if (Utils.IsProperty(line))
                    {
                        ConfigOption member = new ConfigOption(line);

                        member.RawComments = comments;
                        member.Attributes = attributes;

                        cls.ConfigOptions.Add(member);

                        comments = new List<string>();
                        attributes = new List<MetaAttribute>();

                        continue;
                    }

                    if (Utils.IsMethod(line))
                    {
                        Method member = new Method(line);

                        member.RawComments = comments;
                        member.Attributes = attributes;

                        cls.Methods.Add(member);

                        comments = new List<string>();
                        attributes = new List<MetaAttribute>();

                        continue;
                    }
                }

                isMetaOrConfigOption = false;
                comments = new List<string>();
                attributes = new List<MetaAttribute>();
            }

            if (cls != null && cls.Name.IsNotEmpty())
            {
                this.Root.Classes.Add(cls);
            }
        }
Ejemplo n.º 35
0
    static int test_config(
    object clientdata,
    Tcl_Interp interp,
    int objc,
    Tcl_Obj[] objv
    )
    {
      ConfigOption[] aOpt = new ConfigOption[] {
new ConfigOption("singlethread", SQLITE_CONFIG_SINGLETHREAD),
new ConfigOption("multithread",  SQLITE_CONFIG_MULTITHREAD),
new ConfigOption("serialized",   SQLITE_CONFIG_SERIALIZED),
new ConfigOption(null,0)
};
      int s = aOpt.Length;//sizeof(struct ConfigOption);
      int i = 0;
      int rc;

      if ( objc != 2 )
      {
        TCL.Tcl_WrongNumArgs( interp, 1, objv, "" );
        return TCL.TCL_ERROR;
      }

      if ( Tcl_GetIndexFromObjStruct( interp, objv[1], aOpt, s, "flag", 0, ref i ) )
      {
        if ( TCL.Tcl_GetIntFromObj( interp, objv[1], ref i ) )
        {
          return TCL.TCL_ERROR;
        }
      }
      else
      {
        i = aOpt[i].iValue;
      }

      rc = sqlite3_config( i );
      TCL.Tcl_SetResult( interp, sqlite3TestErrorName( rc ), TCL.TCL_VOLATILE );
      return TCL.TCL_OK;
    }
Ejemplo n.º 36
0
 public Result Config(ConfigOption option)
 {
     throw new NotSupportedException();
 }
Ejemplo n.º 37
0
 /// <summary>
 /// 参数配置项保存后处理逻辑,一般用于重要配置项 发消息通知其他系统进行配置项更新
 /// </summary>
 /// <param name="value">当前保存的参数</param>
 public virtual void AfterSave(ConfigOption value)
 {
 }
		public Result Config (ConfigOption option)
		{
			throw new NotImplementedException ();
		}
Ejemplo n.º 39
0
 public ConfigOption SaveConfigOption(ConfigOption data)
 {
     try {
     SetService();  return SerClient.SaveConfigOption(data); }
     finally
     {
         SerClient.Close();
         if (SerClient.State == CommunicationState.Faulted)
         SerClient.Abort(); 
     }
 }
Ejemplo n.º 40
0
        public virtual string Compile(ConfigOption member)
        {
            string privateName = member.Name.ToLowerCamelCase();
            string serializationOptions = "null";

            MetaAttribute configOptionAttribute = member.Attributes.Find(delegate(MetaAttribute attr) { return attr.Type.Equals("ConfigOption"); });

            if (configOptionAttribute != null && configOptionAttribute.Value.IsNotEmpty())
            {
                serializationOptions = "new SerializationOptions({0})".FormatWith(configOptionAttribute.Value);
            }

            var obj = new
            {
                Name = member.Name,
                PrivateName = privateName.IsReservedWord() ? "_" + privateName : privateName,
                LowerCamelName = privateName,
                Type = member.Type,
                DefaultValue = member.DefaultValue ?? "null",
                PrivateValue = member.PrivateValue ?? "null",
                Summary = member.Summary,
                Modifier = member.Modifier.ToString().ToLower(),
                SerializationOptions = serializationOptions
            };

            string template = member.DefaultValue != null ? member.Type : "instance";

            if (member.Template.IsNotEmpty())
            {
                template = member.Template;
            }

            return this.Compile(obj, template);
        }
Ejemplo n.º 41
0
 public void DeleteConfigOption(ConfigOption data)
 {
     try {
     SetService();  SerClient.DeleteConfigOption(data); }
     finally
     {
         SerClient.Close();
         if (SerClient.State == CommunicationState.Faulted)
         SerClient.Abort(); 
     }
 }
Ejemplo n.º 42
0
 public static extern Result Config(ConfigOption option);
Ejemplo n.º 43
0
 public Result Config(ConfigOption option)
 {
     if (_useWinSqlite)
     {
         return (Result)WinSQLite3.Config(option);
     }
     else
     {
         return (Result)SQLite3.Config(option);
     }
 }
Ejemplo n.º 44
0
 public Result Config(ConfigOption option)
 {
     return (Result)SQLite3.Config(option);
 }
Ejemplo n.º 45
0
 static bool Tcl_GetIndexFromObjStruct( Interp interp, TclObject to, ConfigOption[] table, int s, string msg, int flags, ref int index )
 {
   try
   {
     for ( index = 0 ; index < table.Length ; index++ )
     { if ( table[index].zName == msg ) return false; }
     return true;
   }
   catch { return true; }
 }