public static void Parse(Replay replay, byte[] buffer) { int headerSize = 4; if (replay.ReplayBuild >= 17326) // 1.2.0 { headerSize = 5; } var numAttributes = BitConverter.ToInt32(buffer, headerSize); var attributes = new ReplayAttribute[numAttributes]; int initialOffset = 4 + headerSize; for (int i = 0; i < numAttributes; i++) { attributes[i] = ReplayAttribute.Parse(buffer, initialOffset + (i * 13)); } var rae = new ReplayAttributeEvents { Attributes = attributes }; rae.ApplyAttributes(replay); }
public static ReplayAttribute Parse(byte[] buffer, int offset) { var attribute = new ReplayAttribute { Header = BitConverter.ToInt32(buffer, offset), AttributeId = BitConverter.ToInt32(buffer, offset + 4), PlayerId = buffer[offset + 8], Value = new byte[4], }; Array.Copy(buffer, offset + 9, attribute.Value, 0, 4); return attribute; }
public static ReplayAttribute Parse(byte[] buffer, int offset) { var attribute = new ReplayAttribute { Header = BitConverter.ToInt32(buffer, offset), AttributeId = BitConverter.ToInt32(buffer, offset + 4), PlayerId = buffer[offset + 8], Value = new byte[4], }; Array.Copy(buffer, offset + 9, attribute.Value, 0, 4); return(attribute); }
public static ReplayAttribute Parse(byte[] buffer, int offset) { var attribute = new ReplayAttribute { Header = BitConverter.ToInt32(buffer, offset), AttributeId = BitConverter.ToInt32(buffer, offset + 4), // Offset the PlayerID so it matches our array indices. PlayerId = buffer[offset + 8] - 1, Value = new byte[4], }; Array.Copy(buffer, offset + 9, attribute.Value, 0, 4); return attribute; }
public static void Parse(Replay replay, byte[] buffer) { int headerSize = 4; if (replay.ReplayBuild >= 17326) // 1.2.0 { headerSize = 5; } var numAttributes = BitConverter.ToInt32(buffer, headerSize); var attributes = new ReplayAttribute[numAttributes]; int initialOffset = 4 + headerSize; for (int i = 0; i < numAttributes; i++) { attributes[i] = ReplayAttribute.Parse(buffer, initialOffset + (i*13)); } var rae = new ReplayAttributeEvents { Attributes = attributes }; rae.ApplyAttributes(replay); }