Esempio n. 1
0
        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)
            {
            }
        }
Esempio n. 2
0
        internal static void Uninstall(string appName)
        {
            CheckParameterValidity(appName);

            if (!IsInstalled(appName))
            {
                return;
            }

            MainKey.DeleteSubKeyTree(appName);
        }
Esempio n. 3
0
        public override string ToString()
        {
            string str = string.Empty;

            if (SpecialKey != 0)
            {
                str += SpecialKey.ToString() + " + ";
            }
            str += MainKey.ToString();
            return(str);
        }
Esempio n. 4
0
 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);
     }
 }
Esempio n. 5
0
        /// <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");
            }
        }
Esempio n. 6
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());
            }
        }
Esempio n. 7
0
        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);
            }
        }
Esempio n. 8
0
        /// <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));
            }
        }
Esempio n. 9
0
        /// <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]);
            }
        }
Esempio n. 10
0
        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");
            }
        }
Esempio n. 11
0
        /// <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
                });
            }
        }
Esempio n. 12
0
        /// <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");
            }
        }
Esempio n. 13
0
        /// <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);
            }
        }
Esempio n. 14
0
        /// <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);
            }
        }
Esempio n. 15
0
        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;
        }
Esempio n. 17
0
        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);
 }