Exemplo n.º 1
0
        public EleInstance ReadElements()
        {
            m_reader.Seek(0, SeekOrigin.Begin);

            int header = m_reader.ReadByte();

            if (header != 69)
            {
                try
                {
                    var uncompress = ZipHelper.Uncompress(m_reader.ReadBytes((int)m_reader.BytesAvailable));

                    if (uncompress.Length <= 0 || uncompress[0] != 69)
                    {
                        throw new FileLoadException("Wrong header file");
                    }

                    ChangeStream(new MemoryStream(uncompress));
                }
                catch (Exception)
                {
                    throw new FileLoadException("Wrong header file");
                }
            }

            var instance = EleInstance.ReadFromStream(m_reader);

            return(instance);
        }
Exemplo n.º 2
0
        public static EleInstance ReadFromStream(BigEndianReader reader)
        {
            var instance = new EleInstance();

            instance.Version = reader.ReadByte();

            var count = reader.ReadUInt();

            for (int i = 0; i < count; i++)
            {
                var elem = EleGraphicalData.ReadFromStream(instance, reader);
                instance.GraphicalDatas.Add(elem.Id, elem);
            }

            if (instance.Version >= 8)
            {
                var gfxCount = reader.ReadInt();
                for (int i = 0; i < gfxCount; i++)
                {
                    instance.GfxJpgMap.Add(reader.ReadInt(), true);
                }
            }

            return(instance);
        }
        public static EleGraphicalData ReadFromStream(EleInstance instance, BigEndianReader reader)
        {
            var id   = reader.ReadInt();
            var type = (EleGraphicalElementTypes)reader.ReadByte();

            switch (type)
            {
            case EleGraphicalElementTypes.ANIMATED:
                return(AnimatedGraphicalElementData.ReadFromStream(instance, id, reader));

            case EleGraphicalElementTypes.BLENDED:
                return(BlendedGraphicalElementData.ReadFromStream(instance, id, reader));

            case EleGraphicalElementTypes.BOUNDING_BOX:
                return(BoundingBoxGraphicalElementData.ReadFromStream(instance, id, reader));

            case EleGraphicalElementTypes.ENTITY:
                return(EntityGraphicalElementData.ReadFromStream(instance, id, reader));

            case EleGraphicalElementTypes.NORMAL:
                return(NormalGraphicalElementData.ReadFromStream(instance, id, reader));

            case EleGraphicalElementTypes.PARTICLES:
                return(ParticlesGraphicalElementData.ReadFromStream(instance, id, reader));

            default:
                throw new Exception("Unknown graphical data of type " + type);
            }
        }
Exemplo n.º 4
0
        public static EleGraphicalData ReadFromStream(EleInstance instance, BigEndianReader reader)
        {
            var id = reader.ReadInt();
            var type = (EleGraphicalElementTypes)reader.ReadByte();

            switch (type)
            {
                   case EleGraphicalElementTypes.ANIMATED:
                    return AnimatedGraphicalElementData.ReadFromStream(instance, id, reader);
                   case EleGraphicalElementTypes.BLENDED:
                    return BlendedGraphicalElementData.ReadFromStream(instance, id, reader);
                   case EleGraphicalElementTypes.BOUNDING_BOX:
                    return BoundingBoxGraphicalElementData.ReadFromStream(instance, id, reader);
                   case EleGraphicalElementTypes.ENTITY:
                    return EntityGraphicalElementData.ReadFromStream(instance, id, reader);
                   case EleGraphicalElementTypes.NORMAL:
                    return NormalGraphicalElementData.ReadFromStream(instance, id, reader);
                   case EleGraphicalElementTypes.PARTICLES:
                    return ParticlesGraphicalElementData.ReadFromStream(instance, id, reader);
                default:
                    throw new Exception("Unknown graphical data of type " + type);
            }
        }
Exemplo n.º 5
0
        public static EleInstance ReadFromStream(BigEndianReader reader)
        {
            var instance = new EleInstance();

            instance.Version = reader.ReadByte();

            var count = reader.ReadUInt();
            for (int i = 0; i < count; i++)
            {
                var elem = EleGraphicalData.ReadFromStream(instance, reader);
                instance.GraphicalDatas.Add(elem.Id, elem);
            }

            if (instance.Version >= 8)
            {
                var gfxCount = reader.ReadInt();
                for (int i = 0; i < gfxCount; i++)
                {
                    instance.GfxJpgMap.Add(reader.ReadInt(), true);
                }
            }

            return instance;
        }
Exemplo n.º 6
0
 public EleGraphicalData(EleInstance instance, int id)
 {
     Instance = instance;
     Id = id;
 }
 public EleGraphicalData(EleInstance instance, int id)
 {
     Instance = instance;
     Id       = id;
 }