Example #1
0
        public static IniSection[] Parse(string[] lines)
        {
            SectionBuilder builder = new SectionBuilder();

            for (int i = 0; i < lines.Length; i++)
            {
                if (string.IsNullOrEmpty(lines[i]))
                {
                    continue;
                }                                                        // ignore empty lines
                string currentLine = lines[i].Trim();
                if (currentLine.StartsWith("#"))
                {
                    continue;                     // ignore comments
                }
                else if (currentLine.StartsWith("[") && currentLine.EndsWith("]"))
                {
                    builder.AddSection(currentLine.Substring(1, currentLine.Length - 2));
                }
                else
                {
                    builder.Add(lines[i]);
                }
            }
            builder.Pop();

            builder.sections.Sort();
            return(builder.sections.ToArray());
        }
Example #2
0
	   public static IniSection[] Parse(string[] lines) {
		  SectionBuilder builder = new SectionBuilder();

		  for (int i = 0; i < lines.Length; i++) {
			 if(string.IsNullOrEmpty(lines[i])){ continue; } // ignore empty lines
			 string currentLine = lines[i].Trim();
			 if (currentLine.StartsWith("#")) {
				continue;	  // ignore comments
			 }else if (currentLine.StartsWith("[") && currentLine.EndsWith("]")) {
				builder.AddSection(currentLine.Substring(1, currentLine.Length - 2));
			 } else {
				builder.Add(lines[i]);
			 }
		  }
		  builder.Pop();

		  builder.sections.Sort();
		  return builder.sections.ToArray();
	   }