Exemplo n.º 1
0
        public void SetConfig(String group, String configName, String newValue, Boolean createIfNotExist)
        {
            if (createIfNotExist && !Exists(group))
            {
                AddGroup(group);
            }
            ConfigGroup grp = GetConfigGroup(group);    //Finds group

            if (createIfNotExist && grp.Contains(configName) == -1)
            {
                grp.Add(new Config(configName + "=" + newValue));
            }
            else
            {
                grp.Item(configName).Setting = newValue;                                                                                                             //Finds Config (or creates it), and sets new value
            }
        }
Exemplo n.º 2
0
 private void updateConfig()
 {
     String[] fil = ReadAllLines(fileLoc);     //Reads config file and places it in String varible fil
     winINI.Clear();                           //Clears any items that are currently in the list
     for (int i = 0; i <= fil.Length - 1; i++) //Loops through each line of the fil
     {
         if (fil[i].StartsWith("[") && fil[i].EndsWith("]"))
         {                                                         //Checks to see if line is a group header
             ConfigGroup grp = new ConfigGroup(fil[i], i);         //Creates a new group and sets the name and index of header
             i++;                                                  //Increments down to first line in group
             for (bool b = false; i < fil.Length && fil[i] != "";) //Loops through each config in group, need for loop for pretest loop, j won't be used, but is needed for the loop  Loops through till blank line or end of array
             {
                 grp.Add(new Config(fil[i]));                      //Creates config out of line and adds it to grp
                 i++;                                              //Increments to next line of String
             }
             grp.Index = winINI.Count;                             //Adds Index, found by the count of the previous amount in winINI
             winINI.Add(grp);                                      //Adds grp to winINI (which holds the complete config file)
         }
     }
 }