예제 #1
0
 public bool GetKeyValueBool(string sSection, string sKey, bool bDefault)
 {
     if (DOM.ContainsKey(sSection))
     {
         if (DOM[sSection].ContainsKey(sKey))
         {
             if (DOM[sSection][sKey] != "FALSE" || DOM[sSection][sKey] != "false")
             {
                 return(true);
             }
             else
             {
                 return(bDefault);
             }
         }
         else
         {
             return(bDefault);
         }
     }
     else
     {
         return(bDefault);
     }
 }
예제 #2
0
        public int GetKeyValueInt(string sSection, string sKey, int iDefault)
        {
            int value;

            if (DOM.ContainsKey(sSection))
            {
                if (DOM[sSection].ContainsKey(sKey))
                {
                    if (Int32.TryParse(DOM[sSection][sKey], out value))
                    {
                        return(value);
                    }
                    else
                    {
                        return(iDefault);
                    }
                }
                else
                {
                    return(iDefault);
                }
            }
            else
            {
                return(iDefault);
            }
        }
예제 #3
0
 public string GetKeyValueStr(string sSection, string sKey, string sDefault)
 {
     if (DOM.ContainsKey(sSection))
     {
         if (DOM[sSection].ContainsKey(sKey))
         {
             return((string)DOM[sSection][sKey]);
         }
         else
         {
             return(sDefault);
         }
     }
     else
     {
         return(sDefault);
     }
 }
예제 #4
0
 public bool SetKeyValue(string sSection, string sKey, string sValue)
 {
     if (!DOM.ContainsKey(sSection))
     {
         DOM.Add(sSection, new Dictionary <string, string>());
         DOM[sSection].Add(sKey, sValue);
         return(true);
     }
     else
     {
         if (!DOM[sSection].ContainsKey(sKey))
         {
             DOM[sSection].Add(sKey, sValue);
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }