Esempio n. 1
0
        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]);
        }
Esempio n. 2
0
 private void SetViewSourceCodeButton(string title)
 {
     //if it's a class name we are showing
     if (className.IsMatch(title) &&
         ViewSourceCodeDialog.SourceCodeIsAvailableFor(title + ".cs"))
     {
         btnViewSourceCode.Enabled = true;
         btnViewSourceCode.Tag     = title + ".cs";
     }
     else
     {
         btnViewSourceCode.Enabled = false;
     }
 }
        private void OpenVisualStudio(string filename, int lineNumber)
        {
            try
            {
                Clipboard.SetText(Path.GetFileName(filename) + ":" + lineNumber);

                var viewer = new Rdmp.UI.SimpleDialogs.ViewSourceCodeDialog(filename, lineNumber, Color.LawnGreen);
                viewer.ShowDialog();
            }
            catch (FileNotFoundException)
            {
                //there is no source code in the zip file
            }
            catch (Exception ex)
            {
                ExceptionViewer.Show(ex);
            }
        }