Exemplo n.º 1
0
        /// <summary>
        /// This method store the information into registry
        /// </summary>
        /// <param name="regPath"></param>
        /// <returns></returns>
        private Boolean SaveValuesToPath(String regPath)
        {
            RegistryKey key = Registry.CurrentUser.CreateSubKey(regPath);

            if (key == null)
            {
                return(false);
            }
            else
            {
                // convert to regsz
                String strCheckForUpdate  = CheckForUpdate.ToString();
                String strLastCheckTime   = LastCheckTime.ToString();
                String strSkipThisVersion = SkipThisVersion.ToString();
                String strDidRunOnc       = DidRunOnce.ToString();
                String strProfileTime     = LastProfileUpdate.ToString();

                // set the values
                key.SetValue("CheckForUpdate", strCheckForUpdate, RegistryValueKind.String);
                key.SetValue("LastCheckTime", strLastCheckTime, RegistryValueKind.String);
                key.SetValue("SkipThisVersion", strSkipThisVersion, RegistryValueKind.String);
                key.SetValue("DidRunOnce", strDidRunOnc, RegistryValueKind.String);
                key.SetValue("LastProfileUpdate", strProfileTime, RegistryValueKind.String);

                return(true);
            }
        }
        /// <summary>
        /// This method store the information into registry
        /// </summary>
        /// <param name="regPath">the registry path</param>
        /// <returns><c>true</c> if the values were saved to the registry</returns>
        private void SaveValuesToPath(string regPath)
        {
            RegistryKey key = Registry.CurrentUser.CreateSubKey(regPath);

            if (key == null)
            {
                return;
            }
            // convert to regsz
            String strCheckForUpdate  = CheckForUpdate.ToString();
            String strLastCheckTime   = LastCheckTime.ToString(CultureInfo.InvariantCulture);
            String strSkipThisVersion = SkipThisVersion;
            String strDidRunOnc       = DidRunOnce.ToString();
            String strProfileTime     = LastProfileUpdate.ToString(CultureInfo.InvariantCulture);

            // set the values
            key.SetValue("CheckForUpdate", strCheckForUpdate, RegistryValueKind.String);
            key.SetValue("LastCheckTime", strLastCheckTime, RegistryValueKind.String);
            key.SetValue("SkipThisVersion", strSkipThisVersion, RegistryValueKind.String);
            key.SetValue("DidRunOnce", strDidRunOnc, RegistryValueKind.String);
            key.SetValue("LastProfileUpdate", strProfileTime, RegistryValueKind.String);
        }