Exemple #1
0
        public bool ExecObjectInTextFormat(CommandData cmdData)
        {
            //This is a Debug Command to export the objects locally, ExecRequestReview does the full process
            //including ExportInTextFormat
            KBCodeReviewHelper.ExportObjectInTextFormat();

            return(true);
        }
        public bool ExecSendDiff(CommandData cmdData)
        {
            KBCodeReviewHelper.GitInit();
            KBCodeReviewHelper.GitCommit();
            KBCodeReviewHelper.ArcDiff();

            return(true);
        }
        public static void GitClone()
        {
            string path = KBCodeReviewHelper.GetKBCodeReviewDirectory();

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            string gitUser   = GetGitUser();
            string gitPwd    = GetGitPassword();
            string gitServer = PropertyAccessor.GetValueString(UIServices.KB.CurrentModel, "Git remote server");
            string user2     = PropertyAccessor.GetValueString(UIServices.KB.CurrentModel, "Git UserName");
            string url       = "https://" + gitUser + ":" + gitPwd.ToString() + "@" + gitServer;
            //string result2;
            //ArrayList debug = new ArrayList();
            //result2 = "User: "******"Password: "******"GitServer: " + GitServer.ToString();
            //debug.Add(result2);
            //result2 = "GitUrl: " + url.ToString();
            //debug.Add(result2);
            //result2 = "User2: " + user2.ToString();
            //debug.Add(result2);


            bool success = false;

            if (gitServer != "")
            {
                if ((gitUser != "") && (gitPwd != ""))
                {
                    success = GitHelper.GitClone(url);
                }
                else
                {
                    GxConsoleHandler.WriteOutput("Configure Git user and password");
                }
            }
            else
            {
                GxConsoleHandler.WriteOutput("Git remote server can not be null");
            }

            if (success)
            {
                success = GitHelper.SetNotepadAsEditor();
            }
        }
        //--------------------------------GIT-----------------------------------------------------------------------------

        private static bool GitInit()
        {
            string path = KBCodeReviewHelper.GetKBCodeReviewDirectory() + "/.git";

            if (!Directory.Exists(path))
            {
                return(GitHelper.GitInit());
            }
            else
            {
                GxConsoleHandler.WriteOutput("Git was already initialized");
                return(true);
            }
        }
Exemple #5
0
        //--------------------------------GIT-----------------------------------------------------------------------------
        public static void GitInit()
        {
            string path = KBCodeReviewHelper.GetKBCodeReviewDirectory() + "/.git";

            if (!Directory.Exists(path))
            {
                string result = ExecuteCommand.Execute("git init");
                GxConsoleHandler.GitConsoleWriter(result, "KBCodeReviewer - Execute Git Init");
            }
            else
            {
                GxConsoleHandler.GitConsoleWriter("Git was already initialized", "KBCodeReviewer - Execute Git Init");
            }
        }
Exemple #6
0
        //That must be separated and eliminate duplicate code

        public static void Execute(string _Command, out string result, out bool success)
        {
            //Init Cmd.exe
            System.Diagnostics.ProcessStartInfo procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd", "/c " + _Command);

            //Redirect output into a stream
            string KBCodeReviwerDirectory = KBCodeReviewHelper.GetKBCodeReviewDirectory();

            procStartInfo.WorkingDirectory       = KBCodeReviwerDirectory;
            procStartInfo.RedirectStandardInput  = true;
            procStartInfo.RedirectStandardError  = true;
            procStartInfo.RedirectStandardOutput = true;
            procStartInfo.UseShellExecute        = false;

            //Background execution - no black window
            procStartInfo.CreateNoWindow = true;

            //Inicializa el proceso
            System.Diagnostics.Process proc = new System.Diagnostics.Process();
            proc.StartInfo = procStartInfo;
            proc.Start();

            //Consigue la salida de la Consola(Stream) y devuelve una cadena de texto
            proc.WaitForExit();
            string ErrorResult = proc.StandardError.ReadToEnd();
            string resultOK    = proc.StandardOutput.ReadToEnd();
            int    exitCode    = proc.ExitCode;

            //Muestra en pantalla la salida del Comando
            if (exitCode != 0)
            {
                success = false;
            }
            else
            {
                success = true;
            }

            //This is because sometimes git send the output to the standardError although there were no errors.
            if (ErrorResult != "")
            {
                result = ErrorResult;
            }
            else
            {
                result = resultOK;
            }
        }
Exemple #7
0
        public static void ExecuteArc(string _Command)
        {
            //Init Cmd.exe
            System.Diagnostics.ProcessStartInfo procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd", "/k " + _Command);
            //Redirect output into a stream
            string KBCodeReviwerDirectory = KBCodeReviewHelper.GetKBCodeReviewDirectory();

            procStartInfo.WorkingDirectory       = KBCodeReviwerDirectory;
            procStartInfo.RedirectStandardInput  = false;
            procStartInfo.RedirectStandardOutput = false;
            procStartInfo.UseShellExecute        = true;
            //Background execution - black window
            procStartInfo.CreateNoWindow = false;
            //Inicializa el proceso
            System.Diagnostics.Process proc = new System.Diagnostics.Process();
            proc.StartInfo = procStartInfo;

            proc.Start();
        }
        //That must be separated and eliminate duplicate code

        public static String Execute(string _Command)
        {
            //Init Cmd.exe
            System.Diagnostics.ProcessStartInfo procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd", "/c " + _Command);
            //Redirect output into a stream
            string KBCodeReviwerDirectory = KBCodeReviewHelper.GetKBCodeReviewDirectory();

            procStartInfo.WorkingDirectory       = KBCodeReviwerDirectory;
            procStartInfo.RedirectStandardOutput = true;
            procStartInfo.UseShellExecute        = false;
            //Background execution - no black window
            procStartInfo.CreateNoWindow = true;
            //Inicializa el proceso
            System.Diagnostics.Process proc = new System.Diagnostics.Process();
            proc.StartInfo = procStartInfo;
            proc.Start();
            //Consigue la salida de la Consola(Stream) y devuelve una cadena de texto
            string result = proc.StandardOutput.ReadToEnd();

            //Muestra en pantalla la salida del Comando
            Console.WriteLine(result);
            return(result);
        }
Exemple #9
0
        //public bool ExecPushChanges(CommandData cmdData) {

        //    KBCodeReviewHelper.ArcLand();
        //    return true;
        //}

        public bool ExecOpenFolderKBCodeReview(CommandData cmdData)
        {
            KBCodeReviewHelper.OpenFolderKBCodeReview();
            return(true);
        }
Exemple #10
0
 public bool ExecRequestReview(CommandData cmdData)
 {
     KBCodeReviewHelper.RequestCodeReview();
     return(true);
 }
Exemple #11
0
 public bool ExecClone(CommandData cmdData)
 {
     KBCodeReviewHelper.GitClone();
     return(true);
 }
 public bool ExecPushChanges(CommandData cmdData)
 {
     KBCodeReviewHelper.ArcLand();
     return(true);
 }
        public bool ExecObjectInTextFormat(CommandData cmdData)
        {
            KBCodeReviewHelper.ExportObjectInTextFormat();

            return(true);
        }