Exemple #1
0
        private void OnSc2TvChannelList(object sender, Sc2Chat.Sc2Event e)
        {
            if (channelsSC2 == null)
            {
                channelsSC2 = new BindingSource();
                channelsSC2.DataSource = sc2tv.channelList.channels;
            }
            comboSc2Channels.SetDataSource(null);
            comboSc2Channels.SetDataSource(channelsSC2, "Title", "Id");

        }
Exemple #2
0
        private void OnSc2TvMessageReceived(object sender, Sc2Chat.Sc2MessageEvent e)
        {
            if (e.message.name.ToLower() == settings.Sc2tvUser.ToLower())
                return;

            var message = sc2tv.sanitizeMessage(e.message.message,settings.sc2tvSanitizeSmiles);
            if (message.Trim().Length <= 0)
                return;
            
            var to = e.message.to;
            
            if( to == settings.Sc2tvUser && 
                settings.sc2tvPersonalizedOnly )
            {
                SendMessage(new Message(String.Format("{0} ({1}{2})", message, e.message.name, settings.sc2tvChatAlias), EndPoint.Sc2Tv, EndPoint.SteamAdmin));
            }
            else
            {
                SendMessage(new Message(String.Format("{0} ({1}{2})", message, e.message.name, to == null?"":"->" + to), EndPoint.Sc2Tv, EndPoint.SteamAdmin));
            }
        }
Exemple #3
0
 private void OnSc2TvLogin(object sender, Sc2Chat.Sc2Event e)
 {
     if (sc2tv.LoggedIn)
     {
         SendMessage(new Message(String.Format("Sc2tv: logged in!"), EndPoint.Sc2Tv, EndPoint.SteamAdmin));
         sc2tv.updateStreamList();
         checkMark.SetOn(pictureSc2tv);
     }
     else
     {
         SendMessage(new Message(String.Format("Sc2tv: login failed!"), EndPoint.Sc2Tv, EndPoint.SteamAdmin));
     }
 }
Exemple #4
0
        public MainForm()
        {
            //UnprotectConfig();
            settings = Properties.Settings.Default;

            InitializeComponent();
            currentChat = EndPoint.TwitchTV;
            lastMessageSent = new Message("", EndPoint.Console);
            adminCommands = new List<AdminCommand>();
            chatAliases = new List<ChatAlias>();
            lastMessagePerEndpoint = new List<Message>();
            adminCommands.Add(new AdminCommand(@"^/r\s*([^\s]*)\s*(.*)", ReplyCommand));

            chatAliases.Add(new ChatAlias(settings.twitchChatAlias, EndPoint.TwitchTV));
            chatAliases.Add(new ChatAlias(settings.sc2tvChatAlias, EndPoint.Sc2Tv));
            chatAliases.Add(new ChatAlias(settings.steamChatAlias, EndPoint.Steam));
            chatAliases.Add(new ChatAlias(settings.skypeChatAlias, EndPoint.Skype));
            chatAliases.Add(new ChatAlias(settings.battlelogChatAlias, EndPoint.Battlelog));
            chatAliases.Add(new ChatAlias(settings.gohaChatAlias, EndPoint.Gohatv));
            chatAliases.Add(new ChatAlias(settings.empireAlias, EndPoint.Empiretv));
            chatAliases.Add(new ChatAlias(settings.goodgameChatAlias, EndPoint.Goodgame));
            chatAliases.Add(new ChatAlias("@all", EndPoint.All));

            sc2tv = new Sc2Chat(settings.sc2LoadHistory);
            sc2tv.Logon += OnSc2TvLogin;
            sc2tv.ChannelList += OnSc2TvChannelList;
            sc2tv.MessageReceived += OnSc2TvMessageReceived;
            sc2tv.channelList = new Channels();
            sc2ChannelId = 0;

            twitchIrc = new IrcClient();
            twitchIrc.Connected += OnTwitchConnect;
            twitchIrc.Registered += OnTwitchRegister;
            twitchIrc.Disconnected += OnTwitchDisconnect;

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

            log = new Log(textMessages);

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

            steamBot = new SteamAPISession();
            steamBot.Logon += OnSteamLogin;
            steamBot.NewMessage += OnNewSteamMessage;
            steamBot.FriendStateChange += OnSteamFriendStatusChange;
            steamBot.Typing += OnSteamTyping;

            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);
 
            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);

           

        }
Exemple #5
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
            

        }
Exemple #6
0
        private void OnSc2TvMessageReceived(object sender, Sc2Chat.Sc2MessageEvent e)
        {
            if (e.message.name.ToLower() == settings.Sc2tvUser.ToLower())
               return;

            var message = sc2tv.sanitizeMessage(e.message.message,settings.sc2tvSanitizeSmiles);
            if (message.Trim().Length <= 0)
                return;
            
            var to = e.message.to;
            
            if( to == settings.Sc2tvUser && 
                settings.sc2tvPersonalizedOnly )
            {
                SendMessage(new UbiMessage(String.Format("{0}", message), EndPoint.Sc2Tv, EndPoint.SteamAdmin) 
                {
                    FromName = e.message.name,
                    NickColor = settings.sc2NickColor,
                    TextOnly = false

                });
            }
            else
            {
                SendMessage(new UbiMessage(String.Format("{0}", message), EndPoint.Sc2Tv, EndPoint.SteamAdmin) 
                { 
                    FromName = e.message.name, 
                    ToName = to,
                    NickColor = settings.sc2NickColor,
                    TextOnly = false

                });
            }
        }
Exemple #7
0
        private void OnSc2TvLogin(object sender, Sc2Chat.Sc2Event e)
        {
            Debug.Print("OnSc2TvLogin event");
            if (sc2tv.LoggedIn)
            {
                ThreadPool.QueueUserWorkItem( f=> sc2tv.updateStreamList());
                ThreadPool.QueueUserWorkItem( f=>sc2tv.updateSmiles());
                UInt32.TryParse(sc2tv.GetStreamID(), out sc2ChannelId);
                settings.Sc2tvId = sc2ChannelId.ToString();
                sc2tv.ChannelId = sc2ChannelId;
                sc2tv.Start();

                if (sc2ChannelId != 0 )
                {                   
                    if (sc2tv.ChannelIsLive)
                        streamStatus.SetOn(pictureSc2tvStream);
                    else
                        streamStatus.SetOff(pictureSc2tvStream);
                    
                    //var currentVal = sc2tv.channelList.getById(sc2ChannelId);
                    //if(currentVal != null)
                    //    SetComboValue(comboSc2Channels, currentVal);
                }
                if (String.IsNullOrEmpty(settings.sc2tv_ShortDescription))
                    settings.sc2tv_ShortDescription = sc2tv.ShortDescription;
                if (String.IsNullOrEmpty(settings.sc2tv_LongDescription))
                    settings.sc2tv_LongDescription = sc2tv.LongDescription;
                if (String.IsNullOrEmpty(settings.sc2tv_Game))
                    settings.sc2tv_Game = sc2tv.Game;


                SendMessage(new UbiMessage(String.Format("Sc2tv: logged in!"), EndPoint.Sc2Tv, EndPoint.Notice));
                chatStatusSc2tv.On = true;

                if (obsRemote != null && settings.obsRemoteEnable && obsRemote.Status.streaming)
                {
                    ThreadPool.QueueUserWorkItem( f=> SwitchPlayersOn(true, true) );
                }
                
            }
            else
            {
                SendMessage(new UbiMessage(String.Format("Sc2tv: login failed!"), EndPoint.Sc2Tv, EndPoint.Error));
            }
        }