• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# AMFReader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: 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


示例2: 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


示例3: GetReflectionOptimizer

 public IReflectionOptimizer GetReflectionOptimizer(Type type, ClassDefinition classDefinition, AMFReader reader, object instance)
 {
     if( classDefinition == null )
         return new AMF0ReflectionOptimizer(type, reader).Generate(instance);
     else
         return new AMF3ReflectionOptimizer(type, classDefinition, reader).Generate(instance);
 }
开发者ID:apakian,项目名称:fluorinefx,代码行数:7,代码来源:BytecodeProvider.cs


示例4: AMF0ReflectionOptimizer

		public AMF0ReflectionOptimizer(Type type, AMFReader reader, object instance) {
			_createInstanceMethod = CreateCreateInstanceMethod(type);
#if !(MONO) && !(NET_2_0) && !(NET_3_5) && !(SILVERLIGHT)
			_ps = new PermissionSet(PermissionState.None);
			_ps.AddPermission(new ReflectionPermission(ReflectionPermissionFlag.MemberAccess));
#endif
			_readDataMethod = CreateReadDataMethod(type, reader, instance);
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:8,代码来源:AMF0ReflectionOptimizer.cs


示例5: ByteArray

		/// <summary>
		/// Initializes a new instance of the ByteArray class.
		/// </summary>
		public ByteArray() {
			_memoryStream = new MemoryStream();
			AMFReader amfReader = new AMFReader(_memoryStream);
			AMFWriter amfWriter = new AMFWriter(_memoryStream);
			_dataOutput = new DataOutput(amfWriter);
			_dataInput = new DataInput(amfReader);
			_objectEncoding = ObjectEncoding.AMF3;
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:11,代码来源:ByteArray.cs


示例6: GetReflectionOptimizer

        public IReflectionOptimizer GetReflectionOptimizer(Type type, ClassDefinition classDefinition, AMFReader reader, object instance)
        {
            #if NET_1_1
            return null;

            #else
            if (classDefinition == null)
                return new AMF0ReflectionOptimizer(type, reader, instance);
            return new AMF3ReflectionOptimizer(type, classDefinition, reader, instance);
            #endif
        }
开发者ID:mstaessen,项目名称:fluorinefx,代码行数:11,代码来源:BytecodeProvider.cs


示例7: 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


示例8: ReadData

		public object ReadData(AMFReader reader, ClassDefinition classDefinition) {
			ASObject aso = new ASObject(_typeIdentifier);
			reader.AddAMF3ObjectReference(aso);
			string key = reader.ReadAMF3String();
			aso.TypeName = _typeIdentifier;
			while (key != string.Empty) {
				object value = reader.ReadAMF3Data();
				aso.Add(key, value);
				key = reader.ReadAMF3String();
			}
			return aso;
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:12,代码来源:AMF3TypedASObjectReader.cs


示例9: ReadData

 public object ReadData(AMFReader reader, ClassDefinition classDefinition)
 {
     var instance = ObjectFactory.CreateInstance(classDefinition.ClassName);
     if (instance == null) {
         throw new FluorineException(String.Format(Resources.Type_InitError, classDefinition.ClassName));
     }
     reader.AddAMF3ObjectReference(instance);
     if (instance is IExternalizable)
     {
         var externalizable = instance as IExternalizable;
         var dataInput = new DataInput(reader);
         externalizable.ReadExternal(dataInput);
         return instance;
     }
     throw new FluorineException(String.Format(Resources.Externalizable_CastFail, instance.GetType().FullName));
 }
开发者ID:mstaessen,项目名称:fluorinefx,代码行数:16,代码来源:AMF3ExternalizableReader.cs


示例10: ReadData

		public object ReadData(AMFReader reader, ClassDefinition classDefinition) {
			object instance = ObjectFactory.CreateInstance(classDefinition.ClassName);
			if (instance == null) {
				string msg = __Res.GetString(__Res.Type_InitError, classDefinition.ClassName);
				throw new FluorineException(msg);
			}
			reader.AddAMF3ObjectReference(instance);
			if (instance is IExternalizable) {
				IExternalizable externalizable = instance as IExternalizable;
				DataInput dataInput = new DataInput(reader);
				externalizable.ReadExternal(dataInput);
				return instance;
			} else {
				string msg = __Res.GetString(__Res.Externalizable_CastFail, instance.GetType().FullName);
				throw new FluorineException(msg);
			}
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:17,代码来源:AMF3ExternalizableReader.cs


示例11: LoadObject

		private IPersistable LoadObject(string name, IPersistable obj) {
			string fileName = PersistenceUtils.GetFilename(_scope, _path, name, _extension);
			FileInfo file = _scope.Context.GetResource(fileName).File;
			if (!file.Exists)
				return null;// No such file

			IPersistable result = obj;
			lock (this.SyncRoot) {
				using (FileStream fs = new FileStream(file.FullName, FileMode.Open, FileAccess.Read, FileShare.Read)) {
					AMFReader reader = new AMFReader(fs);
					string typeName = reader.ReadData() as string;
					result = ObjectFactory.CreateInstance(typeName) as IPersistable;
					//result.Path = GetObjectPath(name, result.Name);
					//result = amfDeserializer.ReadData() as IPersistable;
					result.Deserialize(reader);
				}
			}
			return result;
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:19,代码来源:FileStore.cs


示例12: 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


示例13: Compress

        /// <summary>
        /// Compresses the byte array using zlib compression. The entire byte array is compressed.
        /// </summary>
        /// <param name="algorithm">The compression algorithm to use when compressing. Valid values are defined as constants in the CompressionAlgorithm class. The default is to use zlib format.</param>
        /// <remarks>
        /// After the call, the Length property of the ByteArray is set to the new length. The position property is set to the end of the byte array.
        /// </remarks>
        public void Compress(string algorithm)
        {
            ValidationUtils.ArgumentConditionTrue(algorithm == CompressionAlgorithm.Deflate || algorithm == CompressionAlgorithm.Zlib, "algorithm", "Invalid parameter");
#if SILVERLIGHT
            throw new NotSupportedException();
#else
            if (algorithm == CompressionAlgorithm.Deflate)
            {
                byte[] buffer = _memoryStream.ToArray();
                MemoryStream ms = new MemoryStream();
                DeflateStream deflateStream = new DeflateStream(ms, CompressionMode.Compress, true);
                deflateStream.Write(buffer, 0, buffer.Length);
                deflateStream.Close();
                _memoryStream.Close();
                _memoryStream = ms;
                AMFReader amfReader = new AMFReader(_memoryStream);
                AMFWriter amfWriter = new AMFWriter(_memoryStream);
                _dataOutput = new DataOutput(amfWriter);
                _dataInput = new DataInput(amfReader);
            }
            if (algorithm == CompressionAlgorithm.Zlib)
            {
                byte[] buffer = _memoryStream.ToArray();
                MemoryStream ms = new MemoryStream();
                ZlibStream zlibStream = new ZlibStream(ms, CompressionMode.Compress, true);
                zlibStream.Write(buffer, 0, buffer.Length);
                zlibStream.Flush();
                zlibStream.Close();
                zlibStream.Dispose();
                _memoryStream.Close();
                _memoryStream = ms;
                AMFReader amfReader = new AMFReader(_memoryStream);
                AMFWriter amfWriter = new AMFWriter(_memoryStream);
                _dataOutput = new DataOutput(amfWriter);
                _dataInput = new DataInput(amfReader);
            }
#endif
        }
开发者ID:ResQue1980,项目名称:LoLTeamChecker,代码行数:45,代码来源:ByteArray.cs


示例14: ReadData

		public object ReadData(AMFReader reader)
		{
			return reader.ReadAMF3Int();
		}
开发者ID:RanadeepPolavarapu,项目名称:LoLNotes,代码行数:4,代码来源:AMF3IntegerReader.cs


示例15: ReadData

		public object ReadData(AMFReader reader)
		{
			return reader.ReadAMF3XmlDocument();
		}
开发者ID:apakian,项目名称:fluorinefx,代码行数:4,代码来源:AMF3XmlReader.cs


示例16: Deserialize

        public void Deserialize(AMFReader reader)
		{
            _name = reader.ReadData() as string;
            _path = reader.ReadData() as string;
            _attributes.Clear();
#if !(NET_1_1)
            _attributes = new CopyOnWriteDictionary<string, object>(reader.ReadData() as IDictionary<string, object>);
#else
            _attributes = new CopyOnWriteDictionary(reader.ReadData() as IDictionary);
#endif
			_persistent = true; _persistentSO = true;
            _ownerMessage.SetName(_name);
            _ownerMessage.SetIsPersistent(true);

		}
开发者ID:Nicholi,项目名称:fluorinefx-mod,代码行数:15,代码来源:SharedObject.cs


示例17: ReadData

		public object ReadData(AMFReader reader) {
			return reader.ReadAssociativeArray();
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:3,代码来源:AMF0AssociativeArrayReader.cs


示例18: ReadData

		public object ReadData(AMFReader reader)
		{
			throw new UnexpectedAMF();
		}
开发者ID:ByteSempai,项目名称:Ubiquitous,代码行数:4,代码来源:AMFUnknownTagReader.cs


示例19: ReadData

		public object ReadData(AMFReader reader)
		{
			int length = reader.ReadInt32();
			return reader.ReadUTF(length);
		}
开发者ID:ByteSempai,项目名称:Ubiquitous,代码行数:5,代码来源:AMF0LongStringReader.cs


示例20: ReadData

 public object ReadData(AMFReader reader)
 {
     return reader.ReadString();
 }
开发者ID:mstaessen,项目名称:fluorinefx,代码行数:4,代码来源:AMF0StringReader.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AMFWriter类代码示例发布时间:2022-05-24
下一篇:
C# AList类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap