Пример #1
0
        private void ExecuteFixCommand(string moduleName)
        {
            string folderPath = "C:\\Users\\belyakov\\Documents\\Visual Studio 2015\\Projects\\RefactorFiles\\RefactorFiles";
            //string folderPath = CodeCleaner.Default.ScriptDirectory;

            // find document path
            ActivePathHolder theHolder          = ActivePathHolder.getInstance();
            string           activeDocumentPath = theHolder.activeFilePath;
            string           tmpDocumentPath    = theHolder.tmpFilePath;

            string strCmdText = "-c \"import sys; sys.path.insert(0, r'" + folderPath + "');"
                                + "import ScriptsMgr as smgr; "
                                + "smgr.fix_with_script(r'" + tmpDocumentPath + "', '" + moduleName + "');\" ";

            var procStIfo = new ProcessStartInfo("py", strCmdText);

            procStIfo.RedirectStandardOutput = true;
            procStIfo.UseShellExecute        = false;
            procStIfo.CreateNoWindow         = true;

            var proc = new Process();

            proc.StartInfo = procStIfo;
            proc.Start();
            proc.WaitForExit();
        }
        private void RewriteActiveFile()
        {
            ActivePathHolder theHolder          = ActivePathHolder.getInstance();
            string           activeDocumentPath = theHolder.activeFilePath;
            string           tmpDocumentPath    = theHolder.tmpFilePath;

            // To copy a file to another location and
            // overwrite the destination file if it already exists.
            System.IO.File.Copy(tmpDocumentPath, activeDocumentPath, true);
        }
        private void RemoveTmpFile()
        {
            ActivePathHolder theHolder       = ActivePathHolder.getInstance();
            string           tmpDocumentPath = theHolder.tmpFilePath;

            if (File.Exists(tmpDocumentPath))
            {
                File.Delete(tmpDocumentPath);
            }
        }
Пример #4
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void MenuItemCallback(object sender, EventArgs e)
        {
            string activeDocumentPath = GetActiveDocumentFilePath(ServiceProvider);

            ActivePathHolder theHolder = ActivePathHolder.getInstance();

            theHolder.activeFilePath = activeDocumentPath;

            // show dialog
            var documentationControl = new InspectCodeWnd();

            documentationControl.ShowModal();
        }
        private void OnOpenDiffTool(object sender, RoutedEventArgs e)
        {
            ActivePathHolder theHolder          = ActivePathHolder.getInstance();
            string           activeDocumentPath = theHolder.activeFilePath;
            string           tmpDocumentPath    = theHolder.tmpFilePath;

            string strCmdText;

            strCmdText = "\"" + activeDocumentPath + "\" \"" + activeDocumentPath + "\" \"" + tmpDocumentPath + "\"";// -o \"temp.cpp\"";

            //string diffToolDirectory = CodeCleaner.Default.DiffToolDirectory; TODO_uncomment
            string diffToolDirectory = "C:\\Program Files\\KDiff3\\kdiff3.exe";

            System.Diagnostics.Process.Start(diffToolDirectory, strCmdText);
        }
Пример #6
0
        private void OnRun(object sender, RoutedEventArgs e)
        {
            // find document path
            ActivePathHolder theHolder          = ActivePathHolder.getInstance();
            string           activeDocumentPath = theHolder.activeFilePath;
            string           tmpDocumentPath    = theHolder.tmpFilePath;

            // To copy a file to another location and
            // overwrite the destination file if it already exists.
            System.IO.File.Copy(activeDocumentPath, tmpDocumentPath, true);


            foreach (var module in modulesToRun)
            {
                ExecuteFixCommand(module);
            }
            this.Close();

            var documentationControl = new OpenDiffToolAndSaveWnd();

            documentationControl.ShowModal();
        }