本文整理匯總了C#中System.Xml.XmlTextReader.ReadElementContentAsLong方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlTextReader.ReadElementContentAsLong方法的具體用法?C# XmlTextReader.ReadElementContentAsLong怎麽用?C# XmlTextReader.ReadElementContentAsLong使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Xml.XmlTextReader
的用法示例。
在下文中一共展示了XmlTextReader.ReadElementContentAsLong方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Unmarshall
public override WebServiceResponse Unmarshall(XmlUnmarshallerContext context)
{
XmlTextReader reader = new XmlTextReader(context.ResponseStream);
QueueAttributes attributes = new QueueAttributes();
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
switch (reader.LocalName)
{
case MNSConstants.XML_ELEMENT_QUEUE_NAME:
attributes.QueueName = reader.ReadElementContentAsString();
break;
case MNSConstants.XML_ELEMENT_CREATE_TIME:
attributes.CreateTime = AliyunSDKUtils.ConvertFromUnixEpochSeconds(reader.ReadElementContentAsLong());
break;
case MNSConstants.XML_ELEMENT_LAST_MODIFY_TIME:
attributes.LastModifyTime = AliyunSDKUtils.ConvertFromUnixEpochSeconds(reader.ReadElementContentAsLong());
break;
case MNSConstants.XML_ELEMENT_VISIBILITY_TIMEOUT:
attributes.VisibilityTimeout = (uint)reader.ReadElementContentAsInt();
break;
case MNSConstants.XML_ELEMENT_MAXIMUM_MESSAGE_SIZE:
attributes.MaximumMessageSize = (uint)reader.ReadElementContentAsInt();
break;
case MNSConstants.XML_ELEMENT_MESSAGE_RETENTION_PERIOD:
attributes.MessageRetentionPeriod = (uint)reader.ReadElementContentAsInt();
break;
case MNSConstants.XML_ELEMENT_DELAY_SECONDS:
attributes.DelaySeconds = (uint)reader.ReadElementContentAsInt();
break;
case MNSConstants.XML_ELEMENT_POLLING_WAIT_SECONDS:
attributes.PollingWaitSeconds = (uint)reader.ReadElementContentAsInt();
break;
case MNSConstants.XML_ELEMENT_INACTIVE_MESSAGES:
attributes.InactiveMessages = (uint)reader.ReadElementContentAsInt();
break;
case MNSConstants.XML_ELEMENT_ACTIVE_MESSAGES:
attributes.ActiveMessages = (uint)reader.ReadElementContentAsInt();
break;
case MNSConstants.ATTRIBUTE_DELAY_MESSAGES:
attributes.DelayMessages = (uint)reader.ReadElementContentAsInt();
break;
}
break;
}
}
reader.Close();
return new GetQueueAttributesResponse()
{
Attributes = attributes
};
}
示例2: Unmarshall
public override WebServiceResponse Unmarshall(XmlUnmarshallerContext context)
{
XmlTextReader reader = new XmlTextReader(context.ResponseStream);
ChangeMessageVisibilityResponse response = new ChangeMessageVisibilityResponse();
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
switch (reader.LocalName)
{
case MNSConstants.XML_ELEMENT_RECEIPT_HANDLE:
response.ReceiptHandle = reader.ReadElementContentAsString();
break;
case MNSConstants.XML_ELEMENT_NEXT_VISIBLE_TIME:
response.NextVisibleTime = AliyunSDKUtils.ConvertFromUnixEpochSeconds(reader.ReadElementContentAsLong());
break;
}
break;
}
}
reader.Close();
return response;
}
示例3: Unmarshall
public override WebServiceResponse Unmarshall(XmlUnmarshallerContext context)
{
XmlTextReader reader = new XmlTextReader(context.ResponseStream);
Message message = new Message();
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
switch (reader.LocalName)
{
case MNSConstants.XML_ELEMENT_MESSAGE_ID:
message.Id = reader.ReadElementContentAsString();
break;
case MNSConstants.XML_ELEMENT_MESSAGE_BODY_MD5:
message.BodyMD5 = reader.ReadElementContentAsString();
break;
case MNSConstants.XML_ELEMENT_MESSAGE_BODY:
message.Body = reader.ReadElementContentAsString();
break;
case MNSConstants.XML_ELEMENT_ENQUEUE_TIME:
message.EnqueueTime = AliyunSDKUtils.ConvertFromUnixEpochSeconds(reader.ReadElementContentAsLong());
break;
case MNSConstants.XML_ELEMENT_FIRST_DEQUEUE_TIME:
message.FirstDequeueTime = AliyunSDKUtils.ConvertFromUnixEpochSeconds(reader.ReadElementContentAsLong());
break;
case MNSConstants.XML_ELEMENT_DEQUEUE_COUNT:
message.DequeueCount = (uint)reader.ReadElementContentAsInt();
break;
case MNSConstants.XML_ELEMENT_PRIORITY:
message.Priority = (uint)reader.ReadElementContentAsInt();
break;
}
break;
}
}
reader.Close();
return new PeekMessageResponse()
{
Message = message
};
}
示例4: ProcessRegionHandle
private static void ProcessRegionHandle(SceneObjectPart obj, XmlTextReader reader)
{
obj.RegionHandle = (ulong)reader.ReadElementContentAsLong("RegionHandle", String.Empty);
}
示例5: ProcessLocalId
private static void ProcessLocalId(SceneObjectPart obj, XmlTextReader reader)
{
obj.LocalId = (uint)reader.ReadElementContentAsLong("LocalId", String.Empty);
}
示例6: LoadPrim
public static PrimObject LoadPrim(XmlTextReader reader)
{
PrimObject obj = new PrimObject();
obj.Shape = new PrimObject.ShapeBlock();
obj.Inventory = new PrimObject.InventoryBlock();
reader.ReadStartElement("SceneObjectPart");
if (reader.Name == "AllowedDrop")
obj.AllowedDrop = reader.ReadElementContentAsBoolean("AllowedDrop", String.Empty);
else
obj.AllowedDrop = true;
obj.CreatorID = ReadUUID(reader, "CreatorID");
obj.FolderID = ReadUUID(reader, "FolderID");
obj.Inventory.Serial = reader.ReadElementContentAsInt("InventorySerial", String.Empty);
#region Task Inventory
List<PrimObject.InventoryBlock.ItemBlock> invItems = new List<PrimObject.InventoryBlock.ItemBlock>();
reader.ReadStartElement("TaskInventory", String.Empty);
while (reader.Name == "TaskInventoryItem")
{
PrimObject.InventoryBlock.ItemBlock item = new PrimObject.InventoryBlock.ItemBlock();
reader.ReadStartElement("TaskInventoryItem", String.Empty);
item.AssetID = ReadUUID(reader, "AssetID");
item.PermsBase = (uint)reader.ReadElementContentAsInt("BasePermissions", String.Empty);
item.CreationDate = Utils.UnixTimeToDateTime((uint)reader.ReadElementContentAsInt("CreationDate", String.Empty));
item.CreatorID = ReadUUID(reader, "CreatorID");
item.Description = reader.ReadElementContentAsString("Description", String.Empty);
item.PermsEveryone = (uint)reader.ReadElementContentAsInt("EveryonePermissions", String.Empty);
item.Flags = reader.ReadElementContentAsInt("Flags", String.Empty);
item.GroupID = ReadUUID(reader, "GroupID");
item.PermsGroup = (uint)reader.ReadElementContentAsInt("GroupPermissions", String.Empty);
item.InvType = (InventoryType)reader.ReadElementContentAsInt("InvType", String.Empty);
item.ID = ReadUUID(reader, "ItemID");
UUID oldItemID = ReadUUID(reader, "OldItemID"); // TODO: Is this useful?
item.LastOwnerID = ReadUUID(reader, "LastOwnerID");
item.Name = reader.ReadElementContentAsString("Name", String.Empty);
item.PermsNextOwner = (uint)reader.ReadElementContentAsInt("NextPermissions", String.Empty);
item.OwnerID = ReadUUID(reader, "OwnerID");
item.PermsOwner = (uint)reader.ReadElementContentAsInt("CurrentPermissions", String.Empty);
UUID parentID = ReadUUID(reader, "ParentID");
UUID parentPartID = ReadUUID(reader, "ParentPartID");
item.PermsGranterID = ReadUUID(reader, "PermsGranter");
item.PermsBase = (uint)reader.ReadElementContentAsInt("PermsMask", String.Empty);
item.Type = (AssetType)reader.ReadElementContentAsInt("Type", String.Empty);
reader.ReadEndElement();
invItems.Add(item);
}
if (reader.NodeType == XmlNodeType.EndElement)
reader.ReadEndElement();
obj.Inventory.Items = invItems.ToArray();
#endregion Task Inventory
PrimFlags flags = (PrimFlags)reader.ReadElementContentAsInt("ObjectFlags", String.Empty);
obj.UsePhysics = (flags & PrimFlags.Physics) != 0;
obj.Phantom = (flags & PrimFlags.Phantom) != 0;
obj.DieAtEdge = (flags & PrimFlags.DieAtEdge) != 0;
obj.ReturnAtEdge = (flags & PrimFlags.ReturnAtEdge) != 0;
obj.Temporary = (flags & PrimFlags.Temporary) != 0;
obj.Sandbox = (flags & PrimFlags.Sandbox) != 0;
obj.ID = ReadUUID(reader, "UUID");
obj.LocalID = (uint)reader.ReadElementContentAsLong("LocalId", String.Empty);
obj.Name = reader.ReadElementString("Name");
obj.Material = reader.ReadElementContentAsInt("Material", String.Empty);
if (reader.Name == "PassTouches")
obj.PassTouches = reader.ReadElementContentAsBoolean("PassTouches", String.Empty);
else
obj.PassTouches = false;
obj.RegionHandle = (ulong)reader.ReadElementContentAsLong("RegionHandle", String.Empty);
obj.RemoteScriptAccessPIN = reader.ReadElementContentAsInt("ScriptAccessPin", String.Empty);
if (reader.Name == "PlaySoundSlavePrims")
reader.ReadInnerXml();
if (reader.Name == "LoopSoundSlavePrims")
reader.ReadInnerXml();
Vector3 groupPosition = ReadVector(reader, "GroupPosition");
Vector3 offsetPosition = ReadVector(reader, "OffsetPosition");
obj.Rotation = ReadQuaternion(reader, "RotationOffset");
obj.Velocity = ReadVector(reader, "Velocity");
if (reader.Name == "RotationalVelocity")
ReadVector(reader, "RotationalVelocity");
obj.AngularVelocity = ReadVector(reader, "AngularVelocity");
obj.Acceleration = ReadVector(reader, "Acceleration");
obj.Description = reader.ReadElementString("Description");
reader.ReadStartElement("Color");
if (reader.Name == "R")
{
obj.TextColor.R = reader.ReadElementContentAsFloat("R", String.Empty);
obj.TextColor.G = reader.ReadElementContentAsFloat("G", String.Empty);
//.........這裏部分代碼省略.........
示例7: ReadXml
internal override void ReadXml(XmlTextReader reader)
{
while (reader.Read())
{
if (reader.Name == "shipping_address" && reader.NodeType == XmlNodeType.EndElement)
break;
if (reader.NodeType != XmlNodeType.Element) continue;
switch (reader.Name)
{
case "address1":
Address1 = reader.ReadElementContentAsString();
break;
case "address2":
Address2 = reader.ReadElementContentAsString();
break;
case "city":
City = reader.ReadElementContentAsString();
break;
case "state":
State = reader.ReadElementContentAsString();
break;
case "zip":
Zip = reader.ReadElementContentAsString();
break;
case "country":
Country = reader.ReadElementContentAsString();
break;
case "phone":
Phone = reader.ReadElementContentAsString();
break;
case "company_name":
CompanyName = reader.ReadElementContentAsString();
break;
case "first_name":
FirstName = reader.ReadElementContentAsString();
break;
case "last_name":
LastName = reader.ReadElementContentAsString();
break;
case "nickname":
Nickname = reader.ReadElementContentAsString();
break;
case "email":
Email = reader.ReadElementContentAsString();
break;
case "vat_number":
VatNumber = reader.ReadElementContentAsString();
break;
case "id":
Id = reader.ReadElementContentAsLong();
break;
}
}
}
示例8: LoadPrim
public static PrimObject LoadPrim(XmlTextReader reader)
{
PrimObject obj = new PrimObject();
obj.Shape = new PrimObject.ShapeBlock();
obj.Inventory = new PrimObject.InventoryBlock();
reader.ReadStartElement("SceneObjectPart");
obj.CreatorIdentity = ReadUUID(reader, "CreatorID").ToString();
//warning CS0219: The variable `folderID' is assigned but its value is never used
//UUID folderID = ReadUUID(reader, "FolderID");
obj.Inventory.Serial = reader.ReadElementContentAsInt("InventorySerial", String.Empty);
// FIXME: Parse TaskInventory
obj.Inventory.Items = new PrimObject.InventoryBlock.ItemBlock[0];
reader.ReadInnerXml();
PrimFlags flags = (PrimFlags)reader.ReadElementContentAsInt("ObjectFlags", String.Empty);
obj.UsePhysics = (flags & PrimFlags.Physics) != 0;
obj.Phantom = (flags & PrimFlags.Phantom) != 0;
obj.DieAtEdge = (flags & PrimFlags.DieAtEdge) != 0;
obj.ReturnAtEdge = (flags & PrimFlags.ReturnAtEdge) != 0;
obj.Temporary = (flags & PrimFlags.Temporary) != 0;
obj.Sandbox = (flags & PrimFlags.Sandbox) != 0;
obj.ID = ReadUUID(reader, "UUID");
obj.LocalID = (uint)reader.ReadElementContentAsLong("LocalId", String.Empty);
obj.Name = reader.ReadElementString("Name");
obj.Material = reader.ReadElementContentAsInt("Material", String.Empty);
reader.ReadInnerXml(); // RegionHandle
obj.RemoteScriptAccessPIN = reader.ReadElementContentAsInt("ScriptAccessPin", String.Empty);
Vector3 groupPosition = ReadVector(reader, "GroupPosition");
Vector3 offsetPosition = ReadVector(reader, "OffsetPosition");
obj.Rotation = ReadQuaternion(reader, "RotationOffset");
obj.Velocity = ReadVector(reader, "Velocity");
//warning CS0219: The variable `rotationalVelocity' is assigned but its value is never used
//Vector3 rotationalVelocity = ReadVector(reader, "RotationalVelocity");
obj.AngularVelocity = ReadVector(reader, "AngularVelocity");
obj.Acceleration = ReadVector(reader, "Acceleration");
obj.Description = reader.ReadElementString("Description");
reader.ReadStartElement("Color");
if (reader.Name == "R")
{
obj.TextColor.R = reader.ReadElementContentAsFloat("R", String.Empty);
obj.TextColor.G = reader.ReadElementContentAsFloat("G", String.Empty);
obj.TextColor.B = reader.ReadElementContentAsFloat("B", String.Empty);
obj.TextColor.A = reader.ReadElementContentAsFloat("A", String.Empty);
reader.ReadEndElement();
}
obj.Text = reader.ReadElementString("Text", String.Empty);
obj.SitName = reader.ReadElementString("SitName", String.Empty);
obj.TouchName = reader.ReadElementString("TouchName", String.Empty);
obj.LinkNumber = reader.ReadElementContentAsInt("LinkNum", String.Empty);
obj.ClickAction = reader.ReadElementContentAsInt("ClickAction", String.Empty);
reader.ReadStartElement("Shape");
obj.Shape.ProfileCurve = reader.ReadElementContentAsInt("ProfileCurve", String.Empty);
byte[] teData = Convert.FromBase64String(reader.ReadElementString("TextureEntry"));
Primitive.TextureEntry te = new Primitive.TextureEntry(teData, 0, teData.Length);
obj.Faces = FromTextureEntry(te);
reader.ReadInnerXml(); // ExtraParams
obj.Shape.PathBegin = Primitive.UnpackBeginCut((ushort)reader.ReadElementContentAsInt("PathBegin", String.Empty));
obj.Shape.PathCurve = reader.ReadElementContentAsInt("PathCurve", String.Empty);
obj.Shape.PathEnd = Primitive.UnpackEndCut((ushort)reader.ReadElementContentAsInt("PathEnd", String.Empty));
obj.Shape.PathRadiusOffset = Primitive.UnpackPathTwist((sbyte)reader.ReadElementContentAsInt("PathRadiusOffset", String.Empty));
obj.Shape.PathRevolutions = Primitive.UnpackPathRevolutions((byte)reader.ReadElementContentAsInt("PathRevolutions", String.Empty));
obj.Shape.PathScaleX = Primitive.UnpackPathScale((byte)reader.ReadElementContentAsInt("PathScaleX", String.Empty));
obj.Shape.PathScaleY = Primitive.UnpackPathScale((byte)reader.ReadElementContentAsInt("PathScaleY", String.Empty));
obj.Shape.PathShearX = Primitive.UnpackPathShear((sbyte)reader.ReadElementContentAsInt("PathShearX", String.Empty));
obj.Shape.PathShearY = Primitive.UnpackPathShear((sbyte)reader.ReadElementContentAsInt("PathShearY", String.Empty));
obj.Shape.PathSkew = Primitive.UnpackPathTwist((sbyte)reader.ReadElementContentAsInt("PathSkew", String.Empty));
obj.Shape.PathTaperX = Primitive.UnpackPathTaper((sbyte)reader.ReadElementContentAsInt("PathTaperX", String.Empty));
obj.Shape.PathTaperY = Primitive.UnpackPathShear((sbyte)reader.ReadElementContentAsInt("PathTaperY", String.Empty));
obj.Shape.PathTwist = Primitive.UnpackPathTwist((sbyte)reader.ReadElementContentAsInt("PathTwist", String.Empty));
obj.Shape.PathTwistBegin = Primitive.UnpackPathTwist((sbyte)reader.ReadElementContentAsInt("PathTwistBegin", String.Empty));
obj.PCode = reader.ReadElementContentAsInt("PCode", String.Empty);
obj.Shape.ProfileBegin = Primitive.UnpackBeginCut((ushort)reader.ReadElementContentAsInt("ProfileBegin", String.Empty));
obj.Shape.ProfileEnd = Primitive.UnpackEndCut((ushort)reader.ReadElementContentAsInt("ProfileEnd", String.Empty));
obj.Shape.ProfileHollow = Primitive.UnpackProfileHollow((ushort)reader.ReadElementContentAsInt("ProfileHollow", String.Empty));
obj.Scale = ReadVector(reader, "Scale");
obj.State = (byte)reader.ReadElementContentAsInt("State", String.Empty);
ProfileShape profileShape = (ProfileShape)Enum.Parse(typeof(ProfileShape), reader.ReadElementString("ProfileShape"));
HoleType holeType = (HoleType)Enum.Parse(typeof(HoleType), reader.ReadElementString("HollowShape"));
obj.Shape.ProfileCurve = (int)profileShape | (int)holeType;
UUID sculptTexture = ReadUUID(reader, "SculptTexture");
SculptType sculptType = (SculptType)reader.ReadElementContentAsInt("SculptType", String.Empty);
if (sculptTexture != UUID.Zero)
{
obj.Sculpt = new PrimObject.SculptBlock();
obj.Sculpt.Texture = sculptTexture;
obj.Sculpt.Type = (int)sculptType;
}
//.........這裏部分代碼省略.........