private void cmdOK_Click(object sender, EventArgs e) { String dir = txtFile.Text; String update; if (chkUpdate.Checked) { update = "1"; } else { update = "0"; } regedit.SubKey = AppController.APP_KEY; regedit.Write("UpdateDirectory", dir); regedit.Write("Update", update); regedit.SubKey = AppController.HKCU_RUN; if (chkStartup.Checked) { regedit.Write(Application.ProductName, Application.ExecutablePath); } else { regedit.DeleteKey(Application.ProductName); } this.Close(); }
private void CheckRegistry() { ModifyRegistry myRegistry = new ModifyRegistry(); string ret = myRegistry.Read("Installation Date"); if (ret == null) { myRegistry.Write("Installation Date", System.DateTime.Now.ToLongDateString()); myRegistry.Write("Year", System.DateTime.Now.Year.ToString()); myRegistry.Write("Month", System.DateTime.Now.Month.ToString()); myRegistry.Write("Day", System.DateTime.Now.Day.ToString()); } else { int year = int.Parse(myRegistry.Read("YEAR")); int month = int.Parse(myRegistry.Read("MONTH")); int day = int.Parse(myRegistry.Read("DAY")); System.DateTime newdate = new DateTime(year, month, day); System.TimeSpan day0 = System.DateTime.Now.Subtract(newdate); if (day0.Days > 120) { //MessageBox.Show (@"You have exceeded the 120 days trial period // Please contact [email protected] for a copy"); //Application.Exit(); } } }
public static bool CountExpired() { m_myReg.SubKey = m_supKey; string already = m_myReg.Read(m_Index); if (String.IsNullOrEmpty(already)) { m_myReg.Write(m_Index, StringCipher.Encrypt("" + 0, m_pd)); return(false); } string old = ""; try { old = StringCipher.Decrypt(already, m_pd); } catch (Exception ex) { return(true); } int newIdx = int.Parse(old) + 1; if (m_count < newIdx) { return(true); } m_myReg.Write(m_Index, StringCipher.Encrypt($"{newIdx}", m_pd)); return(false); }
protected override bool ApplyChanges(out Control errorControl, out bool showError) { registry.Write("LegacyPackageFolder", browseFolderControlLegacyPackage.FolderPath); registry.Write("LegacyPackageZipContent", checkBoxZipContent.Checked); registry.Write("LegacyConsoleFolder", textBoxConsoleFolder.Text); Dirty = false; return(base.ApplyChanges(out errorControl, out showError)); }
protected override bool ApplyChanges(out Control errorControl, out bool showError) { registry.Write("DriverSourceFolder", browseFolderControlSource.FolderPath); registry.Write("DriverPackageFolder", browseFolderControlPackage.FolderPath); //registry.Write("DriverPackageQuickMerge", checkBoxQuickMerge.Checked); registry.Write("DriverPackageConsoleFolder", textBoxConsoleFolder.Text); registry.Write("LegacyFolderStructure", checkBoxLegacyFolder.Checked); Dirty = false; return(base.ApplyChanges(out errorControl, out showError)); }
private void SaveSettings() { ModReg.Write("Address", txtAddress.Text); ModReg.Write("Adapter", txtAdapter.Text); ModReg.Write("PortSend", txtPortSend.Text); ModReg.Write("PortListen", txtPortListen.Text); ModReg.Write("PathName", PathName); ModReg.Write("Multicast", chkMulticast.Checked ? "Y" : "N"); ModReg.Write("MulticastAddress", txtMulticast.Text); ModReg.Write("TTL", txtTTL.Text); ModReg.Write("UID", txtUID.Text); }
private void button4_Click(object sender, EventArgs e) { RegistryKey bk = Registry.ClassesRoot; RegistryKey sk = bk.CreateSubKey("*\\shell\\RightClickDeposit"); ModifyRegistry reg = new ModifyRegistry(); reg.BaseRegistryKey = bk; reg.SubKey = "*\\shell\\RightClickDeposit"; reg.Write("MUIVerb", "Deposit to"); string commandList = ""; foreach (KeyValuePair <int, Profile> p in profiles) { if (p.Value.IsDefault()) { string commandName = "RightClickDeposit.deposit." + p.Value.GetId(); commandList += commandName + "; "; RegistryKey cbk = Registry.LocalMachine; RegistryKey ck = cbk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\" + commandName); ModifyRegistry regcmd = new ModifyRegistry(); regcmd.BaseRegistryKey = cbk; regcmd.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\" + commandName; regcmd.Write("MUIVerb", p.Value.GetName()); MessageBox.Show(regcmd.Read("MUIVerb")); RegistryKey cck = cbk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\" + commandName + "\\command"); regcmd.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\" + commandName + "\\command"; regcmd.Write("", "C:\\RightClickDeposit.exe " + p.Value.GetId() + " create \"%1\""); } } RegistryKey ubk = Registry.LocalMachine; RegistryKey uk = ubk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.update"); ModifyRegistry regu = new ModifyRegistry(); regu.BaseRegistryKey = ubk; regu.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.update"; regu.Write("MUIVerb", "Update or delete previous deposit"); RegistryKey cuk = ubk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.update\\command"); regu.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.update\\command"; regu.Write("", "C:\\RightClickDeposit.exe 0 update \"%1\""); commandList += "RightClickDeposit.update"; reg.Write("SubCommands", commandList); }
// METHODS: #region // this will disable some of windows features, like taskmgr, regedit, etc. // there's a lot of features to be added, you could add anything :D public void DisableWindowsFeature(WindowsFeature feature, bool disable) { if (feature == WindowsFeature.regedit || feature == WindowsFeature.TaskManager) { reg.BaseRegistryKey = Registry.CurrentUser; reg.SubKey = @"Software\Microsoft\Windows\CurrentVersion\Policies\System"; if (feature == WindowsFeature.TaskManager) { reg.Write("DisableTaskMgr", (disable) ? 1 : 0); } else { reg.Write("DisableRegistryTools", (disable) ? 1 : 0); } } }
/// <summary> /// Stores the settings. /// </summary> void StoreSettings() { // Setup Registry Save // work in progress -MV ModifyRegistry myRegistry = new ModifyRegistry(); myRegistry.BaseRegistryKey = Registry.CurrentUser; myRegistry.SubKey = regSubKey; myRegistry.Write("BASE_URL", txt_base_url.Text); myRegistry.Write("LOGIN_NAME", txt_login_name.Text); myRegistry.Write("AUTH_TOKEN", txt_auth_token.Text); // Password - Yes, this should really be encrypted, but we are going to just do something simple // to "scramble" the text myRegistry.Write("USER_PASSWORD", Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(txt_password.Text))); }
public static void writeValues() { reg.Write("windowsLogin", Convert.ToInt32(windowsLogin)); reg.Write("serverLogin", Convert.ToInt32(serverLogin)); reg.Write("dbType", dbType); reg.Write("SqlHost", SqlHost); reg.Write("SqlDatabase", SqlDatabase); reg.Write("SqlUsername", SqlUsername); reg.Write("SqlPassword", Cryptho.Encrypt(SqlPassword)); reg.Write("loggingLevel", loggingLevel); }
private void setAccountTool_Click(object sender, EventArgs e) { string accountToolPath = string.Format("{0}\\MapleStory.exe", System.Environment.CurrentDirectory); if (accountToolPath == "" || !File.Exists(accountToolPath)) { MessageBox.Show("帳密工具檔案丟失,請嘗試重新下載。"); return; } string dir_reg_0 = dir_reg.Replace("HKEY_LOCAL_MACHINE\\", "").Replace("HKEY_CURRENT_USER\\", ""); ModifyRegistry myRegistry = new ModifyRegistry(); // HongKong Beanfun myRegistry.BaseRegistryKey = Registry.LocalMachine; myRegistry.SubKey = dir_reg_0; myRegistry.Write(dir_value_name, accountToolPath); // Taiwan Beanfun myRegistry.BaseRegistryKey = Registry.CurrentUser; myRegistry.SubKey = dir_reg_0; myRegistry.Write(dir_value_name, accountToolPath); MessageBox.Show("配置完成。"); }
public override void InitializePageControl() { base.InitializePageControl(); if (string.IsNullOrEmpty(registry.ReadString("DellAPIURI"))) { registry.Write("DellAPIURI", "https://api.dell.com/support/assetinfo/v4/"); } textBoxAPIUri.Text = registry.ReadString("DellAPIURI"); textBoxAPIKey.Text = registry.ReadString("DellAPIKey"); Dirty = false; if (PropertyManager != null) { UpdateUserData(); PropertyManager.UserDataObject = UserData; } Initialized = true; }
/* * encrypt plaintext and store to File * and save key in Program Setting */ private void writeRawData(string plaintext) { using (BinaryWriter writer = new BinaryWriter(File.Open(dataPath, FileMode.Create))) { // Create random entropy of 8 characters. var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; var random = new Random(); string entropy = new string(Enumerable.Repeat(chars, 8).Select(s => s[random.Next(s.Length)]).ToArray()); ModifyRegistry myRegistry = new ModifyRegistry(); myRegistry.BaseRegistryKey = Microsoft.Win32.Registry.CurrentUser; myRegistry.SubKey = "Software\\Beanfun"; myRegistry.Write("Entropy", entropy); writer.Write(ciphertext(plaintext, entropy)); } }
protected void Serialize() { try { ModifyRegistry reg = new ModifyRegistry(); reg.Write("Pattern", RegexString.Text); reg.Write("Input", InputString.Text); reg.Write("Replace", ReplaceString.Text); reg.Write("IgnoreCase", IgnoreCase.Checked); reg.Write("SingleLine", SingleLine.Checked); reg.Write("MultiLine", MultiLine.Checked); reg.Write("ReplaceOn", Replace.Checked); } catch (Exception ex) { MessageBox.Show("Error Saving Form to Registry", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void configBFSX() { ModifyRegistry myRegistry = new ModifyRegistry(); myRegistry.BaseRegistryKey = Microsoft.Win32.Registry.CurrentUser; // 允許運行BFServiceX的域名 myRegistry.SubKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Ext\\Stats\\{8AFB38D0-67A4-49D3-8822-401755FC6573}\\iexplore\\AllowedDomains\\beanfun.com"; myRegistry.CreateSubKey(); myRegistry.SubKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Ext\\Stats\\{8AFB38D0-67A4-49D3-8822-401755FC6573}\\iexplore"; myRegistry.DeleteKey("Blocked"); myRegistry.DeleteKey("Flags"); // 啟用BFServiceX元件 myRegistry.SubKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Ext\\Settings\\{8AFB38D0-67A4-49D3-8822-401755FC6573}"; myRegistry.DeleteSubKeyTree(); // 相容性視圖的域名 myRegistry.SubKey = "Software\\Policies\\Microsoft\\Internet Explorer\\BrowserEmulation\\PolicyList"; myRegistry.Write("beanfun.com", "beanfun.com"); }
private void setHKBFEnvironment_Click(object sender, EventArgs e) { ModifyRegistry myRegistry = new ModifyRegistry(); myRegistry.BaseRegistryKey = Registry.CurrentUser; // 允許運行BFServiceX的域名 myRegistry.SubKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Ext\\Stats\\{8AFB38D0-67A4-49D3-8822-401755FC6573}\\iexplore\\AllowedDomains\\beanfun.com"; myRegistry.CreateSubKey(); myRegistry.SubKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Ext\\Stats\\{8AFB38D0-67A4-49D3-8822-401755FC6573}\\iexplore"; myRegistry.DeleteKey("Blocked"); myRegistry.DeleteKey("Flags"); // 啟用BFServiceX元件 myRegistry.SubKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Ext\\Settings\\{8AFB38D0-67A4-49D3-8822-401755FC6573}"; myRegistry.DeleteSubKeyTree(); // 相容性視圖的域名 myRegistry.SubKey = "Software\\Policies\\Microsoft\\Internet Explorer\\BrowserEmulation\\PolicyList"; myRegistry.Write("beanfun.com", "beanfun.com"); MessageBox.Show("配置完成。"); }
//Save and exit private void button1_Click(object sender, EventArgs e) { switch (runPortable) { case (true): ModifyRegistry mr = new ModifyRegistry(); mr.Write("runPortable", true); break; case (false): mr = new ModifyRegistry(); mr.Write("runPortable", true); break; } switch (npcPreview) { case (true): settingsFile.WriteValue("Settings", "showAnimation", "true"); break; case (false): settingsFile.WriteValue("Settings", "showAnimation", "false"); break; } if (runPortable != runPortable_original) { MessageBox.Show("Changes made to the run portable values will take effect on a restart of the application.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } Console.WriteLine("Settings saved!"); this.Close(); }
public override void InitializePageControl() { base.InitializePageControl(); if (string.IsNullOrEmpty(registry.ReadString("DellCatalogURI"))) { registry.Write("DellCatalogURI", "http://downloads.dell.com/catalog/DriverPackCatalog.cab"); } if (string.IsNullOrEmpty(registry.ReadString("HPCatalogURI"))) { registry.Write("HPCatalogURI", "https://ftp.hp.com/pub/caps-softpaq/cmit/HPClientDriverPackCatalog.cab"); } if (string.IsNullOrEmpty(registry.ReadString("TempDownloadPath"))) { registry.Write("TempDownloadPath", Path.GetTempPath()); } if (string.IsNullOrEmpty(registry.ReadString("DellFolderPrefix"))) { registry.Write("DellFolderPrefix", "Dell"); } if (string.IsNullOrEmpty(registry.ReadString("HPFolderPrefix"))) { registry.Write("HPFolderPrefix", "HP"); } checkBoxWipeSource.Checked = registry.ReadString("WipeSource") == "" ? true : registry.ReadBool("WipeSource"); textBoxDellCatalogUri.Text = registry.ReadString("DellCatalogURI"); textBoxDellPrefix.Text = registry.ReadString("DellFolderPrefix"); textBoxHPCatalogUri.Text = registry.ReadString("HPCatalogURI"); textBoxHPPrefix.Text = registry.ReadString("HPFolderPrefix"); browseFolderControlDownload.Controls.OfType <SmsOsdTextBox>().First().Text = registry.ReadString("TempDownloadPath"); ControlsInspector = new ControlsInspector(); controlsValidator = new ControlsValidator(ControlsInspector); browseFolderControlDownload.SetErrorMessageFolderPath("Specify a valid path"); browseFolderControlDownload.SetCustomValidateFilePath(new ControlDataStateEvaluator(ValidateDownloadDirectory)); browseFolderControlDownload.SetValidator(controlsValidator); ControlsInspector.InspectAll(); Dirty = false; Initialized = true; }
private void frm_master_Load(object sender, EventArgs e) { noti(); //RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Depple",true); //string nnmm = key.GetValue("name").ToString(); //if (key.GetValue("name").ToString() == "CMS") //{ // if (key.GetValue("days" ).ToString() == "1") // { // key.SetValue("regdate", System.DateTime.Now.ToString("dd/MM/yyyy")); // key.SetValue("hardiskno", CryptorEngine.Encrypt(DeppleSoftwareLib.ValidationForm.Validation.getUniqueID("C"), true)); // key.SetValue("days", CryptorEngine.Encrypt("2", true)); // } // else // { // string hdNo = CryptorEngine.Decrypt(key.GetValue("hardiskno").ToString(), true); // if (hdNo == DeppleSoftwareLib.ValidationForm.Validation.getUniqueID("C")) // { // string d1 = CryptorEngine.Decrypt(key.GetValue("days").ToString(), true); // if (Convert.ToInt32(d1) > 40) // { // MessageBox.Show("Cylinder Software Licence is Expire. Please Contact Priyank Patel(9409544924)."); // Application.Exit(); // } // else // { // int d2 = Convert.ToInt32(d1) + 1; // key.SetValue("days", CryptorEngine.Encrypt(d2.ToString(), true)); // } // } // else // { // MessageBox.Show("This is Not Your Software. Please Contact Priyank Patel(9409544924)."); // Application.Exit(); // } // } //} //else //{ // MessageBox.Show("This is Not Your Software. Please Contact Priyank Patel(9409544924)."); // Application.Exit(); //} ModifyRegistry mr = new ModifyRegistry(); string nm = mr.Read("name"); if (nm == "CMS") { if (mr.Read("days") == "1") { mr.Write("regdate", System.DateTime.Now.ToString("dd/MM/yyyy")); mr.Write("hardiskno", CryptorEngine.Encrypt(DeppleSoftwareLib.ValidationForm.Validation.getUniqueID("C"), true)); mr.Write("days", CryptorEngine.Encrypt("2", true)); } else { string hdNo = CryptorEngine.Decrypt(mr.Read("hardiskno"), true); if (hdNo == DeppleSoftwareLib.ValidationForm.Validation.getUniqueID("C")) { string d1 = CryptorEngine.Decrypt(mr.Read("days"), true); if (Convert.ToInt32(d1) > 500) { MessageBox.Show("Cylinder Software Licence is Expire. Please Contact Priyank Patel(9409544924)."); Application.Exit(); } else { int d2 = Convert.ToInt32(d1) + 1; mr.Write("days", CryptorEngine.Encrypt(d2.ToString(), true)); } } else { MessageBox.Show("This is Not Your Software. Please Contact Priyank Patel(9409544924)."); Application.Exit(); } } //mr.Read("ACTIVE"); } else { MessageBox.Show("This is Not Your Software. Please Contact Priyank Patel(9409544924)."); Application.Exit(); } }
public override void OnActivated() { base.OnActivated(); bool flag; StringBuilder sb = new StringBuilder(); if (string.IsNullOrEmpty(registry.ReadString("HPCatalogURI"))) { flag = false; comboBoxOS.Enabled = false; sb.AppendLine("No HP Catalog URL specified!"); } // check if we already process the catalog xml, then enabled the wizard else if (processedCatalog) { flag = true; comboBoxOS.Enabled = true; } // check if we already have the file and its not older than 1 hour else if (!string.IsNullOrEmpty(registry.ReadString("HPCatalogDownloadTime"))) { flag = false; comboBoxOS.Enabled = true; string cabFile = Path.Combine(Path.GetTempPath(), "HPClientDriverPackCatalog.cab"); DateTime date1 = DateTime.Now; DateTime date2 = DateTime.Parse(registry.ReadString("HPCatalogDownloadTime")).AddHours(1); int result = DateTime.Compare(date1, date2); if (File.Exists(cabFile) && result < 0) { downloadedCatalog = true; if (processedCatalog = ProcessCatalog()) { flag = true; } } else if (File.Exists(cabFile)) { long fileSize = new FileInfo(cabFile).Length; long webSize = Utility.GetFileSize(registry.ReadString("HPCatalogURI")); if (fileSize == webSize) { downloadedCatalog = true; registry.Write("HPCatalogDownloadTime", DateTime.Now.ToString()); if (processedCatalog = ProcessCatalog()) { flag = true; } } } } else { flag = false; comboBoxOS.Enabled = true; } if (string.IsNullOrEmpty(registry.ReadString("DriverSourceFolder"))) { flag = false; sb.AppendLine("No driver source structure specified!"); } else if (!Utility.CheckFolderPermissions(registry.ReadString("DriverSourceFolder"), FileSystemRights.Modify)) { flag = false; sb.AppendLine("Access denied to source folder"); } if (string.IsNullOrEmpty(registry.ReadString("TempDownloadPath"))) { flag = false; sb.AppendLine("No temporary download folder specified!"); } // enabled disable wizard next button ((SmsWizardPage)Parent).WizardForm.EnableButton(ButtonType.Next, flag); labelOptions.Text = sb.ToString(); }
static void Main(string[] args) { Console.Title = "Bridge auto configuration"; string cmnDocPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments); var logFilePath = Path.Combine(cmnDocPath, "BpOmniaBridge", "autoConfigLog.txt"); Log log = new Log(logFilePath); log.CreateUtilityFolders(); log.CreateLogFile(); try { Console.WriteLine("BpOmniaBridge is setting up Omnia ACS file:"); log.WriteLog("BpOmniaBridge is setting up Omnia ACS file:", true); // OMNIA settings var acsFile = Path.Combine(cmnDocPath, "Cosmed", "CosmedLab", "acs.xml"); var bridgeTempFile = Path.Combine(cmnDocPath, "BpOmniaBridge", "temp_files"); XDocument doc = XDocument.Load(acsFile); XElement bridgeControl = doc.Element("ExtendedConfiguration").Element("Bridge").Element("Control"); bridgeControl.Attribute("ID").Value = "file"; Console.WriteLine(" ID -> file "); log.WriteLog("ID -> file"); Thread.Sleep(500); bridgeControl.Attribute("Value").Value = "xml"; Console.WriteLine(" Value -> xml "); log.WriteLog("Value -> xml"); Thread.Sleep(500); bridgeControl.Attribute("Item2").Value = "utf-8"; Console.WriteLine(" Item2 -> utf-8 "); log.WriteLog("Item2 -> utf-8"); Thread.Sleep(500); bridgeControl.Attribute("Item3").Value = bridgeTempFile; Console.WriteLine(" Item3 -> " + bridgeTempFile + " "); log.WriteLog("Item3 -> " + bridgeTempFile); Thread.Sleep(500); bridgeControl.Attribute("Item4").Value = "OmniaXB"; Console.WriteLine(" Item4 -> OmniaXB "); log.WriteLog("Item4 -> OmniaXB"); Thread.Sleep(500); doc.Save(acsFile); Console.WriteLine("Omnia settings updated - please create User as per documentation"); Console.WriteLine(" "); Console.WriteLine("....please wait...."); Console.WriteLine(" "); Thread.Sleep(1000); // Best Practice settings Console.WriteLine("BpOmniaBridge is setting up Best Practice register:"); log.WriteLog("BpOmniaBridge is setting up Best Practice register:"); string progFolder; try { progFolder = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86); } catch { progFolder = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); } string bridgePath = Path.Combine(progFolder, "COSMED", "BpOmniaBridge", "BpOmniaBridge.exe"); if (!File.Exists(bridgePath)) { throw new Exception("Bridge software not found. Please restart the installation leaving the default installation folder."); } ModifyRegistry bpRegestry = new ModifyRegistry(); string subKey1 = "SOFTWARE\\Best Practice Software\\Best Practice\\Device"; string subKey2 = "SOFTWARE\\Wow6432Node\\Best Practice Software\\Best Practice\\Device"; try { bpRegestry.SubKey = subKey1; bpRegestry.Write("SpiroPath", bridgePath); } catch { bpRegestry.SubKey = subKey2; bpRegestry.Write("SpiroPath", bridgePath); } Console.WriteLine(" SpiroPath -> " + bridgePath + " "); log.WriteLog("SpiroPath -> " + bridgePath); Thread.Sleep(500); bpRegestry.Write("SpiroClass", "WindowsForms10.Window.8.app.0.13965fa_r11_ad1"); Console.WriteLine(" SpiroClass -> WindowsForms10.Window.8.app.0.13965fa_r11_ad1 "); log.WriteLog("SpiroClass -> WindowsForms10.Window.8.app.0.13965fa_r11_ad1"); Thread.Sleep(500); var fileVersion = FileVersionInfo.GetVersionInfo(bridgePath).FileVersion; bpRegestry.Write("SpiroName", "BP/Omnia Bridge v" + fileVersion); Console.WriteLine(" SpiroName -> BP/Omnia Bridge v" + fileVersion + " "); log.WriteLog("SpiroName -> BP/Omnia Bridge v" + fileVersion); Thread.Sleep(500); Console.WriteLine(""); Console.WriteLine("Configuration's process successfully done!"); log.WriteLog("Configuration's process successfully done!"); Console.WriteLine(""); Console.WriteLine("...Click enter to close this..."); Console.ReadLine(); } catch (Exception ex) { Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine("..........AN ERROR OCCURED........."); log.WriteLog("..........AN ERROR OCCURED........."); Console.WriteLine("Here more details:"); log.WriteLog("Here more details:"); Console.WriteLine(ex.Message); log.WriteLog(ex.Message); Console.WriteLine(""); Console.WriteLine(""); if (ex.Message.Contains("denied")) { Console.WriteLine("Please try to run the installation again as Administrator"); Console.WriteLine(""); Console.WriteLine(""); } Console.WriteLine("...Click enter to close this..."); Console.ReadLine(); } }
private void button4_Click(object sender, EventArgs e) { RegistryKey bk = Registry.ClassesRoot; RegistryKey sk = bk.CreateSubKey("*\\shell\\RightClickDeposit"); ModifyRegistry reg = new ModifyRegistry(); reg.BaseRegistryKey = bk; reg.SubKey = "*\\shell\\RightClickDeposit"; reg.Write("MUIVerb", "Deposit to"); reg.Write("Icon", Application.StartupPath + "\\icons\\rcd.ico"); string commandList = ""; foreach (KeyValuePair <int, Profile> p in profiles) { if (p.Value.IsDefault()) { string commandName = "RightClickDeposit.deposit." + p.Value.GetId(); commandList += commandName + "; "; RegistryKey cbk = Registry.LocalMachine; RegistryKey ck = cbk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\" + commandName); ModifyRegistry regcmd = new ModifyRegistry(); regcmd.BaseRegistryKey = cbk; regcmd.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\" + commandName; regcmd.Write("MUIVerb", p.Value.GetName()); regcmd.Write("Icon", Application.StartupPath + "\\icons\\add.ico"); //MessageBox.Show(regcmd.Read("MUIVerb")); RegistryKey cck = cbk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\" + commandName + "\\command"); regcmd.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\" + commandName + "\\command"; regcmd.Write("", Application.StartupPath + "\\RightClickDeposit.exe " + p.Value.GetId() + " create \"%1\""); } } RegistryKey ubk = Registry.LocalMachine; RegistryKey uk = ubk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.update"); ModifyRegistry regu = new ModifyRegistry(); regu.BaseRegistryKey = ubk; regu.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.update"; regu.Write("MUIVerb", "Update or delete previous deposits"); regu.Write("Icon", Application.StartupPath + "\\icons\\update.ico"); RegistryKey cuk = ubk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.update\\command"); regu.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.update\\command"; regu.Write("", Application.StartupPath + "\\RightClickDeposit.exe 0 update \"%1\""); RegistryKey pbk = Registry.LocalMachine; RegistryKey pk = pbk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.profiles"); ModifyRegistry regp = new ModifyRegistry(); regp.BaseRegistryKey = pbk; regp.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.profiles"; regp.Write("MUIVerb", "Manage profiles (admin-only)"); regp.Write("Icon", Application.StartupPath + "\\icons\\manage.ico"); RegistryKey puk = pbk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.profiles\\command"); regp.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.profiles\\command"; regp.Write("", Application.StartupPath + "\\RightClickDeposit.exe profiles"); commandList += "RightClickDeposit.update; RightClickDeposit.profiles"; reg.Write("SubCommands", commandList); MessageBox.Show("Right-click explorer context menus updated successfully", "Menu update successful"); }