void OpenFileWithEditor(int rowIndex) { SymbolFile sf = symbolFiles[rowIndex]; try { Process.Start("notepad.exe", sf.FilePath); } catch (Exception ex) { Output(string.Format("Error: {0} {1} {2}", ex.Message, ex.StackTrace, ex.TargetSite)); } }
void ListInformation(int rowIndex) { SymbolFile sf = symbolFiles[rowIndex]; if (sf.FilePath == null) { return; } string text = System.Environment.NewLine + System.Environment.NewLine + sf.SymbolName + System.Environment.NewLine + string.Join(System.Environment.NewLine, sf.LangValues.Select(x => x.Key + " = " + x.Value).ToArray()); Output(text); }
void RefreshInformationLabel(int rowIndex) { SymbolFile sf = symbolFiles[rowIndex]; if (sf.FilePath == null) { return; } string text = sf.SymbolName + System.Environment.NewLine + sf.SymbolThName + System.Environment.NewLine + string.Join(" " /*System.Environment.NewLine*/, sf.LangValues.Select(x => x.Key + " = " + x.Value).ToArray()); symbolInfoLabel.Text = text; }
void ReadFiles() { symbolFiles = new List <SymbolFile>(); langCodes = new List <string>(); int index = 0; foreach (string filePath in GetFiles(symbolsDirectory)) { if (filePath.Contains("readme.symbols")) { continue; } try { string parentDir1 = new FileInfo(filePath).Directory.Name; string parentDir2 = new FileInfo(Path.GetDirectoryName(filePath)).Directory.Name; // Path.GetDirectoryName string categoryTitle = parentDir2.Replace("symbols_", ""); string text = File.ReadAllText(filePath); string relativeFilePath = filePath.Replace(symbolsDirectory, ""); index++; symbolFiles.Add( new SymbolFile() { FilePath = filePath, RelativeFilePath = relativeFilePath, CategoryTitle = categoryTitle, GeometryType = SymbolFile.GetGeometryTypeFromText(parentDir1), FileContents = text, //Index = index }.Build()); } catch (Exception ex) { Output(string.Format("Error: {0} {1} {2}", ex.Message, ex.StackTrace, ex.TargetSite)); } } foreach (SymbolFile sf in symbolFiles) { foreach (var kv in sf.LangValues) { if (langCodes.IndexOf(kv.Key) < 0) { langCodes.Add(kv.Key); } } } PopulateLangCodesComboBox(langCodes); symbolFileBindingSource.DataSource = symbolFiles; Output(string.Format("Found {0} file(s)", symbolFiles.Count)); }