Ejemplo n.º 1
0
 internal static bool WriteCustomData(ModPlayer modPlayer, BinaryWriter writer)
 {
     byte[] data;
     using (MemoryStream stream = new MemoryStream())
     {
         using (BinaryWriter customWriter = new BinaryWriter(stream))
         {
             modPlayer.SaveCustomData(customWriter);
             customWriter.Flush();
             data = stream.ToArray();
         }
     }
     if (data.Length > 0)
     {
         writer.Write(modPlayer.mod.Name);
         writer.Write(modPlayer.Name);
         writer.Write((ushort)data.Length);
         writer.Write(data);
         return(true);
     }
     return(false);
 }
Ejemplo n.º 2
0
 internal static bool WriteCustomData(ModPlayer modPlayer, BinaryWriter writer)
 {
     byte[] data;
     using (MemoryStream stream = new MemoryStream())
     {
         using (BinaryWriter customWriter = new BinaryWriter(stream))
         {
             modPlayer.SaveCustomData(customWriter);
             customWriter.Flush();
             data = stream.ToArray();
         }
     }
     if (data.Length > 0)
     {
         writer.Write(modPlayer.mod.Name);
         writer.Write(modPlayer.Name);
         writer.Write((ushort)data.Length);
         writer.Write(data);
         return true;
     }
     return false;
 }