public void Dump(string indent, IndentTextWriter writer) { writer.WriteLine(indent + "UpdateBlock: " + EntityId + " (FieldCount: " + UpdateCount + ")"); writer.IndentLevel++; writer.WriteLine(indent + "Type: " + Type); if (m_movement != null) { writer.WriteLine(); writer.WriteLine(indent + "Movement:"); m_movement.Dump(indent + "\t", writer); } writer.WriteLine(); if (EntityIds != null) { writer.WriteLine(); writer.WriteLine(indent + "EntityIds:"); foreach (var id in EntityIds) { writer.WriteLine(indent + "\t" + id); } } if (Values != null) { writer.WriteLine(indent + "Fields:"); var renderer = FieldRenderUtil.GetRenderer(EntityId.ObjectType); // use the exact if its available if (m_movement != null) { renderer = FieldRenderUtil.GetRenderer(m_movement.ObjectTypeId); // } writer.IndentLevel++; uint size = 0; for (uint i = 0; i < SetIndices.Length; i++) { var index = SetIndices[i]; size = renderer.Render(index, Values, writer); while (size > 1 && SetIndices.Length > i + 1) { // check if we can skip the next indices var next = SetIndices[i + 1]; if (next != index + 4) { break; } size--; i++; } } writer.IndentLevel--; } writer.WriteLine(); writer.IndentLevel--; }
/// <summary> /// Returns a string representation of the given field in the given block /// </summary> public static string Render(ExtendedUpdateFieldId fieldId, UpdateBlock block) { var renderer = FieldRenderUtil.GetRenderer(fieldId.ObjectType); uint fieldNum = (uint)fieldId.RawId; var field = renderer.Fields.Get(fieldNum); if (field != null) { string strVal; field.Renderer(field, block.Values, out strVal); return(strVal); } return(block.Values.GetUInt32(fieldNum).ToString()); }