コード例 #1
0
		public void AddConfigValue (string configSection, string configName, string configValue)
		{
			ConfigValue confValue = new ConfigValue (configSection, configName, configValue);
			AddConfigValue (confValue);
		}
コード例 #2
0
		public void AddConfigValue (ConfigValue val)
		{
			if (values == null) {
				values = new ConfigValue[0];
				values[0] = val;
			} else {
				ConfigValue[] tmp = new ConfigValue[values.Length + 1];
				
				for (int i = 0; i < values.Length; i++)
					tmp[i] = values[i];
					
				tmp[tmp.Length - 1] = new ConfigValue();
				tmp[tmp.Length - 1] = val;
				values = tmp;
			}
			
			//ArrayList valuesArray = new ArrayList (values);
			
			//valuesArray.Add (val);
			
			//values = (ConfigValue[]) valuesArray.ToArray ();
			//values[0] = val;
		}
コード例 #3
0
		public void AddConfigValues ()
		{
			string line = null;
			string section = null;
			
			TextReader tr = new StreamReader (path);
			
			while ((line = tr.ReadLine()) != null) {
				if (line.StartsWith ("[") && line.EndsWith ("]")) {
					section = line;
					line = tr.ReadLine ();
				}
				
				// TODO: for now we are going to read the value and name as a whole
				// the idea is:
				//
				// Remove all the text after "="(and "=" too) that's the name
				// Remove all the text before "="(and "=" too) that's the value 
				ConfigValue configValue = new ConfigValue (section, line, line);
				
				AddConfigValue (configValue);
			}
			
			tr.Close ();
		}