private void TryChangingCurrentConfigValue(ConfigValue configValue)
        {
            var y = 0;

            switch (configValue)
            {
                case ConfigValue.CombatantsCount:
                    y = 10;
                    break;

                case ConfigValue.CycleTime:
                    y = 115;
                    break;

                case ConfigValue.DojoTime:
                    y = 185;
                    break;
            }

            if (TryStartStoryboard(y))
            {
                _vm.ActiveValue = configValue;
                AdjustScrollbarTooltip(configValue);
            }
        }
 public DynamicKeyBind(ConfigValue key, string displayName, bool defaultValue, KeyBind.BindTypes type, uint defaultKey1 = 27, uint defaultKey2 = 27)
 {
     _configKey = key;
     KeyBind = new KeyBind(displayName, defaultValue, type, defaultKey1, defaultKey2);
     Properties.SetValue(_configKey, KeyBind.CurrentValue);
     KeyBind.OnValueChange += KeyBind_OnValueChange;
 }
        public BaseResponse UpdateKey(ConfigValueUpdateViewModel configValueModel)
        {
            ConfigValue  model    = Mapper.Map <ConfigValue>(configValueModel);
            BaseResponse response = _configurationService.UpdateConfigValue(model);

            return(response);
        }
 public override void SetValue(ConfigValue key, object value, bool raiseEvent = true)
 {
     base.SetValue(key, value, raiseEvent);
     var name = key.Name().ToLower();
     if (name.Contains("key") && !name.Contains("keys")) return;
     if (Saved) Saved = false; //Saying that a value has changed.
     
 }
 /// <summary>
 /// 初始化华文字语言库
 /// </summary>
 private void IntiFontLib()
 {
     config  = (ConfigValue)m_ClientEvent.GetInfo("INI");
     dgTable = new DataTable();
     dgTable.Columns.Add("跋");
     dgTable.Columns.Add("IndexID");
     dgTable.Columns.Add("眀腹");
 }
        public static DataTable GetDataTable(CSocketEvent mEvent, CEnum.Message_Body[,] val, out int PageCount)
        {
            ConfigValue config = (ConfigValue)mEvent.GetInfo("INI");

            DataTable mDataTable = BuildColumn(mEvent, val);

            return(BuildRow(mEvent, val, mDataTable, out PageCount));
        }
Exemple #7
0
 private static void LoadConfig()
 {
     Config = new JsonConfig();
     Config.LoadConfig(Resources.Config);
     Config.LoadConfig(Resources.View);
     Config["RootPath"]     = new ConfigValue(Application.StartupPath);
     Config["ResourcePath"] = new ConfigValue($"{Config["GamePath"]}/ImagePacks2");
 }
Exemple #8
0
 public static void SetValue(ConfigValue key, object value, bool raiseEvent = true)
 {
     Values[key] = value;
     if (OnConfigValueChanged != null && raiseEvent)
     {
         OnConfigValueChanged.Invoke(new ConfigValueChangedArgs(key, value));
     }
 }
        public static DataTable BuildDataTableItemAdd(CSocketEvent mEvent, CEnum.Message_Body[,] val, System.Windows.Forms.DataGridView mGrid, out int PageCount)
        {
            ConfigValue config     = (ConfigValue)mEvent.GetInfo("INI");
            DataTable   mDataTable = BuildColumnItemAdd(mEvent, val);

            mGrid.DataSource = BuildRowItemAdd(mEvent, val, mDataTable, out PageCount);
            return(null);
        }
Exemple #10
0
 public override void Save()
 {
     Config["GamePath"]        = new ConfigValue(gamePathBox.Text);
     Config["ResourcePath"]    = new ConfigValue($"{gamePathBox.Text}\\{NpkCoder.IMAGE_DIR}");
     Config["AutoSave"]        = new ConfigValue(autoSaveCheck.Checked);
     Config["AutoCheckUpdate"] = new ConfigValue(autoUpdateCheck.Checked);
     Config["ShowFeature"]     = new ConfigValue(updatedShowFeatureCheck.Checked);
 }
Exemple #11
0
 public DynamicComboBox(ConfigDataType type, ConfigValue key, string displayName, int defaultValue, string[] values)
 {
     _configKey                       = key;
     _type                            = type;
     ComboBox                         = new ComboBox(displayName, defaultValue, values);
     ComboBox.OnValueChange          += ComboBox_OnValueChange;
     Properties.OnConfigValueChanged += Properties_OnConfigValueChanged;
 }
Exemple #12
0
        public void ConfigValue(string name, ConfigValue value)
        {
            var cfgDelta = new ConfigDelta {
                Key = name, Value = value
            };

            m_configDeltaMap.AddOrUpdate(name, cfgDelta, (a, b) => cfgDelta);
        }
Exemple #13
0
        private ConfigValue GetValue(int index, uint[] types, uint strSecOffset)
        {
            ConfigValue    val    = new ConfigValue();
            BinaryReaderBE reader = new BinaryReaderBE(this.file.BaseStream);

            // Get the type 32bits value from the array
            uint type = types[0];

            for (int i = 1; i < types.Length && index >= (i == 1 ? 12 : 16); i++)
            {
                type   = types[i];
                index -= (i == 1 ? 12 : 16);
            }

            // The value with the info type is stored in separated 8bits (a byte) values
            // here it takes the correct 8bits value for the index.
            uint info = 0;

            info = (00 <= index && index < 04) ? (type >> 24) & 0xFF : info;
            info = (04 <= index && index < 08) ? (type >> 16) & 0xFF : info;
            info = (08 <= index && index < 12) ? (type >> 08) & 0xFF : info;
            info = (12 <= index && index < 16) ? (type >> 00) & 0xFF : info;

            // Get the type
            val.Type = (byte)((info >> ((index % 4) * 2)) & 3);

            switch (val.Type)
            {
            case 0:         // String
                int offset = reader.ReadInt32();
                if (offset == -1)
                {
                    val.Value = string.Empty;     //"<Empty>";
                }
                else
                {
                    reader.BaseStream.Position = this.file.Position + strSecOffset + offset;
                    val.Value = reader.ReadString();
                }

                break;

            case 1:         // Integer
                val.Value = reader.ReadUInt32();
                break;

            case 2:         // Single value, IEEE-754
                val.Value = reader.ReadSingle();
                break;

            case 3:
                val.Value = null;
                break;
            }

            reader = null;
            return(val);
        }
Exemple #14
0
 public void Replace(object sender, EventArgs e)
 {
     Config["SaveImagePath"]    = new ConfigValue(pathBox.Text);
     Config["SaveImageTip"]     = new ConfigValue(!tipsCheck.Checked);
     Config["SaveImageAllPath"] = new ConfigValue(allPathCheck.Checked);
     Config.Save();
     Connector.Do("saveImage", Album, 1, Indexes, pathBox.Text);
     DialogResult = DialogResult.OK;
 }
 public virtual void SetValue(ConfigValue key, object value, bool raiseEvent = true)
 {
     if((key.IsInt() && (value is int || value is float)) || (key.IsBool() && value is bool))
         if (Values.ContainsKey(key))
             Values[key] = value;
         else
             Values.Add(key, value);
     if(raiseEvent) Properties.OnValueChanged(key, value);
 }
        private static T[] PrimitiveArrayValue <T>(this ConfigValue value)
        {
#if !STENCIL_JSON_NET
            Debug.LogError("Json.net disabled. Not parsing conversion.");
            return(null);
#else
            return(JsonConvert.DeserializeObject <T[]>(value.StringValue));
#endif
        }
        public static object GetValue(this ConfigValue value, Type type)
        {
            if (type.TypeEquals <string>())
            {
                return(value.StringValue);
            }
            if (type.TypeEquals <long>())
            {
                return(value.LongValue);
            }
            if (type.TypeEquals <int>())
            {
                return(Convert.ToInt32(value.LongValue));
            }
            if (type.TypeEquals <double>())
            {
                return(value.DoubleValue);
            }
            if (type.TypeEquals <float>())
            {
                return(Convert.ToSingle(value.DoubleValue));
            }
            if (type.TypeEquals <bool>())
            {
                return(value.BooleanValue);
            }
            if (type.TypeEquals <Color>())
            {
                return(value.ColorValue(Color.white));
            }
            if (type.TypeEquals <Color[]>())
            {
                return(value.ColorArrayValue());
            }
            if (type.TypeEquals <int[]>())
            {
                return(value.IntArrayValue());
            }
            if (type.TypeEquals <long[]>())
            {
                return(value.LongArrayValue());
            }
            if (type.TypeEquals <float[]>())
            {
                return(value.FloatArrayValue());
            }
            if (type.TypeEquals <double[]>())
            {
                return(value.DoubleArrayValue());
            }
            if (type.TypeEquals <string[]>())
            {
                return(value.StringArrayValue());
            }

            throw new Exception($"RemoteConfig got confused by {type}");
        }
Exemple #18
0
 private void Replace(object sender, EventArgs e)
 {
     Config["SaveImagePath"]     = new ConfigValue(pathBox.Text);
     Config["SaveImageTip"]      = new ConfigValue(!tipsCheck.Checked);
     Config["SaveImageFullPath"] = new ConfigValue(fullPathCheck.Checked);
     Config["SaveAllImage"]      = new ConfigValue(allImagesCheck.Checked);
     Config.Save();
     DialogResult = Save();
 }
        public ConfigValueViewModel Get(string path, string key)
        {
            string[] pathParts = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);

            ConfigValue          value    = _configurationService.GetConfigValue(pathParts, key);
            ConfigValueViewModel response = Mapper.Map <ConfigValueViewModel>(value);

            return(response);
        }
Exemple #20
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void connectorSettingHasItsOwnValues()
        public virtual void ConnectorSettingHasItsOwnValues()
        {
            Config config = Config.builder().withServerDefaults().withSetting((new HttpConnector("http")).address, "localhost:123").build();

            ConfigValue address = config.ConfigValues.SetOfKeyValuePairs().Where(c => c.Key.Equals("dbms.connector.http.address")).Select(DictionaryEntry.getValue).First().orElseThrow(() => new Exception("Setting not present!"));

            assertTrue(address.Deprecated());
            assertEquals("dbms.connector.http.listen_address", address.Replacement());
        }
 protected override void OnVisibleChanged(EventArgs e)
 {
     base.OnVisibleChanged(e);
     Config["AutoTrim"]           = new ConfigValue(autoTrimCheck.Checked);
     Config["AutoSort"]           = new ConfigValue(autoSortCheck.Checked);
     Config["MergeCompletedHide"] = new ConfigValue(completedHideCheck.Checked);
     Config["GlowLayerMode"]      = new ConfigValue(glowLayerBox.SelectedIndex);
     Config.Save();
 }
        /// <summary>
        /// 构造 DataGridView 列
        /// </summary>
        /// <param name="val">数据</param>
        /// <param name="mDataRow">DataRow</param>
        /// <returns>DataRow</returns>
        private static DataTable BuildRow(CSocketEvent mEvent, CEnum.Message_Body[,] m_val, DataTable mTable, out int PageCount)
        {
            try
            {
                PageCount = 0;
                ConfigValue config = (ConfigValue)mEvent.GetInfo("INI");
                CEnum.Message_Body[,] val = m_val;
                for (int i = 0; i < val.GetLength(0); i++)
                {
                    DataRow mRow = mTable.NewRow();

                    for (int j = 0; j < val.GetLength(1); j++)
                    {
                        if (val[i, j].eName != CEnum.TagName.PageCount && val[i, j].eName != CEnum.TagName.FJ_BoardFlag)
                        {
                            if (val[i, j].eName == CEnum.TagName.FJ_Sex)
                            {
                                if (val[i, j].oContent.ToString().Equals("0"))
                                {
                                    val[i, j].oContent = config.ReadConfigValue("MSDO", "OP_Code_Msex");
                                }
                                //mRow[(string)mEvent.DecodeFieldName(val[i, j].eName)] = config.ReadConfigValue("MSDO", "OP_Code_Fsex");
                                else
                                {
                                    val[i, j].oContent = config.ReadConfigValue("MSDO", "OP_Code_Fsex");
                                }
                                //mRow[(string)mEvent.DecodeFieldName(val[i, j].eName)] = config.ReadConfigValue("MSDO", "OP_Code_Msex");
                            }

                            if (val[i, j].oContent == null)
                            {
                                mRow[(string)config.ReadConfigValue("GLOBAL", val[i, j].eName.ToString())] = "N/A";
                                //mRow[(string)mEvent.DecodeFieldName(val[i, j].eName)] = "N/A";
                            }
                            else
                            {
                                mRow[(string)config.ReadConfigValue("GLOBAL", val[i, j].eName.ToString())] = val[i, j].oContent.ToString();
                                //mRow[(string)mEvent.DecodeFieldName(val[i, j].eName)] = val[i, j].oContent;
                            }
                        }
                        else
                        {
                            PageCount = int.Parse(val[i, j].oContent.ToString());
                        }
                    }

                    mTable.Rows.Add(mRow);
                }

                return(mTable);
            }
            catch (Exception ex)
            {
                PageCount = 0;
                return(null);
            }
        }
Exemple #23
0
        internal static void Initialize()
        {
            var config = System.Configuration.ConfigurationManager.AppSettings;

            modelName    = config.Get("ModelName");
            UserToExport = config.Get("UserToExport");
            var _testConfiguration = new ConfigValue("TestConfig", config.Get("Domain"), config.Get("UserName"), config.Get("Password"), new Uri(config.Get("MDSInstance1")), global::Common.BindingType.WSHttpBinding);

            MDSWrapper.Configuration = _testConfiguration;
        }
        public override bool TryPack(object value, out string result)
        {
            ConfigValue configValue = null;
            var         ok          = getMarshaller(value.GetType())
                                      ?.TryPack(((dynamic)value).ToArray(), out configValue) ?? false;

            result = ok ? configValue.Value : null;

            return(ok);
        }
Exemple #25
0
        public void DeleteConfigValue(string configname)
        {
            ConfigValue configValue = ConfigValues.FirstOrDefault(t => t.ConfigName == configname);

            if (configValue != null)
            {
                ConfigValues.Remove(configValue);
            }
            SaveConfig();
        }
Exemple #26
0
        public bool Read(MyMessageReader msg)
        {
            int configValues = 0;

            var result = msg.ReadInt32(ref configValues) &&
                         msg.ReadInt32(ref TimeBombTimer) &&
                         msg.ReadUInt32(ref ShipId);

            m_config = (ConfigValue)configValues;
            return(result);
        }
Exemple #27
0
        /// <summary>
        /// Get ConfigSetting by Id
        /// </summary>
        public EntityResponse <ConfigValue> GetConfigValueById(int id)
        {
            ConfigValue setting = Uow.ConfigValues.GetById(id);

            if (setting == null)
            {
                return(ErrorCode.ConfigurationSectionNotFound);
            }

            return(setting);
        }
Exemple #28
0
        private void SetCbSonumSelection(ConfigValue config)
        {
            if (File.Exists(config.ExpressDataPath + @"\isrun.dbf"))
            {
                this.isrun = MainForm.LoadIsrunFromDBF(config).Where(i => i.doctyp == "SO").OrderBy(i => i.prefix).ToList();

                this.cbSoNum.AddItem(this.isrun, true);
                var doc = this.isrun.Where(i => i.prefix == this.selected_doc).FirstOrDefault();
                this.cbSoNum.Text = (doc != null ? "[" + doc.prefix + "] " + doc.posdes : "");
            }
        }
Exemple #29
0
            public void SelectPath()
            {
                var dialog = new FolderBrowserDialog();

                dialog.SelectedPath = Config["GamePath"].Value;
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    Config["GamePath"] = new ConfigValue(dialog.SelectedPath);
                    Config.Save();
                }
            }
        public bool Read(MyMessageReader msg)
        {
            int configValues = 0;

            var result = msg.ReadInt32(ref configValues)
                && msg.ReadInt32(ref TimeBombTimer)
                && msg.ReadUInt32(ref ShipId);

            m_config = (ConfigValue)configValues;
            return result;
        }
Exemple #31
0
        public static void SetInstanceSettingsValue(string key, string value)
        {
            Dictionary <string, ConfigValue> config = CopyInstanceSettings();
            ConfigValue current;

            if (!config.TryGetValue(key, out current) || (current.Value != value))
            {
                config[key] = new ConfigValue(value);
                SetInstanceSettings(config);
            }
        }
        public void BasicTest()
        {
            AppConfig appConfig = new AppConfig();

            Present(appConfig, "Defined Config");

            var configExtension = new ConfigValue <Point>(SensorExtension.Location, new Point(200, 300));

            appConfig.Add(configExtension);

            Present(appConfig, "Extended Config");
        }
        public async Task <IActionResult> PostConfigValue([FromBody] ConfigValue configValue)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            this.dataContext.ConfigValues.Add(configValue);
            await this.dataContext.SaveChangesAsync();

            return(CreatedAtAction("GetConfigValue", new { id = configValue.Id }, configValue));
        }
        public ExchangeMoreInfo(string sss, CEnum.Message_Body[,] val, CSocketEvent m_ClientEvent)
        {
            ConfigValue config = (ConfigValue)m_ClientEvent.GetInfo("INI");

            this.Text = config.ReadConfigValue("MAUDITION", "EMI_UI_ExchangeMoreInfo");
            InitializeComponent();

            LblUser.Text = config.ReadConfigValue("MAUDITION", "EMI_Code_LblUser").Replace("{user}", sss);
            //LblUser.Text = "玩家 " + sss + " 的兑换记录详细信息:";

            Operation_Shop.BuildDataTable(m_ClientEvent, val, GrdInfo, out iPageCount);
        }
 public override void Save()
 {
     Config["SaveImageTip"]      = new ConfigValue(promptCheck.Checked);
     Config["SaveImageFullPath"] = new ConfigValue(fullPathCheck.Checked);
     Config["SaveImagePath"]     = new ConfigValue(savePathBox.Text);
     foreach (var box in converterList)
     {
         var converter = box.Tag as IEffect;
         Config[$"{converter.Name}SpriteConverter"] = new ConfigValue(box.Checked);
         converter.Enable = box.Checked;
     }
 }
        private void AdjustScrollbarTooltip(ConfigValue configValue)
        {
            switch (configValue)
            {
                case ConfigValue.CombatantsCount:
                    scrollBar.ToolTip = CodingDojoHelper.Resources.DefineNumberOfCombatants;
                    break;

                case ConfigValue.CycleTime:
                    scrollBar.ToolTip = CodingDojoHelper.Resources.DefineCycleTime;
                    break;

                case ConfigValue.DojoTime:
                    scrollBar.ToolTip = CodingDojoHelper.Resources.DefineDojoTime;
                    break;
            }
        }
		public void SetBoolean(string key, bool b)
		{
			values[key] = new ConfigValue(b);
		}
Exemple #38
0
 public static bool SetTo(this bool value, ConfigValue key)
 {
     SetBool(key, value);
     return value;
 }
 public DynamicSlider(ConfigDataType configDataType, ConfigValue key, string displayName, int defaultValue, int minValue, int maxValue)
 {
     _type = configDataType;
     _configKey = key;
     DynamicSliderInit(displayName, defaultValue, minValue, maxValue, false, SpellConfigProperty.None);
 }
Exemple #40
0
 public static int SetTo(this int value, ConfigValue key)
 {
     SetInt(key, value);
     return value;
 }
Exemple #41
0
 public static int SetTo(this float value, ConfigValue key)
 {
     SetInt(key, (int) value);
     return (int) value;
 }
 public static int GetInt(ConfigValue key)
 {
     return ConfigPluginControler.SelectedPreset.GetInt(key);
 }
		public void SetString(string key, string value)
		{
			values[key] = new ConfigValue(value);
		}
 public static ConfigValue BuildConfigValue(ref SQLiteDataReader reader)
 {
     ConfigValue value = new ConfigValue() { Key = reader["Key"].ToString(), Value = reader["Value"].ToString() };
     return value;
 }
        /// <summary>
        /// Gets an <see cref="int"/> from the config database.
        /// </summary>
        /// <param name="value">The config value wanted from the database. (Must be a value less than 255)</param>
        /// <returns></returns>
        public virtual int GetInt(ConfigValue value)
        {
            if ((short)value > Constants.ValueSeperator)
                throw new ArgumentOutOfRangeException(
                    "ConfigValue is not within the range of integer options! (< " + Constants.ValueSeperator + ", value: " + (short)value + ":" +
                    value + ")");
            if (!Values.ContainsKey(value))
                throw new ArgumentException("Value not found within database! (value: "
                                            + (short)value + ":" + value + ")");
            return (int)Values[value];

        }
Exemple #46
0
 public ConfigValueChangedArgs(ConfigValue key, object value)
 {
     Key = key;
     Value = value;
 }
		public void SetAutocomplete(string newKey, List<AutocompleteData> ad)
		{
			if (ad == null)
				return;

			values[newKey] = new ConfigValue(ad);
		}
Exemple #48
0
 public static void SetValue(ConfigValue key, object value, bool raiseEvent = true)
 {
     Values[key] = value;
     if(OnConfigValueChanged != null && raiseEvent) OnConfigValueChanged.Invoke(new ConfigValueChangedArgs(key, value));
 }
Exemple #49
0
 public static void OnValueChanged(ConfigValue key, object value)
 {
     if(OnConfigValueChanged != null) OnConfigValueChanged.Invoke(new ConfigValueChangedArgs(key, value));
 }
		public void SetListOfStrings(string key, List<string> list)
		{
			if (list == null)
				return;

			values[key] = new ConfigValue(list);
		}
 public static void SetValue(ConfigValue key, object value, bool raiseEvent = true)
 {
     ConfigPluginControler.SelectedPreset.SetValue(key, value, raiseEvent);
 }
		public void UpdateAutocomplete(string key, string url, int count = -1)
		{
			if (values.ContainsKey(key))
			{
				var obj = values[key];

				if (obj.boxedType == ConfigValue.Type.AutocompleteList)
				{
					var acl = (List<AutocompleteData>)obj.boxedValue;
					int updated = acl.Update(p => p.url == url,
						upd => new AutocompleteData(upd.url, count == -1 ? upd.count + 1 : count));

					if (updated == 0)
						acl.Add(new AutocompleteData(url, count == -1 ? 1 : count));
				}
				else
					throw new Exception("bad type");
			}
			else
			{
				List<AutocompleteData> lst = new List<AutocompleteData>();
				lst.Add(new AutocompleteData(url, count == -1 ? 1 : count));
				values[key] = new ConfigValue(lst);
			}
		}
 public static bool GetBool(ConfigValue key)
 {
     return ConfigPluginControler.SelectedPreset.GetBoolean(key);
 }
        /// <summary>
        /// Gets a <see cref="bool"/> from the config database.
        /// </summary>
        /// <param name="value">The config value wanted from the database. (Must be a value less than 255)</param>
        /// <returns></returns>
        public virtual bool GetBoolean(ConfigValue value)
        {
            if ((short)value < Constants.ValueSeperator)
                throw new ArgumentOutOfRangeException(
                    "ConfigValue is not within the range of boolean options! (> " + Constants.ValueSeperator + ", value: " + (short)value + ":" +
                    value + ")");
            if (!Values.ContainsKey(value))
                throw new ArgumentException("Value not found within database! (value: "
                                            + (short)value + ":" + value + ")");
            return (bool)Values[value];

        }
Exemple #55
0
 public static bool GetBool(ConfigValue key)
 {
     return (bool)Values[key];
 }
 public DynamicCheckBox(ConfigDataType configDataType, ConfigValue key, string displayName, bool defaultValue)
 {
     _type = configDataType;
     _configKey = key;
     DynamicCheckBoxInit(displayName, defaultValue, false, SpellConfigProperty.None);
 }
		public void SetInt(string key, int value)
		{
			values[key] = new ConfigValue(value);
		}
Exemple #58
0
 public static int GetInt(ConfigValue key)
 {
     return (int)Values[key];
 }