Exemplo n.º 1
0
 public void AddOrUpdateLocalGps(LocalGpsSource src)
 {
     using (var stream = new ByteStream(1024))
         using (var writer = new BinaryWriter(stream))
         {
             writer.WriteAddOrUpdateLocalGps(_moduleId, src);
             MyAPIGateway.Utilities.SendModMessage(ModVersion, stream.Data);
         }
 }
 public static void WriteAddOrUpdateLocalGps(this BinaryWriter writer, long moduleId, LocalGpsSource src)
 {
     writer.Write(true);
     writer.Write(moduleId);
     writer.WriteProtobuf(src);
 }
 public static void ReadLocalGps(this BinaryReader reader, out bool isAddOrUpdate, out long moduleId, out LocalGpsSource source, out long gpsId)
 {
     if (reader.ReadBoolean())
     {
         isAddOrUpdate = true;
         moduleId      = reader.ReadInt64();
         source        = reader.ReadProtobuf <LocalGpsSource>();
         gpsId         = source.Id;
     }
     else
     {
         isAddOrUpdate = false;
         moduleId      = reader.ReadInt64();
         gpsId         = reader.ReadInt64();
         source        = null;
     }
 }