protected override void InternalBuild()
        {
            var x64Components = AgentComponents.GetAgentComponents(AgentType.Framework, Configuration, "x64", RepoRootDirectory, HomeRootDirectory);
            var x86Components = AgentComponents.GetAgentComponents(AgentType.Framework, Configuration, "x86", RepoRootDirectory, HomeRootDirectory);

            x64Components.ValidateComponents();
            x86Components.ValidateComponents();

            FileHelpers.CopyAll($@"{PackageDirectory}\Installer", FilesToZipFolderName);
            var replacements = new Dictionary <string, string>()
            {
                { "AGENT_VERSION_STRING", x64Components.Version }
            };

            FileHelpers.ReplaceTextInFile($@"{FilesToZipFolderName}\install.ps1", replacements);

            var agentInfo = new AgentInfo
            {
                InstallType = "ScriptableFramework"
            };

            agentInfo.WriteToDisk(FilesToZipFolderName);

            CreateNugetPackage(x64Components, x86Components, $@"{PackageDirectory}\NewRelic.Net.Agent.x64.nuspec");
            CreateNugetPackage(x86Components, x86Components, $@"{PackageDirectory}\NewRelic.Net.Agent.nuspec");

            var zipFilePath = $@"{OutputDirectory}\NewRelic.Agent.Installer.{x64Components.Version}.zip";

            Directory.CreateDirectory(OutputDirectory);
            System.IO.Compression.ZipFile.CreateFromDirectory(FilesToZipFolderName, zipFilePath);
            File.WriteAllText($@"{OutputDirectory}\checksum.sha256", FileHelpers.GetSha256Checksum(zipFilePath));
        }
Пример #2
0
        private static void Main(string[] args)
        {
            Console.WriteLine("ShareX setup started.");

            if (SetupHelpers.CheckArguments(args, "-AppVeyorRelease"))
            {
                AppVeyor = true;
                Job      = SetupJobs.AppVeyorRelease;
            }
            else if (SetupHelpers.CheckArguments(args, "-AppVeyorSteam"))
            {
                AppVeyor = true;
                Job      = SetupJobs.AppVeyorSteam;
            }
            else if (SetupHelpers.CheckArguments(args, "-AppVeyorMicrosoftStore"))
            {
                AppVeyor = true;
                Job      = SetupJobs.AppVeyorMicrosoftStore;
            }
            else if (SetupHelpers.CheckArguments(args, "-AppVeyorSteamRelease"))
            {
                AppVeyor = true;
                Job      = SetupJobs.AppVeyorSteamRelease;
            }
            else if (SetupHelpers.CheckArguments(args, "-AppVeyorMicrosoftStoreRelease"))
            {
                AppVeyor = true;
                Job      = SetupJobs.AppVeyorMicrosoftStoreRelease;
            }

            Console.WriteLine("Setup job: " + Job);

            if (Directory.Exists(OutputDir))
            {
                Console.WriteLine("Cleaning output directory: " + OutputDir);

                Directory.Delete(OutputDir, true);
            }

            if (Job.HasFlag(SetupJobs.CreateSetup))
            {
                CompileSetup();
            }

            if (Job.HasFlag(SetupJobs.CreatePortable))
            {
                CreateFolder(ReleaseDir, PortableOutputDir, SetupJobs.CreatePortable);
            }

            if (Job.HasFlag(SetupJobs.CreateSteamFolder))
            {
                CreateSteamFolder();

                if (Job.HasFlag(SetupJobs.DownloadFFmpeg))
                {
                    CopyFFmpeg(SteamUpdatesDir, true, true);
                }
            }

            if (Job.HasFlag(SetupJobs.CreateMicrosoftStoreFolder))
            {
                CreateFolder(MicrosoftStoreDir, MicrosoftStoreOutputDir, SetupJobs.CreateMicrosoftStoreFolder);

                if (Job.HasFlag(SetupJobs.DownloadFFmpeg))
                {
                    CopyFFmpeg(MicrosoftStoreOutputDir, false, true);
                }
            }

            if (Job.HasFlag(SetupJobs.CreateMicrosoftStoreDebugFolder))
            {
                CreateFolder(MicrosoftStoreDebugDir, MicrosoftStoreOutputDir, SetupJobs.CreateMicrosoftStoreDebugFolder);
            }

            if (Job.HasFlag(SetupJobs.CompileAppx))
            {
                using (Process process = new Process())
                {
                    ProcessStartInfo psi = new ProcessStartInfo()
                    {
                        FileName               = MakeAppxPath,
                        Arguments              = $"pack /d \"{MicrosoftStoreOutputDir}\" /p \"{MicrosoftStoreAppxPath}\" /l /o",
                        UseShellExecute        = false,
                        RedirectStandardOutput = true
                    };

                    process.OutputDataReceived += (s, e) => Console.WriteLine(e.Data);
                    process.StartInfo           = psi;
                    process.Start();
                    process.BeginOutputReadLine();
                    process.WaitForExit();
                }

                Directory.Delete(MicrosoftStoreOutputDir, true);
            }

            if (Job.HasFlag(SetupJobs.CreateChecksumFile))
            {
                Console.WriteLine("Creating checksum files.");

                foreach (string file in Directory.GetFiles(OutputDir))
                {
                    Helpers.CreateChecksumFile(file);
                }
            }

            if (AppVeyor)
            {
                FileHelpers.CopyAll(OutputDir, ParentDir);
            }

            if (Job.HasFlag(SetupJobs.OpenOutputDirectory))
            {
                OpenOutputDirectory();
            }

            if (Job.HasFlag(SetupJobs.UploadOutputFile))
            {
                UploadLatestFile();
            }

            Console.WriteLine("ShareX setup successfully completed.");
        }
Пример #3
0
        private static void CreateFolder(string source, string destination, SetupJobs job)
        {
            Console.WriteLine("Creating folder: " + destination);

            if (Directory.Exists(destination))
            {
                Directory.Delete(destination, true);
            }

            Directory.CreateDirectory(destination);

            SetupHelpers.CopyFile(Path.Combine(source, "ShareX.exe"), destination);
            SetupHelpers.CopyFile(Path.Combine(source, "ShareX.exe.config"), destination);
            SetupHelpers.CopyFiles(source, "*.dll", destination);

            if (job == SetupJobs.CreateMicrosoftStoreDebugFolder)
            {
                SetupHelpers.CopyFiles(source, "*.pdb", destination);
            }

            SetupHelpers.CopyFiles(Path.Combine(ParentDir, "Licenses"), "*.txt", Path.Combine(destination, "Licenses"));

            if (job != SetupJobs.CreateMicrosoftStoreFolder && job != SetupJobs.CreateMicrosoftStoreDebugFolder)
            {
                if (!File.Exists(RecorderDevicesSetupPath))
                {
                    CompileISSFile("Recorder-devices-setup.iss");
                }

                SetupHelpers.CopyFile(RecorderDevicesSetupPath, destination);

                SetupHelpers.CopyFile(Path.Combine(NativeMessagingHostDir, "ShareX_NativeMessagingHost.exe"), destination);
            }

            string[] languages = new string[] { "de", "es", "es-MX", "fa-IR", "fr", "hu", "id-ID", "it-IT", "ja-JP", "ko-KR", "nl-NL", "pl", "pt-BR", "pt-PT",
                                                "ro", "ru", "tr", "uk", "vi-VN", "zh-CN", "zh-TW" };

            foreach (string language in languages)
            {
                SetupHelpers.CopyFiles(Path.Combine(source, language), "*.resources.dll", Path.Combine(destination, "Languages", language));
            }

            FileHelpers.CopyAll(Path.Combine(ParentDir, @"ShareX.ScreenCaptureLib\Stickers"), Path.Combine(destination, "Stickers"));

            if (job == SetupJobs.CreateMicrosoftStoreFolder || job == SetupJobs.CreateMicrosoftStoreDebugFolder)
            {
                FileHelpers.CopyAll(MicrosoftStorePackageFilesDir, destination);
            }
            else if (job == SetupJobs.CreatePortable)
            {
                FileHelpers.CreateEmptyFile(Path.Combine(destination, "Portable"));

                FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(ReleaseExecutablePath);
                string          zipFileName = string.Format("ShareX-{0}.{1}.{2}-portable.zip", versionInfo.ProductMajorPart, versionInfo.ProductMinorPart, versionInfo.ProductBuildPart);
                string          zipPath     = Path.Combine(OutputDir, zipFileName);
                //string zipPath = Path.Combine(OutputDir, "ShareX-portable.zip");
                ZipManager.Compress(Path.GetFullPath(destination), Path.GetFullPath(zipPath));

                Directory.Delete(destination, true);
            }

            Console.WriteLine("Folder created.");
        }