GetTitle() public method

public GetTitle ( ) : string
return string
Exemplo n.º 1
0
        public void HandleWebTitle(IRCMessage sIRCMessage, string msg)
        {
            try
            {
                var sSendMessage = sIrcBase.Networks[sIRCMessage.ServerName].sSendMessage;
                var youtube = new YoutubeTitle(msg);

                if(youtube.IsYoutube())
                {
                    if(youtube.IsTitle())
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, "\u0002\u00031,0You\u00030,4Tube\u0003\u0002: {0} \u0002\u000304{1}:\u000f\u000f {2}", youtube.GetTitle(), sLConsole.Other("YoutubeViewCount", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)), youtube.GetViewCount());
                        return;
                    }
                }

                var url = new Uri(msg);
                string webTitle = string.Empty;
                var thread = new Thread(() => webTitle = WebHelper.GetWebTitle(url));
                thread.Start();
                thread.Join(5000);
                thread.Abort();

                if(string.IsNullOrEmpty(webTitle))
                    return;

                var title = Regex.Replace(webTitle, @"\s+", SchumixBase.Space.ToString());
                sSendMessage.SendChatMessage(sIRCMessage, "\u0002\u00031,0Title\u0003\u0002: {0}", title);
            }
            catch(Exception e)
            {
                Log.Debug("Functions", sLConsole.GetString("Failure details: {0}"), e.Message);
                return;
            }
        }
Exemplo n.º 2
0
        public void HandleWebTitle(IRCMessage sIRCMessage, string msg)
        {
            try
            {
                var sSendMessage = sIrcBase.Networks[sIRCMessage.ServerName].sSendMessage;
                var youtube      = new YoutubeTitle(msg);

                if (youtube.IsYoutube())
                {
                    if (youtube.IsTitle())
                    {
                        sSendMessage.SendChatMessage(sIRCMessage, "1,0You0,4Tube: {0}", youtube.GetTitle());
                        return;
                    }
                }

                var    url      = new Uri(msg);
                string webTitle = string.Empty;
                var    thread   = new Thread(() => webTitle = WebHelper.GetWebTitle(url));
                thread.Start();
                thread.Join(5000);
                thread.Abort();

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

                var title = Regex.Replace(webTitle, @"\s+", SchumixBase.Space.ToString());
                sSendMessage.SendChatMessage(sIRCMessage, "1,0Title: {0}", title);
            }
            catch (Exception e)
            {
                Log.Debug("Functions", sLConsole.GetString("Failure details: {0}"), e.Message);
                return;
            }
        }