using System; using System.IO; using System.Text; namespace builder { [Flags] public enum BasePlatform { Platform_Windows, Platform_Linux }; public class Config { public string source_path; public string pkg_path; public string builder_path; public string build_options; public string pdb_log_file; public builder.BasePlatform Platform; public Config() { if ((int)System.Environment.OSVersion.Platform == 128) { Platform = BasePlatform.Platform_Linux; } else { Platform = BasePlatform.Platform_Windows; } } public static string PathFormat(string format, params string [] args) { string temp = string.Format(format, args); return temp.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar); } public bool ReadFromFile(string file) { bool read = true; StreamReader sr = null; try { sr = new StreamReader(file); string line; string delim = "\t \n\r\v"; string split = "="; while ( (line = sr.ReadLine()) != null ) { line = line.Trim(delim.ToCharArray()); if (line.Length < 1 || line[0] == ';') { continue; } string [] s = line.Split(split.ToCharArray()); string key, val = ""; if (s.GetLength(0) >= 1) { key = s[0]; if (s.GetLength(0) >= 2) { for (int i=1; i