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(); }
public static string CounterConsole() { CounterConsoleWin = new Window(2, ScreenInfo.WindowWidth, ScreenInfo.WindowHeight - 2, 0); Actions act = new Actions(); CounterConsoleWin.Keypad = true; Curses.Echo = false; int splitCount = 3; string command = ""; string message = ""; int charCount = 0; int buttonPress = 0; int bufferPosition = 0; char[] splitter = { ' ' }; do { CounterConsoleWin.Clear(); if (command.StartsWith("/")) { try { message = command.Split(splitter, splitCount)[2]; CounterConsoleWin = DrawConsoleNum(CounterConsoleWin, message.Length); } catch (IndexOutOfRangeException) { CounterConsoleWin = DrawConsoleNum(CounterConsoleWin, message.Length); } } else { CounterConsoleWin = DrawConsoleNum(CounterConsoleWin, charCount); } CounterConsoleWin.Add(command); CounterConsoleWin.Refresh(); buttonPress = CounterConsoleWin.GetChar(); if (Settings.NoShortcuts == false) { if (act.DealWithShortcuts(buttonPress)) { buttonPress = 57344; /* So it's ignored */ } } if (buttonPress == 8) /* 8 is backspace */ { if (charCount != 0) { command = command.Remove(command.Length - 1, 1); charCount--; } else { Curses.Beep(); } } else { if (buttonPress == Keys.DOWN) { if (bufferPosition == 0) /* Nothing happens if you're already at the latest command possible */ { Curses.Beep(); } else { try { bufferPosition--; command = CommandHistory.GetCommand(bufferPosition); charCount = command.Length; } catch (ArgumentOutOfRangeException) { Curses.Beep(); } } } else if (buttonPress == Keys.UP) /* Handles going to earlier points in the history */ { if (bufferPosition == 0) { if (CommandHistory.MaxIndex() != bufferPosition || CommandHistory.MaxIndex() == 0) { try { CommandHistory.Add(command); bufferPosition++; command = CommandHistory.GetCommand(bufferPosition); charCount = command.Length; } catch (ArgumentOutOfRangeException) { Curses.Beep(); } } else { Curses.Beep(); } } else if (bufferPosition == CommandHistory.MaxIndex()) { Curses.Beep(); } else { try { bufferPosition++; command = CommandHistory.GetCommand(bufferPosition); charCount = command.Length; } catch (ArgumentOutOfRangeException) { Curses.Beep(); } } } else if (buttonPress == Keys.RIGHT || buttonPress == Keys.LEFT) { /* Ignores left and right arrow key currently */ /* but one day I hope you could move in the command */ } else if (buttonPress == 10 || buttonPress == Keys.ENTER) /* 10 is return */ { buttonPress = int.MinValue; } else if (buttonPress == 9) /* TAB key */ { buttonPress = 57344; } else if (charCount < 146) { if (buttonPress < 57344) { command = command + Convert.ToChar(buttonPress); try { message = command.Split(splitter, splitCount)[2]; } catch (IndexOutOfRangeException) { } charCount++; } } } } while (buttonPress != int.MinValue); CommandHistory.Add(command); CommandHistory.RemoveEmpties(); return command; }
private void Mentions() { GetUpdates getMentions = new GetUpdates(); ScreenDraw draw = new ScreenDraw(); getMentions.GetMentions(); TimerMan.Pause(); draw.ShowMentions(); Actions twitterMethods = new Actions(); MentionsConsole(); if (Settings.AFK == false) { TimerMan.Resume(); } draw.ShowTimeline(); User.CounterConsoleWin.Refresh(); }