private string[] ReadAllLinesCached(string filename) { if (!SourceFileCache.ContainsKey(filename)) { string[] fileContents; //if you have the original file if (File.Exists(filename)) { fileContents = File.ReadLines(filename).ToArray(); } //otherwise get it from SourceCodeForSelfAwareness.zip / Plugin zip source codes else { string contentsInOneLine = ViewSourceCodeDialog.GetSourceForFile(Path.GetFileName(filename)); if (contentsInOneLine == null) { return(null); } fileContents = contentsInOneLine.Split('\n'); } SourceFileCache.Add(filename, fileContents); } return(SourceFileCache[filename]); }
private void OpenVisualStudio(string filename, int lineNumber) { try { Clipboard.SetText(Path.GetFileName(filename) + ":" + lineNumber); var viewer = new ViewSourceCodeDialog(filename, lineNumber, Color.LawnGreen); viewer.ShowDialog(); } catch (FileNotFoundException) { //there is no source code in the zip file } catch (Exception ex) { ExceptionViewer.Show(ex); } }