Exemple #1
0
 private static void HandleSongFinished(object sender, BassNetPlayer.SongFinishedEventArgs e)
 {
     if (mode == PlayMode.Party)
     {
         while (ThePlayer.PlayQueue.Count < 10)
         {
             CliCommandFactory.Execute(ThePlayer, "/random");     //todo : ewww. this ain't pretty
         }
     }
     if (ThePlayer.PlayQueue.Count > 0)
     {
         ConsoleUtils.UOut(ConsoleColor.Black, "Now playing : {0}", ConsoleColor.White, ThePlayer.PlayQueue.Peek().ToString());
     }
 }
Exemple #2
0
        private static void EnterMainLoop()
        {
            string Argument    = "";
            bool   exitProgram = false;

            ThePlayer.SongFinished += HandleSongFinished;

            while (!exitProgram)
            {
                string ln = Console.ReadLine();

                if (ln.StartsWith("/"))
                {
                    if (ln.StartsWith("/exit"))   //todo : yuck.
                    {
                        exitProgram = true;
                        continue;
                    }
                    CliCommandFactory.Execute(ThePlayer, ln);
                }
                else
                {
                    if (!string.IsNullOrEmpty(ln))
                    {
                        Subsonic.AddChatMessage(ln);
                    }
                }
                //todo : messages should be fetched async so we get more of a live chat idea
                //todo : i keep seeing the whole message log. this sucks
                IOrderedEnumerable <ChatMessage> messages = Subsonic.GetChatMessages(LastMsgDate).OrderBy(cm => cm.Date);

                foreach (var msg in messages)
                {
                    if (msg.Date >= LastMsgDate)
                    {
                        ConsoleUtils.UOut(ConsoleColor.Cyan, msg.ToString());
                    }
                }
                LastMsgDate = messages.Max(msg => msg.Date);
            }
            ThePlayer.Stop();
        }