public void Init() { try { RegistryKey MainKey; MainKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Crow Canyon\Sharepoint\Custom Fields"); if (MainKey == null) { MainKey = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Crow Canyon\Sharepoint\Custom Fields", RegistryKeyPermissionCheck.ReadWriteSubTree); } if (MainKey.GetValue("EnableTraceLog", null) == null) { MainKey.SetValue("EnableTraceLog", "true"); } if (MainKey.GetValue("TraceLog Folder Path", null) == null) { MainKey.SetValue("TraceLog Folder Path", this.GetFolderPath()); } if (MainKey.GetValue("TraceLog Level (Information/Error)", null) == null) { MainKey.SetValue("TraceLog Level (Information/Error)", "Error"); } bInitialized = true; } catch (System.Exception) { } }
internal static void Uninstall(string appName) { CheckParameterValidity(appName); if (!IsInstalled(appName)) { return; } MainKey.DeleteSubKeyTree(appName); }
public override string ToString() { string str = string.Empty; if (SpecialKey != 0) { str += SpecialKey.ToString() + " + "; } str += MainKey.ToString(); return(str); }
public override int GetHashCode() { unchecked { var hashCode = Build.GetHashCode(); hashCode = hashCode * 397 ^ MainKey.GetHashCode(); hashCode = hashCode * 397 ^ DynamicKeys.GetHashCode(); hashCode = hashCode * 397 ^ Updated.GetHashCode(); return(hashCode); } }
/// <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()); } }
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> /// 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)); } }
/// <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]); } }
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> /// 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 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 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 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); } }
internal static void Install(string appName, Version version, bool reinstall = false) { CheckParameterValidity(appName, version); if (reinstall) { Uninstall(appName, version); } if (!IsInstalled(appName)) { MainKey.CreateSubKey(appName + "\\" + "Version_" + version.ToVersionString()); } //if (!IsInstalled(appName, version)) { // RegistryKey registryKey = AppKey(appName); // AppKey(appName).CreateSubKey("Version_" + version.ToVersionString()); // TODO!!!! //} }
public static bool IsCorrespondingKeyCode(MainKey key, int code) { Enum keyEnum = (Enum)key; FieldInfo fieldInfo = keyEnum.GetType().GetField(keyEnum.ToString()); object[] attribArray = fieldInfo.GetCustomAttributes(false); foreach (object attr in attribArray) { if (attr is CorrespondingKeyCodeAttribute) { var corCode = attr as CorrespondingKeyCodeAttribute; if (corCode.Code == code) { return true; } } } return false; }
internal static bool IsInstalled(string appName) { CheckParameterValidity(appName); return(MainKey.GetSubKeyNames().Contains(appName)); }
public bool RegisterHotKey(MainKey main, int second) { return SetupHotKey(_host.Handle, (int)main, second); }