private static string GetProductFileName(AppveyorProduct product)
        {
            switch (product)
            {
            case AppveyorProduct.Client:
            case AppveyorProduct.Server:
                return("LunaMultiplayer");

            case AppveyorProduct.MasterServer:
                return("LunaMultiplayerMasterServer");

            default:
                throw new ArgumentOutOfRangeException(nameof(product), product, null);
            }
        }
        public static string GetZipFileUrl(AppveyorProduct product, bool debugVersion = false)
        {
            if (AppveyorUpdateChecker.LatestBuild.build.status == "success")
            {
                var job = AppveyorUpdateChecker.LatestBuild.build.jobs.FirstOrDefault(j => debugVersion ? j.name.Contains("Debug") : j.name.Contains("Release"));
                if (job != null)
                {
                    var filename = GetProductFileName(product);
                    if (debugVersion)
                    {
                        filename += "-Debug.zip";
                    }
                    else
                    {
                        filename += "-Release.zip";
                    }

                    return($"https://ci.appveyor.com/api/buildjobs/{job.jobId}/artifacts/{filename}");
                }
            }

            return(null);
        }
Beispiel #3
0
        public static void ExtractZipFileToDirectory(string zipFilePath, string destinationFolder, AppveyorProduct product)
        {
            if (string.IsNullOrEmpty(zipFilePath) || string.IsNullOrEmpty(destinationFolder) || !Directory.Exists(destinationFolder) || !File.Exists(zipFilePath))
            {
                return;
            }

            var tempFolder = Path.Combine(destinationFolder, "TempUnzipFolder");

            Directory.CreateDirectory(tempFolder);
            System.IO.Compression.ZipFile.ExtractToDirectory(zipFilePath, tempFolder, true);

            switch (product)
            {
            case AppveyorProduct.Client:
                ExtractClient(tempFolder);
                break;

            case AppveyorProduct.Server:
                ExtractServer(tempFolder);
                break;

            case AppveyorProduct.MasterServer:
                ExtractMasterServer(tempFolder);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(product), product, null);
            }

            Directory.Delete(tempFolder, true);

            File.Delete(zipFilePath);
        }