public DirectoryInfo Decompress(string worldname)
        {
            var archivePath = Path.Combine(_archiveFolder.FullName, $"{worldname}.zip");

            if (!File.Exists(archivePath))
            {
                throw new WorldNotExistsException(worldname, archivePath);
            }

            var worldPath = Path.Combine(_tempFolder.FullName, ArchiveFoldername, worldname);

            _deleter.Delete(worldname);

            ZipFile.ExtractToDirectory(archivePath, worldPath);
            if (!Directory.Exists(worldPath))
            {
                throw new Exception("Decompression faild.");
            }

            return(new DirectoryInfo(worldPath));
        }
Beispiel #2
0
 public JsonResult Delete(string worldname)
 {
     _worldDeleter.Delete(worldname);
     return(Json(true));
 }