public MavLink4Net.Messages.IMessage Deserialize(System.IO.BinaryReader reader)
 {
     MavLink4Net.Messages.Common.FollowTargetMessage message = new MavLink4Net.Messages.Common.FollowTargetMessage();
     message.Timestamp       = reader.ReadUInt64();
     message.CustomState     = reader.ReadUInt64();
     message.Lat             = reader.ReadInt32();
     message.Lon             = reader.ReadInt32();
     message.Alt             = reader.ReadSingle();
     message.Vel[0]          = reader.ReadSingle();
     message.Vel[1]          = reader.ReadSingle();
     message.Vel[2]          = reader.ReadSingle();
     message.Acc[0]          = reader.ReadSingle();
     message.Acc[1]          = reader.ReadSingle();
     message.Acc[2]          = reader.ReadSingle();
     message.AttitudeQ[0]    = reader.ReadSingle();
     message.AttitudeQ[1]    = reader.ReadSingle();
     message.AttitudeQ[2]    = reader.ReadSingle();
     message.AttitudeQ[3]    = reader.ReadSingle();
     message.Rates[0]        = reader.ReadSingle();
     message.Rates[1]        = reader.ReadSingle();
     message.Rates[2]        = reader.ReadSingle();
     message.PositionCov[0]  = reader.ReadSingle();
     message.PositionCov[1]  = reader.ReadSingle();
     message.PositionCov[2]  = reader.ReadSingle();
     message.EstCapabilities = reader.ReadByte();
     return(message);
 }
Esempio n. 2
0
            /// <summary>
            /// Reads from stream.
            /// </summary>
            /// <param name="stream">The stream.</param>
            /// <exception cref="System.IO.InvalidDataException">Version of object is not supported!</exception>
            internal void ReadFromStream(System.IO.BinaryReader stream)
            {
                int version = stream.ReadInt32();

                if (version <= 0 || version > StreamVersion)
                {
                    throw new System.IO.InvalidDataException("Version of object is not supported!");
                }

                this.Begin = stream.ReadUInt64();
                this.End   = stream.ReadUInt64();
                if (stream.ReadByte() != 0)
                {
                    this.ShortName = stream.ReadString();
                }
                else
                {
                    this.ShortName = null;
                }
                if (stream.ReadByte() != 0)
                {
                    this.FullName = stream.ReadString();
                }
                else
                {
                    this.FullName = null;
                }

                if (version >= 2)
                {
                    this.Id = stream.ReadUInt64();
                }
            }
Esempio n. 3
0
        protected override void DecodeContent(System.IO.BinaryReader r)
        {
            Id = ReadString(r, 25);                        //r.ReadInt64();  //车辆信息Id

            StationId = ReadString(r, 6);                  //r.ReadInt32();  //站点Id
            EvtTime   = ConvertToDateTime(r.ReadUInt64()); //事件发生时间
            MsgTime   = ConvertToDateTime(r.ReadUInt64()); //消息接收时间

            LaneNo = r.ReadByte();                         //车道序号
            EvtNo  = r.ReadInt64();                        //设备序号

            DevType    = r.ReadByte();                     //devType
            ClassIndex = r.ReadUInt16();
            ClassName  = ReadString(r, 20);
            AxlesCount = r.ReadByte();
            Weight     = r.ReadUInt32();

            AxleWeights = new ushort[10];
            for (var idx = 0; idx < 10; idx++)
            {
                AxleWeights[idx] = r.ReadUInt16();//axle_x weight
            }

            AxleSpaces = new ushort[9];
            for (var idx = 0; idx < 9; idx++)
            {
                AxleSpaces[idx] = r.ReadUInt16();//axle_x inner space
            }

            Direction = r.ReadByte();      // == 1 ? "逆行" : "正常行驶";//direction   //DictDataModel.dictDemo(r.ReadByte());
            Speed     = r.ReadUInt16();    //speed
            Length    = r.ReadUInt16();    //length
            Straddle  = r.ReadByte() == 1; // ? "跨道" : "未跨道";//isStraddle

            AxlesOnTractor = r.ReadByte();
            DrawBarTrailer = r.ReadByte();

            Temperature  = r.ReadByte();
            ChassisCode  = ReadString(r, 20);
            Acceleration = r.ReadUInt16();

            Gap        = r.ReadUInt16(); //length
            TimeGap    = r.ReadUInt16(); //length
            Headway    = r.ReadUInt16();
            TimeOffset = r.ReadUInt16();
            LoopOnTime = r.ReadUInt16();

            LegalStatus   = r.ReadUInt16();//length
            SensorFailure = r.ReadByte();
            ValidityCode  = r.ReadUInt16();

            OverWeight      = r.ReadUInt16();
            OverWeightRatio = r.ReadUInt16();

            OverSpeed      = r.ReadUInt16();
            OverSpeedRatio = r.ReadUInt16();

            OverLength      = r.ReadUInt16();
            OverLengthRatio = r.ReadUInt16();
        }
Esempio n. 4
0
        /// <summary>
        /// 分析网络数据包并进行转换为信息对象
        /// </summary>
        /// <param name="packs">接收到的封包对象</param>
        /// <returns></returns>
        /// <remarks>
        /// 对于分包消息,如果收到的只是片段并且尚未接收完全,则不会进行解析
        /// </remarks>
        public static IPMessager.Entity.Message ParseToMessage(params Entity.PackedNetworkMessage[] packs)
        {
            if (packs.Length == 0 || (packs[0].PackageCount > 1 && packs.Length != packs[0].PackageCount))
            {
                return(null);
            }

            //尝试解压缩,先排序
            Array.Sort(packs);
            //尝试解压缩
            System.IO.MemoryStream           ms  = new System.IO.MemoryStream();
            System.IO.Compression.GZipStream zip = new System.IO.Compression.GZipStream(ms, System.IO.Compression.CompressionMode.Decompress);
            try
            {
                Array.ForEach(packs, s => zip.Write(s.Data, 0, s.Data.Length));
            }
            catch (Exception)
            {
                OnDecompressFailed(new DecomprssFailedEventArgs(packs));
                return(null);
            }

            zip.Close();
            ms.Flush();
            ms.Seek(0, System.IO.SeekOrigin.Begin);

            //构造读取流
            System.IO.BinaryReader br = new System.IO.BinaryReader(ms, System.Text.Encoding.Unicode);

            //开始读出数据
            IPMessager.Entity.Message m = new FSLib.IPMessager.Entity.Message(packs[0].RemoteIP);
            m.PackageNo = br.ReadUInt64();                                                      //包编号
            ulong tl = br.ReadUInt64();

            m.Command = (Define.Consts.Commands)(tl & 0xFF); //命令编码
            m.Options = tl & 0xFFFFFF00;                     //命令参数

            m.UserName = br.ReadString();                    //用户名
            m.HostName = br.ReadString();                    //主机名

            int length = br.ReadInt32();

            m.NormalMsgBytes = new byte[length];
            br.Read(m.NormalMsgBytes, 0, length);

            length = br.ReadInt32();
            m.ExtendMessageBytes = new byte[length];
            br.Read(m.ExtendMessageBytes, 0, length);

            if (!Consts.Check(m.Options, Consts.Cmd_All_Option.BinaryMessage))
            {
                m.NormalMsg     = System.Text.Encoding.Unicode.GetString(m.NormalMsgBytes, 0, length);                  //正文
                m.ExtendMessage = System.Text.Encoding.Unicode.GetString(m.ExtendMessageBytes, 0, length);              //扩展消息
            }

            return(m);
        }
 public MavLink4Net.Messages.IMessage Deserialize(System.IO.BinaryReader reader)
 {
     MavLink4Net.Messages.Common.CameraTriggerMessage message = new MavLink4Net.Messages.Common.CameraTriggerMessage();
     message.TimeUsec = reader.ReadUInt64();
     message.Seq      = reader.ReadUInt32();
     return(message);
 }
Esempio n. 6
0
 public MavLink4Net.Messages.IMessage Deserialize(System.IO.BinaryReader reader)
 {
     MavLink4Net.Messages.Common.ControlSystemStateMessage message = new MavLink4Net.Messages.Common.ControlSystemStateMessage();
     message.TimeUsec       = reader.ReadUInt64();
     message.XAcc           = reader.ReadSingle();
     message.YAcc           = reader.ReadSingle();
     message.ZAcc           = reader.ReadSingle();
     message.XVel           = reader.ReadSingle();
     message.YVel           = reader.ReadSingle();
     message.ZVel           = reader.ReadSingle();
     message.XPos           = reader.ReadSingle();
     message.YPos           = reader.ReadSingle();
     message.ZPos           = reader.ReadSingle();
     message.Airspeed       = reader.ReadSingle();
     message.VelVariance[0] = reader.ReadSingle();
     message.VelVariance[1] = reader.ReadSingle();
     message.VelVariance[2] = reader.ReadSingle();
     message.PosVariance[0] = reader.ReadSingle();
     message.PosVariance[1] = reader.ReadSingle();
     message.PosVariance[2] = reader.ReadSingle();
     message.Q[0]           = reader.ReadSingle();
     message.Q[1]           = reader.ReadSingle();
     message.Q[2]           = reader.ReadSingle();
     message.Q[3]           = reader.ReadSingle();
     message.RollRate       = reader.ReadSingle();
     message.PitchRate      = reader.ReadSingle();
     message.YawRate        = reader.ReadSingle();
     return(message);
 }
Esempio n. 7
0
        public void Unpack(string in_path, string out_path, string KOMFileName)
        {
            System.IO.BinaryReader reader = new System.IO.BinaryReader(System.IO.File.OpenRead(in_path), System.Text.Encoding.ASCII);
            reader.BaseStream.Position += 52;
            int entry_count = (int)reader.ReadUInt64();
            // trying to understand this crap... This is where it starts to fail
            // for KOM V4 on Elsword's current data036.kom.
            int compressed = reader.ReadInt32();
            int file_time  = reader.ReadInt32();
            int xml_size   = reader.ReadInt32();

            byte[] xmldatabuffer = reader.ReadBytes(xml_size);
            Els_kom_Core.Classes.KOMStream kOMStream = new Els_kom_Core.Classes.KOMStream();
            kOMStream.DecryptCRCXml(compressed, ref xmldatabuffer, xml_size, System.Text.Encoding.ASCII);
            string xmldata = System.Text.Encoding.ASCII.GetString(xmldatabuffer);

            try
            {
                System.Collections.Generic.List <Els_kom_Core.Classes.EntryVer> entries = kOMStream.Make_entries_v4(xmldata, entry_count);
                foreach (var entry in entries)
                {
                    // we iterate through every entry here and unpack the data.
                    kOMStream.WriteOutput(reader, out_path, entry, SupportedKOMVersion);
                }
            }
            catch (System.Xml.XmlException)
            {
                throw new Els_kom_Core.Classes.UnpackingError("failure with xml entry data reading...");
            }
            kOMStream.Dispose();
            reader.Dispose();
        }
Esempio n. 8
0
        public void FromBytes(System.IO.BinaryReader reader)
        {
            uid = reader.ReadUInt64();

            int len = reader.ReadInt32();

            if (len != 0)
            {
                byte[] ipbytes = reader.ReadBytes(len);
                ip = new System.Net.IPAddress(ipbytes);
            }
            else
            {
                len = reader.ReadInt32(); // read 4 more bytes
                ip  = null;
            }
            port   = reader.ReadInt32();
            active = reader.ReadByte();
            role   = reader.ReadInt32();
            len    = reader.ReadInt32();
            name   = "";
            for (int i = 0; i < len; i++)
            {
                char c = (char)reader.ReadInt16();
                name += c;
            }
        }
Esempio n. 9
0
 public MavLink4Net.Messages.IMessage Deserialize(System.IO.BinaryReader reader)
 {
     MavLink4Net.Messages.Common.SystemTimeMessage message = new MavLink4Net.Messages.Common.SystemTimeMessage();
     message.TimeUnixUsec = reader.ReadUInt64();
     message.TimeBootMs   = reader.ReadUInt32();
     return(message);
 }
Esempio n. 10
0
        public static void Read(System.IO.BinaryReader reader, out PackedMemorySection[] value, out string stateString)
        {
            value       = new PackedMemorySection[0];
            stateString = "";

            var version = reader.ReadInt32();

            if (version >= 1)
            {
                var length = reader.ReadInt32();
                value = new PackedMemorySection[length];

                var onePercent = Math.Max(1, value.Length / 100);
                for (int n = 0, nend = value.Length; n < nend; ++n)
                {
                    if ((n % onePercent) == 0)
                    {
                        stateString = string.Format("Loading Managed Heap Sections\n{0}/{1}, {2:F0}% done", n + 1, length, ((n + 1) / (float)length) * 100);
                    }

                    var count = reader.ReadInt32();
                    value[n].bytes        = reader.ReadBytes(count);
                    value[n].startAddress = reader.ReadUInt64();
                    value[n].arrayIndex   = -1;
                }
            }
        }
Esempio n. 11
0
        public static object ReadAs(System.IO.Stream stream, Type type)
        {
            System.IO.BinaryReader reader = new System.IO.BinaryReader(stream);

            if (type == typeof(bool))
            {
                return(reader.ReadBoolean());
            }
            else if (type == typeof(char))
            {
                return(reader.ReadChar());
            }
            else if (type == typeof(byte))
            {
                return(reader.ReadByte());
            }
            else if (type == typeof(short))
            {
                return(reader.ReadInt16());
            }
            else if (type == typeof(int))
            {
                return(reader.ReadInt32());
            }
            else if (type == typeof(long))
            {
                return(reader.ReadInt64());
            }
            else if (type == typeof(float))
            {
                return(reader.ReadSingle());
            }
            else if (type == typeof(double))
            {
                return(reader.ReadDouble());
            }
            else if (type == typeof(sbyte))
            {
                return(reader.ReadSByte());
            }
            else if (type == typeof(ushort))
            {
                return(reader.ReadUInt16());
            }
            else if (type == typeof(uint))
            {
                return(reader.ReadUInt32());
            }
            else if (type == typeof(ulong))
            {
                return(reader.ReadUInt64());
            }
            else if (type == typeof(string))
            {
                return(reader.ReadString());
            }

            throw new ArgumentException("Usupported type!");
        }
Esempio n. 12
0
        public bool Deserialize(System.IO.BinaryReader Reader, Action Callback, int SerializationVersion)
        {
            try
            {
                callback   = Callback;
                delay      = Reader.ReadUInt64();
                delayBasis = (DelayBasis)Reader.ReadInt32();
                Trigger    = Reader.ReadUInt64();
                Active     = Reader.ReadBoolean();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Esempio n. 13
0
 public DirectoryRecord(System.IO.BinaryReader br)
 {
     indexOffset   = br.BaseStream.Position;
     Hash          = br.ReadUInt64();
     Offset        = br.ReadInt32();
     Size          = br.ReadInt32();
     RecursiveSize = br.ReadInt32();
 }
 public MavLink4Net.Messages.IMessage Deserialize(System.IO.BinaryReader reader)
 {
     MavLink4Net.Messages.Common.VisionSpeedEstimateMessage message = new MavLink4Net.Messages.Common.VisionSpeedEstimateMessage();
     message.Usec = reader.ReadUInt64();
     message.X    = reader.ReadSingle();
     message.Y    = reader.ReadSingle();
     message.Z    = reader.ReadSingle();
     return(message);
 }
Esempio n. 15
0
        public Int32 ReadUInt64(ref UInt64 value)
        {
            if ((mStream == null) ||
                (mReader == null) ||
                ((mStream.Length - mStream.Position) < (sizeof(UInt64) + 1)))
            {
                return(AResult.AE_FAIL);
            }

            mReader.ReadSByte();
            value = mReader.ReadUInt64();
            if (!mIsLittleEndian)
            {
                value = ByteOrder.Swap64(value);
            }

            return(AResult.AS_OK);
        }
Esempio n. 16
0
 public MavLink4Net.Messages.IMessage Deserialize(System.IO.BinaryReader reader)
 {
     MavLink4Net.Messages.Common.PingMessage message = new MavLink4Net.Messages.Common.PingMessage();
     message.TimeUsec = reader.ReadUInt64();
     message.Seq = reader.ReadUInt32();
     message.TargetSystem = reader.ReadByte();
     message.TargetComponent = reader.ReadByte();
     return message;
 }
 public MavLink4Net.Messages.IMessage Deserialize(System.IO.BinaryReader reader)
 {
     MavLink4Net.Messages.Common.TerrainRequestMessage message = new MavLink4Net.Messages.Common.TerrainRequestMessage();
     message.Mask        = reader.ReadUInt64();
     message.Lat         = reader.ReadInt32();
     message.Lon         = reader.ReadInt32();
     message.GridSpacing = reader.ReadUInt16();
     return(message);
 }
Esempio n. 18
0
 public DirectoryRecord(System.IO.BinaryReader br)
 {
     indexOffset = br.BaseStream.Position;
     Hash        = br.ReadUInt64();
     Offset      = br.ReadInt32();
     Size        = br.ReadInt32();
     Unknown     = br.ReadUInt32();
     paths       = new List <string>();
 }
Esempio n. 19
0
        public new void Deserialize(System.IO.BinaryReader br, short command)
        {
            Continental.Games.Vector2 pos;
            switch (command)
            {
            case NetworkCommands.INIT_AREA:
            case NetworkCommands.PLAYER_ADDED:
                playerId = br.ReadUInt64();
                Name     = br.ReadString();
                IsOnline = br.ReadBoolean();
                pos      = new Continental.Games.Vector2();
                pos.Deserialize(br, command);
                Position      = pos;
                RotationAngle = br.ReadSingle();
                Rotation      = (RotationState)br.ReadByte();
                Movement      = (MovementState)br.ReadByte();
                Continental.Games.Color color = new Continental.Games.Color();
                color.Deserialize(br, command);
                Color = color;
                break;

            case NetworkCommands.PLAYER_CHARACTER_STATE_CHANGE:
                playerId = br.ReadUInt64();
                Movement = (MovementState)br.ReadByte();
                if (Movement.Equals(MovementState.Motionless))                         // character stopped, update position
                {
                    pos = new Continental.Games.Vector2();
                    pos.Deserialize(br, command);
                    Position = pos;
                }
                Rotation = (RotationState)br.ReadByte();
                if (Rotation.Equals(RotationState.Motionless))                         // rotation stopped, update angle
                {
                    RotationAngle = br.ReadSingle();
                }
                CommandTime = new DateTime(br.ReadInt64());
                break;

            case NetworkCommands.ONLINE_STATE_CHANGE:
                playerId = br.ReadUInt64();
                IsOnline = br.ReadBoolean();
                break;
            }
        }
Esempio n. 20
0
 public bool Deserialize(System.IO.BinaryReader Reader, int DeserializationVersion)
 {
     try
     {
         speed       = (Baud)Reader.ReadInt32();
         Before      = (PulseState)Reader.ReadInt32();
         After       = (PulseState)Reader.ReadInt32();
         LastNonZero = (PulseState)Reader.ReadInt32();
         FlipFlop    = Reader.ReadBoolean();
         Value       = Reader.ReadBoolean();
         timeStamp   = Reader.ReadUInt64();
         duration    = Reader.ReadUInt64();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Esempio n. 21
0
 public MavLink4Net.Messages.IMessage Deserialize(System.IO.BinaryReader reader)
 {
     MavLink4Net.Messages.Common.RawPressureMessage message = new MavLink4Net.Messages.Common.RawPressureMessage();
     message.TimeUsec    = reader.ReadUInt64();
     message.PressAbs    = reader.ReadInt16();
     message.PressDiff1  = reader.ReadInt16();
     message.PressDiff2  = reader.ReadInt16();
     message.Temperature = reader.ReadInt16();
     return(message);
 }
Esempio n. 22
0
        public ulong ReadULong()
        {
            ulong value = mReader.ReadUInt64();

            if (!LittleEndian)
            {
                value = Endian.SwapUInt64(value);
            }
            return(value);
        }
Esempio n. 23
0
        private static void Main(string[] args)
        {
            int processID = GetProcessID();

            if (processID != 0)
            {
                MemoryManager memoryManager    = new MemoryManager(Process.GetProcessById(processID));
                IntPtr        startAddress     = memoryManager.ImageBase + 0x1000;
                string        pathToExecutable = GetPathToOriginalExecutable();
                PeFile        peFile           = new PeFile(pathToExecutable);
                PeNet.Structures.IMAGE_SECTION_HEADER text_section = GetSectionHeader(peFile, ".text");
                byte[] buffer = memoryManager.ReadBytes(startAddress, (int)text_section.VirtualSize);
                System.IO.BinaryReader reader = new System.IO.BinaryReader(new System.IO.MemoryStream(buffer));
                System.IO.BinaryWriter writer = new System.IO.BinaryWriter(new System.IO.MemoryStream(buffer));
                System.IO.StreamWriter log    = new System.IO.StreamWriter("log.txt");
                foreach (var block in peFile.ImageRelocationDirectory)
                {
                    foreach (var offset in block.TypeOffsets)
                    {
                        ulong rva = offset.Offset + block.VirtualAddress;
                        log.WriteLine("relocation : 0x" + rva.ToString("X4"));
                        log.Flush();
                        if (rva >= text_section.VirtualAddress && rva < text_section.VirtualAddress + text_section.VirtualSize)
                        {
                            switch (offset.Type)
                            {
                            case 3:
                                int file_ofs = (int)(rva - text_section.VirtualAddress);
                                reader.BaseStream.Seek(file_ofs, System.IO.SeekOrigin.Begin);
                                ulong oldOffset = reader.ReadUInt64();
                                writer.Seek(file_ofs, System.IO.SeekOrigin.Begin);
                                writer.Write((oldOffset - (ulong)memoryManager.ImageBase + peFile.ImageNtHeaders.OptionalHeader.ImageBase));
                                break;

                            case 0:
                                break;

                            default:
                                //throw new Exception("wrong relocation offset type");
                                break;
                            }
                        }
                    }
                }
                int text_size = Math.Min(buffer.Length, (int)text_section.SizeOfRawData);
                System.IO.FileStream wow_file = System.IO.File.OpenRead(pathToExecutable);
                byte[] wow_data = new byte[wow_file.Length];
                wow_file.Read(wow_data, 0, (int)wow_file.Length);
                writer = new System.IO.BinaryWriter(new System.IO.MemoryStream(wow_data));
                writer.Seek((int)text_section.PointerToRawData, System.IO.SeekOrigin.Begin);
                writer.Write(buffer);
                System.IO.File.Open($"{pathToExecutable.TrimEnd('e').TrimEnd('x').Trim('e')}.dumped.exe", System.IO.FileMode.CreateNew).Write(wow_data, 0, wow_data.Length);
            }
        }
Esempio n. 24
0
 public MavLink4Net.Messages.IMessage Deserialize(System.IO.BinaryReader reader)
 {
     MavLink4Net.Messages.Common.VibrationMessage message = new MavLink4Net.Messages.Common.VibrationMessage();
     message.TimeUsec   = reader.ReadUInt64();
     message.VibrationX = reader.ReadSingle();
     message.VibrationY = reader.ReadSingle();
     message.VibrationZ = reader.ReadSingle();
     message.Clipping0  = reader.ReadUInt32();
     message.Clipping1  = reader.ReadUInt32();
     message.Clipping2  = reader.ReadUInt32();
     return(message);
 }
Esempio n. 25
0
        public MagicalProjectile(System.IO.BinaryReader reader, bool sentFromServer)
            : base(reader, sentFromServer)
        {
            myColour = Tools.ReadColor4FromStream(reader);
            myEffect = MagicalEffect.Load(reader);
            myHit    = reader.ReadBoolean();

            if (myHit)
            {
                myHitTime = reader.ReadUInt64();
            }
        }
 public MavLink4Net.Messages.IMessage Deserialize(System.IO.BinaryReader reader)
 {
     MavLink4Net.Messages.Common.AltitudeMessage message = new MavLink4Net.Messages.Common.AltitudeMessage();
     message.TimeUsec          = reader.ReadUInt64();
     message.AltitudeMonotonic = reader.ReadSingle();
     message.AltitudeAmsl      = reader.ReadSingle();
     message.AltitudeLocal     = reader.ReadSingle();
     message.AltitudeRelative  = reader.ReadSingle();
     message.AltitudeTerrain   = reader.ReadSingle();
     message.BottomClearance   = reader.ReadSingle();
     return(message);
 }
 public MavLink4Net.Messages.IMessage Deserialize(System.IO.BinaryReader reader)
 {
     MavLink4Net.Messages.Common.ViconPositionEstimateMessage message = new MavLink4Net.Messages.Common.ViconPositionEstimateMessage();
     message.Usec  = reader.ReadUInt64();
     message.X     = reader.ReadSingle();
     message.Y     = reader.ReadSingle();
     message.Z     = reader.ReadSingle();
     message.Roll  = reader.ReadSingle();
     message.Pitch = reader.ReadSingle();
     message.Yaw   = reader.ReadSingle();
     return(message);
 }
Esempio n. 28
0
        public static UOPFileData FromBinary(System.IO.BinaryReader bStream, uint length)
        {
            UOPFileData toReturn = new UOPFileData();

            toReturn.m_DataFlag          = bStream.ReadUInt16();
            toReturn.m_LocalOffsetToData = bStream.ReadUInt16();
            toReturn.m_Unknown           = bStream.ReadUInt64();
            toReturn.m_CompressedData    = new byte[length];
            toReturn.m_CompressedData    = bStream.ReadBytes(toReturn.m_CompressedData.Length);

            return(toReturn);
        }
Esempio n. 29
0
 public void Deserialize(string path)
 {
     System.IO.FileStream fs = new System.IO.FileStream(path, System.IO.FileMode.Open);
     using (System.IO.BinaryReader sw = new System.IO.BinaryReader(fs))
     {
         int count = 0;
         while (count < NUMBRACKETS && sw.BaseStream.Position < sw.BaseStream.Length)
         {
             Matrix[count++] = sw.ReadUInt64();
         }
     }
 }
 public MavLink4Net.Messages.IMessage Deserialize(System.IO.BinaryReader reader)
 {
     MavLink4Net.Messages.Common.OpticalFlowMessage message = new MavLink4Net.Messages.Common.OpticalFlowMessage();
     message.TimeUsec       = reader.ReadUInt64();
     message.FlowCompMX     = reader.ReadSingle();
     message.FlowCompMY     = reader.ReadSingle();
     message.GroundDistance = reader.ReadSingle();
     message.FlowX          = reader.ReadInt16();
     message.FlowY          = reader.ReadInt16();
     message.SensorId       = reader.ReadByte();
     message.Quality        = reader.ReadByte();
     return(message);
 }
Esempio n. 31
0
File: Row.cs Progetto: vebin/BD2
 public static Row Deserialize(byte[] bytes)
 {
     using (System.IO.MemoryStream MS = new System.IO.MemoryStream (bytes, false)) {
         using (System.IO.BinaryReader BR = new System.IO.BinaryReader (MS)) {
             byte[] columnSet = BR.ReadBytes (32);
             int FieldCount = BR.ReadInt32 ();
             object[] fields = new object[FieldCount];
             ColumnSet cs = css [columnSet];
             if (cs.Columns.Length != fields.Length)
                 throw new Exception ();
             for (int n = 0; n != fields.Length; n++) {
                 bool Null = BR.ReadBoolean ();
                 if (Null) {
                     fields [n] = null;
                     continue;
                 }
                 switch (cs.Columns [n].TFQN) {
                 case "System.Byte[]":
                     fields [n] = BR.ReadBytes (BR.ReadInt32 ());
                     break;
                 case "System.Byte":
                     fields [n] = BR.ReadByte ();
                     break;
                 case "System.SByte":
                     fields [n] = BR.ReadSByte ();
                     break;
                 case "System.Int16":
                     fields [n] = BR.ReadInt16 ();
                     break;
                 case "System.UInt16":
                     fields [n] = BR.ReadUInt16 ();
                     break;
                 case "System.Int32":
                     fields [n] = BR.ReadInt32 ();
                     break;
                 case "System.UInt32":
                     fields [n] = BR.ReadUInt32 ();
                     break;
                 case "System.Int64":
                     fields [n] = BR.ReadInt64 ();
                     break;
                 case "System.UInt64":
                     fields [n] = BR.ReadUInt64 ();
                     break;
                 case "System.Single":
                     fields [n] = BR.ReadSingle ();
                     break;
                 case "System.Double":
                     fields [n] = BR.ReadDouble ();
                     break;
                 case "System.String":
                     fields [n] = BR.ReadString ();
                     break;
                 case "System.Char":
                     fields [n] = BR.ReadChar ();
                     break;
                 case "System.Boolean":
                     fields [n] = BR.ReadBoolean ();
                     break;
                 case "System.DateTime":
                     fields [n] = new DateTime (BR.ReadInt64 ());
                     break;
                 case "System.Guid":
                     fields [n] = new Guid (BR.ReadBytes (16));
                     break;
                 }
             }
             return new Row (cs, fields);
         }
     }
 }