Exemplo n.º 1
0
        public static EcoBlueprint Create(List <WorldEditBlock> blocks, List <WorldEditBlock> plants, List <WorldEditBlock> worldObjects, AuthorInformation author)
        {
            EcoBlueprint schematic = new EcoBlueprint();

            schematic.Version    = WorldEditSerializer.CurrentVersion;
            schematic.EcoVersion = Shared.EcoVersion.VersionNumber;
            schematic.Blocks     = blocks;
            schematic.Plants     = plants;
            schematic.Objects    = worldObjects;
            schematic.Author     = author;
            return(schematic);
        }
Exemplo n.º 2
0
        public void Deserialize(Stream stream)
        {
            EcoBlueprint schematic = Deserialize <EcoBlueprint>(stream);

            if (!CurrentVersion.Equals(schematic.Version))
            {
                //TODO: Handle serialization version changes and support previous versions
                //throw new FileLoadException(message: $"EcoBlueprint file version missmatch [file version: {schematic.Version}, current version: {currentVersion}]");
            }

            if (!string.IsNullOrEmpty(schematic.EcoVersion) && !this.CurrentEcoVersion.Equals(schematic.EcoVersion))
            {
                //TODO: Handle ECO version changes and migrate from previous versions
                //throw new FileLoadException(message: $"EcoBlueprint file created in different Eco version [file version: {schematic.EcoVersion}, current version: {this.CurrentEcoVersion}]");
            }

            this.BlockList         = schematic.Blocks;
            this.PlantList         = schematic.Plants;
            this.WorldObjectList   = schematic.Objects;
            this.AuthorInformation = schematic.Author;
        }
Exemplo n.º 3
0
        public void Serialize(Stream stream)
        {
            EcoBlueprint schematic = EcoBlueprint.Create(this.blockList, this.plantList, this.worldObjectList, this.AuthorInformation);

            Serialize(stream, schematic);
        }