public ActionResult StartMapper(string world) { var serverPath = WebConfig.AppSettings["McServerPath"]; if (world == null) { world = McProperties.GetValue("level-name"); } var mapsDir = Path.Combine(serverPath, "Map"); if (!Directory.Exists(mapsDir)) { Directory.CreateDirectory(mapsDir); } try { ProcHttpClient.StartProc("Mapper", Path.Combine(serverPath, "Overviewer\\overviewer.exe"), "-p 4 --rendermodes=smooth_lighting,smooth_night \"" + world + "\" \"" + Path.Combine("Map", world) + "\"", serverPath); } catch (Exception ex) { Response.StatusCode = 500; return(Content(ex.ToString())); } return(Content("OK " + DateTime.Now.Ticks)); }
// MC World Management public ActionResult ManageWorlds() { var serverPath = WebConfig.AppSettings["McServerPath"]; var backupsDir = Path.Combine(serverPath, "Backups"); if (!Directory.Exists(backupsDir)) { Directory.CreateDirectory(backupsDir); } ViewBag.Backups = new DirectoryInfo(backupsDir) .EnumerateFiles("*.zip") .OrderByDescending(fi => fi.LastWriteTimeUtc) .Select(fi => { var s = fi.Name.Split('.'); return(Tuple.Create(s[0], DateTime.ParseExact(s[1], "yyyy-MM-dd-hh-mm-ss-tt", null))); }) .ToList(); ViewBag.Worlds = Directory.EnumerateDirectories(serverPath) .Where(d => FileIO.Exists(d + "\\level.dat")) .Select(d => Path.GetFileName(d)) .ToList(); ViewBag.SelWorld = McProperties.GetValue("level-name"); return(View()); }
public ActionResult Map(string world) { var serverPath = WebConfig.AppSettings["McServerPath"]; ViewBag.Worlds = Directory.EnumerateDirectories(serverPath) .Where(d => FileIO.Exists(d + "\\level.dat")) .Select(d => Path.GetFileName(d)) .ToList(); ViewBag.SelWorld = world ?? McProperties.GetValue("level-name"); return(View()); }