private static ParseIniFile ( TextReader reader ) : IEnumerable |
||
reader | TextReader | |
return | IEnumerable |
internal void Parse() { if (String.IsNullOrEmpty(FileName)) { throw new InvalidOperationException(); } string extensionDir = String.Empty; using (StreamReader reader = new StreamReader(FileName)) { foreach (object o in PHPIniFile.ParseIniFile(reader)) { PHPIniSetting directive = o as PHPIniSetting; if (directive != null) { Settings.Add(directive); RawEntries.Add(directive); // Get the path to the extension directory - this will be used later if (String.Equals(directive.Name, "extension_dir", StringComparison.OrdinalIgnoreCase)) { extensionDir = directive.GetTrimmedValue(); } } else { PHPIniExtension extension = o as PHPIniExtension; if (extension != null) { Extensions.Add(extension); RawEntries.Add(extension); } else { PHPIniBase entry = o as PHPIniBase; if (entry != null) { RawEntries.Add(entry); } } } } } if (String.IsNullOrEmpty(extensionDir) || !Path.IsPathRooted(extensionDir)) { extensionDir = Path.Combine(Path.GetDirectoryName(FileName), "ext"); } if (Directory.Exists(extensionDir)) { AddAllAvailableExtensions(extensionDir); } }