Ejemplo n.º 1
0
        public static string GetGitFilePath()
        {
            string[] gitPathArray =
            {
                "%ProgramFiles%\\Git\\bin\\git.exe",
                "%ProgramFiles(x86)%\\Git\\bin\\git.exe",
                "%ProgramW6432%\\Git\\bin\\git.exe"
            };

            foreach (string path in gitPathArray)
            {
                string file = Environment.ExpandEnvironmentVariables(path);

                if (File.Exists(file))
                {
                    return(file);
                }
            }

            {
                string file = Win32.SearchFile("git.exe");

                if (File.Exists(file))
                {
                    return(file);
                }
            }

            return(null);
        }
Ejemplo n.º 2
0
        public static string GetVswhereFilePath()
        {
            string[] vswherePathArray =
            {
                "%ProgramFiles%\\Microsoft Visual Studio\\Installer\\vswhere.exe",
                "%ProgramFiles(x86)%\\Microsoft Visual Studio\\Installer\\vswhere.exe",
                "%ProgramW6432%\\Microsoft Visual Studio\\Installer\\vswhere.exe"
            };

            foreach (string path in vswherePathArray)
            {
                string file = Environment.ExpandEnvironmentVariables(path);

                if (File.Exists(file))
                {
                    return(file);
                }
            }

            {
                string file = Win32.SearchFile("vswhere.exe");

                if (File.Exists(file))
                {
                    return(file);
                }
            }

            return(null);
        }
Ejemplo n.º 3
0
        public static string GetGitFilePath()
        {
            string git = Win32.SearchFile("git.exe");

            if (File.Exists(git))
            {
                return(git);
            }

            git = Environment.ExpandEnvironmentVariables("%ProgramFiles%\\Git\\bin\\git.exe");

            if (File.Exists(git))
            {
                return(git);
            }

            git = Environment.ExpandEnvironmentVariables("%ProgramFiles(x86)%\\Git\\bin\\git.exe");

            if (File.Exists(git))
            {
                return(git);
            }

            git = Environment.ExpandEnvironmentVariables("%ProgramW6432%\\Git\\bin\\git.exe");

            if (File.Exists(git))
            {
                return(git);
            }

            return(null);
        }
Ejemplo n.º 4
0
 static AppVeyor()
 {
     try
     {
         AppVeyorPath = Win32.SearchFile("appveyor");
     }
     catch (Exception) { }
 }
Ejemplo n.º 5
0
        public static bool UploadFile(string FileName)
        {
            try
            {
                string AppVeyorFilePath = Win32.SearchFile("appveyor.exe");

                if (!string.IsNullOrWhiteSpace(AppVeyorFilePath) && !string.IsNullOrWhiteSpace(FileName))
                {
                    Win32.ShellExecute("appveyor", $"PushArtifact \"{FileName}\" ");
                    return(true);
                }
            }
            catch (Exception ex)
            {
                Program.PrintColorMessage("[UploadFile] " + ex, ConsoleColor.Red, true);
            }

            return(false);
        }
Ejemplo n.º 6
0
        public static bool UpdateBuildVersion(string BuildVersion)
        {
            try
            {
                string AppVeyorFilePath = Win32.SearchFile("appveyor.exe");

                if (!string.IsNullOrWhiteSpace(AppVeyorFilePath) && !string.IsNullOrWhiteSpace(BuildVersion))
                {
                    Win32.ShellExecute("appveyor", $"UpdateBuild -Version \"{BuildVersion}\" ");
                    return(true);
                }
            }
            catch (Exception ex)
            {
                Program.PrintColorMessage("[UpdateBuildVersion] " + ex, ConsoleColor.Red, true);
            }

            return(false);
        }
Ejemplo n.º 7
0
        public static string GetGitFilePath()
        {
            string git = Win32.SearchFile("git.exe");

            if (File.Exists(git))
            {
                return(git);
            }

            foreach (string path in GitPathArray)
            {
                git = Environment.ExpandEnvironmentVariables(path);

                if (File.Exists(git))
                {
                    return(git);
                }
            }

            return(null);
        }
Ejemplo n.º 8
0
        public static bool BuildAppxSignature(string BuildOutputFolder)
        {
            string sdkRootPath = string.Empty;

            string[] cleanupAppxArray =
            {
                BuildOutputFolder + "\\processhacker-appx.pvk",
                BuildOutputFolder + "\\processhacker-appx.cer",
                BuildOutputFolder + "\\processhacker-appx.pfx"
            };

            Program.PrintColorMessage("Building Appx Signature...", ConsoleColor.Cyan);

            using (var view32 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32))
            {
                using (var kitsroot = view32.OpenSubKey("Software\\Microsoft\\Windows Kits\\Installed Roots", false))
                {
                    sdkRootPath = (string)kitsroot.GetValue("WdkBinRootVersioned", string.Empty);
                }
            }

            if (string.IsNullOrEmpty(sdkRootPath))
            {
                Program.PrintColorMessage("[Skipped] Windows SDK", ConsoleColor.Red);
                return(false);
            }

            string makeCertExePath = Environment.ExpandEnvironmentVariables(sdkRootPath + "\\x64\\MakeCert.exe");
            string pvk2PfxExePath  = Environment.ExpandEnvironmentVariables(sdkRootPath + "\\x64\\Pvk2Pfx.exe");
            string certUtilExePath = Win32.SearchFile("certutil.exe");

            try
            {
                foreach (string file in cleanupAppxArray)
                {
                    if (File.Exists(file))
                    {
                        File.Delete(file);
                    }
                }

                string output = Win32.ShellExecute(makeCertExePath,
                                                   "/n " +
                                                   "\"CN=ProcessHacker, O=ProcessHacker, C=AU\" " +
                                                   "/r /h 0 " +
                                                   "/eku \"1.3.6.1.5.5.7.3.3,1.3.6.1.4.1.311.10.3.13\" " +
                                                   "/sv " +
                                                   BuildOutputFolder + "\\processhacker-appx.pvk " +
                                                   BuildOutputFolder + "\\processhacker-appx.cer "
                                                   );

                if (!string.IsNullOrEmpty(output) && !output.Equals("Succeeded", StringComparison.OrdinalIgnoreCase))
                {
                    Program.PrintColorMessage("[MakeCert] " + output, ConsoleColor.Red);
                    return(false);
                }

                output = Win32.ShellExecute(pvk2PfxExePath,
                                            "/pvk " + BuildOutputFolder + "\\processhacker-appx.pvk " +
                                            "/spc " + BuildOutputFolder + "\\processhacker-appx.cer " +
                                            "/pfx " + BuildOutputFolder + "\\processhacker-appx.pfx "
                                            );

                if (!string.IsNullOrEmpty(output))
                {
                    Program.PrintColorMessage("[Pvk2Pfx] " + output, ConsoleColor.Red);
                    return(false);
                }

                output = Win32.ShellExecute(certUtilExePath,
                                            "-addStore TrustedPeople " + BuildOutputFolder + "\\processhacker-appx.cer"
                                            );

                if (!string.IsNullOrEmpty(output) && !output.Contains("command completed successfully"))
                {
                    Program.PrintColorMessage("[Certutil] " + output, ConsoleColor.Red);
                    return(false);
                }

                Program.PrintColorMessage("[Pvk2Pfx] " + output, ConsoleColor.Green);
            }
            catch (Exception ex)
            {
                Program.PrintColorMessage("[ERROR] " + ex, ConsoleColor.Red);
                return(false);
            }

            return(true);
        }
Ejemplo n.º 9
0
 static AppVeyor()
 {
     AppVeyorPath = Win32.SearchFile("appveyor.exe");
 }