private void LogoutButt_Click(object sender, EventArgs e) { UploadHdr.Logout(); UpdateAll(); }
static private bool commandLineStep() { Console.Write(">"); string raw = Console.ReadLine(); int x = 2; string[] rawArray = raw.Split(new char[] { ' ' }, x); string command = rawArray[0]; List <string> args = new List <string>(); if (rawArray.Length > 1) { string pattern = "[\"'](.*?)[\"']|([^ \"'\\s]+)"; Regex rgx = new Regex(pattern); int[] groupNumbers = rgx.GetGroupNumbers(); Match m = rgx.Match(rawArray[1]); while (m.Success) { for (int i = 1; i <= 2; i++) { Group g = m.Groups[i]; CaptureCollection cc = g.Captures; if (cc.Count > 0) { args.Add(cc[0].Value); } } m = m.NextMatch(); } } switch (command) { case "damn": case "bye": case "kys": case "quit": case "close": case "exit": write("Bye!"); System.Threading.Thread.Sleep(500); return(false); //FreeCons(); break; case "upload": if (args.Count == 0) { OpenFileDialog opf = new OpenFileDialog(); DialogResult result = opf.ShowDialog(); if (result == DialogResult.OK) { UploadHdr.Upload(opf.FileName); } else { writeE("There was an problem with:\n" + opf.FileName); } } else { foreach (string path in args) { UploadHdr.Upload(path); } } break; case "logout": UploadHdr.Logout(); Console.WriteLine("Please log back in"); StartupHdr.ShowLogin(); break; case "screenshot": Process proc = Process.Start("snippingtool", "/clip"); proc.WaitForExit(); if (Clipboard.ContainsImage()) { string path = Path.GetTempPath() + "screenshot_" + DateTime.Now.ToString("dd-MM-yy_HH.mm.ss") + ".png"; Image img = Clipboard.GetImage(); img.Save(path, System.Drawing.Imaging.ImageFormat.Png); UploadHdr.Upload(path, "screenshots/", true); File.Delete(path); } else { writeE("Theres no picture!"); } break; case "fullscreenshot": string ImgPath = Path.GetTempPath() + "screenshot_" + DateTime.Now.ToString("dd-MM-yy_HH.mm.ss") + ".png"; Bitmap image = HotKeyHdr.screenshot(); image.Save(ImgPath, System.Drawing.Imaging.ImageFormat.Png); UploadHdr.Upload(ImgPath, "screenshots/", true); File.Delete(ImgPath); break; default: writeE("Unrecognized command: " + command); break; } return(true); }