IrcDotNet.IrcClient.Quit C# (CSharp) Method

Quit() public method

Quits the server, giving the specified comment. Waits the specified duration of time before forcibly disconnecting.
The current instance has already been disposed.
public Quit ( int timeout, string comment = null ) : void
timeout int The number of milliseconds to wait before forcibly disconnecting.
comment string
return void
        public virtual void Quit(int timeout, string comment = null)
        {
            SendMessageQuit(comment);
        }

Same methods

IrcClient::Quit ( string comment = null ) : void

Usage Example

コード例 #1
0
        public ActionResult Irc()
        {
            var api = new AppHarborApi(new AuthInfo { AccessToken = ConfigurationManager.AppSettings["authToken"] });

            var latestBuild = api.GetBuilds(Constants.AppHarborAppName).First();
            var testResults = api.GetTests(Constants.AppHarborAppName, latestBuild.ID);
            List<AppHarbor.Model.Test> allTests = new List<AppHarbor.Model.Test>();

            foreach (var testresult in testResults)
            {
                FillTests(allTests, testresult);
            }

            AutoResetEvent are = new AutoResetEvent(false);
            IrcDotNet.IrcClient client = new IrcDotNet.IrcClient();

            try
            {
                client.Connect("irc.gamesurge.net", false, new IrcUserRegistrationInfo() { NickName = "crymono-build", RealName = "crymono", UserName = "******" });

                client.ClientInfoReceived += (s, e) => are.Set();

                are.WaitOne();

                client.Channels.Join(new string[] { "#crymono" });

                Thread.Sleep(200);
                string msg = latestBuild.Commit.Message.Replace("\n", "").Replace("\r", "");

                client.LocalUser.SendMessage("#crymono", "Build finished, latest commit: " + msg);
                Thread.Sleep(200);

                int numPassedTests = allTests.Count(t => t.Status == "Passed");
                float percentage = (float)numPassedTests / allTests.Count * 100;
                client.LocalUser.SendMessage("#crymono", String.Format("Test results: {0} of {1} passed ({2:0}%) - http://crymono.apphb.com/#!/{3} - AppHB: https://appharbor.com/applications/crymonobuild/builds/{3}/tests",
                    numPassedTests,
                    allTests.Count,
                    percentage,
                    latestBuild.ID
                    ));
                Thread.Sleep(200);

            }
            finally
            {
                if (client != null && client.IsConnected)
                {
                    client.Quit("to the hills!");
                    Thread.Sleep(200);
                    client.Disconnect();
                }
            }

            return Content("OK");
        }
All Usage Examples Of IrcDotNet.IrcClient::Quit
IrcClient