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


C# AMFWriter.WriteAMF3Array方法代码示例

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


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

示例1: WriteData

 public void WriteData(AMFWriter writer, object data)
 {
     if (data is ArrayCollection)
     {
         writer.WriteByte(AMF3TypeCode.Object);
         writer.WriteAMF3Object(data);
         return;
     }
     //TODO: configure somehow Vector support
     /*
     if (CollectionUtils.IsGenericListType(data.GetType()))
     {
         Type itemType = ReflectionUtils.GetListItemType(data.GetType());
         switch (Type.GetTypeCode(itemType))
         {
             case TypeCode.Int32:
                 writer.WriteByte(AMF3TypeCode.IntVector);
                 writer.WriteAMF3IntVector(data as IList<int>);
                 return;
             case TypeCode.UInt32:
                 writer.WriteByte(AMF3TypeCode.UIntVector);
                 writer.WriteAMF3UIntVector(data as IList<uint>);
                 return;
             case TypeCode.Double:
                 writer.WriteByte(AMF3TypeCode.NumberVector);
                 writer.WriteAMF3DoubleVector(data as IList<double>);
                 return;
             case TypeCode.String:
                 writer.WriteByte(AMF3TypeCode.ObjectVector);
                 writer.WriteAMF3ObjectVector(data as IList<string>);
                 return;
             case TypeCode.Boolean:
                 writer.WriteByte(AMF3TypeCode.ObjectVector);
                 writer.WriteAMF3ObjectVector(data as IList<bool>);
                 return;
             default:
                 writer.WriteByte(AMF3TypeCode.ObjectVector);
                 writer.WriteAMF3ObjectVector(data as IList);
                 return;
         }
     }
     */
     var list = data as IList;
     if (list != null )
     {
         //http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001104.html#270405
         //http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001105.html#268711
         if( writer.UseLegacyCollection )
         {
             writer.WriteByte(AMF3TypeCode.Array);
             writer.WriteAMF3Array(list);
         }
         else
         {
             writer.WriteByte(AMF3TypeCode.Object);
             object value = new ArrayCollection(list);
             writer.WriteAMF3Object(value);
         }
         return;
     }
     #if !(SILVERLIGHT)
     var listSource = data as IListSource;
     if (listSource != null)
     {
         if (writer.UseLegacyCollection)
         {
             writer.WriteByte(AMF3TypeCode.Array);
             writer.WriteAMF3Array(listSource.GetList());
         }
         else
         {
             writer.WriteByte(AMF3TypeCode.Object);
             object value = new ArrayCollection(listSource.GetList());
             writer.WriteAMF3Object(value);
         }
         return;
     }
     #endif
     var dictionary = data as IDictionary;
     if (dictionary != null)
     {
         //writer.WriteByte(AMF3TypeCode.Object);
         //writer.WriteAMF3Object(data);
         writer.WriteByte(AMF3TypeCode.Array);
         writer.WriteAMF3AssociativeArray(dictionary);
         return;
     }
     if(data is Exception)
     {
         writer.WriteByte(AMF3TypeCode.Object);
         if (writer.UseLegacyThrowable)
             writer.WriteAMF3Object(new ASExceptionObject(data as Exception) );
         else
             writer.WriteAMF3Object(data);
         return;
     }
     if( data is IExternalizable )
     {
         writer.WriteByte(AMF3TypeCode.Object);
         writer.WriteAMF3Object(data);
//.........这里部分代码省略.........
开发者ID:mstaessen,项目名称:fluorinefx,代码行数:101,代码来源:AMF3ObjectWriter.cs

示例2: WriteData

		public void WriteData(AMFWriter writer, object data)
		{
			writer.WriteByte(AMF3TypeCode.Array);
			writer.WriteAMF3Array(data as Array);
		}
开发者ID:apakian,项目名称:fluorinefx,代码行数:5,代码来源:AMF3ArrayWriter.cs


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