private void SetValue(SettingsPropertyValue propVal)
        {
            XmlElement newChild = null;

            try {
                newChild = (XmlElement)SettingsXML.SelectSingleNode("Settings/" + propVal.Name);
            }
            catch (Exception) {
                newChild = null;
            }
            if (newChild != null)
            {
                newChild.InnerText = propVal.SerializedValue.ToString();
            }
            else
            {
                newChild           = SettingsXML.CreateElement(propVal.Name);
                newChild.InnerText = propVal.SerializedValue.ToString();
                var selectSingleNode = SettingsXML.SelectSingleNode("Settings");
                if (selectSingleNode != null)
                {
                    selectSingleNode.AppendChild(newChild);
                }
            }
        }
        public override void SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection propvals)
        {
            //Iterate through the settings to be stored
            //Only dirty settings are included in propvals, and only ones relevant to this provider
            foreach (SettingsPropertyValue propval in propvals)
            {
                SetValue(propval);
            }

            try
            {
                if (Program.customConfigFile != "")
                {
                    SettingsXML.Save(Path.Combine(GetAppSettingsPath(), Program.customConfigFile));
                }
                else
                {
                    SettingsXML.Save(Path.Combine(GetAppSettingsPath(), GetAppSettingsFilename()));
                }
            }
            catch (Exception ex)
            {
            }
            //Ignore if cant save, device been ejected
        }
Exemplo n.º 3
0
    public override void SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection propvals)
    {
        //Iterate through the settings to be stored
        //Only dirty settings are included in propvals, and only ones relevant to this provider
        foreach (SettingsPropertyValue propval in propvals)
        {
            SetValue(propval);
        }

        try
        {
            string settingsFile = System.IO.Path.Combine(GetAppSettingsPath(), GetAppSettingsFilename());

            if (!File.Exists(settingsFile))
            {
                Directory.CreateDirectory(GetAppSettingsPath());
                File.Create(settingsFile).Close();
            }

            SettingsXML.Save(System.IO.Path.Combine(GetAppSettingsPath(), GetAppSettingsFilename()));
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    }
Exemplo n.º 4
0
        public override void SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection propvals)
        {
            this.CalcSettingsFilename(context);

            //Iterate through the settings to be stored
            //Only dirty settings are included in propvals, and only ones relevant to this provider
            foreach (SettingsPropertyValue propval in propvals)
            {
                SetValue(propval);
            }

            try
            {
                string directoryName = Path.GetDirectoryName(m_xmlFileName);
                if (!Directory.Exists(directoryName))
                {
                    Directory.CreateDirectory(directoryName);
                }

                SettingsXML.Save(m_xmlFileName);
            }
            catch
            {
                //Ignore if cant save, device been ejected
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Iterate through the settings to be stored
 /// Only dirty settings are included in propvals, and only ones relevant to this provider
 /// </summary>
 /// <param name="context"></param>
 /// <param name="propvals"></param>
 public override void SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection propvals)
 {
     foreach (SettingsPropertyValue propval in propvals)
     {
         SetValue(propval);
     }
     SettingsXML.Save(Path.Combine(GetAppSettingsPath(), GetAppSettingsFilename()));
 }
Exemplo n.º 6
0
        public void SaveSetMain(SettingsXML config, string fileName)
        {
            XmlSerializer xml = new XmlSerializer(typeof(SettingsXML));

            using (StreamWriter sw = new StreamWriter(fileName))
            {
                xml.Serialize(sw, config);
            }
        }
        private string GetValue(SettingsProperty setting)
        {
            var selectSingleNode = SettingsXML.SelectSingleNode("Settings/" + setting.Name);

            if (selectSingleNode != null)
            {
                return(selectSingleNode.InnerText);
            }
            return(setting.DefaultValue != null?setting.DefaultValue.ToString() : "");
        }
Exemplo n.º 8
0
        /// <summary>
        /// 設定XML生成
        /// </summary>
        private void InitializeSetting()
        {
            // 設定インスタンス
            SettingsXML oSettingsXML = new SettingsXML();

            // 画面初期化
            oSettingsXML.setDefaultData();
            // 画面設定値設定
            oSettingsXML.setSettingData();
        }
Exemplo n.º 9
0
        private void LoadSetXML()
        {
            if (File.Exists(sSettings))
            {
                YourSets = LoadSettings(sSettings);
            }
            else
            {
                YourSets = new SettingsXML
                {
                    MenuKey       = Keys.L,
                    Spawn         = false,
                    Locate        = true,
                    Saved         = false,
                    DisableRecord = false,
                    KeepWeapons   = false,
                    BeltUp        = false,
                    Version       = 0,
                    LangSupport   = 0,
                    Reincarn      = false,
                    ReCritter     = true,
                    ReCurr        = false,
                    ReSave        = false,
                    YourWeaps     = new List <WeaponSaver>(),
                    BeachPart     = true,

                    BeachPed    = true,
                    Tramps      = true,
                    Highclass   = true,
                    Midclass    = true,
                    Lowclass    = true,
                    Business    = true,
                    Bodybuilder = true,
                    GangStars   = true,
                    Epsilon     = true,
                    Jogger      = true,
                    Golfer      = true,
                    Hiker       = true,
                    Methaddict  = true,
                    Rural       = true,
                    Cyclist     = true,
                    LGBTWXYZ    = true,
                    PoolPeds    = true,
                    Workers     = true,
                    Jetski      = true,
                    BikeATV     = true,
                    Services    = true,
                    Pilot       = true,
                    Animals     = true,
                    Yankton     = true,
                    Cayo        = true,
                    RandStarts  = BuildRandStartsList()
                };
            }
        }
 public override void SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection propvals)
 {
     foreach (SettingsPropertyValue value2 in propvals)
     {
         SetValue(value2);
     }
     try {
         SettingsXML.Save(Path.Combine(GetAppSettingsPath(), GetAppSettingsFilename()));
     }
     catch (Exception) {
     }
 }
Exemplo n.º 11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDefalt_Click(object sender, EventArgs e)
        {
            // 初期化
            SettingsXML oSettingData = new SettingsXML();

            // 設定値初期化
            oSettingData.setDefaultData();
            // 背景色再設定
            oSettingData.setSettingData();
            // 設定XML出力
            oXMLProcess.fStreamXML("SETTING", oXMLProcess.outSettingXml);
            // 設定反映メッセージ
            MessageBox.Show("設定が反映されました。");
        }
Exemplo n.º 12
0
        /// <summary>
        /// 設定XML出力
        /// </summary>
        /// <param name="sFullPath"></param>
        public void outSettingXml(string sFullPath)
        {
            // アクセス設定情報を設定
            SettingsXML oSetting = new SettingsXML();

            // ファイルを開く
            using (StreamWriter lStreamWriter = new StreamWriter(sFullPath, false, new UTF8Encoding(false)))
            {
                // アクセス用のXmlSirializerの作成
                XmlSerializer lXMLSerializer = new XmlSerializer(typeof(SettingsXML));
                // アクセス情報をシリアル化してXMLに出力
                lXMLSerializer.Serialize(lStreamWriter, oSetting);
            }
        }
Exemplo n.º 13
0
        public override void SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection collection)
        {
            foreach (SettingsPropertyValue propVal in collection)
            {
                SetValue(propVal);
            }

            try
            {
                SettingsXML.Save(GetAppSettingsFilePath());
            }
            catch (Exception ex) {
                Log.Error("Error saving settings", ex);
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// 設定XML読込
        /// </summary>
        /// <param name="sFullPath"></param>
        public void redSettingXml(string sFullPath)
        {
            // 画面設定情報を設定
            SettingsXML oSetting = new SettingsXML();

            // ファイルを開く
            using (StreamReader lStreamReader = new StreamReader(sFullPath, new UTF8Encoding(false)))
            {
                // 画面設定のXmlSirializerの作成
                XmlSerializer lXMLSerializer = new XmlSerializer(typeof(SettingsXML));
                // 画面設定情報をデシリアライズ
                oSetting = (SettingsXML)lXMLSerializer.Deserialize(lStreamReader);
                // 設定値の設定
                oSetting.setSettingData();
            }
        }
Exemplo n.º 15
0
        public override void SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection propvals)
        {
            //Iterate through the settings to be stored
            //Only dirty settings are included in propvals, and only ones relevant to this provider
            foreach (SettingsPropertyValue propval in propvals)
            {
                SetValue(propval);
            }

            try
            {
                SettingsXML.Save(_settingsFileName);
            }
            catch (Exception)
            {
            }
            //Ignore if cant save, device been ejected
        }
Exemplo n.º 16
0
		} // End Function


		public override void SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection propvals)
		{
			// Iterate through the settings to be stored
			// Only dirty settings are included in propvals, and only ones relevant to this provider
			foreach (SettingsPropertyValue propval in propvals)
			{
				SetValue(propval);
			}

			try
			{
				SettingsXML.Save(IO.Path.Combine(GetAppSettingsPath, GetAppSettingsFilename));
			}
			catch(Exception ex)
			{
				// Ignore if cant save, device been ejected
			} // End Try-Catch
		} // End Sub
Exemplo n.º 17
0
    public override void SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection propvals)
    {
        //Iterate through the settings to be stored
        //Only dirty settings are included in propvals, and only ones relevant to this provider
        foreach (SettingsPropertyValue propval in propvals)
        {
            SetValue(propval);
        }

        try
        {
            SettingsXML.Save(Path.Combine(GetAppSettingsPath(), GetAppSettingsFilename()));
        }
        catch (Exception ex)
        {
            Log.Error("Exception in PortableSettingsProvider: " + ex.ToString());
        }
        //Ignore if cant save, device been ejected
    }
        public override void SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection propvals)
        {
            //Iterate through the settings to be stored
            //Only dirty settings are included in propvals, and only ones relevant to this provider
            foreach (SettingsPropertyValue propval in propvals)
            {
                SetValue(propval);
            }

            try {
                if (!Directory.Exists(GetAppSettingsPath()))
                {
                    Directory.CreateDirectory(GetAppSettingsPath());
                }
                SettingsXML.Save(Path.Combine(GetAppSettingsPath(), GetAppSettingsFilename()));
            } catch (Exception) {
                //Ignore if cant save, device been ejected
            }
        }