本文整理汇总了C#中AMFWriter.WriteByte方法的典型用法代码示例。如果您正苦于以下问题:C# AMFWriter.WriteByte方法的具体用法?C# AMFWriter.WriteByte怎么用?C# AMFWriter.WriteByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AMFWriter
的用法示例。
在下文中一共展示了AMFWriter.WriteByte方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteData
public void WriteData(AMFWriter writer, object data)
{
NameObjectCollectionBase collection = data as NameObjectCollectionBase;
object[] attributes = collection.GetType().GetCustomAttributes(typeof(DefaultMemberAttribute), false);
if (attributes != null && attributes.Length > 0)
{
DefaultMemberAttribute defaultMemberAttribute = attributes[0] as DefaultMemberAttribute;
PropertyInfo pi = collection.GetType().GetProperty(defaultMemberAttribute.MemberName, new Type[] { typeof(string) });
if (pi != null)
{
ASObject aso = new ASObject();
for (int i = 0; i < collection.Keys.Count; i++)
{
string key = collection.Keys[i];
object value = pi.GetValue(collection, new object[]{ key });
aso.Add(key, value);
}
writer.WriteByte(AMF3TypeCode.Object);
writer.WriteAMF3Object(aso);
return;
}
}
//We could not access an indexer so write out as it is.
writer.WriteByte(AMF3TypeCode.Object);
writer.WriteAMF3Object(data);
}
示例2: WriteData
public void WriteData(AMFWriter writer, object data)
{
writer.WriteByte(AMF3TypeCode.IntVector);
writer.WriteAMF3IntVector(data as IList<int>);
}
示例3: WriteData
public void WriteData(AMFWriter writer, object data) {
writer.WriteByte(AMF0TypeCode.Boolean);
writer.WriteBoolean((bool)data);
}
示例4: WriteData
public void WriteData(AMFWriter writer, object data)
{
writer.WriteByte(AMF0TypeCode.String);
writer.WriteUTF( new String( (char)data, 1) );
}
示例5: WriteData
public void WriteData(AMFWriter writer, object data) {
writer.WriteByte(AMF3TypeCode.Object);
writer.WriteAMF3Object(data);
}
示例6: WriteData
public void WriteData(AMFWriter writer, object data)
{
writer.WriteByte(AMF0TypeCode.Number);
double dbl = (double)Convert.ToInt32(data);
writer.WriteDouble(dbl);
}
示例7: WriteData
public void WriteData(AMFWriter writer, object data)
{
ASObject aso = TypeHelper.ConvertDataSetToASO(data as DataSet, false);
writer.WriteByte(AMF3TypeCode.Object);
writer.WriteAMF3Object(aso);
}
示例8: WriteData
public void WriteData(AMFWriter writer, object data)
{
writer.WriteByte(AMF0TypeCode.AMF3Tag);
writer.WriteAMF3Data(data);
}
示例9: 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);
//.........这里部分代码省略.........
示例10: WriteData
public void WriteData(AMFWriter writer, object data)
{
writer.WriteByte(AMF3TypeCode.Array);
writer.WriteAMF3Array(data as Array);
}
示例11: WriteData
public void WriteData(AMFWriter writer, object data)
{
writer.WriteByte(AMF0TypeCode.DateTime);
writer.WriteDateTime((DateTime)data);
}
示例12: WriteData
public void WriteData(AMFWriter writer, object data)
{
writer.WriteByte(AMF0TypeCode.Number);
double value = Convert.ToDouble(data);
writer.WriteDouble(value);
}