GetProperty() 공개 정적인 메소드

This method returns the value for a given property
public static GetProperty ( string tag ) : string
tag string property name
리턴 string
예제 #1
0
 public override object Evaluate()
 {
     if (!IsValid)
     {
         _value  = GUIPropertyManager.GetProperty(_propertyName);
         IsValid = true;
     }
     return(_value);
 }
예제 #2
0
 public override object Evaluate(ExpressionOptions options)
 {
     // Evaluate if required or if the expression is invalid
     if ((options & ExpressionOptions.EVALUATE_ALWAYS) > 0 || !IsValid)
     {
         _value  = GUIPropertyManager.GetProperty(_propertyName);
         IsValid = true;
     }
     return(_value);
 }
예제 #3
0
        /// <summary>
        /// Translate the skin boolean, create the skin boolean if not found.
        /// </summary>
        /// <param name="setting"></param>
        /// <param name="kind"></param>
        /// <returns></returns>
        public static int TranslateSkinBool(string setting, Kind kind)
        {
            lock (_skinBoolSettings)
            {
                foreach (int iKey in _skinBoolSettings.Keys.ToList())
                {
                    SkinBool skin = _skinBoolSettings[iKey];
                    if (skin.Name == setting)
                    {
                        if (skin.Kind == Kind.TRANSIENT && kind == Kind.PERSISTENT)
                        {
                            skin.Kind = kind;
                            _skinBoolSettings[iKey] = skin;
                        }
                        return(iKey);
                    }
                }
            }

            SkinBool newBool = new SkinBool();

            newBool.Name  = setting;
            newBool.Value = false;
            newBool.Kind  = kind;

            // Create the setting as a property if not already present.  The boolean value is converted as a string representation.
            if (!GUIPropertyManager.PropertyIsDefined(newBool.Name))
            {
                GUIPropertyManager.SetProperty(newBool.Name, newBool.Value.ToString());
            }
            else
            {
                try
                {
                    newBool.Value = bool.Parse(GUIPropertyManager.GetProperty(newBool.Name));
                }
                catch (FormatException ex)
                {
                    // Value is set to false.
                    Log.Warn("SkinSettings: Boolean setting value is not a valid boolean name={0} value={1} {2}", newBool.Name, newBool.Value, ex.Message);
                }
            }

            int key;

            lock (_skinBoolSettings) // Lock dictionary, we might be saving, should not alter structre
            {
                key = _skinBoolSettings.Count;
                _skinBoolSettings[key] = newBool;
            }
            return(key);
        }
예제 #4
0
        /// <summary>
        /// Translate the skin string, create the skin string if not found.
        /// </summary>
        /// <param name="line"></param>
        /// <param name="kind"></param>
        /// <returns></returns>
        public static int TranslateSkinString(string line, Kind kind)
        {
            lock (_skinStringSettings)
            {
                foreach (int iKey in _skinStringSettings.Keys.ToList())
                {
                    SkinString skin = _skinStringSettings[iKey];
                    if (skin.Name == line)
                    {
                        if (skin.Kind == Kind.TRANSIENT && kind == Kind.PERSISTENT)
                        {
                            skin.Kind = kind;
                            _skinStringSettings[iKey] = skin;
                        }
                        return(iKey);
                    }
                }
            }

            SkinString newString = new SkinString();

            newString.Name  = line;
            newString.Value = line;
            newString.Kind  = kind;

            // Create the setting as a property if not already present.
            if (!GUIPropertyManager.PropertyIsDefined(newString.Name))
            {
                GUIPropertyManager.SetProperty(newString.Name, newString.Value);
            }
            else
            {
                newString.Value = GUIPropertyManager.GetProperty(newString.Name);
            }

            int key;

            lock (_skinStringSettings) //Lock the dictionary, it might be getting saved at the moment
            {
                key = _skinStringSettings.Count;
                _skinStringSettings[key] = newString;
            }
            return(key);
        }
        /// <summary>
        /// Translate the skin boolean, create the skin boolean if not found.
        /// </summary>
        /// <param name="setting"></param>
        /// <param name="kind"></param>
        /// <returns></returns>
        public static int TranslateSkinBool(string setting, Kind kind)
        {
            Dictionary <int, SkinBool> .Enumerator enumer = _skinBoolSettings.GetEnumerator();
            while (enumer.MoveNext())
            {
                SkinBool skin = enumer.Current.Value;
                if (skin.Name == setting)
                {
                    return(enumer.Current.Key);
                }
            }
            SkinBool newBool = new SkinBool();

            newBool.Name  = setting;
            newBool.Value = false;
            newBool.Kind  = kind;

            // Create the setting as a property if not already present.  The boolean value is converted as a string representation.
            if (!GUIPropertyManager.PropertyIsDefined(newBool.Name))
            {
                GUIPropertyManager.SetProperty(newBool.Name, newBool.Value.ToString());
            }
            else
            {
                try
                {
                    newBool.Value = bool.Parse(GUIPropertyManager.GetProperty(newBool.Name));
                }
                catch (FormatException)
                {
                    // Value is set to false.
                    Log.Warn("SkinSettings: Boolean setting value is not a valid boolean name={0} value={1}", newBool.Name, newBool.Value);
                }
            }

            int key;

            lock (_skinBoolSettings) // Lock dictionary, we might be saving, should not alter structre
            {
                key = _skinBoolSettings.Count;
                _skinBoolSettings[key] = newBool;
            }
            return(key);
        }
        /// <summary>
        /// Translate the skin string, create the skin string if not found.
        /// </summary>
        /// <param name="line"></param>
        /// <param name="kind"></param>
        /// <returns></returns>
        public static int TranslateSkinString(string line, Kind kind)
        {
            Dictionary <int, SkinString> .Enumerator enumer = _skinStringSettings.GetEnumerator();
            while (enumer.MoveNext())
            {
                SkinString skin = enumer.Current.Value;
                if (skin.Name == line)
                {
                    return(enumer.Current.Key);
                }
            }

            SkinString newString = new SkinString();

            newString.Name  = line;
            newString.Value = line;
            newString.Kind  = kind;

            // Create the setting as a property if not already present.
            if (!GUIPropertyManager.PropertyIsDefined(newString.Name))
            {
                GUIPropertyManager.SetProperty(newString.Name, newString.Value);
            }
            else
            {
                newString.Value = GUIPropertyManager.GetProperty(newString.Name);
            }

            int key;

            lock (_skinStringSettings) //Lock the dictionary, it might be getting saved at the moment
            {
                key = _skinStringSettings.Count;
                _skinStringSettings[key] = newString;
            }
            return(key);
        }