private void LoadSkin() { DirectoryInfo skinDir = new DirectoryInfo(_textBoxSkinPath.Text); if (skinDir.Exists) { Regex stringSearch = new Regex(@"\""\[(?<section>[\w^\\]+)\.(?<name>[\w]+)]\"""); foreach (FileInfo file in skinDir.GetFiles("*.x*",SearchOption.AllDirectories)) { TextReader reader = new StreamReader(file.FullName); string source = reader.ReadToEnd(); MatchCollection matches = stringSearch.Matches(source); foreach (Match stringId in matches) { StringMatch stringInfo = new StringMatch(); stringInfo.stringId = stringId.Groups["section"].Value + "." + stringId.Groups["name"].Value; stringInfo.file = file.Name; stringInfo.source = StringMatch.Source.Skin; _matchedStrings.Add(stringInfo); } } } }
private void LoadSolution() { Cursor.Current = Cursors.WaitCursor; Solution solution = new Solution(_textBoxSolution.Text); _matchedStrings = new List<StringMatch>(); foreach (CSProject project in solution.Projects) { foreach (string file in project.csList) { TextReader reader = new StreamReader(Path.Combine(project.dir, file)); string source = reader.ReadToEnd(); Regex stringSearch = new Regex(@"\""\[(?<section>[\w^\\]+)\.(?<name>[\w]+)]\"""); MatchCollection matches = stringSearch.Matches(source); foreach (Match stringId in matches) { StringMatch stringInfo = new StringMatch(); stringInfo.stringId = stringId.Groups["section"].Value + "." + stringId.Groups["name"].Value; stringInfo.file = file; stringInfo.source = StringMatch.Source.Code; stringInfo.project = project.name; _matchedStrings.Add(stringInfo); } } } Cursor.Current = Cursors.Default; }