public static void Autostart(bool enable) { string curPath = System.Reflection.Assembly.GetExecutingAssembly().CodeBase.Substring(8).Replace('/', '\\'); string newFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\HllmUp\Autostart"; string newPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\HllmUp\Autostart\HllmUp.exe"; if (enable) { if (!System.IO.Directory.Exists(newFolder)) { Directory.CreateDirectory(newFolder); } System.IO.File.Copy(curPath, newPath, true); RegistryHdr.setValueGlobal(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "HllmUp", newPath); } else { RegistryHdr.DelValue(@"Software\Microsoft\Windows\CurrentVersion\Run", "HllmUp"); } RegistryHdr.setValue("autostart", enable.ToString()); UploadHdr.Autostart = enable; }
private void Login() { LoginButt.Enabled = false; bool worked = UploadHdr.Login(Username.Text, Password.Text); if (RegistryHdr.getValue("context") != ContextEnable.Checked.ToString() & !(ContextEnable.Checked == false & RegistryHdr.getValue("context") == "")) { //todo: E/Disable content thingy thing MessageBox.Show("An elevated Process needs to be started to enable explorer right-clicking.\nPlease click yes."); var exeName = System.Reflection.Assembly.GetExecutingAssembly().CodeBase.Substring(8).Replace('/', '\\'); ProcessStartInfo startInfo = new ProcessStartInfo(exeName); startInfo.Verb = "runas"; if (ContextEnable.Checked == true) { startInfo.Arguments = "RegisterRC"; } else { startInfo.Arguments = "DeRegisterRC"; } Process p = Process.Start(startInfo); p.WaitForExit(); RegistryHdr.setValue("context", ContextEnable.Checked.ToString()); UploadHdr.Context = ContextEnable.Checked; } if (RegistryHdr.getValue("autostart") != AutostartEnable.Checked.ToString()) { StartupHdr.Autostart(AutostartEnable.Checked); } UpdateAll(); if (worked == true) { Username.Text = ""; Password.Text = ""; ErrorText.Text = ""; System.Media.SystemSounds.Hand.Play(); } else { ErrorText.Text = "Couldn't log in!"; Password.Text = ""; System.Media.SystemSounds.Asterisk.Play(); } LoginButt.Enabled = true; }
public static void Logout() { //RegistryHdr.DelKey(@"HKEY_CLASSES_ROOT\*\shell\Upload"); //RegistryHdr.DelKey(@"HKEY_CLASSES_ROOT\Directory\shell\Upload"); RegistryHdr.DelKey(@"SOFTWARE", "HllmUp"); LoggedIn = false; }
public static void DeRegisterRC() { string Folder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\HllmUp"; Directory.Delete(Folder, true); RegistryHdr.DelRootKey(@"*\shell", "Upload"); RegistryHdr.DelRootKey(@"Directory\shell", "Upload"); }
public static bool Login(string name, string pass) { string result = PostRequest("https://hllm.tk/php/upload/login", new NameValueCollection() { { "Username", name }, { "Password", pass } }); if (result != "false" & result != "") { LoggedIn = true; try { Filedata = result.Split(','); RegistryHdr.setValue("uid", Filedata[0]); RegistryHdr.setValue("utk", Filedata[1]); RegistryHdr.setValue("active", "true"); GetName(); } catch { LoggedIn = false; } if (Username == "false" || Username == "") { return(false); } Console.WriteLine("-" + Username + "-"); return(true); } else { return(false); } }
public static bool Recover() { Filedata = new string[] { RegistryHdr.getValue("uid"), RegistryHdr.getValue("utk") }; Boolean.TryParse(RegistryHdr.getValue("context"), out Context); Boolean.TryParse(RegistryHdr.getValue("autostart"), out Autostart); GetName(); StartupHdr.UpdateExes(Autostart, Context); if (Username != "false" & Username != "") { LoggedIn = true; return(true); } else { return(false); } }