public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._powerSetting = dis.ReadFloat();
                    this._engineRpm    = dis.ReadFloat();
                }
                catch (Exception e)
                {
#if DEBUG
                    Trace.WriteLine(e);
                    Trace.Flush();
#endif
                    this.OnException(e);
                }
            }
        }
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._horizontalDeflectionAngle = dis.ReadFloat();
                    this._verticalDeflectionAngle   = dis.ReadFloat();
                }
                catch (Exception e)
                {
#if DEBUG
                    Trace.WriteLine(e);
                    Trace.Flush();
#endif
                    this.OnException(e);
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// 读取头文件
        /// </summary>
        ///
        /// <param name="dis"></param>
        /// <returns></returns>
        /// <exception cref="System.Exception"></exception>
        public static LPKHeader ReadHeader(DataInputStream dis)
        {
            LPKHeader header = new LPKHeader();

            header.SetPAKIdentity(dis.ReadInt());
            byte[] pass = ReadByteArray(dis, LPKHeader.LF_PASSWORD_LENGTH);
            header.SetPassword(pass);
            header.SetVersion(dis.ReadFloat());
            header.SetTables(dis.ReadLong());
            return(header);
        }
        public override void Unmarshal(DataInputStream dis)
        {
            base.Unmarshal(dis);

            if (dis != null)
            {
                try
                {
                    this._munitionType.Unmarshal(dis);
                    this._shotStartTime.Unmarshal(dis);
                    this._commulativeShotTime = dis.ReadFloat();
                    this._ApertureEmitterLocation.Unmarshal(dis);
                    this._apertureDiameter         = dis.ReadFloat();
                    this._wavelength               = dis.ReadFloat();
                    this._peakIrradiance           = dis.ReadFloat();
                    this._pulseRepetitionFrequency = dis.ReadFloat();
                    this._pulseWidth               = dis.ReadInt();
                    this._flags             = dis.ReadInt();
                    this._pulseShape        = dis.ReadByte();
                    this._padding1          = dis.ReadUnsignedByte();
                    this._padding2          = dis.ReadUnsignedInt();
                    this._padding3          = dis.ReadUnsignedShort();
                    this._numberOfDERecords = dis.ReadUnsignedShort();
                    for (int idx = 0; idx < this.NumberOfDERecords; idx++)
                    {
                        StandardVariableSpecification anX = new StandardVariableSpecification();
                        anX.Unmarshal(dis);
                        this._dERecords.Add(anX);
                    }
                    ;
                }
                catch (Exception e)
                {
#if DEBUG
                    Trace.WriteLine(e);
                    Trace.Flush();
#endif
                    this.OnException(e);
                }
            }
        }
Exemple #5
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._recordType          = dis.ReadUnsignedInt();
                    this._recordLength        = dis.ReadUnsignedShort();
                    this._padding             = dis.ReadUnsignedShort();
                    this._emitterNumber       = dis.ReadUnsignedByte();
                    this._beamNumber          = dis.ReadUnsignedByte();
                    this._stateIndicator      = dis.ReadUnsignedByte();
                    this._padding2            = dis.ReadUnsignedByte();
                    this._falseTargetCount    = dis.ReadFloat();
                    this._walkSpeed           = dis.ReadFloat();
                    this._walkAcceleration    = dis.ReadFloat();
                    this._maximumWalkDistance = dis.ReadFloat();
                    this._keepTime            = dis.ReadFloat();
                    this._echoSpacing         = dis.ReadFloat();
                    this._padding3            = dis.ReadUnsignedInt();
                }
                catch (Exception e)
                {
#if DEBUG
                    Trace.WriteLine(e);
                    Trace.Flush();
#endif
                    this.OnException(e);
                }
            }
        }
Exemple #6
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._beamDirection.Unmarshal(dis);
                    this._azimuthBeamwidth   = dis.ReadFloat();
                    this._elevationBeamwidth = dis.ReadFloat();
                    this._referenceSystem    = dis.ReadFloat();
                    this._padding1           = dis.ReadUnsignedByte();
                    this._padding2           = dis.ReadUnsignedShort();
                    this._ez       = dis.ReadFloat();
                    this._ex       = dis.ReadFloat();
                    this._phase    = dis.ReadFloat();
                    this._padding3 = dis.ReadUnsignedInt();
                }
                catch (Exception e)
                {
#if DEBUG
                    Trace.WriteLine(e);
                    Trace.Flush();
#endif
                    this.OnException(e);
                }
            }
        }
Exemple #7
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._beamAzimuthCenter   = dis.ReadFloat();
                    this._beamAzimuthSweep    = dis.ReadFloat();
                    this._beamElevationCenter = dis.ReadFloat();
                    this._beamElevationSweep  = dis.ReadFloat();
                    this._beamSweepSync       = dis.ReadFloat();
                }
                catch (Exception e)
                {
#if DEBUG
                    Trace.WriteLine(e);
                    Trace.Flush();
#endif
                    this.OnException(e);
                }
            }
        }
Exemple #8
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._frequency                = dis.ReadFloat();
                    this._frequencyRange           = dis.ReadFloat();
                    this._effectiveRadiatedPower   = dis.ReadFloat();
                    this._pulseRepetitionFrequency = dis.ReadFloat();
                    this._pulseWidth               = dis.ReadFloat();
                }
                catch (Exception e)
                {
#if DEBUG
                    Trace.WriteLine(e);
                    Trace.Flush();
#endif
                    this.OnException(e);
                }
            }
        }
Exemple #9
0
        /* (non-Javadoc)
         * @see org.gogpsproject.Streamable#write(java.io.DataOutputStream)
         */
        public void read(DataInputStream dai, bool oldVersion)
        {
            int v = 1;

            if (!oldVersion)
            {
                v = dai.ReadInt();
            }

            if (v == 1)
            {
                health = dai.ReadLong();
                utcA1  = dai.ReadDouble();
                utcA0  = dai.ReadDouble();
                utcTOW = dai.ReadLong();
                utcWNT = dai.ReadInt();
                utcLS  = dai.ReadInt();
                utcWNF = dai.ReadInt();
                utcDN  = dai.ReadInt();
                utcLSF = dai.ReadInt();
                for (int i = 0; i < alpha.Count(); i++)
                {
                    alpha[i] = dai.ReadFloat();
                }
                for (int i = 0; i < beta.Count(); i++)
                {
                    beta[i] = dai.ReadFloat();
                }
                validHealth    = dai.ReadBoolean();
                validUTC       = dai.ReadBoolean();
                validKlobuchar = dai.ReadBoolean();
                long l = dai.ReadLong();
                refTime = new Time(l > 0 ? l : JavaSystem.CurrentTimeMillis());
            }
            else
            {
                throw new IOException("Unknown format version:" + v);
            }
        }
Exemple #10
0
        public override void Unmarshal(DataInputStream dis)
        {
            base.Unmarshal(dis);

            if (dis != null)
            {
                try
                {
                    this._designatingEntityID.Unmarshal(dis);
                    this._codeName = dis.ReadUnsignedShort();
                    this._designatedEntityID.Unmarshal(dis);
                    this._designatorCode       = dis.ReadUnsignedShort();
                    this._designatorPower      = dis.ReadFloat();
                    this._designatorWavelength = dis.ReadFloat();
                    this._designatorSpotWrtDesignated.Unmarshal(dis);
                    this._designatorSpotLocation.Unmarshal(dis);
                    this._deadReckoningAlgorithm = dis.ReadByte();
                    this._padding1 = dis.ReadUnsignedShort();
                    this._padding2 = dis.ReadByte();
                    this._entityLinearAcceleration.Unmarshal(dis);
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
Exemple #11
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._activeEmissionParameterIndex = dis.ReadUnsignedShort();
                    this._scanPattern = dis.ReadUnsignedShort();
                    this._beamCenterAzimuthHorizontal   = dis.ReadFloat();
                    this._azimuthalBeamwidthHorizontal  = dis.ReadFloat();
                    this._beamCenterDepressionElevation = dis.ReadFloat();
                    this._beamwidthDownElevation        = dis.ReadFloat();
                }
                catch (Exception e)
                {
#if DEBUG
                    Trace.WriteLine(e);
                    Trace.Flush();
#endif
                    this.OnException(e);
                }
            }
        }
Exemple #12
0
        public virtual float ReadSingle()
        {
            FillBuffer(4);

            var byteArrayInputStream = new ByteArrayInputStream(ReadSwapped(4));
            var dataInputStream      = new DataInputStream(byteArrayInputStream);

            var result = dataInputStream.ReadFloat();

            byteArrayInputStream.Close();
            dataInputStream.Close();

            return(result);
        }
        public override void Unmarshal(DataInputStream dis)
        {
            base.Unmarshal(dis);

            if (dis != null)
            {
                try
                {
                    this._fieldScale     = dis.ReadFloat();
                    this._fieldOffset    = dis.ReadFloat();
                    this._numberOfValues = dis.ReadUnsignedShort();

                    for (int idx = 0; idx < this.NumberOfValues; idx++)
                    {
                        TwoByteChunk anX = new TwoByteChunk();
                        anX.Unmarshal(dis);
                        this._dataValues.Add(anX);
                    }
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
Exemple #14
0
        public override void Unmarshal(DataInputStream dis)
        {
            base.Unmarshal(dis);

            if (dis != null)
            {
                try
                {
                    this._issuingEntityID.Unmarshal(dis);
                    this._collidingEntityID.Unmarshal(dis);
                    this._collisionEventID.Unmarshal(dis);
                    this._pad = dis.ReadShort();
                    this._contactVelocity.Unmarshal(dis);
                    this._mass = dis.ReadFloat();
                    this._location.Unmarshal(dis);
                    this._collisionResultXX = dis.ReadFloat();
                    this._collisionResultXY = dis.ReadFloat();
                    this._collisionResultXZ = dis.ReadFloat();
                    this._collisionResultYY = dis.ReadFloat();
                    this._collisionResultYZ = dis.ReadFloat();
                    this._collisionResultZZ = dis.ReadFloat();
                    this._unitSurfaceNormal.Unmarshal(dis);
                    this._coefficientOfRestitution = dis.ReadFloat();
                }
                catch (Exception e)
                {
                    if (PduBase.TraceExceptions)
                    {
                        Trace.WriteLine(e);
                        Trace.Flush();
                    }

                    this.RaiseExceptionOccured(e);

                    if (PduBase.ThrowExceptions)
                    {
                        throw e;
                    }
                }
            }
        }
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._supplyType.Unmarshal(dis);
                    this._quantity = dis.ReadFloat();
                }
                catch (Exception e)
                {
#if DEBUG
                    Trace.WriteLine(e);
                    Trace.Flush();
#endif
                    this.OnException(e);
                }
            }
        }
Exemple #16
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._currentShaftRPMs     = dis.ReadShort();
                    this._orderedShaftRPMs     = dis.ReadShort();
                    this._shaftRPMRateOfChange = dis.ReadFloat();
                }
                catch (Exception e)
                {
#if DEBUG
                    Trace.WriteLine(e);
                    Trace.Flush();
#endif
                    this.OnException(e);
                }
            }
        }
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._targetEntityID.Unmarshal(dis);
                    this._padding        = dis.ReadUnsignedShort();
                    this._peakIrradiance = dis.ReadFloat();
                }
                catch (Exception e)
                {
#if DEBUG
                    Trace.WriteLine(e);
                    Trace.Flush();
#endif
                    this.OnException(e);
                }
            }
        }
Exemple #18
0
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._explodingObject.Unmarshal(dis);
                    this._explosiveMaterial = dis.ReadUnsignedShort();
                    this._padding           = dis.ReadUnsignedShort();
                    this._explosiveForce    = dis.ReadFloat();
                }
                catch (Exception e)
                {
#if DEBUG
                    Trace.WriteLine(e);
                    Trace.Flush();
#endif
                    this.OnException(e);
                }
            }
        }
Exemple #19
0
        public override void Unmarshal(DataInputStream dis)
        {
            base.Unmarshal(dis);

            if (dis != null)
            {
                try
                {
                    this._receiverState = dis.ReadUnsignedShort();
                    this._padding1      = dis.ReadUnsignedShort();
                    this._receivedPoser = dis.ReadFloat();
                    this._transmitterEntityId.Unmarshal(dis);
                    this._transmitterRadioId = dis.ReadUnsignedShort();
                }
                catch (Exception e)
                {
#if DEBUG
                    Trace.WriteLine(e);
                    Trace.Flush();
#endif
                    this.OnException(e);
                }
            }
        }
Exemple #20
0
        /// <exception cref="IOException"/>
        public ConstantPool(DataInputStream @in)
        {
            int size = @in.ReadUnsignedShort();

            pool = new List <PooledConstant>(size);
            BitSet[] nextPass = new BitSet[] { new BitSet(size), new BitSet(size), new BitSet
                                                   (size) };
            // first dummy constant
            pool.Add(null);
            // first pass: read the elements
            for (int i = 1; i < size; i++)
            {
                byte tag = unchecked ((byte)@in.ReadUnsignedByte());
                switch (tag)
                {
                case ICodeConstants.CONSTANT_Utf8:
                {
                    pool.Add(new PrimitiveConstant(ICodeConstants.CONSTANT_Utf8, @in.ReadUTF()));
                    break;
                }

                case ICodeConstants.CONSTANT_Integer:
                {
                    pool.Add(new PrimitiveConstant(ICodeConstants.CONSTANT_Integer, (@in.ReadInt
                                                                                         ())));
                    break;
                }

                case ICodeConstants.CONSTANT_Float:
                {
                    pool.Add(new PrimitiveConstant(ICodeConstants.CONSTANT_Float, @in.ReadFloat()));
                    break;
                }

                case ICodeConstants.CONSTANT_Long:
                {
                    pool.Add(new PrimitiveConstant(ICodeConstants.CONSTANT_Long, @in.ReadLong()));
                    pool.Add(null);
                    i++;
                    break;
                }

                case ICodeConstants.CONSTANT_Double:
                {
                    pool.Add(new PrimitiveConstant(ICodeConstants.CONSTANT_Double, @in.ReadDouble()));
                    pool.Add(null);
                    i++;
                    break;
                }

                case ICodeConstants.CONSTANT_Class:
                case ICodeConstants.CONSTANT_String:
                case ICodeConstants.CONSTANT_MethodType:
                {
                    pool.Add(new PrimitiveConstant(tag, @in.ReadUnsignedShort()));
                    nextPass[0].Set(i);
                    break;
                }

                case ICodeConstants.CONSTANT_NameAndType:
                {
                    pool.Add(new LinkConstant(tag, @in.ReadUnsignedShort(), @in.ReadUnsignedShort()));
                    nextPass[0].Set(i);
                    break;
                }

                case ICodeConstants.CONSTANT_Fieldref:
                case ICodeConstants.CONSTANT_Methodref:
                case ICodeConstants.CONSTANT_InterfaceMethodref:
                case ICodeConstants.CONSTANT_InvokeDynamic:
                {
                    pool.Add(new LinkConstant(tag, @in.ReadUnsignedShort(), @in.ReadUnsignedShort()));
                    nextPass[1].Set(i);
                    break;
                }

                case ICodeConstants.CONSTANT_MethodHandle:
                {
                    pool.Add(new LinkConstant(tag, @in.ReadUnsignedByte(), @in.ReadUnsignedShort()));
                    nextPass[2].Set(i);
                    break;
                }
                }
            }
            // resolving complex pool elements
            foreach (BitSet pass in nextPass)
            {
                int idx = 0;
                while ((idx = pass.NextSetBit(idx + 1)) > 0)
                {
                    pool[idx].ResolveConstant(this);
                }
            }
            // get global constant pool interceptor instance, if any available
            interceptor = DecompilerContext.GetPoolInterceptor();
        }
Exemple #21
0
 public override void Run()
 {
     while (true)
     {
         try
         {
             if (Sharpen.Thread.CurrentThread().IsInterrupted())
             {
                 throw new Exception();
             }
             int cmd = WritableUtils.ReadVInt(inStream);
             Log.Debug("Handling uplink command " + cmd);
             if (cmd == BinaryProtocol.MessageType.AuthenticationResp.code)
             {
                 string digest = Text.ReadString(inStream);
                 authPending = !handler.Authenticate(digest);
             }
             else
             {
                 if (authPending)
                 {
                     Log.Warn("Message " + cmd + " received before authentication is " + "complete. Ignoring"
                              );
                     continue;
                 }
                 else
                 {
                     if (cmd == BinaryProtocol.MessageType.Output.code)
                     {
                         ReadObject(key);
                         ReadObject(value);
                         handler.Output(key, value);
                     }
                     else
                     {
                         if (cmd == BinaryProtocol.MessageType.PartitionedOutput.code)
                         {
                             int part = WritableUtils.ReadVInt(inStream);
                             ReadObject(key);
                             ReadObject(value);
                             handler.PartitionedOutput(part, key, value);
                         }
                         else
                         {
                             if (cmd == BinaryProtocol.MessageType.Status.code)
                             {
                                 handler.Status(Text.ReadString(inStream));
                             }
                             else
                             {
                                 if (cmd == BinaryProtocol.MessageType.Progress.code)
                                 {
                                     handler.Progress(inStream.ReadFloat());
                                 }
                                 else
                                 {
                                     if (cmd == BinaryProtocol.MessageType.RegisterCounter.code)
                                     {
                                         int    id    = WritableUtils.ReadVInt(inStream);
                                         string group = Text.ReadString(inStream);
                                         string name  = Text.ReadString(inStream);
                                         handler.RegisterCounter(id, group, name);
                                     }
                                     else
                                     {
                                         if (cmd == BinaryProtocol.MessageType.IncrementCounter.code)
                                         {
                                             int  id     = WritableUtils.ReadVInt(inStream);
                                             long amount = WritableUtils.ReadVLong(inStream);
                                             handler.IncrementCounter(id, amount);
                                         }
                                         else
                                         {
                                             if (cmd == BinaryProtocol.MessageType.Done.code)
                                             {
                                                 Log.Debug("Pipe child done");
                                                 handler.Done();
                                                 return;
                                             }
                                             else
                                             {
                                                 throw new IOException("Bad command code: " + cmd);
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         catch (Exception)
         {
             return;
         }
         catch (Exception e)
         {
             Log.Error(StringUtils.StringifyException(e));
             handler.Failed(e);
             return;
         }
     }
 }
Exemple #22
0
		public virtual float ReadSingle() {
			FillBuffer(4);

            var byteArrayInputStream = new ByteArrayInputStream(ReadSwapped(4));
            var dataInputStream = new DataInputStream(byteArrayInputStream);

            var result = dataInputStream.ReadFloat();

            byteArrayInputStream.Close();
            dataInputStream.Close();

            return result;
		}
 public float FileReadFloat()
 {
     return(InputStream.ReadFloat());
 }