Beispiel #1
0
        public static string HashSignatureFromMSIX(string packageFilePath)
        {
            // Obtain MakeAppX Executable Path
            string pathToSDK          = SDKDetector.Instance.LatestSDKBinPath;
            string makeappxExecutable = Path.Combine(pathToSDK, "makeappx.exe");

            // Generate temp path to unpack MSIX package
            FileInfo fileInfo             = new FileInfo(packageFilePath);
            string   packageName          = Path.GetFileNameWithoutExtension(fileInfo.Name);
            string   tempPath             = Path.GetTempPath();
            string   extractedPackageDest = Path.Combine(tempPath, packageName);

            // Delete existing extracted package directories to avoid stalling MakeAppX command
            if (Directory.Exists(extractedPackageDest))
            {
                TestIndexSetup.DeleteDirectoryContents(Directory.CreateDirectory(extractedPackageDest));
                Directory.Delete(extractedPackageDest);
            }

            TestIndexSetup.RunCommand(makeappxExecutable, $"unpack /nv /p {packageFilePath} /d {extractedPackageDest}");

            string packageSignaturePath = Path.Combine(extractedPackageDest, "AppxSignature.p7x");

            return(HashFile(packageSignaturePath));
        }
Beispiel #2
0
        /// <summary>
        /// Copies log files to the path %TEMP%\E2ETestLogs
        /// </summary>
        public static void PublishE2ETestLogs()
        {
            string tempPath           = Path.GetTempPath();
            string localAppDataPath   = Environment.GetEnvironmentVariable("LocalAppData");
            string testLogsSourcePath = Path.Combine(localAppDataPath, Constants.E2ETestLogsPath);
            string testLogsDestPath   = Path.Combine(tempPath, "E2ETestLogs");

            if (Directory.Exists(testLogsDestPath))
            {
                TestIndexSetup.DeleteDirectoryContents(new DirectoryInfo(testLogsDestPath));
                Directory.Delete(testLogsDestPath);
            }

            if (Directory.Exists(testLogsSourcePath))
            {
                TestIndexSetup.CopyDirectory(testLogsSourcePath, testLogsDestPath);
            }
        }