public void Serialize(BinaryWriter writer) { writer.Write(IsValid ? 1 : 0); if (IsValid) { writer.WriteLengthPrefixedString(Reference.LevelName); writer.WriteLengthPrefixedString(Reference.PathName); writer.Write(HasPrev ? 1 : 0); if (HasPrev) { Prev.Serialize(writer); } writer.Write(HasStep ? 1 : 0); if (HasStep) { writer.WriteLengthPrefixedString(Step); } } }