当前位置: 首页>>代码示例>>C#>>正文


C# IrcClient.Quit方法代码示例

本文整理汇总了C#中IrcDotNet.IrcClient.Quit方法的典型用法代码示例。如果您正苦于以下问题:C# IrcClient.Quit方法的具体用法?C# IrcClient.Quit怎么用?C# IrcClient.Quit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IrcDotNet.IrcClient的用法示例。


在下文中一共展示了IrcClient.Quit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Irc

        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 = "crymono" });

                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");
        }
开发者ID:PoppermostProductions,项目名称:CryMono-web,代码行数:55,代码来源:NotifyController.cs

示例2: TravisCi


//.........这里部分代码省略.........

                        if (line.Equals("-- START TEST RUN --"))
                        {
                            buildResult = true;
                        }  else if (line.StartsWith("Tests run: "))
                        {
                            summary = line + " - " + stringReader.ReadLine();
                        }
                        else if (line.Equals("<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>"))
                        {
                            string xmlContents = stringReader.ReadToEnd();

                            xmlContents = xmlContents.Substring(0, xmlContents.IndexOf("</test-results>")+15);

                            XDocument doc = XDocument.Parse(xmlContents);

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

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

                                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", "");
                                string msg = "hello";
                                string buildStatus = buildResult ? "OK" : "FAILED";

                                client.LocalUser.SendMessage("#crymonobuild", String.Format("Travis build completed. Build: {0} - http://travis-ci.org/inkdev/CryMono/builds/{1}", buildStatus,buildId));
                                Thread.Sleep(200);
                                var testResultsElement = doc.Element("test-results");
                                client.LocalUser.SendMessage("#crymonobuild", String.Format("Tests run: {0}, Errors: {1}, Failures: {2}, Inconclusive: {3}, Not run: {4}, Invalid: {5}, Ignored: {6}, Skipped: {7}, Time: {8}s",
                                    testResultsElement.Attribute("total").Value,
                                    testResultsElement.Attribute("errors").Value,
                                    testResultsElement.Attribute("failures").Value,
                                    testResultsElement.Attribute("inconclusive").Value,
                                    testResultsElement.Attribute("not-run").Value,
                                    testResultsElement.Attribute("invalid").Value,
                                    testResultsElement.Attribute("ignored").Value,
                                    testResultsElement.Attribute("skipped").Value,
                                    doc.Descendants("test-suite").First().Attribute("time").Value

                                    ));
                                Thread.Sleep(500);

                                var failingTests =
                                    doc.Descendants("test-case").Where(
                                        x =>
                                        x.Attribute("success").Value == "False" &&
                                        x.Descendants().Any(d => d.Name == "failure")).Take(3);

                                foreach (var item in failingTests)
                                {
                                    client.LocalUser.SendMessage("#crymonobuild", String.Format("{0}: {1}",
                                        item.Attribute("name").Value,
                                        item.Element("failure").Element("message").Value.Replace("\n","")));
                                    Thread.Sleep(500);
                                }

                                if (payload == null)
                                {
                                    client.LocalUser.SendMessage("#crymonobuild", "Something wrong: " + String.Join(",",Request.Form.AllKeys));
                                }
                                else
                                {

                                    client.LocalUser.SendMessage("#crymonobuild",
                                                                 "Debug for ins\\: " + payload);
                                }
                                Thread.Sleep(5000);

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

                            break;
                        }

                        line = stringReader.ReadLine();

                    }
                }

            }

            return Content("What?");
        }
开发者ID:PoppermostProductions,项目名称:CryMono-web,代码行数:101,代码来源:NotifyController.cs


注:本文中的IrcDotNet.IrcClient.Quit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。