Ejemplo n.º 1
0
 /// <summary>
 /// Reauthenticates twitter access when needed
 /// </summary>
 public static void ReauthenticateTwitter()
 {
     User files = new User();
     OAuthAccessToken userToken = files.GetUser();
     User.Account.AuthenticateWith(userToken.Token, userToken.TokenSecret);
     TwitterAccount user = User.Account.GetAccountSettings(); /* Update screen name for user switching */
     userScreenName = user.ScreenName;
     ScreenDraw.HeadLine.Clear();
     ScreenDraw.HeadLine.Add("ClutterFeed | " + ScreenDraw.VersionName + " (" + ScreenDraw.Version + ")");
     string signOn = "Signed on as: @" + userScreenName;
     if (Settings.AFK)
     {
         signOn = "(AFK) | " + signOn;
     }
     ScreenDraw.HeadLine.Add(0, (ScreenInfo.WindowWidth - signOn.Length - 1), signOn);
     ScreenDraw.HeadLine.Refresh();
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Curses.InitScr();
            Curses.Newlines = true;
            Curses.ResizeTerm(ScreenInfo.WindowHeight, ScreenInfo.WindowWidth);
            if (User.ConfigExists() == false)
            {
                User.SetUnsetColorsToDefaults();
            }
            else
            {
                User config = new User();
                config.GetConfigs();
                config.FindColors();
            }

            Curses.InitColor(101, Color.IdentifierColor.Red, Color.IdentifierColor.Green, Color.IdentifierColor.Blue);
            Curses.InitColor(102, Color.LinkColor.Red, Color.LinkColor.Green, Color.LinkColor.Blue);
            Curses.InitColor(103, Color.FriendColor.Red, Color.FriendColor.Green, Color.FriendColor.Blue);
            Curses.InitColor(104, Color.SelfColor.Red, Color.SelfColor.Green, Color.SelfColor.Blue);
            Curses.InitColor(105, Color.MentionColor.Red, Color.MentionColor.Green, Color.MentionColor.Blue);
            Curses.InitColor(Colors.BLACK, Color.BackgroundColor.Red, Color.BackgroundColor.Green, Color.BackgroundColor.Blue);

            if (Curses.HasColors)
            {
                Curses.StartColor();
                for (short i = 1; i < 8; ++i)
                    Curses.InitPair(i, color_table[i], Colors.BLACK);
            }
            else
            {
                Curses.EndWin();
                Console.WriteLine("Color support not found");
                Environment.Exit(0);
            }

            Curses.InitPair(11, 101, Colors.BLACK);
            Curses.InitPair(12, 102, Colors.BLACK);
            Curses.InitPair(13, 103, Colors.BLACK);
            Curses.InitPair(14, 104, Colors.BLACK);
            Curses.InitPair(15, 105, Colors.BLACK);

            Curses.InitPair(21, Colors.BLACK, 101);

            ScreenDraw.HeadLine = new Window(1, ScreenInfo.WindowWidth, 0, 0);

            Actions twitterDo = new Actions();
            twitterDo.SetUpTwitter();

            if (Settings.AFK)
            {
                TimerMan.Paused = true;
            }

            twitterDo.TimelineConsole();

            ScreenDraw.HeadLine.Dispose();
            ScreenDraw.Tweets.Dispose();

            Curses.EndWin();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes the API quickly
        /// </summary>
        /// <returns></returns>
        public void InitializeTwitter()
        {
            User files = new User();

            files.Run();

            OAuthAccessToken userToken = files.GetUser();
            OAuthAccessToken appToken = User.appKey;

            User.Account = new TwitterService(appToken.Token, appToken.TokenSecret);
            User.Account.AuthenticateWith(userToken.Token, userToken.TokenSecret);
            User.Account.TraceEnabled = true; /* Forget what this does */
            TwitterAccount user = User.Account.GetAccountSettings();
            if (User.Account.Response.Error != null)
            {
                ScreenDraw.ShowMessage(User.Account.Response.Error.Code + ": " + User.Account.Response.Error.Message, true);
                Curses.EndWin();
                Environment.Exit(0);
            }
            try
            {
                userScreenName = user.ScreenName;
            }
            catch (NullReferenceException)
            {
                ScreenDraw.ShowMessage("Twitter is currently unavailable.", true);
                Curses.EndWin();
                Environment.Exit(0);
            }
        }