Ejemplo n.º 1
0
        void ProcessCommand(TileBaseCmd command)
        {
            switch (command)
            {
            case TileCMD_GetServername cmd:
                cmd.Servername = Settings.Servername;
                client.SendMessage(cmd.SID, serializer.Serialize(cmd));
                break;

            case TileCMD_GetMapInfo cmd:
                cmd.MapInfo = Settings.MapInfo;
                client.SendMessage(cmd.SID, serializer.Serialize(cmd));
                break;

            case TileCMD_UpdatePlayerInfo cmd:
                lock (tileClients)
                {
                    PlayerInfo pi = tileClients.FirstOrDefault(p => p.ID == cmd.SID);
                    if (pi == null)
                    {
                        tileClients.Add(pi = new PlayerInfo()
                        {
                            ID = cmd.SID
                        });
                    }
                    pi.Populate(cmd.Playerinfo);
                }
                break;
            }
        }
Ejemplo n.º 2
0
        private void download_Contentdl_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            if (ConverterOptions.autostart)
            {
                var firstOrDefault = _downloads.FirstOrDefault(d => d.DLStatus == DownloadStatus.Waiting);
                if (firstOrDefault != null)
                {
                    firstOrDefault.StartDownload();
                }
            }
            DownloadInstance dli = (DownloadInstance)e.UserState;

            dli.ProgressChanged       -= download_Contentdl_ProgressChanged;
            dli.DownloadFileCompleted -= download_Contentdl_DownloadFileCompleted;
            dli.CancelDownload();
            _xcpList.Add(dli.GetXcpInstance);
            dli.Dispose();
        }