Пример #1
0
        static void Main(string[] args)
        {
            Globals.Initialize();
            YoutubeHelper.Initialize();
            CommandManager.Initialize();
            syncHandler = new SyncHandler();
            PacketManager.Initialize(syncHandler);

            using (server = new WebSocketServer(Globals.MyLocation))
            {
                try
                {
                    server.Start(ServerConfig);
                }
                catch (SocketException ex)
                {
                    if (ex.ErrorCode == 10048)
                    {
                        Console.WriteLine("Something is already running on this port. Can't start server.");
                        Environment.Exit(1);
                    }
                }

                while (true)
                {
                    Thread.Sleep(100);
                }
            }
        }
Пример #2
0
 public static void Initialize(SyncHandler handler)
 {
     syncHandler = handler;
     AddListener(new ConnectPacket());
     AddListener(new ChatPacket());
     AddListener(new SetVideoStatePacket());
     AddListener(new AddVideoPacket());
     AddListener(new GetPublicRoomsPacket());
     AddListener(new SetNameColorPacket());
 }