public void Import(string path) { using (var fileReader = FileReaderService.Read(path)) { var line = fileReader.ReadLine(); while (line != null) { line = line.Trim(' ', '\t', '\r', '\n'); if (line.StartsWith("#")) { if (line.Contains(":")) { var indexOfSeperater = line.IndexOf(":"); var key = line.Substring(0, indexOfSeperater).Trim(' ', '\t', '\r', '\n'); var value = line.Substring(indexOfSeperater + 1, line.Length - indexOfSeperater - 1).Trim(' ', '\t', '\r', '\n'); string profile = null; HelperService.ExtractProfile(key, ref key, ref profile); key = key.TrimStart('#').Trim(' ', '\t', '\r', '\n'); var configuration = GetOrCreateConfiguration(profile); var changed = false; if (key == "launcher") { configuration.WebAppLauncher = value; changed = true; } if (key == "argumentsPattern") { configuration.WebAppArgumentPattern = value; changed = true; } if (changed) { WebAppConfigurationRepository.SaveConfiguration(configuration); } } } else { var elements = line.Split(' '); var url = elements[0]; var keywords = string.Join(" ", elements.Skip(1).Where(e => e.Length > 0).ToArray()); keywords = keywords.TrimStart('(', ' ', '\t', '\r', '\n').TrimEnd(')', ' ', '\t', '\r', '\n'); string profile = null; if (HelperService.ExtractProfile(keywords, ref keywords, ref profile)) { keywords = keywords.TrimStart('(', ' ', '\t', '\r', '\n').TrimEnd(')', ' ', '\t', '\r', '\n'); } if (!string.IsNullOrEmpty(url)) { AddWebAppItem(url, keywords, profile); } } line = fileReader.ReadLine(); } } }