public void Serialize(EndianAwareBinaryWriter writer) { writer.WriteInt32(TypeId); Util.WriteLengthPrefixedString(writer, Name); writer.WriteByte((byte)(AdditionalData != null ? 1 : 0)); writer.WriteInt32(InstanceCount); Util.WriteReferentArray(writer, Referents); if (AdditionalData != null) { writer.WriteBytes(AdditionalData); } }
private void Serialize(EndianAwareBinaryWriter writer) { writer.WriteInt32(TypeId); Util.WriteLengthPrefixedString(writer, Name); writer.WriteByte((byte)PropertyType); SerializeValues(writer); }
public static void WriteLengthPrefixedString(EndianAwareBinaryWriter writer, string value) { var stringBytes = RobloxEncoding.GetBytes(value); writer.WriteInt32(stringBytes.Length); writer.WriteBytes(stringBytes); }
public static void WriteNumberSequence(EndianAwareBinaryWriter writer, NumberSequence sequence) { writer.WriteInt32(sequence.Keypoints.Length); for (var i = 0; i < sequence.Keypoints.Length; i++) { writer.WriteSingle(sequence.Keypoints[i].Time); writer.WriteSingle(sequence.Keypoints[i].Value); writer.WriteSingle(sequence.Keypoints[i].Envelope); } }
public static void WriteColorSequence(EndianAwareBinaryWriter writer, ColorSequence sequence) { writer.WriteInt32(sequence.Keypoints.Length); for (var i = 0; i < sequence.Keypoints.Length; i++) { writer.WriteSingle(sequence.Keypoints[i].Time); writer.WriteSingle(sequence.Keypoints[i].Value.R); writer.WriteSingle(sequence.Keypoints[i].Value.G); writer.WriteSingle(sequence.Keypoints[i].Value.B); } }
public static void SerializeParentData(EndianAwareBinaryWriter writer, Tuple <int, int>[] parentData) { // This could be improved by creating an incremental version of WriteReferentArray var children = new int[parentData.Length]; var parents = new int[parentData.Length]; for (var i = 0; i < parentData.Length; i++) { children[i] = parentData[i].Item1; parents[i] = parentData[i].Item2; } writer.WriteByte(0); // Reserved writer.WriteInt32(parentData.Length); WriteReferentArray(writer, children); WriteReferentArray(writer, parents); }