public void Write(BinaryWriter writer) { if (Data == null) { throw new NullReferenceException("Attempting to serialize Layer with null data"); } writer.Write(Name); writer.Write(Visible); writer.Write(TimelineColor.A); writer.Write(TimelineColor.R); writer.Write(TimelineColor.G); writer.Write(TimelineColor.B); writer.Write(FileFormat.GetEntityID(Data.GetType())); Data.Write(writer); FileFormat.WriteList(writer, Framesets); }