Exemplo n.º 1
0
        public GameUpdate GetGameUpdate()
        {
            var config = MinecraftCronConfiguration.GetConfiguration();

            var newId = Regex.Replace(this.Version, "[^0-9]", "");

            int.TryParse(newId, out var parsedId);

            var variables = new Dictionary <string, object>
            {
                { "Update", this }
            };

            var gameUpdate = new GameUpdate
            {
                Name            = config.SpigotSettings.NameTemplate.ReplaceWithVariables(variables),
                GroupName       = config.SpigotSettings.Group,
                WindowsFileName = $"{GetDownloadUrl(Version)} minecraft_server.jar",
                LinuxFileName   = $"{GetDownloadUrl(Version)} minecraft_server.jar",
                ExtractPath     = "/",
                Reinstallable   = true,
                DefaultInstall  = false,
                GameId          = config.GameId,
                Comments        = config.SpigotSettings.Description.ReplaceWithVariables(variables),
                UserAccess      = true,
                SubAdminAccess  = true,
                ResellerAccess  = true,
                ViewOrder       = config.SpigotSettings.UseVersionAsViewOrder ? parsedId : 0
            };

            gameUpdate.GenerateKey();
            return(gameUpdate);
        }
Exemplo n.º 2
0
        public GameUpdate CreateGameUpdate()
        {
            var config = new CronJob().FindByType(typeof(MinecraftVanillaUpdatesCron)).Configuration.Parse <VanillaSettings>();

            var newId = Regex.Replace(this.Id, "[^0-9]", "");

            int.TryParse(newId, out var parsedId);

            var variables = new Dictionary <string, object>
            {
                { "Update", this },
                { "Update.Version", this.Id }
            };

            var gameUpdate = new GameUpdate
            {
                Name            = config.NameTemplate.ReplaceWithVariables(variables),
                GroupName       = config.Group,
                WindowsFileName = $"{this.Downloads.Server.Url} {config.FileName.ReplaceWithVariables(variables)}",
                LinuxFileName   = $"{this.Downloads.Server.Url} {config.FileName.ReplaceWithVariables(variables)}",
                ImageUrl        = config.ImageUrl,
                ExtractPath     = config.ExtractPath,
                Reinstallable   = true,
                DefaultInstall  = false,
                GameId          = config.GameId,
                Comments        = config.Description.ReplaceWithVariables(variables),
                UserAccess      = true,
                SubAdminAccess  = true,
                ResellerAccess  = true,
                ViewOrder       = config.UseVersionAsViewOrder ? parsedId : 0
            };

            gameUpdate.GenerateKey();
            return(gameUpdate);
        }
        public GameUpdate CreateGameUpdate()
        {
            var config = MinecraftCronConfiguration.GetConfiguration();

            var newId = Regex.Replace(this.Id, "[^0-9]", "");

            int.TryParse(newId, out var parsedId);

            var variables = new Dictionary <string, object>
            {
                { "Update", this },
                { "Update.Version", this.Id }
            };

            Console.WriteLine("Name = " + config.VanillaSettings.NameTemplate.ReplaceWithVariables(variables));
            var gameUpdate = new GameUpdate
            {
                Name            = config.VanillaSettings.NameTemplate.ReplaceWithVariables(variables),
                GroupName       = this.Type == "release" ? config.VanillaSettings.Group : config.VanillaSettings.SnapshotGroup,
                WindowsFileName = $"{this.Downloads.Server.Url} minecraft_server.jar",
                LinuxFileName   = $"{this.Downloads.Server.Url} minecraft_server.jar",
                ExtractPath     = "/",
                Reinstallable   = true,
                DefaultInstall  = false,
                GameId          = config.GameId,
                Comments        = config.VanillaSettings.Description.ReplaceWithVariables(variables),
                UserAccess      = true,
                SubAdminAccess  = true,
                ResellerAccess  = true,
                ViewOrder       = config.VanillaSettings.UseVersionAsViewOrder ? parsedId : 0
            };

            gameUpdate.GenerateKey();
            return(gameUpdate);
        }
Exemplo n.º 4
0
        public static GameUpdate GetGameUpdate(string version)
        {
            var config = new CronJob().FindByType(typeof(MinecraftPaperUpdatesCron)).Configuration.Parse <PaperSettings>();

            var newId = Regex.Replace(version, "[^0-9]", "");

            int.TryParse(newId, out var parsedId);

            var latestBuild = GetLatestBuildForVersion(version);

            var variables = new Dictionary <string, object>
            {
                { "Update.Version", version },
                { "Update.Version.Build", latestBuild },
            };

            var gameUpdate = new GameUpdate
            {
                Name            = config.NameTemplate.ReplaceWithVariables(variables),
                GroupName       = config.Group,
                WindowsFileName = $"{GetDownloadUrl(version)} {config.FileName.ReplaceWithVariables(variables)}",
                LinuxFileName   = $"{GetDownloadUrl(version)} {config.FileName.ReplaceWithVariables(variables)}",
                ImageUrl        = config.ImageUrl,
                ExtractPath     = config.ExtractPath,
                Reinstallable   = true,
                DefaultInstall  = false,
                GameId          = config.GameId,
                Comments        = config.Description.ReplaceWithVariables(variables),
                UserAccess      = true,
                SubAdminAccess  = true,
                ResellerAccess  = true,
                ViewOrder       = config.UseVersionAsViewOrder ? parsedId : 0,
                AppData         = { ["PaperBuild"] = latestBuild }
            };

            gameUpdate.GenerateKey();
            return(gameUpdate);
        }