Example #1
0
 public bool WriteFile(string filePath, bool compress, bool binary)
 {
     if (!binary)
     {
         return(FileUtils.SaveJSon(this, filePath, compress));
     }
     return(FileUtils.SaveBinary(this, filePath));
 }
Example #2
0
 public bool WriteFile(string filePath, bool compress, bool binary)
 {
     if (!binary)
     {
         return(FileUtils.SaveJSon <OverworldFile>(this, filePath, compress));
     }
     else
     {
         return(FileUtils.SaveBinary <OverworldFile>(this, filePath));
     }
 }
Example #3
0
        public void WriteFile(string directory)
        {
            System.IO.Directory.CreateDirectory(directory);
            System.IO.Directory.CreateDirectory(directory + Path.DirectorySeparatorChar + "Chunks");

            foreach (ChunkFile chunk in ChunkData)
            {
                var filename = directory + Path.DirectorySeparatorChar + "Chunks" + Path.DirectorySeparatorChar + chunk.ID.X + "_" + chunk.ID.Y + "_" + chunk.ID.Z + ".";
                if (DwarfGame.COMPRESSED_BINARY_SAVES)
                {
                    FileUtils.SaveBinary(chunk, filename + ChunkFile.CompressedExtension);
                }
                else
                {
                    FileUtils.SaveJSon(chunk, filename + ChunkFile.Extension, false);
                }
            }

            FileUtils.SaveJSon(this.Metadata, directory + Path.DirectorySeparatorChar + "Metadata." + MetaData.Extension, false);
            FileUtils.SaveJSon(this.PlayData, directory + Path.DirectorySeparatorChar + "World." + PlayData.Extension, DwarfGame.COMPRESSED_BINARY_SAVES);
        }