private void LoadSetting() { if (!_settingLoaded) { _setting = this.Preprocessor.ReadSetting(this.VirtualPath); _settingLoaded = true; } }
private static WebPageSetting LoadSetting(string path) { WebPageSetting setting = new WebPageSetting(); using (StreamReader reader = GetTextReader(path)) { if (reader == null) { return(null); } Regex reg = new Regex("<%@ *(\\w+) +(.*?)%>"); Regex parReg = null; while (true) { string lineCode = reader.ReadLine(); if (lineCode == null) { break; } Match m = reg.Match(lineCode); if (!m.Success) { break; } if (parReg == null) { parReg = new Regex(" *([^=]+) *= *\"([^=]+)\""); } string name = m.Groups[1].Value; string parCode = m.Groups[2].Value; NameValueCollection args = new NameValueCollection(); MatchCollection mcs = parReg.Matches(parCode); foreach (Match pm in mcs) { args.Add(pm.Groups[1].Value, pm.Groups[2].Value); } setting.AddItem(name, args); } } return(setting); }