Example #1
0
        static void ConnectToTwitch()
        {
            ConWin.UpdateTwitchLog("Twitch Client: Connecting...");
            TwitchClient = new TcpClient("irc.chat.twitch.tv", 6667);
            SReader      = new StreamReader(TwitchClient.GetStream());
            SWriter      = new StreamWriter(TwitchClient.GetStream());
            SWriter.WriteLine("PASS " + AuthKey);
            SWriter.WriteLine("NICK " + UserName.ToLower());
            SWriter.WriteLine("USER " + UserName.ToLower() + " 8 * :" + UserName.ToLower());
            SWriter.WriteLine("JOIN #" + DisplayName.ToLower());
            SWriter.Flush();
            string Response = SReader.ReadLine();

            if (Response.Contains("Welcome, GLHF"))
            {
                Debug.Environment("Twitch Client -> Connected");
                ChatWriterTimer = Settings.GetChatWriterTime();
            }
            else
            {
                Debug.Environment("Twitch Client -> Failed to Connect");
                return;
            }
            ConWin.UpdateTwitchLog(Response);
            string Response2 = SReader.ReadLine();

            ConWin.UpdateTwitchLog(Response2);
        }
Example #2
0
 static void GetTwitchDetails()
 {
     ConWin.UpdateTwitchLog("Twitch Client: Getting Details...");
     DisplayName = File.ReadAllText("Channel Details\\Display Name.txt");
     UserName    = File.ReadAllText("Channel Details\\User Name.txt");
     AuthKey     = File.ReadAllText("Channel Details\\Auth Key.txt");
 }
Example #3
0
 public static void Log(string LogText)
 {
     LogNumber += 1;
     if (LogNumber == 1)
     {
         CreateDebugFile();
     }
     ConWin.UpdateDebugLog("Debug.Log #" + LogNumber + ": " + LogText);
     UpdateDebugFile("Debug.Log #" + LogNumber + ": " + LogText);
 }
 static void Main(string[] args)
 {
     ConWin.DrawGUI();
     IO.GameUpdate("Game Starting...");
     IO.Options(null);
     Debug.Environment("Loading Settings...");
     Settings.LoadSettingsFromFile();
     System.Threading.Thread GameThread   = new System.Threading.Thread(new System.Threading.ThreadStart(GameThreadStart));
     System.Threading.Thread ConWinThread = new System.Threading.Thread(new System.Threading.ThreadStart(ConWin.ConWinThreadStart));
     GameThread.Start();
     ConWinThread.Start();
 }
Example #5
0
 static void ReadChat()
 {
     if (!TwitchClient.Connected)
     {
         ConnectToTwitch();
         return;
     }
     if (TwitchClient.Available > 0)
     {
         var Msg = SReader.ReadLine();
         ConWin.UpdateTwitchLog(Msg);
         if (Msg.Contains("PRIVMSG"))
         {
             var splitPoint = Msg.IndexOf("!", 1);
             var ChatName   = Msg.Substring(0, splitPoint);
             ChatName   = ChatName.Substring(1);
             splitPoint = Msg.IndexOf(":", 1);
             Msg        = Msg.Substring(splitPoint + 1);
             if (Msg.Substring(0, 1) == "!" && Msg.Length <= 3)
             {
                 MainClass.ChatOptions.CheckNewVote(Msg, ChatName);
             }
             if (Msg.Substring(0, 1) == "!" && ChatName == DisplayName.ToLower())
             {
                 StreamerChatCommands(Msg);
             }
         }
         else if (Msg.Contains("PING"))
         {
             SWriter.WriteLine("PONG :tmi.twitch.tv");
         }
     }
     if (!Settings.GetPause())
     {
         ChatWriterTimer -= 1;
     }
     if (ChatWriterTimer <= 0)
     {
         WriteToChat("Type '!' and the number of the option you wish to vote for!");
         ChatWriterTimer = Settings.GetChatWriterTime();
     }
 }
Example #6
0
 public static void WG(string LogText)
 {
     ConWin.UpdateDebugLog("WG: " + LogText);
 }
Example #7
0
 public static void Environment(string LogText)
 {
     ConWin.UpdateDebugLog("Environment: " + LogText);
 }