示例#1
0
        /// <summary>
        /// Run when the map sharer has finished downloading a map.
        /// </summary>
        /// <param name="sha1">The SHA1 of the map.</param>
        /// <param name="filePath">The map's file name.</param>
        private void MapSharer_OnMapDownloadComplete(string sha1, string filePath)
        {
            if (lbChatBox.InvokeRequired)
            {
                DualStringCallback d = new DualStringCallback(MapSharer_OnMapDownloadComplete);
                this.BeginInvoke(d, sha1, filePath);
                return;
            }

            bool success = SharedLogic.AddMapToMaplist("Maps\\Custom\\" + filePath);

            if (success)
            {
                Logger.Log("Map " + sha1 + " succesfully added to the internal map list.");
                AddNotice("Map succesfully transferred.");

                if (currentSHA1 == sha1)
                {
                    currentMap = CnCNetData.MapList[CnCNetData.MapList.Count - 1];
                    lblMapName.Text = "Map: " + currentMap.Name;
                    lblMapAuthor.Text = "By " + currentMap.Author;
                    LoadPreview();
                    btnLaunchGame.Enabled = true;
                }
            }
            else
            {
                Logger.Log("Adding map " + sha1 + " to the internal map list failed.");
                AddNotice("Transfer of the custom map failed. The host needs to change the map or you will be unable to participate in this match.");

                string msgToSend = "NOTICE " + ChannelName + " " + CTCPChar1 + CTCPChar2 + "MAPFAIL " + sha1 + CTCPChar2;
                CnCNetData.ConnectionBridge.SendMessage(msgToSend);
                return;
            }
        }
示例#2
0
        private void Instance_OnUserLeaveChannel(string channelName, string userName)
        {
            if (this.InvokeRequired)
            {
                // Necessary for thread-safety
                DualStringCallback d = new DualStringCallback(Instance_DoUserLeaveChannel);
                this.BeginInvoke(d, channelName, userName);
                return;
            }

            Instance_DoUserLeaveChannel(channelName, userName);
        }