public void Export(TextureFormat texture, MetadataWriter metadata, string directory, string basename)
        {
            PE3DATTexture dat = texture as PE3DATTexture;

            if (dat == null)
            {
                throw new TextureFormatException("Not a valid PE3 DAT texture!");
            }

            metadata.BeginSection("PE3DAT");
            metadata.PutAttribute("Textures", dat.FramesCount);
            metadata.PutAttribute("Basename", basename);

            int oldSelected = dat.SelectedFrame;

            for (int i = 0; i < dat.FramesCount; i++)
            {
                dat.SelectedFrame = i;

                metadata.BeginSection("PE3DATSegment");
                metadata.Put("Position1", dat.Position1);
                metadata.Put("Position2", dat.Position2);
                metadata.Put("Bpp", dat.Bpp);
                metadata.EndSection();

                dat.GetImage().Save(Path.Combine(directory, basename + "_" + i + ".png"));
            }
            dat.SelectedFrame = oldSelected;
            metadata.EndSection();
        }
예제 #2
0
        public void Export(TextureFormat txt, MetadataWriter metadata, string directory, string basename)
        {
            TX48Texture texture = txt as TX48Texture;

            if (texture == null)
            {
                throw new TextureFormatException("Not a valid TX48Texture!");
            }

            try
            {
                metadata.BeginSection("TX48Texture");
                metadata.PutAttribute("Basename", basename);

                metadata.BeginSection("TX48Segment");
                metadata.Put("Bpp", texture.Bpp);
                metadata.EndSection();

                texture.GetImage().Save(Path.Combine(directory, basename + ".png"));
                metadata.EndSection();
            }
            catch (Exception e)
            {
                throw new TextureFormatException(e.Message, e);
            }
        }
예제 #3
0
        public void Export(TextureFormat texture, MetadataWriter metadata, string directory, string basename)
        {
            TIM2Texture tim2 = texture as TIM2Texture;

            if (tim2 == null)
            {
                throw new TextureFormatException("Not a valid TIM2Texture!");
            }

            metadata.BeginSection("TIM2");
            metadata.PutAttribute("Version", tim2.Version);
            metadata.PutAttribute("Basename", basename);
            metadata.PutAttribute("Swizzled", tim2.Swizzled);

            metadata.PutAttribute("Textures", tim2.TIM2SegmentsList.Count);
            int layer = 0;

            foreach (TIM2Segment segment in tim2.TIM2SegmentsList)
            {
                TextureFormatSerializer serializer = new TIM2SegmentSerializer();
                serializer.Export(segment, metadata, directory, basename + "_layer" + layer++);
            }

            metadata.EndSection();
        }
        public void Export(TextureFormat t, MetadataWriter metadata, string directory, string basename)
        {
            PE3SimpleDATTexture texture = t as PE3SimpleDATTexture;

            if (texture == null)
            {
                throw new TextureFormatException("Not a valid PE3 Simple DAT Texture!");
            }

            metadata.BeginSection("PE3SimpleDAT");
            metadata.PutAttribute("Basename", basename);
            metadata.Put("RawHeader", texture.GetRawHeader());

            texture.GetImage().Save(Path.Combine(directory, basename + ".png"));

            metadata.EndSection();
        }
예제 #5
0
        private void Writemetadata(TIM2Segment segment, MetadataWriter metadata, string basename)
        {
            metadata.BeginSection("TIM2Texture");
            metadata.PutAttribute("Basename", basename);
            metadata.PutAttribute("Cluts", segment.PalettesCount);
            metadata.PutAttribute("LinearClut", segment.GetParameters().linearPalette);

            metadata.Put("Width", segment.GetParameters().width);
            metadata.Put("Height", segment.GetParameters().height);
            metadata.Put("Bpp", segment.GetParameters().bpp);
            metadata.Put("ColorSize", segment.GetParameters().colorSize);
            metadata.Put("MipmapCount", segment.GetParameters().mipmapCount);

            metadata.Put("Format", segment.GetParameters().format);

            metadata.Put("GsTEX0", segment.GetParameters().GsTEX0);
            metadata.Put("GsTEX1", segment.GetParameters().GsTEX1);

            metadata.Put("GsRegs", segment.GetParameters().GsRegs);
            metadata.Put("GsTexClut", segment.GetParameters().GsTexClut);
            metadata.Put("UserData", segment.GetParameters().userdata);

            metadata.EndSection();
        }