当前位置: 首页>>代码示例>>C#>>正文


C# AMFReader.ReadUInt16方法代码示例

本文整理汇总了C#中AMFReader.ReadUInt16方法的典型用法代码示例。如果您正苦于以下问题:C# AMFReader.ReadUInt16方法的具体用法?C# AMFReader.ReadUInt16怎么用?C# AMFReader.ReadUInt16使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AMFReader的用法示例。


在下文中一共展示了AMFReader.ReadUInt16方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Read

		public void Read(byte[] data) {
			using (MemoryStream ms = new MemoryStream(data)) {
				using (AMFReader amf = new AMFReader(ms)) {
					Header = new List<object>();
					Bodies = new List<object>();


					// AMF0_VERSION = 0;
					// AMF1_VERSION = 1; // There is no AMF1 but FMS uses it for some reason, hence special casing.
					// AMF3_VERSION = 3;
					ushort version = amf.ReadUInt16();

					// Number of headers
					ushort numHeaders = amf.ReadUInt16();
					while (numHeaders-- > 0) {
						var head = DsoAmfHeader.Read(amf);
						if (head != null) {
							Bodies.Add(head);
						}
					}

					// Number of bodys
					ushort numBodies = amf.ReadUInt16();
					while (numBodies-- > 0) {
						var body = DsoAmfBody.Read(amf);
						if (body != null) {
							Bodies.Add(body);
						}
					}
				}
			}


		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:34,代码来源:DsoAmfReader.cs

示例2: Read

		public static DsoAmfBody Read(AMFReader reader, bool isAmf3) {
			reader.Reset();

			ushort targetUriLen = reader.ReadUInt16();
			string targetUri = reader.ReadUTF(targetUriLen); // When the message holds a response from a remote endpoint, the target URI specifies which method on the local client (i.e. reader request originator) should be invoked to handle the response.
			ushort responseUriLen = reader.ReadUInt16();
			string responseUri = reader.ReadUTF(responseUriLen); // The response's target URI is set to the request's response URI with an '/onResult' suffix to denote a success or an '/onStatus' suffix to denote a failure.

			long dataLen = reader.ReadUInt32();
			if (dataLen >= 2147483648) {
				dataLen = -4294967296;
			}

			object bodyObj;
			// Check for AMF3 kAvmPlusObjectType object type
			if (isAmf3) {
				byte typeMarker = reader.ReadByte();
				if (typeMarker == 17) {
					bodyObj = reader.ReadAMF3Data();
				} else {
					bodyObj = reader.ReadData();
				}
			} else {
				bodyObj = reader.ReadData();
			}


			DsoAmfBody body = new DsoAmfBody(targetUri, responseUri, bodyObj);
			return body;
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:30,代码来源:DsoAmfBody.cs

示例3: Read

		public static DsoAmfBody Read(AMFReader reader) {
			reader.Reset();

			ushort targetUriLen = reader.ReadUInt16();
			string targetUri = reader.ReadUTF(targetUriLen); // When the message holds a response from a remote endpoint, the target URI specifies which method on the local client (i.e. reader request originator) should be invoked to handle the response.
			ushort responseUriLen = reader.ReadUInt16();
			string responseUri = reader.ReadUTF(responseUriLen); // The response's target URI is set to the request's response URI with an '/onResult' suffix to denote a success or an '/onStatus' suffix to denote a failure.

			int numBytes = 4;
			uint dataLen = 0;
			while (numBytes-- > 0)
				dataLen = (dataLen << 8) | reader.ReadByte();

			// Need to skip 1 byte more, dont know why..
			reader.ReadByte();
			object bodyObj = reader.ReadData(); // turn the element into real data


			DsoAmfBody body = new DsoAmfBody(targetUri, responseUri, bodyObj);
			return body;
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:21,代码来源:DsoAmfBody.cs

示例4: Read

		public static DsoAmfHeader Read(AMFReader reader) {
			reader.Reset();

			ushort nameLen = reader.ReadUInt16();
			string name = reader.ReadUTF(nameLen);
			bool required = (reader.ReadByte() > 0); // find the must understand flag
			uint dataLen = reader.ReadUInt32();
			object headObj = reader.ReadData();

			DsoAmfHeader header = new DsoAmfHeader(name, required, headObj);
			return header;
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:12,代码来源:DsoAmfHeader.cs


注:本文中的AMFReader.ReadUInt16方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。