Esempio n. 1
0
        private void SendMessageToHashd(UbiMessage message)
        {
            if (hashd == null)
                return;

            if (settings.hashdEnabled &&
                hashd.isLoggedIn &&
                (message.FromEndPoint == EndPoint.Console || message.FromEndPoint == EndPoint.SteamAdmin))
            {
                hashd.SendMessage(message.Text);
            }

        }
Esempio n. 2
0
        private void SendMessageToHitBox(UbiMessage message)
        {
            if (hitbox == null || !hitbox.IsLoggedIn)
                return;

            if (settings.hitboxEnable &&
                (message.FromEndPoint == EndPoint.Console || message.FromEndPoint == EndPoint.SteamAdmin))
            {
                hitbox.SendMessage(message.Text);
            }

        }
Esempio n. 3
0
        private void SendMessageToJetSet(UbiMessage message)
        {
            if (jetset == null || !jetset.IsLoggedIn)
                return;

            if (settings.jetsetEnable &&
                (message.FromEndPoint == EndPoint.Console || message.FromEndPoint == EndPoint.SteamAdmin))
            {
                jetset.SendMessage(message.Text);
            }

        }
Esempio n. 4
0
        private bool SwitchToChat(string alias, bool notice=true)
        {
            if (!String.IsNullOrEmpty(alias))
            {
                var chatAlias = chatAliases.Where(ca => ca.Alias.Trim().ToLower() == alias.Trim().ToLower()).FirstOrDefault();
                if (chatAlias == null)
                {
                    var knownAliases = "";
                    chatAliases.ForEach(ca => knownAliases += ca.Alias += " ");
                    knownAliases = knownAliases.Trim();
                    if( notice )
                        SendMessage(new UbiMessage(
                            String.Format("\"{0}\" is unknown chat alias. Use one of: {1}", alias, knownAliases),
                            EndPoint.Bot, EndPoint.SteamAdmin)
                    );
                    return false;
                }
                else
                {
                    currentChat = chatAlias.Endpoint;
                    try
                    {
                        pictureCurrentChat.Image = log.GetChatBitmap(chatAlias.Icon);
                    }
                    catch (Exception ex)
                    {
                        Debug.Print(ex.Message + " " + ex.StackTrace);
                    }

                    if (notice)
                    {
                        var msg = new UbiMessage(String.Format("Switching to {0}...", currentChat.ToString()), EndPoint.Bot, EndPoint.Notice);
                        if (settings.steamCurrentChatNotify && settings.steamEnabled)
                        {
                            if (!isFlood(msg))
                                SendMessage(msg);
                        }
                    }

                    lastMessageSent.FromEndPoint = chatAlias.Endpoint;

                    return true;
                }
            }
            return false;
        }
Esempio n. 5
0
        private void SendMessageToCybergame(UbiMessage message)
        {
            if (cybergame == null || !cybergame.isLoggedIn )
                return;

            if (settings.cyberEnabled &&                
                (message.FromEndPoint == EndPoint.Console || message.FromEndPoint == EndPoint.SteamAdmin))
            {
                cybergame.SendMessage(message.Text);
            }

        }
Esempio n. 6
0
            public bool isCommand(string command)
            {
                if (Regex.IsMatch(command, _re,RegexOptions.IgnoreCase))
                {
                    Match reCommand = Regex.Match(command, _re, RegexOptions.IgnoreCase);
                    switch (_type)
                    {
                        case CommandType.BoolCmd:
                            break;
                        case CommandType.PartnerCmd:
                            if (reCommand.Groups.Count > 0)
                                partnerHandle = reCommand.Groups[1].Value;
                            break;
                        case CommandType.ReplyCmd:
                            if (reCommand.Groups.Count >= 3)
                            {
                                _switchto = reCommand.Groups[1].Value;
                                _message = new UbiMessage(reCommand.Groups[2].Value, EndPoint.SteamAdmin);
                            }
                            break;
                        case CommandType.EmptyParam:
                            break;
                    }

                    return true;
                }
                else
                {
                    return false;
                }
            }
Esempio n. 7
0
 private Result TwitchBitrate()
 {
     var bitrate = (int)double.Parse(twitchChannel.Bitrate, NumberStyles.Float, CultureInfo.InvariantCulture);
     var m = new UbiMessage(String.Format("Twitch bitrate: {0}Kbit", bitrate), EndPoint.TwitchTV, EndPoint.SteamAdmin);
     SendMessage(m);
     return Result.Successful;
 }
Esempio n. 8
0
        private void SendMessageToSc2Tv(UbiMessage message)
        {
            if (sc2tv == null)
                return;

            if (sc2tv.LoggedIn && settings.sc2tvEnabled)
            {
                if (!sc2tv.SendMessage(message.Text))
                    SendMessage(new UbiMessage("Sc2tv: I didn't send a message. Try again!", EndPoint.Sc2Tv, EndPoint.Error));
            }
        }
Esempio n. 9
0
 private void SendMessageToSkype(UbiMessage message)
 {
 }
Esempio n. 10
0
 private void SendToAll(UbiMessage message)
 {
     try
     {
         SendMessageToEmpireTV(message);
         SendMessageToGohaIRC(message);
         SendMessageToTwitchIRC(message);
         SendMessageToSc2Tv(message);
         SendMessageToGoodgame(message);
         SendMessageToCybergame(message);
         SendMessageToHashd(message);
         SendMessageToJetSet(message);
         SendMessageToHitBox(message);
     }
     catch(Exception e )
     {
         Debug.Print("Error sending a message to all {0} {1}", e.Message, e.StackTrace);
     }
 }
Esempio n. 11
0
        private void SendMessageToGoodgame(UbiMessage message)
        {
            if (ggChat == null)
                return;

            if ( ggChat.isLoggedIn && settings.goodgameEnabled)
            {
                ggChat.SendMessage(message.Text);
            }
        }
Esempio n. 12
0
        private void SendMessage(UbiMessage message)
        {
            
            lock (lockSendMessage)
            {
                if (message == null)
                    return;

                message.Text = HttpUtility.HtmlDecode( message.Text.Trim() );
                message.Text = Regex.Replace(message.Text, @"<.*?>(.*)<\/.*?>", "$1", RegexOptions.IgnoreCase | RegexOptions.Multiline);
                message.Text = Regex.Replace(message.Text, @"\[.*?\](.*)\[\/.*?\]", "$1", RegexOptions.IgnoreCase | RegexOptions.Multiline);
                message.Text = message.Text.Replace(@"\", @"\\");    
                if (message.FromEndPoint != EndPoint.Console &&
                    message.FromEndPoint != EndPoint.SteamAdmin &&
                    message.FromEndPoint != EndPoint.Bot)
                    lastMessageSent = message;

                if (message.Text.Length <= 0)
                    return;

                if (settings.generalSuppressErrors && message.ToEndPoint == EndPoint.Error)
                    return;

                if (settings.generalSuppressNotices && message.ToEndPoint == EndPoint.Notice)
                    return;

                // Execute command or write it to console
                if (message.FromEndPoint == EndPoint.Console ||
                    message.FromEndPoint == EndPoint.SteamAdmin)
                {
                    if (ParseAdminCommand(message.Text) == Result.Successful)
                    {
                        log.WriteLine(new UbiMessage( message.Text ), ChatIcon.Admin);
                        return;
                    }
                    if (!isFlood(message))
                        log.WriteLine(new UbiMessage( message.Text ), ChatIcon.Admin);

                    if (message.ToEndPoint == EndPoint.Console)
                        return;

                    message.ToEndPoint = currentChat;
                }


                /*var text = message.Text;

                if (text.Contains("gif-maniac.net"))
                    SendMessageToTwitchIRC(new UbiMessage("/ban " + message.FromName, EndPoint.Console));

                if (!String.IsNullOrEmpty(message.FromGroupName))
                    text = settings.appearanceGrpMessageFormat;
                else if (!String.IsNullOrEmpty(message.FromName))
                    text = settings.appearanceMsgFormat;

                */
                
                /*
                message.Text = text;
                */
                // Send message to specified chat(s)
                if (isClosing)
                    return;

                switch (message.ToEndPoint)
                {
                    case EndPoint.All:
                        {
                            ThreadPool.QueueUserWorkItem(arg => SendToAll(message));
                        }
                        break;
                    case EndPoint.Goodgame:
                        ThreadPool.QueueUserWorkItem(f => SendMessageToGoodgame(message));
                        break;
                    case EndPoint.Sc2Tv:
                        ThreadPool.QueueUserWorkItem(f => SendMessageToSc2Tv(message));
                        break;
                    case EndPoint.Skype:
                        ThreadPool.QueueUserWorkItem(f => SendMessageToSkype(message));
                        break;
                    case EndPoint.SkypeGroup:
                        ThreadPool.QueueUserWorkItem(f => SendMessageToSkype(message));
                        break;
                    case EndPoint.SteamAdmin:
                        ThreadPool.QueueUserWorkItem(f => SendMessageToSteamAdmin(message));
                        break;
                    case EndPoint.TwitchTV:
                        ThreadPool.QueueUserWorkItem(f => SendMessageToTwitchIRC(message));
                        break;
                    case EndPoint.Gohatv:
                        ThreadPool.QueueUserWorkItem(f => SendMessageToGohaIRC(message));
                        break;
                    case EndPoint.Empiretv:
                        ThreadPool.QueueUserWorkItem(f => SendMessageToEmpireTV(message));
                        break;
                    case EndPoint.Cybergame:
                        ThreadPool.QueueUserWorkItem(f => SendMessageToCybergame(message));
                        break;
                    case EndPoint.Hashd:
                        ThreadPool.QueueUserWorkItem(f => SendMessageToHashd(message));
                        break;
                    case EndPoint.JetSet:
                        ThreadPool.QueueUserWorkItem(f => SendMessageToJetSet(message));
                        break;
                    case EndPoint.HitBox:
                        ThreadPool.QueueUserWorkItem(f => SendMessageToHitBox(message));
                        break;
                    case EndPoint.Console:
                        log.WriteLine(new UbiMessage(message.Text));
                        break;
                    case EndPoint.Notice:
                        ThreadPool.QueueUserWorkItem(f => SendMessageToSteamAdmin(message));
                        break;
                    case EndPoint.Error:
                        ThreadPool.QueueUserWorkItem(f => SendMessageToSteamAdmin(message));
                        break;
                    default:
                        log.WriteLine(new UbiMessage( "Can't send a message. Chat is readonly!"));
                        break;
                }
                if (!isFlood(message))
                {
                    if (obsRemote != null && settings.obsRemoteEnable && settings.obsChatSwitch && !String.IsNullOrEmpty(settings.obsChatSourceName))
                    {
                        obsRemote.SetSourceRendererPart(settings.obsChatSourceName, true);
                        Int32 timeout = 0;
                        Int32.TryParse(settings.obsChatTimeout, out timeout);
                        if (timeout > 0)
                        {
                            obsChatSourceSwitch.Change( timeout * 1000, Timeout.Infinite );
                        }
                    }

                    bool highlight = false;
                    highlight = (!String.IsNullOrEmpty(message.ToName) && chatAliases.FirstOrDefault(c => c.MyNick == message.ToName && c.Endpoint == message.FromEndPoint) != null);

                    if (!highlight &&                        
                        chatAliases.FirstOrDefault(c => !String.IsNullOrEmpty(c.MyNick) && message.Text.Length > c.MyNick.Length && c.MyNick.ToLower() + "," == message.Text.ToLower().Substring(0, c.MyNick.Length) + ","
                        && c.Endpoint == message.FromEndPoint) != null)
                        highlight = true;

                    Color? foreColor = null;
                    Color? backColor = null;

                    
                    if (message.FromEndPoint == EndPoint.TwitchTV && message.Text.StartsWith("\x0001ACTION") )
                    {
                        message.Text = message.Text.Replace("\x0001","").Replace("ACTION ", "");
                        foreColor = settings.twitchMeForeColor;
                        backColor = settings.twitchMeBackcolor;
                    }


                    if (settings.webEnable && webChat != null)
                    {

                        webChat.AddMessage(
                            message.ImagePath,
                            message.Text,
                            message.FromName,
                            message.ToName,
                            DateTime.Now.GetDateTimeFormats('T')[0],
                            String.IsNullOrEmpty(message.ToName) ? "" : "->",
                            message.FromEndPoint.ToString(),
                            highlight
                            );
                    }
                    //Debug.Print(String.Format("{0} (highlight={1})", message.Text, highlight));
                    log.WriteLine( message, message.Icon, highlight, foreColor, backColor);
                    if (message.Icon == ChatIcon.Sc2Tv)
                    {
                        if (message.Text.Contains(":s:"))
                        {
                            String m = message.Text;
                            for (int i = 0; i < m.Length; i++)
                            {
                                int smilePos = -1;
                                if (m.Substring(i).IndexOf(":s:") == 0)
                                {
                                    foreach (Smile smile in sc2tv.smiles)
                                    {
                                        smilePos = m.Substring(i).IndexOf(":s" + smile.Code);
                                        if (smilePos == 0)
                                        {
                                            log.ReplaceSmileCode(":s" + smile.Code, smile.bmp);
                                            break;
                                        }
                                    }
                                }
                            }

                            textMessages.ScrollToEnd();
                        }
                    }
                    else if (message.Icon == ChatIcon.TwitchTv)
                    {
                        var regex = new Regex(@"[\s\t\r\n\p{P}]");
                        var msgText = message.Text;
                        var words = regex.Split(msgText).Where(x => !string.IsNullOrEmpty(x));
                        foreach (var smile in TwitchSmiles.Smiles)
                        {
                            log.ReplaceSmileCode(smile.Code, smile.Smile);
                        }

                    }
                }
            }
        }
Esempio n. 13
0
        private bool isFlood( UbiMessage message)
        {
            try
            {
                if (lastMessagePerEndpoint.FirstOrDefault(m => (m.Text == message.Text && m.ToEndPoint == m.ToEndPoint)) != null)
                    return true;
                else
                    lastMessagePerEndpoint.RemoveAll(m => m.ToEndPoint == message.ToEndPoint);

                lastMessagePerEndpoint.Add(message);
            }
            catch {
                Debug.Print("Exception in isFlood()");
            }
            return false;

        }
Esempio n. 14
0
        private Result ReplyCommand( string switchto, UbiMessage message)
        {
            if (!SwitchToChat(switchto))
                return Result.Failed;


            if (currentChat != lastMessageSent.FromEndPoint)
            {
                var chatAlias = chatAliases.Where(ca => ca.Endpoint == lastMessageSent.FromEndPoint).FirstOrDefault();
                if (chatAlias == null)
                {
                    SendMessage(new UbiMessage(
                        String.Format("I can't replay to a message from ({0})!", lastMessageSent.FromEndPoint.ToString()),
                        EndPoint.Bot, EndPoint.Error)
                    );
                }
                else
                {
                    currentChat = lastMessageSent.FromEndPoint;
                }
            }

            message.FromEndPoint = EndPoint.SteamAdmin;
            message.ToEndPoint = currentChat;
            if( message.Text.Length > 0 )
                SendMessage(message);

            return Result.Successful;
        }
Esempio n. 15
0
 private void SendMessageToEmpireTV(UbiMessage message)
 {
     if (empireTV == null)
         return;
     if (settings.empireEnabled && empireTV.LoggedIn &&
         (message.FromEndPoint == EndPoint.Console || message.FromEndPoint == EndPoint.SteamAdmin))
     {
         empireTV.SendMessage(message.Text);
     }
 }
Esempio n. 16
0
        private void SendMessageToSteamAdmin(UbiMessage message)
        {
            if (steamAdmin == null || steamBot == null)
                return;

            if (steamBot.loginStatus == SteamAPISession.LoginStatus.LoginSuccessful)
            {
                if (settings.skypeSkipGroupMessages && message.FromEndPoint == EndPoint.SkypeGroup)
                    return;
                if (steamAdmin.status != SteamAPISession.UserStatus.Online)
                    return;

                var text = settings.appearanceMsgFormat;

                text = text.Replace(@"%t", message.Text);
                text = text.Replace(@"%s", message.FromName == null ? String.Empty : message.FromName);
                text = text.Replace(@"%d", message.ToName == null ? String.Empty : "->" + message.ToName);
                text = text.Replace(@"%c", message.FromEndPoint.ToString());
                text = text.Replace(@"%sg", message.FromGroupName == null ? String.Empty : message.FromGroupName);

                steamBot.SendMessage(steamAdmin, text);
            }
        }
Esempio n. 17
0
 public AdminCommand(string re, Func<string, UbiMessage, Result> action)
 {
     _re = re;
     _action4 = action;                
     _type = CommandType.ReplyCmd;
     _message = new UbiMessage("", EndPoint.SteamAdmin);
     _switchto = "";
 }
Esempio n. 18
0
        private void SendMessageToTwitchIRC(UbiMessage message)
        {
            if (!settings.twitchEnabled || twitchIrc == null)
                return;
            
            if( twitchIrc.IsRegistered &&
                (message.FromEndPoint == EndPoint.Console || message.FromEndPoint == EndPoint.SteamAdmin))
            {
                var channelName = "#" + settings.TwitchUser.ToLower();
                var twitchChannel = twitchIrc.Channels.SingleOrDefault(c => c.Name == channelName);
                twitchIrc.LocalUser.SendMessage(twitchChannel, message.Text);
            }

        }
Esempio n. 19
0
 private Result TwitchViewers()
 {
     var m = new UbiMessage(String.Format("Twitch viewers: {0}", twitchChannel.Viewers), EndPoint.TwitchTV, EndPoint.SteamAdmin);
     SendMessage(m);
     return Result.Successful;
 }
Esempio n. 20
0
        private void SendMessageToGohaIRC(UbiMessage message)
        {
            if (gohaIrc == null || !gohaIrc.IsRegistered)
                return;

            if (settings.gohaEnabled &&
                (message.FromEndPoint == EndPoint.Console || message.FromEndPoint == EndPoint.SteamAdmin))
            {
                var channelName = "#" + settings.GohaIRCChannel;
                var gohaChannel = gohaIrc.Channels.SingleOrDefault(c => c.Name == channelName);
                gohaIrc.LocalUser.SendMessage(gohaChannel, message.Text);
            }

        }
Esempio n. 21
0
        public MainForm()
        {


            //UnprotectConfig();

            settings = Properties.Settings.Default;
            try
            {
                if (String.IsNullOrEmpty(settings.currentProfile))
                {
                    settings.currentProfile = "Default";
                }

                if (settings.chatProfiles == null)
                {
                    settings.chatProfiles = new ChatProfiles();
                    settings.chatProfiles.WriteProfile(settings.currentProfile, settings);
                }
                else if (!settings.chatProfiles.Profiles.Any(p => p.Name.Equals(settings.currentProfile)))
                {
                    settings.chatProfiles.WriteProfile(settings.currentProfile, settings);
                }

            }
            catch { }

            
            InitializeComponent();


            endpointList = new ChannelList();
            endpointListBS = new BindingSource();

            if( settings.globalDebug )
                debugForm = new DebugForm();

            //RefreshChatProperties();
            log = new Log(textMessages);


            chatUsers = new List<ChatUser>();
            
            Enum.TryParse<EndPoint>(settings.globalDefaultChat, out currentChat);

            lastMessageSent = new UbiMessage("", EndPoint.Console);
            adminCommands = new List<AdminCommand>();
            chatAliases = new List<ChatAlias>();
            lastMessagePerEndpoint = new List<UbiMessage>();
            adminCommands.Add(new AdminCommand(@"^/r\s*([^\s]*)\s*(.*)", ReplyCommand));
            adminCommands.Add(new AdminCommand(@"^/stream$", StartStopStreamsCommand));
            adminCommands.Add(new AdminCommand(@"^/gohaconfirm\s*(.*)", GohaConfirmCommand));
            adminCommands.Add(new AdminCommand(@"^/gohasetpass", GohaUpdatePassword));
            adminCommands.Add(new AdminCommand(@"^/width\s*(.*)", SetFormWidth));
            adminCommands.Add(new AdminCommand(@"^/height\s*(.*)", SetFormHeight));
            adminCommands.Add(new AdminCommand(@"^/scene\s*(.*)", SetOBSScene));

            chatAliases.Add(new ChatAlias(settings.twitchChatAlias, EndPoint.TwitchTV, ChatIcon.TwitchTv, settings.TwitchUser.ToLower()));
            chatAliases.Add(new ChatAlias(settings.sc2tvChatAlias, EndPoint.Sc2Tv, ChatIcon.Sc2Tv, settings.Sc2tvUser));
            chatAliases.Add(new ChatAlias(settings.steamChatAlias, EndPoint.Steam, ChatIcon.Steam));
            chatAliases.Add(new ChatAlias(settings.skypeChatAlias, EndPoint.Skype, ChatIcon.Skype));
//            chatAliases.Add(new ChatAlias(settings.battlelogChatAlias, EndPoint.Battlelog, ChatIcon.Battlelog));
            chatAliases.Add(new ChatAlias(settings.gohaChatAlias, EndPoint.Gohatv, ChatIcon.Goha, settings.GohaUser));
            chatAliases.Add(new ChatAlias(settings.empireAlias, EndPoint.Empiretv, ChatIcon.Empire, settings.empireUser.ToLower()));
            chatAliases.Add(new ChatAlias(settings.goodgameChatAlias, EndPoint.Goodgame, ChatIcon.Goodgame, settings.goodgameUser.ToLower()));
            chatAliases.Add(new ChatAlias(settings.cyberAlias, EndPoint.Cybergame, ChatIcon.Cybergame, settings.cyberUser.ToLower()));
            chatAliases.Add(new ChatAlias(settings.hashdAlias, EndPoint.Hashd, ChatIcon.Hashd, settings.hashdUser.ToLower()));
            chatAliases.Add(new ChatAlias(settings.youtubeAlias, EndPoint.Youtube, ChatIcon.Youtube));
            chatAliases.Add(new ChatAlias(settings.gmtvAlias, EndPoint.GamersTV, ChatIcon.GamersTv));
            chatAliases.Add(new ChatAlias(settings.jetsetAlias, EndPoint.JetSet, ChatIcon.JetSet));
            chatAliases.Add(new ChatAlias(settings.hitboxAlias, EndPoint.HitBox, ChatIcon.HitBox));
            chatAliases.Add(new ChatAlias("@all", EndPoint.All, ChatIcon.Default));

            var switchTo = chatAliases.FirstOrDefault( c => c.Endpoint == currentChat );
            if( switchTo != null )
                SwitchToChat(switchTo.Alias,false);

            uint.TryParse(settings.Sc2tvId, out sc2ChannelId);
            Debug.Print(String.Format("Sc2tv Channel ID: {0}",sc2ChannelId));

            sc2tv = new Sc2Chat(settings.sc2LastMsgId + 1);

            sc2tv.Logon += OnSc2TvLogin;
            sc2tv.ChannelList += OnSc2TvChannelList;
            sc2tv.MessageReceived += OnSc2TvMessageReceived;
            sc2tv.channelList = new Channels();

            gohaIrc = new IrcClient();
            gohaIrc.Connected += OnGohaConnect;
            gohaIrc.Registered += OnGohaRegister;
            gohaIrc.Disconnected += OnGohaDisconnect;


            checkMark = new StatusImage(Properties.Resources.checkMarkGreen, Properties.Resources.checkMarkRed);
            streamStatus = new StatusImage(Properties.Resources.streamOnline, Properties.Resources.streamOffline);


            statusServer = new StatusServer();
            //battlelog = new Battlelog();

            
            steamBW = new BGWorker(ConnectSteamBot, null);
            sc2BW = new BGWorker(ConnectSc2tv, null);
            
            twitchBW = new BGWorker(ConnectTwitchIRC, null);                
            gohaBW = new BGWorker(ConnectGohaIRC, null);
            twitchTV = new BGWorker(ConnectTwitchChannel, null);
            skypeBW = new BGWorker(ConnectSkype, null);
            cyberBW = new BGWorker(ConnectCybergame, null);
            hashdBW = new BGWorker(ConnectHashd, null);
            youtubeBW = new BGWorker(ConnectYoutube, null);
            gamerstvBW = new BGWorker(ConnectGamersTV, null );
            jetsetBW = new BGWorker(ConnectJetSet, null);
            hitboxBW = new BGWorker(ConnectHitBox, null);
 
            goodgameBW = new BGWorker(ConnectGoodgame, null);
//            battlelogBW = new BGWorker(ConnectBattlelog, null);

            if (settings.enableXSplitStats)
            {
                xsplit = new XSplit();
                xsplit.OnFrameDrops += OnXSplitFrameDrops;
                xsplit.OnStatusRefresh += OnXSplitStatusRefresh;
            }
            if (settings.enableStatusServer)
            {
                statusServer.Start();
            }

            gohaTVstream = new GohaTV();
            gohaStreamBW = new BGWorker(ConnectGohaStream, null);

            empireTV = new EmpireTV();
            empireBW = new BGWorker(ConnectEmpireTV, null);

            obsremoteBW = new BGWorker(ConnectOBSRemote, null);

            settings.PropertyChanged += new PropertyChangedEventHandler(settings_PropertyChanged);
            settings.SettingsSaving += new SettingsSavingEventHandler(settings_SettingsSaving);

            fontDialog = new FontDialog();

            forceCloseTimer = new System.Threading.Timer(new TimerCallback(ForceClose), null, Timeout.Infinite, Timeout.Infinite);

            obsChatSourceSwitch = new System.Threading.Timer(new TimerCallback(OBSChatSwitch), null, Timeout.Infinite, Timeout.Infinite);

            if (settings.webEnable)
            {
                int port;
                int.TryParse(settings.webPort, out port);
                try
                {
                    webChat = new WebChat(port);
                }
                catch (Exception e)
                {
                    SendMessage(new UbiMessage("Web server error: " + e.Message, EndPoint.Error));
                }
            }

            if (settings.lastFmEnable && !String.IsNullOrEmpty(settings.lastFmLogin) && !String.IsNullOrEmpty(settings.lastFmPassword))
            {
                try
                {
                    lastFm = new ULastFm();
                    lastFm.OnLogin += new EventHandler<EventArgs>(lastFm_OnLogin);
                    lastFm.OnTrackChange += new EventHandler<LastFmArgs>(lastFm_OnTrackChange);
                    ThreadPool.QueueUserWorkItem(t => lastFm.Authenticate(settings.lastFmLogin, settings.lastFmPassword));
                }
                catch (Exception ex)
                {
                    Debug.Print(ex.Message + " " + ex.StackTrace);
                }

            }

            //@Debug.Print("Config is here:" + ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath);
            #region Set tooltips
            ToolTip fullScreenDblClk = new ToolTip();

            fullScreenDblClk.AutoPopDelay = 2000;
            fullScreenDblClk.InitialDelay = 100;
            fullScreenDblClk.ReshowDelay = 100;
            fullScreenDblClk.ShowAlways = false;

            // Set up the ToolTip text for the Button and Checkbox.
            fullScreenDblClk.SetToolTip(textMessages, "DblClick - switch mode, Hold RMB - move window");

            viewersTooltip = new ToolTip();

            viewersTooltip.AutoPopDelay = 2000;
            viewersTooltip.InitialDelay = 0;
            viewersTooltip.ReshowDelay = 0;
            viewersTooltip.ShowAlways = false;

            viewersTooltip.SetToolTip(labelViewers, String.Format("Twitch.tv: {0}, Cybergame.tv: {0}, Hashd.tv: {0}", 0));

            var tooltip = new ToolTip();
            tooltip.AutoPopDelay = 2000;
            tooltip.InitialDelay = 0;
            tooltip.ReshowDelay = 0;
            tooltip.ShowAlways = false;
            tooltip.SetToolTip(buttonStreamStartStop, "Click to start/stop streaming in OBS");
            
            #endregion
            

        }
Esempio n. 22
0
 private void textCommand_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         var m = new UbiMessage(textCommand.Text, EndPoint.SteamAdmin, currentChat);
         SendMessage(m);
         textCommand.Text = "";
         e.Handled = true;
     }
 }