Exemple #1
0
        public void ExportDesigns(ArrayList designs, string defaultFile)
        {
            if (designs.Count == 0)
            {
                return;
            }

            string filename = GetExportFileName(defaultFile);

            if (filename.Length > 0)
            {
                BinaryFileWriter writer = new BinaryFileWriter(File.Open(filename, FileMode.Create, FileAccess.Write, FileShare.None));

                // write file version
                writer.WriteShort(EXPORT_VERSION);
                // writer design count
                writer.WriteShort((short)designs.Count);

                for (int i = 0; i < designs.Count; ++i)
                {
                    DesignData design = (DesignData)designs[i];

                    if (!design.IsLoaded)
                    {
                        design.Load();
                    }

                    ExportDesign(design, writer);
                    design.Unload();
                }

                writer.Close();
                System.Windows.Forms.MessageBox.Show(string.Format("{0} designs were exported.", designs.Count));
            }
        }
Exemple #2
0
        public override void Export(DesignData design)
        {
            string filename = Utility.GetSaveFileName("(*.mlt)|*.mlt", "Multi Data File", "");

            if (filename.Length > 0)
            {
                if (!design.IsLoaded)
                {
                    design.Load();
                }

                int zoffset = CalculateMinZ(design.Items);

                BinaryFileWriter writer = new BinaryFileWriter(File.Open(filename, FileMode.Create, FileAccess.Write, FileShare.None));

                for (int i = 0; i < design.Items.Count; ++i)
                {
                    DesignItem item = design.Items[i];

                    writer.WriteShort(item.ItemID);
                    writer.WriteShort((short)item.X);
                    writer.WriteShort((short)item.Y);
                    writer.WriteShort((short)(item.Z - zoffset));
                    writer.WriteShort(1);
                    writer.WriteShort(item.Hue);
                }

                writer.Close();
            }
        }
Exemple #3
0
        public void ExportDesign(DesignData design, BinaryFileWriter writer)
        {
            writer.WriteString(design.Name);
            writer.WriteString(design.Category);
            writer.WriteString(design.Subsection);
            writer.WriteInt(design.Width);
            writer.WriteInt(design.Height);
            writer.WriteInt(design.UserWidth);
            writer.WriteInt(design.UserHeight);

            // item count
            writer.WriteInt(design.Items.Count);

            for (int i = 0; i < design.Items.Count; ++i)
            {
                DesignItem item = design.Items[i];

                writer.WriteShort(item.ItemID);
                writer.WriteShort((short)item.X);
                writer.WriteShort((short)item.Y);
                writer.WriteShort((short)item.Z);
                writer.WriteShort(item.Level);
                writer.WriteShort(item.Hue);
            }
        }
        public override void Export(DesignData design)
        {
            string filename = GetExportFileName(design.Name);

            if (filename.Length > 0)
            {
                if (!design.IsLoaded)
                {
                    design.Load();
                }

                BinaryFileWriter writer = new BinaryFileWriter(File.Open(filename, FileMode.Create, FileAccess.Write, FileShare.None));

                writer.WriteShort(EXPORT_VERSION);
                writer.WriteString(design.Name);
                writer.WriteString(design.Category);
                writer.WriteString(design.Subsection);
                writer.WriteInt(design.Width);
                writer.WriteInt(design.Height);
                writer.WriteInt(design.UserWidth);
                writer.WriteInt(design.UserHeight);

                // item count
                writer.WriteInt(design.Items.Count);

                for (int i = 0; i < design.Items.Count; ++i)
                {
                    DesignItem item = design.Items[i];

                    writer.WriteShort(item.ItemID);
                    writer.WriteShort((short)item.X);
                    writer.WriteShort((short)item.Y);
                    writer.WriteShort((short)item.Z);
                    writer.WriteShort(item.Level);
                    writer.WriteShort(item.Hue);
                }

                writer.Close();
            }
        }