static public void Upload(string path, string subdir = "", bool getToken = false) { if (LoggedIn) { Cursor.Current = Cursors.WaitCursor; if (File.Exists(path)) { string dataStr = Convert.ToBase64String(File.ReadAllBytes(path)); string filename = Path.GetFileName(path); Console.WriteLine("Uploading " + filename + (subdir != "" ? " under: " + subdir : "")); string response = PostRequest("https://hllm.tk/php/upload/upload", new NameValueCollection() { { "uid", Filedata[0] }, { "utk", Filedata[1] }, { "data", dataStr }, { "name", filename }, { "dir", subdir } }); if (response != "false") { if (subdir == "" || getToken) { Clipboard.SetText(response); } Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("OK"); Console.ForegroundColor = ConsoleColor.White; } else { ConsoleHdr.writeE("ERROR UPLOADING"); //Console.ReadKey(); //System.Threading.Thread.Sleep(2000); } } else if (Directory.Exists(path)) { bool token = false; if (subdir == "" || getToken) { token = true; } Console.WriteLine("Encountered /" + new DirectoryInfo(path).Name + " ..."); subdir = subdir + new DirectoryInfo(path).Name + "/"; string[] paths = Directory.GetFileSystemEntries(path); foreach (string newpath in paths) { Upload(newpath, subdir); } if (token) { string response = PostRequest("https://hllm.tk/php/upload/token", new NameValueCollection() { { "uid", Filedata[0] }, { "utk", Filedata[1] }, { "name", new DirectoryInfo(path).Name }, { "dir", "" } }); Clipboard.SetText(response); } } else { ConsoleHdr.writeE(Path.GetFileName(path) + " not found!"); } } else { StartupHdr.ShowLogin(); } Cursor.Current = Cursors.Default; }
void ShowConsole(object sender, EventArgs e) { ConsoleHdr.StartConsole(); }