private void ProcessResources() { resources = new ResourcesData(); if (verbose) { Console.WriteLine("Processing resource files"); } foreach (var resFile in resFiles) { if (verbose) { Console.WriteLine(" Processing resource file {0}", resFile); } var resource = new ResourceData(Path.GetFileNameWithoutExtension(resFile)); using (var reader = new ResourceReader(resFile)) { IDictionaryEnumerator en = reader.GetEnumerator(); while (en.MoveNext()) { resource.Data.Add(en.Key.ToString(), en.Value.ToString()); } } resources.AddResource(resource); } if (resources.GetResourceNames().Length == 0) { throw new ApplicationException("No resources found"); } }
private void CreateRegex() { string pattern = @"(?<!\w) (?<ResName>{0}) \s* \. \s* (?<Entry>\w+)"; var names = resources.GetResourceNames(); string resnames = names.Aggregate(new StringBuilder(names.First()), (sb, n) => sb.AppendFormat("|{0}", n), (sb) => sb.ToString()); regex = new Regex(String.Format(pattern, resnames), RegexOptions.IgnorePatternWhitespace); }
private void ProcessResources() { resources = new ResourcesData(); if (verbose) Console.WriteLine("Processing resource files"); foreach (var resFile in resFiles) { if (verbose) Console.WriteLine(" Processing resource file {0}", resFile); var resource = new ResourceData(Path.GetFileNameWithoutExtension(resFile)); using (var reader = new ResourceReader(resFile)) { IDictionaryEnumerator en = reader.GetEnumerator(); while (en.MoveNext()) { resource.Data.Add(en.Key.ToString(), en.Value.ToString()); } } resources.AddResource(resource); } if (resources.GetResourceNames().Length == 0) throw new ApplicationException("No resources found"); }