Ejemplo n.º 1
0
        public static void ExecutePacketAndBroadcast(HaProtoImpl.Opcode op, HaProtoImpl.HaProtoPacket packet)
        {
            bool announceIndexChange = packet.ApplyToDatabase(Program.Core.DataSource);

            if (announceIndexChange)
            {
                Program.Core.AnnounceIndexChange();
            }
            Program.Server.BroadcastMessage(op, packet);
        }
Ejemplo n.º 2
0
        private void ExecutePacketAndBroadcast(HaProtoImpl.Opcode op, HaProtoImpl.HaProtoPacket packet)
        {
            bool announceIndexChange;

            lock (dataSource.Lock)
            {
                announceIndexChange = packet.ApplyToDatabase(dataSource);
            }
            if (announceIndexChange)
            {
                AnnounceIndexChange();
            }
            BroadcastMessage(op, packet);
        }
Ejemplo n.º 3
0
 public void BroadcastMessage(HaProtoImpl.Opcode type, HaProtoImpl.HaProtoPacket packet, Client exempt = null)
 {
     byte[] data = packet.Build();
     lock (clients)
     {
         for (int i = 0; i < clients.Count; i++)
         {
             Client c = clients[i];
             if (c == exempt)
             {
                 continue;
             }
             HaProtoImpl.Send(c.Socket, type, data);
         }
     }
 }
Ejemplo n.º 4
0
 public void Send(HaProtoImpl.Opcode type, HaProtoImpl.HaProtoPacket packet)
 {
     Send(type, packet.Build());
 }
Ejemplo n.º 5
0
 public static void Send(Socket s, Opcode type, HaProtoImpl.HaProtoPacket x)
 {
     Send(s, type, x.Build());
 }
Ejemplo n.º 6
0
 public static async Task SendAsync(NetworkStream stream, Opcode type, HaProtoImpl.HaProtoPacket x)
 {
     await SendAsync(stream, type, x.Build());
 }