Caucho.ResinConf.parse C# (CSharp) Method

parse() private static method

private static parse ( String path, String resinConf, Hashtable properties ) : void
path String
resinConf String
properties System.Collections.Hashtable
return void
        private static void parse(String path, String resinConf, Hashtable properties)
        {
            if (path.StartsWith("cloud:"))
            return;

              String file;
              if (path.StartsWith("${__DIR__}/")) {
            file = resinConf.Substring(0, resinConf.LastIndexOf('\\')) + '\\' + path.Substring(11, path.Length - 11);
              } else {
            file = path;
              }

              if (! File.Exists(file))
            return;

              TextReader reader = null;

              try {
            reader = File.OpenText(file);
            String line;
            while ((line = reader.ReadLine()) != null) {
              if (line.StartsWith("#"))
            continue;

              int sepIdx = line.IndexOf(':');

              if (sepIdx == -1)
            continue;

              String key = line.Substring(0, sepIdx).Trim();
              String value = line.Substring(sepIdx + 1, line.Length - sepIdx - 1).Trim();

              properties.Remove(key);

              properties.Add(key, value);
            }
              } finally {
            if (file != null)
              reader.Close();
              }
        }