示例#1
0
 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);
     }
 }
示例#2
0
 private void Serialize(EndianAwareBinaryWriter writer)
 {
     writer.WriteInt32(TypeId);
     Util.WriteLengthPrefixedString(writer, Name);
     writer.WriteByte((byte)PropertyType);
     SerializeValues(writer);
 }
示例#3
0
        public static void WriteLengthPrefixedString(EndianAwareBinaryWriter writer, string value)
        {
            var stringBytes = RobloxEncoding.GetBytes(value);

            writer.WriteInt32(stringBytes.Length);
            writer.WriteBytes(stringBytes);
        }
示例#4
0
 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);
     }
 }
示例#5
0
 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);
     }
 }
示例#6
0
        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);
        }