コード例 #1
0
        private void BtnLoadMPGame_LeftClick(object sender, EventArgs e)
        {
            string gameName = tbGameName.Text.Replace(";", string.Empty);

            if (string.IsNullOrEmpty(gameName))
            {
                return;
            }

            if (!lbTunnelList.IsValidIndexSelected())
            {
                return;
            }

            IniFile spawnSGIni = new IniFile(ProgramConstants.GamePath +
                                             ProgramConstants.SAVED_GAME_SPAWN_INI);

            string password = Utilities.CalculateSHA1ForString(
                spawnSGIni.GetStringValue("Settings", "GameID", string.Empty)).Substring(0, 10);

            GameCreationEventArgs ea = new GameCreationEventArgs(gameName,
                                                                 spawnSGIni.GetIntValue("Settings", "PlayerCount", 2), password,
                                                                 tunnelHandler.Tunnels[lbTunnelList.SelectedIndex]);

            LoadedGameCreated?.Invoke(this, ea);
        }
コード例 #2
0
        private void BtnApply_LeftClick(object sender, EventArgs e)
        {
            Disable();
            if (!lbTunnelList.IsValidIndexSelected())
            {
                return;
            }

            CnCNetTunnel tunnel = tunnelHandler.Tunnels[lbTunnelList.SelectedIndex];

            TunnelSelected?.Invoke(this, new TunnelEventArgs(tunnel));
        }