Ejemplo n.º 1
0
        public static string Get(string key, string sDefault, string error, bool create)
        {
            for (int i = 0; i < Dict.Count; i++)
            {
                ConfValue KV = Dict[i];
                //Trace.WriteLine(KV.Key + " <- " + key);
                if (KV.Key.Trim().ToLower() == key.Trim().ToLower())
                {
                    //T//race.WriteLineIf(string.IsNullOrEmpty(KV.Value), "Empty Value");
                    return(KV.Value);
                }
            }
            //Trace.WriteLine("Setting Not found");
            if (create)
            {
                ConfValue c = new ConfValue(key, sDefault);
                Dict.Add(c);

                if (OnSettingChanged != null)
                {
                    OnSettingChanged.Invoke(c);
                }

                if (key == "#Settings|Save On Modification" || Settings.Get("#Settings|Save On Modification", true))
                {
                    Save();
                }
                return(sDefault);
            }
            return(error);
        }
Ejemplo n.º 2
0
        public static void Set(string key, string value)
        {
            for (int i = 0; i < Dict.Count; i++)
            {
                ConfValue KV = Dict[i];

                if (KV.Key == key)
                {
                    KV.Value = value;

                    if (key == "#Settings|Save On Modification" || Settings.Get("#Settings|Save On Modification", true))
                    {
                        Save();
                    }
                    if (OnSettingChanged != null)
                    {
                        OnSettingChanged.Invoke(KV);
                    }
                    return;
                }
            }

            ConfValue c = new ConfValue(key, value);

            Dict.Add(c);

            if (OnSettingChanged != null)
            {
                OnSettingChanged.Invoke(c);
            }

            if (key == "#Settings|Save On Modification" || Settings.Get("#Settings|Save On Modification", true))
            {
                Save();
            }
        }
Ejemplo n.º 3
0
        public static void Set(string key, string value)
        {
            for (int i = 0; i < Dict.Count; i++)
            {
                ConfValue KV = Dict[i];

                if (KV.Key == key)
                {
                    KV.Value = value;

                    if (key == "#Settings|Save On Modification" || Settings.Get("#Settings|Save On Modification", true))
                    {
                        Save();
                    }
                    if (OnSettingChanged != null)
                    {
                        OnSettingChanged.Invoke(KV);
                    }
                    return;
                }
            }

            ConfValue c = new ConfValue(key, value);
            Dict.Add(c);

            if (OnSettingChanged != null)
            {
                OnSettingChanged.Invoke(c);
            }

            if (key == "#Settings|Save On Modification" || Settings.Get("#Settings|Save On Modification", true))
            {
                Save();
            }
        }
Ejemplo n.º 4
0
        public static string Get(string key, string sDefault, string error, bool create)
        {
            for (int i = 0; i < Dict.Count; i++)
            {
                ConfValue KV = Dict[i];
                //Trace.WriteLine(KV.Key + " <- " + key);
                if (KV.Key.Trim().ToLower() == key.Trim().ToLower())
                {
                    //T//race.WriteLineIf(string.IsNullOrEmpty(KV.Value), "Empty Value");
                    return KV.Value;
                }
            }
            //Trace.WriteLine("Setting Not found");
            if (create)
            {
                ConfValue c = new ConfValue(key, sDefault);
                Dict.Add(c);

                if (OnSettingChanged != null)
                {
                    OnSettingChanged.Invoke(c);
                }

                if (key == "#Settings|Save On Modification" || Settings.Get("#Settings|Save On Modification", true))
                {
                    Save();
                }
                return sDefault;
            }
            return error;
        }