本文整理汇总了C#中ObjectId.WriteTo方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectId.WriteTo方法的具体用法?C# ObjectId.WriteTo怎么用?C# ObjectId.WriteTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectId
的用法示例。
在下文中一共展示了ObjectId.WriteTo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetValuesAsync
/// <summary>
/// Returns the value of one or more instance fields. Each field must be member of the object's type or one of its superclasses,
/// superinterfaces, or implemented interfaces. Access control is not enforced; for example, the values of private fields can be obtained.
/// </summary>
public Task<List<Value>> GetValuesAsync(ObjectId objectId, FieldId[] fields)
{
var conn = ConnectionOrError;
var sizeInfo = conn.GetIdSizeInfo();
var t = conn.SendAsync(JdwpPacket.CreateCommand(conn, Nr, 2, objectId.Size + 4 + (sizeInfo.FieldIdSize * fields.Length),
x => {
var data = x.Data;
objectId.WriteTo(data);
data.SetInt(fields.Length);
foreach (var fieldId in fields)
{
fieldId.WriteTo(data);
}
}));
return t.ContinueWith(x => {
x.ForwardException();
var result = x.Result;
result.ThrowOnError();
var data = result.Data;
var count = data.GetInt();
var list = new List<Value>(count);
for (var i = 0; i < count; i++)
{
var value = new Value(data);
list.Add(value);
}
return list;
});
}
示例2: GetValuesAsync
/// <summary>
/// Returns a range of array components. The specified range must be within the bounds of the array.
/// </summary>
public Task<List<Value>> GetValuesAsync(ObjectId objectId, string elementSignature, int firstIndex, int length)
{
var conn = ConnectionOrError;
var t = conn.SendAsync(JdwpPacket.CreateCommand(conn, Nr, 2, objectId.Size + 8,
x => {
var data = x.Data;
objectId.WriteTo(data);
data.SetInt(firstIndex);
data.SetInt(length);
}));
return t.ContinueWith(x => {
x.ForwardException();
var result = x.Result;
result.ThrowOnError();
var data = result.Data;
var arrayElementTag = (Jdwp.Tag)data.GetByte();
var arrayElementIsObject = !arrayElementTag.IsPrimitive();
var count = data.GetInt();
var list = new List<Value>(count);
for (var i = 0; i < count; i++)
{
var value = arrayElementIsObject ? new Value(data) : new Value(data, arrayElementTag);
list.Add(value);
}
return list;
});
}
示例3: ValueAsync
/// <summary>
/// Returns the characters contained in the string.
/// </summary>
public Task<string> ValueAsync(ObjectId objectId)
{
var conn = ConnectionOrError;
var t = conn.SendAsync(JdwpPacket.CreateCommand(conn, Nr, 1, objectId.Size,
x => {
var data = x.Data;
objectId.WriteTo(data);
}));
return t.ContinueWith(x => {
x.ForwardException();
var result = x.Result;
result.ThrowOnError();
return result.Data.GetString();
});
}
示例4: ReflectedTypeAsync
/// <summary>
/// Returns the reference type reflected by this class object.
/// </summary>
public Task<ReferenceTypeId> ReflectedTypeAsync(ObjectId classObjectId)
{
var conn = ConnectionOrError;
var t = conn.SendAsync(JdwpPacket.CreateCommand(conn, Nr, 1, classObjectId.Size, x => classObjectId.WriteTo(x.Data)));
return t.ContinueWith(x => {
x.ForwardException();
var result = x.Result;
result.ThrowOnError();
var kind = (Jdwp.TypeTag) x.Result.Data.GetByte();
if(kind == Jdwp.TypeTag.Array)
return (ReferenceTypeId)new ArrayTypeId(result.Data);
if(kind == Jdwp.TypeTag.Interface)
return new InterfaceId(result.Data);
return new ClassId(result.Data);
});
}