Ejemplo n.º 1
0
        private void WriteValue(RegistryKey regKeyPath, RegistryItem regItem)
        {
            try
            {
                if (regKeyPath == null)
                {
                    throw new Exception("RegKeyPath is null for item " + regItem.Name + ".");
                }
                if (regItem.Name == String.Empty)
                {
                    throw new Exception("One or more of the values in " + regItem.Name + " are incomplete.");
                }

                try
                {
                    regKeyPath.SetValue(regItem.Name, regItem.Value, regItem.type);
                }
                catch (Exception ex)
                {
                    throw new Exception("Error writing " + regItem.Value + " to " + regItem.Name + " of type " + regItem.type.ToString() + " in the path of " + regKeyPath.Name + ". " + ex.Message);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error writing registry key. " + ex.Message);
            }
        }
 public EntryPointItem(String AppId, String AddIn, String Context, String DisplayName, String GUID, String Description, String ImageUrl, String InactiveImageUrl )
 {
     _AppID = new RegistryItem(AppIdName, RegistryValueKind.String, AppId);
     _AddIn = new RegistryItem(AddInName, RegistryValueKind.ExpandString, AddIn);
     _Title = new RegistryItem(TitleName, RegistryValueKind.ExpandString, DisplayName);
     _Context = new RegistryItem(ContextName, RegistryValueKind.ExpandString, Context);
     _GUID = GUID;
     _Description = new RegistryItem(DescriptionName, RegistryValueKind.ExpandString, Description);
     _ImageUrl = new RegistryItem(ImageUrlName, RegistryValueKind.ExpandString, ImageUrl);
     _InactiveImageUrl = new RegistryItem(InactiveImageUrlName, RegistryValueKind.ExpandString, InactiveImageUrl);
 }
Ejemplo n.º 3
0
 public EntryPointItem(String AppId, String AddIn, String Context, String DisplayName, String GUID, String Description, String ImageUrl, String InactiveImageUrl)
 {
     _AppID            = new RegistryItem(AppIdName, RegistryValueKind.String, AppId);
     _AddIn            = new RegistryItem(AddInName, RegistryValueKind.ExpandString, AddIn);
     _Title            = new RegistryItem(TitleName, RegistryValueKind.ExpandString, DisplayName);
     _Context          = new RegistryItem(ContextName, RegistryValueKind.ExpandString, Context);
     _GUID             = GUID;
     _Description      = new RegistryItem(DescriptionName, RegistryValueKind.ExpandString, Description);
     _ImageUrl         = new RegistryItem(ImageUrlName, RegistryValueKind.ExpandString, ImageUrl);
     _InactiveImageUrl = new RegistryItem(InactiveImageUrlName, RegistryValueKind.ExpandString, InactiveImageUrl);
 }
Ejemplo n.º 4
0
        private bool TestRegistryAccess()
        {
            try
            {
                RegistryKey key = Registry.LocalMachine.OpenSubKey(Constants.ENTRYPOINTS_REGISTRY_PATH + @"\" + Constants.MB_MAIN_ENTRYPOINT_GUID, true);

                RegistryItem items = ReadValue(key, EntryPointItem.TimeStampName);
                WriteValue(key, items);
            }
            catch (Exception ex)
            {
                Logger.ReportException("Failed when testing for regitry access", ex);
                return(false);
            }
            return(true);
        }
        private void WriteValue(RegistryKey regKeyPath, RegistryItem regItem)
        {
            try
            {
                if (regKeyPath == null)
                {
                    throw new Exception("RegKeyPath is null for item " + regItem.Name + ".");
                }
                if (regItem.Name == String.Empty)
                {
                    throw new Exception("One or more of the values in " + regItem.Name + " are incomplete.");
                }

                try
                {
                    regKeyPath.SetValue(regItem.Name, regItem.Value, regItem.type);
                }
                catch (Exception ex)
                {
                    throw new Exception("Error writing " + regItem.Value + " to " + regItem.Name + " of type " + regItem.type.ToString() + " in the path of " + regKeyPath.Name + ". " + ex.Message);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error writing registry key. " + ex.Message);
            }
        }
 public EntryPointItem(String DisplayName, String Context)
 {
     _Title = new RegistryItem(TitleName, RegistryValueKind.ExpandString, DisplayName);
     _Context = new RegistryItem(ContextName, RegistryValueKind.ExpandString, Context);
 }
 public void SetTitle(String title)
 {
     this._Title = new RegistryItem(TitleName, RegistryValueKind.ExpandString, title);
 }
 public void SetContext(String Context)
 {
     _Context = new RegistryItem(ContextName, RegistryValueKind.ExpandString, Context);
 }
Ejemplo n.º 9
0
 public EntryPointItem(String DisplayName, String Context)
 {
     _Title   = new RegistryItem(TitleName, RegistryValueKind.ExpandString, DisplayName);
     _Context = new RegistryItem(ContextName, RegistryValueKind.ExpandString, Context);
 }
Ejemplo n.º 10
0
 public void SetContext(String Context)
 {
     _Context = new RegistryItem(ContextName, RegistryValueKind.ExpandString, Context);
 }
Ejemplo n.º 11
0
 public void SetTitle(String title)
 {
     this._Title = new RegistryItem(TitleName, RegistryValueKind.ExpandString, title);
 }