Ejemplo n.º 1
0
        public RCConfigurationStruct copy()
        {
            RCConfigurationStruct newCs = new RCConfigurationStruct();

            newCs.configurationName              = this.configurationName;
            newCs.configurationDescription       = this.configurationDescription;
            newCs.configurationIPPort            = this.configurationIPPort;
            newCs.configurationSchema            = this.configurationSchema;
            newCs.configurationUsername          = this.configurationUsername;
            newCs.configurationPassword          = this.configurationPassword;
            newCs.configurationDBType            = this.configurationDBType;
            newCs.configurationConnectionTimeout = this.configurationConnectionTimeout;
            newCs.configurationExePath           = this.configurationExePath;
            return(newCs);
        }
Ejemplo n.º 2
0
 public static void ReadFromFile()
 {
     confList = new List <RCConfigurationStruct>();
     using (StreamReader sr = new StreamReader(".\\config\\database.ini", Encoding.Default))
     {
         string        content    = sr.ReadToEnd();
         List <string> eachConfig = content.Split(new String[] { "\n\n" }, StringSplitOptions.RemoveEmptyEntries).ToList();
         foreach (string strConfig in eachConfig)
         {
             RCConfigurationStruct cs = new RCConfigurationStruct();
             cs.ReadFromConfigFileString(strConfig);
             confList.Add(cs);
         }
     }
 }
Ejemplo n.º 3
0
        public static bool NewAdd(string confName)
        {
            foreach (var ci in confList)
            {
                if (ci.getName().Trim() == confName.Trim())
                {
                    return(false);
                }
            }

            RCConfigurationStruct cs = new RCConfigurationStruct();

            cs.configurationName = confName.Trim();
            confList.Add(cs);
            mListChanged = true;

            return(true);
        }
Ejemplo n.º 4
0
        public static void SetCurrent(string confName)
        {
            int found = -1;

            for (int index = 0; index < confList.Count; ++index)
            {
                var cs = confList[index];
                if (cs.getName() == confName)
                {
                    found = index;
                    break;
                }
            }

            if (found >= 0)
            {
                RCConfigurationStruct newCS = GetByName(confName).copy();
                confList.RemoveAt(found);
                confList.Add(newCS);
            }
        }