예제 #1
0
파일: RSLT.cs 프로젝트: yakoder/s3pi
 public RSLT(int APIversion, EventHandler handler, RSLT basis)
     : base(APIversion, handler, null)
 {
     this.version                      = basis.version;
     this.routes                       = new PartList(handler, basis.routes);
     this.routeOffsets                 = basis.routeOffsets == null ? null : new SlotOffsetList(handler, basis.routeOffsets);
     this.containers                   = basis.containers == null ? null : new SlottedPartList(handler, basis.containers);
     this.containerOffsets             = basis.containerOffsets == null ? null : new SlotOffsetList(handler, basis.containerOffsets);
     this.effects                      = basis.effects == null ? null : new PartList(handler, basis.effects);
     this.effectOffsets                = basis.effectOffsets == null ? null : new SlotOffsetList(handler, basis.effectOffsets);
     this.inverseKineticsTargets       = basis.inverseKineticsTargets == null ? null : new PartList(handler, basis.inverseKineticsTargets);
     this.inverseKineticsTargetOffsets = basis.inverseKineticsTargetOffsets == null ? null : new SlotOffsetList(handler, basis.inverseKineticsTargetOffsets);
 }
예제 #2
0
파일: RSLT.cs 프로젝트: yakoder/s3pi
        protected override void Parse(Stream s)
        {
            BinaryReader r = new BinaryReader(s);

            tag = r.ReadUInt32();
            if (checking)
            {
                if (tag != (uint)FOURCC(TAG))
                {
                    throw new InvalidDataException(String.Format("Invalid Tag read: '{0}'; expected: '{1}'; at 0x{2:X8}", FOURCC(tag), TAG, s.Position));
                }
            }
            version = r.ReadUInt32();

            int nRouteSlots             = r.ReadInt32();
            int nContainers             = r.ReadInt32();
            int nEffects                = r.ReadInt32();
            int nInverseKineticsTargets = r.ReadInt32();
            int nConeSlots              = r.ReadInt32();

            if (checking)
            {
                if (nConeSlots != 0)
                {
                    throw new InvalidDataException(string.Format("Expected zero, read 0x{0:X8} at 0x{1:X8}", nConeSlots, s.Position));
                }
            }

            routes = new PartList(handler, s, nRouteSlots);
            if (nRouteSlots == 0)
            {
                routeOffsets = new SlotOffsetList(handler);
            }
            else
            {
                routeOffsets = new SlotOffsetList(handler, s);
            }

            containers = new SlottedPartList(handler, s, nContainers);
            if (nContainers == 0)
            {
                containerOffsets = new SlotOffsetList(handler);
            }
            else
            {
                containerOffsets = new SlotOffsetList(handler, s);
            }

            effects = new PartList(handler, s, nEffects);
            if (nEffects == 0)
            {
                effectOffsets = new SlotOffsetList(handler);
            }
            else
            {
                effectOffsets = new SlotOffsetList(handler, s);
            }

            inverseKineticsTargets = new PartList(handler, s, nInverseKineticsTargets);
            if (nInverseKineticsTargets == 0)
            {
                inverseKineticsTargetOffsets = new SlotOffsetList(handler);
            }
            else
            {
                inverseKineticsTargetOffsets = new SlotOffsetList(handler, s);
            }

            cones = new ConePartList(handler, s, nConeSlots);
            if (nConeSlots == 0)
            {
                coneOffsets = new SlotOffsetList(handler);
            }
            else
            {
                coneOffsets = new SlotOffsetList(handler, s);
            }
        }
예제 #3
0
파일: RSLT.cs 프로젝트: yakoder/s3pi
        public override Stream UnParse()
        {
            MemoryStream ms = new MemoryStream();
            BinaryWriter w  = new BinaryWriter(ms);

            w.Write(tag);
            w.Write(version);

            if (routes == null)
            {
                routes = new PartList(handler);
            }
            w.Write(routes.Count);
            if (containers == null)
            {
                containers = new SlottedPartList(handler);
            }
            w.Write(containers.Count);
            if (effects == null)
            {
                effects = new PartList(handler);
            }
            w.Write(effects.Count);
            if (inverseKineticsTargets == null)
            {
                inverseKineticsTargets = new PartList(handler);
            }
            w.Write(inverseKineticsTargets.Count);
            if (cones == null)
            {
                cones = new ConePartList(handler);
            }
            w.Write(cones.Count);

            routes.UnParse(ms);
            if (routes.Count > 0)
            {
                routeOffsets.UnParse(ms);
            }
            containers.UnParse(ms);
            if (containers.Count > 0)
            {
                containerOffsets.UnParse(ms);
            }
            effects.UnParse(ms);
            if (effects.Count > 0)
            {
                effectOffsets.UnParse(ms);
            }
            inverseKineticsTargets.UnParse(ms);
            if (inverseKineticsTargets.Count > 0)
            {
                inverseKineticsTargetOffsets.UnParse(ms);
            }
            cones.UnParse(ms);
            if (cones.Count > 0)
            {
                coneOffsets.UnParse(ms);
            }

            return(ms);
        }