当前位置: 首页>>代码示例>>C#>>正文


C# Setting.ToString方法代码示例

本文整理汇总了C#中Setting.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Setting.ToString方法的具体用法?C# Setting.ToString怎么用?C# Setting.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Setting的用法示例。


在下文中一共展示了Setting.ToString方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Set

 public static void Set(Setting setting, string value)
 {
     var settingName = setting.ToString();
     var bytes = Encoding.UTF8.GetBytes(value);
     var encryptedBytes = ProtectedData.Protect(bytes, null);
     IsolatedStorageSettings.ApplicationSettings[settingName] = encryptedBytes;
 }
开发者ID:jasonamyers,项目名称:Apps,代码行数:7,代码来源:Settings.cs

示例2: GetString

 public static string GetString(Setting setting)
 {
     var settingName = setting.ToString();
     if (IsolatedStorageSettings.ApplicationSettings.Contains(settingName))
     {
         var encryptedBytes = (byte[])IsolatedStorageSettings.ApplicationSettings[settingName];
         var bytes = ProtectedData.Unprotect(encryptedBytes, null);
         return Encoding.UTF8.GetString(bytes, 0, bytes.Length);
     }
     else
     {
         return "";
     }
 }
开发者ID:jasonamyers,项目名称:Apps,代码行数:14,代码来源:Settings.cs

示例3: GetSettingName

        public static string GetSettingName(Setting settingNameEnum)
        {
            if (SettingNames._cache.Count() == 0)
            {
                LoadDictionary(SettingNames, "setting.names.json");
            }

            return SettingNames.GetString(settingNameEnum.ToString());
        }
开发者ID:homoluden,项目名称:Blogger,代码行数:9,代码来源:StringsManager.cs

示例4: DB_UpdateSetting

            /// <summary>
            /// Updates a program setting
            /// </summary>
            /// <param name="DBSetting">The setting to update</param>
            /// <param name="value">The new value for the setting</param>
            internal static int DB_UpdateSetting(Setting DBSetting, object value)
            {
                //setup parameters
                SQLiteParameter sqParam = null;

                switch (DBSetting) {
                  case Setting.BackgroundColour:
                  case Setting.DBversion:
                  case Setting.member_id:
                  case Setting.NewUser:
                  case Setting.ReadInterval:
                  case Setting.RowColourAlt:
                  case Setting.RowColourHighlight:
                  case Setting.SendReports:
                  case Setting.ShowDate:
                  case Setting.ShowGrid:
                int iConvertedValue;
                if (int.TryParse(value.ToString().Trim(), out iConvertedValue)) {
                  sqParam = new SQLiteParameter("@value", DbType.Int32) {
                Value = iConvertedValue
                  };
                }
                break;
                  case Setting.FormPosition:
                  case Setting.GallerySettings:
                  case Setting.ImageBrowser:
                  case Setting.Notes:
                  case Setting.pass_hash:
                  case Setting.RootPath:
                  case Setting.SavePath:
                  case Setting.SearchIgnore:
                sqParam = new SQLiteParameter("@value", DbType.String) {
                  Value = value.ToString()
                };
                break;
                }

                //determine whether to insert or update
                string sCommandText = string.Format(
                  "update [Settings] set {0} = @value"
                  , DBSetting.ToString());

                //run the command
                return sqlBase.ExecuteNonQuery(sCommandText, CommandBehavior.Default, sqParam);
            }
开发者ID:mirurururu,项目名称:Manga-Organizer,代码行数:50,代码来源:SQL.cs

示例5: GetSetting

 /// <summary>
 /// Returns a setting from the DB
 /// </summary>
 /// <param name="DBSetting"></param>
 public static string GetSetting(Setting DBSetting)
 {
     string sVal = "";
       using (DataTable dt = SQLAccess.DB_GetSettings()) {
     sVal = dt.Rows[0][DBSetting.ToString()].ToString();
       }
       return sVal;
 }
开发者ID:mirurururu,项目名称:Manga-Organizer,代码行数:12,代码来源:SQL.cs

示例6: TrySetIndividualSetting

 private void TrySetIndividualSetting(IsolatedStorageSettings settings, Setting settingNameEnum, string settingValue)
 {
     var settingName = settingNameEnum.ToString();
     if (settings.Contains(settingName))
     {
         settings[settingName] = settingValue;
     }
     else
     {
         settings.Add(settingName, settingValue);
     }
 }
开发者ID:BrianLima,项目名称:Blogger,代码行数:12,代码来源:Communicator.cs

示例7: SetValue

        /// <summary>
        /// Internal method to set the value of a specified setting in the in-memory settings file.
        /// If the specified setting does not exist then it is added.
        /// </summary>
        /// <param name="node">The setting to set the value of</param>
        /// <param name="value">The value to assign to the specified setting</param>
        private void SetValue(Setting node, string value)
        {
            XmlNode xmlNode = _xml.SelectSingleNode("/CharacterSettings/" + node.ToString());

            try
            {
                if (xmlNode == null)
                {
                    XmlNode parent = _xml.SelectSingleNode("/CharacterSettings");
                    xmlNode = _xml.CreateElement(node.ToString());
                    parent.AppendChild(xmlNode);
                }
                if (xmlNode.FirstChild == null)
                {
                    XmlText xmlValue = _xml.CreateTextNode(value);
                    xmlNode.AppendChild(xmlValue);
                }
                else
                {
                    xmlNode.FirstChild.Value = value;
                }
                _changed = true;
                if (SettingsUpdated != null)
                {
                    SettingsUpdated(this, null);
                }
            }
            catch (Exception ex)
            {
                EMMASettingsException emmaEx = new EMMASettingsException(ExceptionSeverity.Error,
                    "Error setting value in character settings file for " + node.ToString(), ex);
            }
        }
开发者ID:dedimarco,项目名称:evemarketmonitorapp,代码行数:39,代码来源:APICharSettings.cs

示例8: GetValueNode

        /// <summary>
        /// 
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        private XmlNode GetValueNode(Setting node)
        {
            XmlNode xmlNode = _xml.SelectSingleNode("/CharacterSettings/" + node.ToString());

            try
            {
                if (xmlNode == null)
                {
                    XmlNode parent = _xml.SelectSingleNode("/CharacterSettings");
                    xmlNode = _xml.CreateElement(node.ToString());
                    parent.AppendChild(xmlNode);
                }
                if (xmlNode.FirstChild == null)
                {
                    XmlText xmlValue = _xml.CreateTextNode(GetDefaultValue(node));
                    xmlNode.AppendChild(xmlValue);
                }
            }
            catch (Exception ex)
            {
                EMMASettingsException emmaEx = new EMMASettingsException(ExceptionSeverity.Error,
                    "Error getting value from character settings file for " + node.ToString(), ex);
            }

            return xmlNode;
        }
开发者ID:dedimarco,项目名称:evemarketmonitorapp,代码行数:31,代码来源:APICharSettings.cs

示例9: GetSetting

		/// <summary>
		/// Returns a setting from the DB
		/// </summary>
		/// <param name="DBSetting"></param>
		public static string GetSetting(Setting DBSetting)
		{
			string sVal = "";
			using (DataTable dt = SQLAccess._GetSettings()) {
				if (dt.Rows.Count > 0) {
					sVal = dt.Rows[0][DBSetting.ToString()].ToString().Trim();
				}
			}
			return sVal;
		}
开发者ID:emmauss,项目名称:Manga-Organizer,代码行数:14,代码来源:SQL.cs

示例10: _UpdateSetting

            /// <summary>
            /// Updates a program setting
            /// </summary>
            /// <param name="DBSetting">The setting to update</param>
            /// <param name="value">The new value for the setting</param>
            internal static int _UpdateSetting(Setting DBSetting, object value)
            {
                //setup parameters
                SQLiteParameter sqParam = null;

                switch (DBSetting) {
                    case Setting.BackgroundColour:
                    case Setting.RowColourAlt:
                    case Setting.RowColourHighlight:
                        if (value is Color) {
                            sqParam = SQLBase.NewParameter("@value", DbType.Int32, ((Color)value).ToArgb());
                        }
                        break;
                    case Setting.NewUser:
                    case Setting.IsAdmin:
                    case Setting.ShowDate:
                    case Setting.ShowGrid:
                    case Setting.ShowCovers:
                    case Setting.RemoveTitleAddenda:
                        if (value is bool) {
                            sqParam = SQLBase.NewParameter("@value", DbType.Int32, (bool)value ? 1 : 0);
                        }
                        break;
                    case Setting.SendReports:
                    case Setting.DBversion:
                    case Setting.member_id:
                    case Setting.ReadInterval:
                        int iConvertedValue;
                        if (int.TryParse(value.ToString().Trim(), out iConvertedValue)) {
                            sqParam = SQLBase.NewParameter("@value", DbType.Int32, iConvertedValue);
                        }
                        break;
                    case Setting.FormPosition:
                        if (value is Rectangle) {
                            Rectangle rct = (Rectangle)value;
                            string svalue = string.Format("{0},{1},{2},{3}"
                                , rct.Location.X > -1 ? rct.Location.X : 0
                                , rct.Location.Y > -1 ? rct.Location.Y : 0
                                , rct.Size.Width
                                , rct.Size.Height);
                            sqParam = SQLBase.NewParameter("@value", DbType.String, svalue);
                        }
                        break;
                    case Setting.ImageBrowser:
                    case Setting.Notes:
                    case Setting.pass_hash:
                    case Setting.RootPath:
                    case Setting.SavePath:
                        sqParam = SQLBase.NewParameter("@value", DbType.String, value.ToString());
                        break;
                    case Setting.GallerySettings:
                        if (value is byte[]) {
                            sqParam = SQLBase.NewParameter("@value", DbType.String, string.Join(",", (byte[])value));
                        }
                        break;
                    case Setting.SearchIgnore:
                    case Setting.TagIgnore:
                        if (value is string[]) {
                            sqParam = SQLBase.NewParameter("@value", DbType.String, string.Join("|", (string[])value));
                        }
                        break;
                }

                int iAltered = -1;
                if (sqParam != null) {
                    string sCommandText = string.Format("update [Settings] set {0} = @value", DBSetting.ToString());
                    iAltered = sqlBase.ExecuteNonQuery(sCommandText, sqParam);
                }
                else {
                    SQL.LogMessage("Setting was not a valid datatype", EventType.CustomException, value);
                    xMessage.ShowError("Invalid settings data was ignored.");
                }

                return iAltered;
            }
开发者ID:Nagru,项目名称:Manga-Organizer,代码行数:80,代码来源:SQL.cs

示例11: SetValue

 /// <summary>
 /// Internal method to set the value of a specified setting in the in-memory settings file.
 /// If the specified setting does not exist then it is added.
 /// </summary>
 /// <param name="node">The setting to set the value of</param>
 /// <param name="value">The value to assign to the specified setting</param>
 private void SetValue(Setting node, string value)
 {
     SetValue(node.ToString(), value);
 }
开发者ID:dedimarco,项目名称:evemarketmonitorapp,代码行数:10,代码来源:UserSettings.cs

示例12: GetValue

 /// <summary>
 /// Internal method to return the value of a specified setting from the in-memory settings file.
 /// If the value does not exist then it is added from the default values returned by GetDefaultValue.
 /// </summary>
 /// <param name="node">The setting to return the value for</param>
 /// <returns></returns>
 private string GetValue(Setting node)
 {
     return GetValue(node.ToString());
 }
开发者ID:dedimarco,项目名称:evemarketmonitorapp,代码行数:10,代码来源:UserSettings.cs

示例13: GetSetting

 public Object GetSetting(Setting setting)
 {
     return GetSetting(setting.ToString());
 }
开发者ID:EraYaN,项目名称:Moonstone,代码行数:4,代码来源:Configuration.cs

示例14: SetSetting

 public Boolean SetSetting(Setting setting, Object value)
 {
     return SetSetting(setting.ToString(), value);
 }
开发者ID:EraYaN,项目名称:Moonstone,代码行数:4,代码来源:Configuration.cs


注:本文中的Setting.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。