Esempio n. 1
0
        public async Task <IActionResult> Index(string version, string type)
        {
            if (version != null)
            {
                if (!Util.IsCorrectUuid(version))
                {
                    return(NotFound());
                }
                var minecraftVersion = await _context.MinecraftVersions.FindAsync(version);

                switch (type)
                {
                case "coremod":
                {
                    var path = _storageSetting.GetCoremodStorageSetting().GetCoremodFile(minecraftVersion).FullName;
                    return(PhysicalFile(path, "application/java-archive", $"portal-core-{minecraftVersion.Version}.jar"));
                }

                case "property":
                {
                    var path = _storageSetting.GetCoremodStorageSetting().GetPropertyFile(minecraftVersion).FullName;
                    return(PhysicalFile(path, "text/plain", "portal.properties"));
                }
                }
            }
            return(View());
        }