public bool SetConfigurationValue(string aspect, object value) { using (var key = MainKey.OpenSubKey(SettingsKeys, RegistryKeyPermissionCheck.ReadWriteSubTree)) { if (key == null) { return(false); } key.SetValue(aspect, value); return(true); } }
/// <summary> /// Set the Copy Handle value to 0 and Exist registry'key to 0. /// </summary> /// <param name="hwnd"></param> public void UnregisterCopyHandler() { using (var key = MainKey.OpenSubKey(CompanyKey, RegistryKeyPermissionCheck.ReadWriteSubTree)) { if (key == null) { return; } key.SetValue("Exist", "0"); key.SetValue("Handle", "0"); } }
public string GetConfigurationValue(string aspect) { using (var key = MainKey.OpenSubKey(SettingsKeys, RegistryKeyPermissionCheck.ReadWriteSubTree)) { if (key == null) { return(""); } object value = key.GetValue(aspect); return(value.ToString()); } }
/// <summary> /// Retrieve the Handle of active CopyHandlersManager Window. /// </summary> /// <returns></returns> public int GetActiveCopyHandle() { using (var key = MainKey.OpenSubKey(CompanyKey, RegistryKeyPermissionCheck.ReadWriteSubTree)) { if (key == null) { return(-1); } object value = key.GetValue("Handle"); return(int.Parse((string)value)); } }
public bool ExistConfiguration() { using (var key = MainKey.OpenSubKey(CompanyKey, RegistryKeyPermissionCheck.ReadWriteSubTree)) { if (key == null) { return(false); } var res = key.GetValue("ExistConfig"); return(res == null?false:res.ToString() == "1"); } }
/// <summary> /// Set the last request arguments in to the registry. /// </summary> /// <param name="requestInfo"></param> public void SetLastArguments(string[] args) { using (var key = MainKey.OpenSubKey(LastArgumentsKey, RegistryKeyPermissionCheck.ReadWriteSubTree)) { if (key == null) { return; } key.SetValue("Operation", args[0]); key.SetValue("Source", args[1]); key.SetValue("Destiny", args[2]); } }
/// <summary> /// Retrieve the arguments of the last request operation. /// </summary> /// <returns></returns> public RequestInfo GetLastCopyRequestInfo() { using (var key = MainKey.OpenSubKey(LastArgumentsKey, RegistryKeyPermissionCheck.ReadWriteSubTree)) { if (key == null) { return(null); } return(new RequestInfo((string)key.GetValue("Operation"), (string)key.GetValue("Source"), (string)key.GetValue("Destiny")) { Content = RquestContent.All }); } }
/// <summary> /// Enter in register and get the errors logs path. /// </summary> /// <returns></returns> public string GetLogsDir() { //return Environment.CurrentDirectory; using (var key = MainKey.OpenSubKey(CompanyKey, RegistryKeyPermissionCheck.ReadWriteSubTree)) { if (key == null) { return(""); } object value = key.GetValue("LogsDir"); if (value == null) { return(Application.StartupPath); } return((string)value); } }
/// <summary> /// Enter in register and specific if there is any other NeathCopy runing. /// </summary> /// <returns></returns> public bool ExistAnyNeathCopy() { using (var key = MainKey.OpenSubKey(CompanyKey, RegistryKeyPermissionCheck.ReadWriteSubTree)) { if (key == null) { return(false); } object value = key.GetValue("Exist"); if (value == null) { return(false); } return((string)value == "1"); } }
/// <summary> /// Enter in register and the FilesList Path. /// FilesList is the files wich contains the files will be copied or moved. /// </summary> /// <returns></returns> public string GetFilesListPath() { //return Environment.CurrentDirectory; using (var key = MainKey.OpenSubKey(CompanyKey, RegistryKeyPermissionCheck.ReadWriteSubTree)) { if (key == null) { return(""); } object value = key.GetValue("FilesList"); if (value == null) { return(System.IO.Path.Combine(Application.StartupPath, "FilesList.txt")); } return((string)value); } }