Ejemplo n.º 1
0
        public CardFace(byte[] bytes,FaceType type)
        {
            faceBytes = bytes;
            faceType = type;

            Stream stream = new MemoryStream(faceBytes);
            FileReader reader = new FileReader(stream);
            reader.ReadBytes(4);//skip Tag 'FACE'
            bgColor = reader.ReadUInt32();
            hasLogo = reader.ReadBoolean();

            byte[] dataBytes;
            byte[] readBytes;
            int len;

            if (hasLogo)
            {
                reader.ReadBytes(16);//skip LogoRect

                logoDepth = reader.ReadUInt32();//LogoDepth

                len = (int)(reader.ReadUInt32());//LogoMatrixBytes
                if (len > 0)
                {
                    logoMatrix = new Matrix(reader.ReadBytes(24));
                }

                len = (int)(reader.ReadUInt32());//LogoColorTransBytes
                if (len > 0)
                {
                    logoColorTrans = new ColorTransform(reader.ReadBytes(32));
                }
            }

            len = (int)(reader.ReadUInt32());//SymbolBytes
            if (len > 0)
            {
                symbols = new SymbolCollection(reader.ReadBytes(len));
            }

            len = (int)(reader.ReadUInt32());//TextBytes
            if (len > 0)
            {
                texts = new TextCollection(reader.ReadBytes(len));
            }

            len = (int)(reader.ReadUInt32());//ThumbnailBytes
            if (len > 0)
            {
                dataBytes=new byte[len];
                readBytes = reader.ReadBytes(len);
                readBytes.CopyTo(dataBytes,0);
                thumbnail = new Thumbnail(dataBytes,ThumbnailType.CardThumbnail);
            }

            stream.Close();
            reader.Close();
        }
Ejemplo n.º 2
0
        public LogoFile(Stream stream)
        {
            reader = new FileReader(stream);
            reader.ReadBytes(4);//skip Signature
            reader.ReadBytes(4);//skip Version
            guid = reader.ReadGB2312(32);
            uid = (int)(reader.ReadUInt32());

            int len = (int)(reader.ReadUInt32());
            if (len > 0)
            {
                title = reader.ReadGB2312(len);
            }

            len = (int)(reader.ReadUInt32());
            if (len > 0)
            {
                remark = reader.ReadGB2312(len);
            }

            date = reader.ReadGB2312(8);

            rect = new RectangleF();
            rect.X = reader.ReadSingle();
            rect.Y = reader.ReadSingle();
            rect.Width = reader.ReadSingle();
            rect.Height = reader.ReadSingle();

            len = (int)(reader.ReadUInt32());//SymbolBytes
            if (len > 0)
            {
                reader.BaseStream.Seek(len, SeekOrigin.Current);//skip Symbols
            }

            len = (int)(reader.ReadUInt32());//TextBytes
            if (len > 0)
            {
                reader.BaseStream.Seek(len, SeekOrigin.Current);//skip Texts
            }

            len = (int)(reader.ReadUInt32());//ThumbnailBytes
            if (len > 0)
            {
                byte[] thumbnailBytes = new byte[len];
                reader.ReadBytes(len).CopyTo(thumbnailBytes, 0);
                thumbnail = new Thumbnail(thumbnailBytes,ThumbnailType.LogoThumbnail);
                thumbnail.Save(HttpContext.Current.Server.MapPath("/flexLib/Thumbnails/Logos/" + guid + ".png"));
            }
        }