public void WriteFile(FileStream stream, string path, FileFormat filetype) { CreateWorld(); if (filetype.IsFormat("MCR") || filetype.IsFormat("MCR-RAW")) { world.WriteRegionFile(stream, regionOffsetX, regionOffsetZ); } else { path = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path)); Directory.CreateDirectory(path); var mapPath = Path.Combine(path, "overviewmap.png"); using (var mapStream = new FileStream(mapPath, FileMode.Create)) { var mapExporter = new OverviewmapExporter(this, true); mapExporter.WriteFile(mapStream, mapPath, null); } mapPath = Path.Combine(path, "overviewmap_no-water.png"); using (var mapStream = new FileStream(mapPath, FileMode.Create)) { var mapExporter = new OverviewmapExporter(this, true, HeightmapType.SolidBlocksNoLiquid); mapExporter.WriteFile(mapStream, mapPath, null); } world.WriteWorldSave(path, regionOffsetX * 512 + 50, regionOffsetZ * 512 + 50); } }
public void WriteFile(FileStream stream, string path, FileFormat filetype) { if (filetype.IsFormat("ASC")) { WriteFileASC(stream); } else if (filetype.IsFormat("PTS_XYZ")) { WriteFileXYZ(stream); } }
public override HeightData Import(string importPath, FileFormat ff, params string[] args) { if (ff.IsFormat("ASC")) { return(ASCImporter.Import(importPath)); } return(null); }
public static ImageType GetImageType(this FileFormat ff) { if (ff.IsFormat("IMG_PNG-HM")) { return(ImageType.Heightmap); } else if (ff.IsFormat("IMG_PNG-NM")) { return(ImageType.Normalmap); } else if (ff.IsFormat("IMG_PNG-HS")) { return(ImageType.Hillshade); } else if (ff.IsFormat("IMG_PNG-HM-S")) { return(ImageType.Heightmap_Banded); } else { return(ImageType.Heightmap); } }
public override bool Export(string importPath, FileFormat ff, ASCData data, string filename, string fileSubName, ExportOptions exportOptions, Bounds bounds) { if (ff.IsFormat("MCA")) { int regionX = 0; int regionZ = 0; if (!string.IsNullOrEmpty(fileSubName)) { string[] s = fileSubName.Split('.'); if (s.Length >= 3) { regionX = int.Parse(s[1]); regionZ = int.Parse(s[2]); } } return(WriteFileMCA(importPath, exportOptions.useSplatmaps, data, filename, exportOptions.subsampling, bounds)); } return(false); }
public static bool IsPointFormat(this FileFormat format) { return(format.IsFormat("ASC") || format.Identifier.StartsWith("PTS")); }