本文整理汇总了C#中AMFWriter.WriteAMF3AssociativeArray方法的典型用法代码示例。如果您正苦于以下问题:C# AMFWriter.WriteAMF3AssociativeArray方法的具体用法?C# AMFWriter.WriteAMF3AssociativeArray怎么用?C# AMFWriter.WriteAMF3AssociativeArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AMFWriter
的用法示例。
在下文中一共展示了AMFWriter.WriteAMF3AssociativeArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
//.........这里部分代码省略.........