Esempio n. 1
0
        /// <summary>
        /// Serializes the object into protobuf byte data
        /// </summary>
        public static byte[] SerializeUpdate(IServerUpdate update)
        {
            MemoryStream ms = new MemoryStream();

            update.Serialize(ms);

            return(ms.GetBuffer());
        }
Esempio n. 2
0
 /// <summary>
 /// Serializes and sends a status update to the client
 /// </summary>
 /// <param name="update"></param>
 public void SendStatusUpdate(IServerUpdate update)
 {
     try
     {
         byte[] updateData = Util.SerializeUpdate(update);
         _socket.BeginSend(updateData, 0, updateData.Length, SocketFlags.None, null, null);
     }
     catch (SocketException ex)
     {
         Console.WriteLine("Error " + ex.Message);
     }
 }
Esempio n. 3
0
 public static void UnregisterObject(IServerUpdate obj)
 {
     _instance.serverTicked.Remove(obj);
 }
Esempio n. 4
0
 public static void RegisterObject(IServerUpdate obj)
 {
     _instance.serverTicked.Add(obj);
 }