コード例 #1
0
        public void Load(IVsSettingsReader reader, string valueName)
        {
            string value;

            reader.ReadSettingString(valueName, out value);
            this.Load(value, valueName);
        }
コード例 #2
0
        /// <summary>
        /// Loads our settings to the specified XML writer
        /// </summary>
        /// <param name="reader">The VsSettings reader we read ou values from</param>
        public override void LoadSettingsFromXml(IVsSettingsReader reader)
        {
            try
            {
                this.InitializeDefaults();
                string exePath, exeCmdLine;
                int    enablePreview;
                if (ErrorHandler.Succeeded(reader.ReadSettingString(RegPreviewExe, out exePath)) && !string.IsNullOrEmpty(exePath))
                {
                    this.PreviewToolExecutablePath = exePath;
                }

                if (ErrorHandler.Succeeded(reader.ReadSettingString(RegPreviewCmdLine, out exeCmdLine)) && !string.IsNullOrEmpty(exeCmdLine))
                {
                    this.PreviewToolCommandLine = exeCmdLine;
                }

                if (ErrorHandler.Succeeded(reader.ReadSettingBoolean(RegPreviewEnable, out enablePreview)))
                {
                    this.EnablePreview = enablePreview == 1;
                }
            }
            catch (Exception e)
            {
                Debug.Assert(false, "Error importing Slow Cheetah settings: " + e.Message);
            }
        }
コード例 #3
0
 public void LoadSettingsFromXml(IVsSettingsReader reader)
 {
     var service = Service;
     if (ValidateService(service)) {
         service.Load(reader);
     }
 }
コード例 #4
0
        public static string ReadSettingString(this IVsSettingsReader reader, string keyFormat, int index)
        {
            var    key = string.Format(keyFormat, index);
            string value;

            reader.ReadSettingString(key, out value);
            return(value);
        }
コード例 #5
0
ファイル: Settings.cs プロジェクト: yuzd/VS-QuickNavigation
        public void LoadSettingsFromXml(IVsSettingsReader reader)
        {
            string outValue;

            if (reader.ReadSettingString("ListedExtensions", out outValue) == VSConstants.S_OK)
            {
                ListedExtensionsString = outValue;
            }
        }
コード例 #6
0
        public void LoadSettingsFromXml(IVsSettingsReader reader)
        {
            var service = Service;

            if (ValidateService(service))
            {
                service.Load(reader);
            }
        }
コード例 #7
0
        /// <summary>
        /// Reads integer value from XML settings key
        /// </summary>
        protected int ReadIntFromXml(IVsSettingsReader reader, string name)
        {
            int p;
            int hr = reader.ReadSettingLong(name, out p);

            if (hr != VSConstants.S_OK)
            {
                reader.ReportError(name + " value cannot be read", (uint)__VSSETTINGSERRORTYPES.vsSettingsErrorTypeError);
            }
            return(p);
        }
コード例 #8
0
        public override void LoadSettingsFromXml(IVsSettingsReader reader)
        {
            var typeConverter = new ColorerFormatSettingsCollectionConverter();

            string buildSettingsString;
            reader.ReadSettingString("BuildOutputSettings", out buildSettingsString);

            if (!string.IsNullOrWhiteSpace(buildSettingsString))
                BuildOutputSettings = (Collection<ColorerFormatSetting>)typeConverter.ConvertFrom(buildSettingsString);

            string debugSettingsString;
            reader.ReadSettingString("BuildOutputSettings", out debugSettingsString);

            if (!string.IsNullOrWhiteSpace(buildSettingsString))
                BuildOutputSettings = (Collection<ColorerFormatSetting>)typeConverter.ConvertFrom(debugSettingsString);
        }
コード例 #9
0
ファイル: DialogPage.cs プロジェクト: Loong-Lee/VSDT
        // --------------------------------------------------------------------------------------------
        /// <summary>
        /// Writes a VSPackage's configuration to disk using the Visual Studio settings mechanism when
        /// the export option of an Import/Export Settings feature available on the IDE’s Tools menu
        /// is selected by a user.
        /// </summary>
        /// <remarks>
        /// This method is called when the dialog page should load its default settings from the
        /// profile XML file.
        /// </remarks>
        // --------------------------------------------------------------------------------------------
        public virtual void LoadSettingsFromXml(IVsSettingsReader reader)
        {
            _Initializing = true;
            try
            {
                object automationObject = AutomationObject;
                var    properties       = TypeDescriptor.GetProperties(automationObject,
                                                                       new Attribute[] { DesignerSerializationVisibilityAttribute.Visible });
                foreach (PropertyDescriptor property in properties)
                {
                    var converter = property.Converter;
                    if (converter.CanConvertTo(typeof(string)) && converter.CanConvertFrom(typeof(string)))
                    {
                        // --- read from the xml feed
                        object cv = null;
                        try
                        {
                            string value;
                            if (NativeMethods.Succeeded(reader.ReadSettingString(property.Name, out value)) && (value != null))
                            {
                                cv = property.Converter.ConvertFromInvariantString(value);
                            }
                        }
                        catch (Exception)
                        {
                            // --- ReadSettingString throws an exception if the property is not found and we also
                            // --- catch ConvertFromInvariantString exceptions so that we gracefully handle bad
                            // --- vssettings.
                            VsDebug.Fail("Error in ReadSettingsString ignored.");
                        }
                        // --- Not all values have to be present
                        if (cv != null)
                        {
                            property.SetValue(automationObject, cv);
                        }
                    }
                }
            }
            finally
            {
                _Initializing = false;
            }

            // --- Hook in properties
            HookProperties(true);
            OnPageDataLoaded();
        }
コード例 #10
0
        internal void Load(IVsSettingsReader reader, string key)
        {
            string temp;

            reader.ReadSettingAttribute(key, "ExtendInwardsOnly", out temp);
            ExtendInwardsOnly = bool.Parse(temp);
            reader.ReadSettingAttribute(key, "VisibleAligned", out temp);
            VisibleAligned = bool.Parse(temp);
            reader.ReadSettingAttribute(key, "VisibleUnaligned", out temp);
            VisibleUnaligned = bool.Parse(temp);
            reader.ReadSettingAttribute(key, "VisibleAtTextEnd", out temp);
            VisibleAtTextEnd = bool.Parse(temp);
            reader.ReadSettingAttribute(key, "VisibleEmpty", out temp);
            VisibleEmpty = bool.Parse(temp);
            reader.ReadSettingAttribute(key, "VisibleEmptyAtEnd", out temp);
            VisibleEmptyAtEnd = bool.Parse(temp);
        }
コード例 #11
0
        /// <summary>
        /// Loads settings from XML (on import settings)
        /// </summary>
        /// <param name="reader"></param>
        public override void LoadSettingsFromXml(IVsSettingsReader reader)
        {
            SettingsObject.Instance.IgnorePropertyChanges = true;

            SettingsObject.Instance.ReferenceUpdateInterval = ReadIntFromXml(reader, "ReferenceUpdateInterval");
            SettingsObject.Instance.BadKeyNamePolicy        = (BAD_KEY_NAME_POLICY)ReadIntFromXml(reader, "BadKeyNamePolicy");
            SettingsObject.Instance.OptimizeSpecialSequencesInTranslation = ReadBoolFromXml(reader, "OptimizeSpecialSequencesInTranslation");

            int count = ReadIntFromXml(reader, "LanguagesCount");

            for (int i = 0; i < count; i++)
            {
                string pair;
                int    hr = reader.ReadSettingString("Language" + i, out pair);
                if (hr != VSConstants.S_OK)
                {
                    reader.ReportError("Language value cannot be read", (uint)__VSSETTINGSERRORTYPES.vsSettingsErrorTypeError);
                }

                string[] arr = pair.Split(':');

                SettingsObject.Instance.LanguagePairs.Add(new SettingsObject.LanguagePair()
                {
                    FromLanguage = arr[0],
                    ToLanguage   = arr[1]
                });
            }

            string s;
            int    r = reader.ReadSettingString("BingAppId", out s);

            if (r != VSConstants.S_OK)
            {
                reader.ReportError("BingAppId value cannot be read", (uint)__VSSETTINGSERRORTYPES.vsSettingsErrorTypeError);
            }
            SettingsObject.Instance.BingAppId = s;
            if (string.IsNullOrEmpty(SettingsObject.Instance.BingAppId))
            {
                SettingsObject.Instance.BingAppId = null;
            }


            SettingsObject.Instance.IgnorePropertyChanges = false;
            SettingsObject.Instance.NotifySettingsLoaded();
        }
コード例 #12
0
ファイル: ProfileManager.cs プロジェクト: negrutiu/remarker
        public void LoadSettingsFromXml(IVsSettingsReader reader)
        {
            string valueKeysString;

            reader.ReadSettingString("ValueKeys", out valueKeysString);
            RemarkerService service = this.Service;

            foreach (var valueKey in valueKeysString.Split(';').Where(
                         valueKey => !string.IsNullOrWhiteSpace(valueKey)))
            {
                try
                {
                    service.Load(reader, valueKey);
                }
                catch (Exception)
                {
                }
            }
        }
コード例 #13
0
        /// <inheritdoc/>
        public override void LoadSettingsFromXml(IVsSettingsReader reader)
        {
            try
            {
                this.InitializeDefaults();

                if (ErrorHandler.Succeeded(reader.ReadSettingBoolean(RegPreviewEnable, out int enablePreview)))
                {
                    this.EnablePreview = enablePreview == 1;
                }

                if (ErrorHandler.Succeeded(reader.ReadSettingBoolean(RegDependentUpon, out int addDependentUpon)))
                {
                    this.AddDependentUpon = addDependentUpon == 1;
                }
            }
            catch (Exception e)
            {
                Debug.Assert(false, "Error importing Slow Cheetah settings: " + e.Message);
            }
        }
コード例 #14
0
        public static bool?ReadSettingStringToBoolean(this IVsSettingsReader reader, string keyFormat, int index)
        {
            var name = string.Format(keyFormat, index);
            int intValue;
            var readResult = reader.ReadSettingBoolean(name, out intValue);

            if (readResult == Microsoft.VisualStudio.VSConstants.S_OK)
            {
                return(Convert.ToBoolean(intValue));
            }

            // fallback for older settings
            var strValue = reader.ReadSettingString(keyFormat, index);

            if (strValue == null)
            {
                return(null);
            }
            bool rtn;

            return(bool.TryParse(strValue.ToLowerInvariant(), out rtn) && rtn);
        }
コード例 #15
0
ファイル: DialogPage.cs プロジェクト: Plankankul/SpecSharp
        /// <include file='doc\DialogPage.uex' path='docs/doc[@for="DialogPage.LoadSettingsFromXml"]' />
        /// <devdoc>
        ///     This method is called when the dialog page should load
        ///     its default settings from the profile XML file.
        /// </devdoc>
        public virtual void LoadSettingsFromXml(IVsSettingsReader reader)
        {
            _initializing = true;
            try {
                object automationObject = this.AutomationObject;
                PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(automationObject, new Attribute[] { DesignerSerializationVisibilityAttribute.Visible });

                foreach (PropertyDescriptor property in properties)
                {
                    TypeConverter converter = property.Converter;
                    if (converter.CanConvertTo(typeof(string)) && converter.CanConvertFrom(typeof(string)))
                    {
                        // read from the xml feed
                        string value = null;
                        object cv    = null;
                        try {
                            if (NativeMethods.Succeeded(reader.ReadSettingString(property.Name, out value)) && (value != null))
                            {
                                cv = property.Converter.ConvertFromInvariantString(value);
                            }
                        } catch (Exception) {
                            // ReadSettingString throws an exception if the property
                            // is not found and we also catch ConvertFromInvariantString
                            // exceptions so that we gracefully handle bad vssettings.
                        }
                        //not all values have to be present
                        if (cv != null)
                        {
                            property.SetValue(automationObject, cv);
                        }
                    }
                }
            }
            finally {
                _initializing = false; //we have loaded from storage
            }
            HookProperties(true);      //hook if this failed during construction.
        }
コード例 #16
0
        public void Load(IVsSettingsReader reader)
        {
            lock (_Themes) {
                _Themes.Clear();
                DefaultTheme = new IndentTheme();

                string themeKeysString;
                reader.ReadSettingString("Themes", out themeKeysString);

                foreach (var key in themeKeysString.Split(';'))
                {
                    if (string.IsNullOrWhiteSpace(key))
                    {
                        continue;
                    }

                    try {
                        var theme = IndentTheme.Load(reader, key);
                        if (theme.IsDefault)
                        {
                            DefaultTheme = theme;
                        }
                        else
                        {
                            _Themes[theme.ContentType] = theme;
                        }
                    } catch (Exception ex) {
                        Trace.WriteLine(string.Format("IndentGuide::LoadSettingsFromXML: {0}", ex));
                    }
                }

                int tempInt;
                reader.ReadSettingLong("Visible", out tempInt);
                Visible = (tempInt != 0);
            }

            OnThemesChanged();
        }
コード例 #17
0
 /// <summary>
 /// Loads settings from XML (on import settings)
 /// </summary>
 public override void LoadSettingsFromXml(IVsSettingsReader reader)
 {
 }
コード例 #18
0
        public static IndentTheme Load(IVsSettingsReader reader, string themeKey)
        {
            var theme = new IndentTheme();

            theme.ContentType = (themeKey == DefaultThemeName) ? null : themeKey;
            theme.Behavior.Load(reader, themeKey);
            string caretHandler;

            reader.ReadSettingString("CaretHandler", out caretHandler);
            theme.CaretHandler = caretHandler ?? DefaultCaretHandler;

            string subkeyNames, settingNames;

            ErrorHandler.ThrowOnFailure(reader.ReadSettingString(themeKey, out subkeyNames));
            if (!string.IsNullOrEmpty(subkeyNames))
            {
                foreach (var subkeyName in subkeyNames.Split(';'))
                {
                    if (string.IsNullOrEmpty(subkeyName))
                    {
                        continue;
                    }

                    int i = subkeyName.LastIndexOf('.');
                    if (i < 0)
                    {
                        continue;
                    }

                    var values = new Dictionary <string, string>();
                    if (ErrorHandler.Failed(reader.ReadSettingAttribute(subkeyName, "Keys", out settingNames)) ||
                        string.IsNullOrEmpty(settingNames))
                    {
                        settingNames = "LineStyle;LineColor;HighlightStyle;HighlightColor;Visible";
                    }
                    foreach (var setting in settingNames.Split(';'))
                    {
                        if (string.IsNullOrEmpty(subkeyName))
                        {
                            continue;
                        }
                        string value;
                        ErrorHandler.ThrowOnFailure(reader.ReadSettingAttribute(subkeyName, setting, out value));
                        if (!string.IsNullOrEmpty(value))
                        {
                            values[setting] = value;
                        }
                    }

                    var format = LineFormat.FromInvariantStrings(theme, values);
                    format.FormatIndexName = subkeyName.Substring(i + 1);
                    if (format.FormatIndex.HasValue)
                    {
                        theme.LineFormats[format.FormatIndex.GetValueOrDefault()] = format;
                    }
                    else
                    {
                        Trace.TraceWarning("{0}.{1} is not a valid format index.", themeKey, subkeyName);
                    }
                }
            }

            return(theme);
        }
コード例 #19
0
 public void LoadSettingsFromXml(IVsSettingsReader reader)
 {
     // We do not support import/export
 }
コード例 #20
0
 public void LoadSettingsFromXml(IVsSettingsReader reader)
 {
     throw new NotImplementedException();
 }
コード例 #21
0
        public void Load(IVsSettingsReader reader)
        {
            lock (_Themes) {
                _Themes.Clear();
                DefaultTheme = new IndentTheme();

                string themeKeysString;
                reader.ReadSettingString("Themes", out themeKeysString);

                foreach (var key in themeKeysString.Split(';')) {
                    if (string.IsNullOrWhiteSpace(key)) continue;

                    try {
                        var theme = IndentTheme.Load(reader, key);
                        if (theme.IsDefault) {
                            DefaultTheme = theme;
                        } else {
                            _Themes[theme.ContentType] = theme;
                        }
                    } catch (Exception ex) {
                        Trace.WriteLine(string.Format("IndentGuide::LoadSettingsFromXML: {0}", ex));
                    }
                }

                int tempInt;
                reader.ReadSettingLong("Visible", out tempInt);
                Visible = (tempInt != 0);
            }

            OnThemesChanged();
        }
コード例 #22
0
        /// <include file='doc\DialogPage.uex' path='docs/doc[@for="DialogPage.LoadSettingsFromXml"]' />
        /// <devdoc>
        ///     This method is called when the dialog page should load
        ///     its default settings from the profile XML file.  
        /// </devdoc>
        public virtual void LoadSettingsFromXml(IVsSettingsReader reader)
        {
            _initializing = true;
            try {
                object automationObject = this.AutomationObject;
                PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(automationObject, new Attribute[] {DesignerSerializationVisibilityAttribute.Visible});

                foreach(PropertyDescriptor property in properties) {
                    TypeConverter converter = property.Converter;
                    if (converter.CanConvertTo(typeof(string)) && converter.CanConvertFrom(typeof(string))) {
                        // read from the xml feed
                        string value = null;
                        object cv = null;
                        try {
                            if ( NativeMethods.Succeeded(reader.ReadSettingString(property.Name, out value)) && (value != null) )
                            {
                                cv = property.Converter.ConvertFromInvariantString(value);
                            }
                        } catch (Exception) {
                            // ReadSettingString throws an exception if the property
                            // is not found and we also catch ConvertFromInvariantString
                            // exceptions so that we gracefully handle bad vssettings.
                        }
                        //not all values have to be present
                        if (cv != null) {
                            property.SetValue(automationObject, cv);
                        }
                    }
                }
            }
            finally {
                _initializing = false;    //we have loaded from storage
            }
            HookProperties(true); //hook if this failed during construction.
        }
コード例 #23
0
 public void LoadSettingsFromXml(IVsSettingsReader reader)
 {
     // We do not support import/export
 }
コード例 #24
0
 public void LoadSettingsFromXml(IVsSettingsReader reader)
 {
 }
コード例 #25
0
ファイル: Package.cs プロジェクト: Graham-Pedersen/IronPlot
        /// <include file='doc\Package.uex' path='docs/doc[@for="Package.MigrateSettings"]' />
        /// <devdoc>
        ///     This method implements the IVsUserSettingsMigration Interface
        ///     used to bring forward user settings from a previous version.
        /// </devdoc>
        int IVsUserSettingsMigration.MigrateSettings(IVsSettingsReader reader, IVsSettingsWriter writer, string strPageGuid)
        {
            Debug.Assert(strPageGuid != null && strPageGuid.Length > 0, "Passed page guid cannot be null");
            Debug.Assert(reader != null, "IVsSettingsReader cannot be null");
            Debug.Assert(writer != null, "IVsSettingsWriter cannot be null");

            Guid requestPageGuid = Guid.Empty;

            try
            {
                requestPageGuid = new Guid(strPageGuid);
            }
            catch (FormatException)
            {
                // If this is thrown, it means strPageGuid is not really a GUID, but rather a
                // tools options page name like "Environment.General".
            }

            IProfileMigrator profileMigrator = null;

            if (requestPageGuid == Guid.Empty)
            {
                profileMigrator = GetAutomationObject(strPageGuid) as IProfileMigrator;
            }
            else
            {
                profileMigrator = GetProfileManager(requestPageGuid, ProfileManagerLoadAction.None) as IProfileMigrator;
            }

            if(profileMigrator != null) {
                profileMigrator.MigrateSettings(reader, writer);
            }
            return NativeMethods.S_OK;
        }
コード例 #26
0
        /// <summary>
        /// Loads settings from XML (on import settings)
        /// </summary>
        public override void LoadSettingsFromXml(IVsSettingsReader reader)
        {
            SettingsObject.Instance.IgnorePropertyChanges = true;

            SettingsObject.Instance.ShowContextColumn              = ReadBoolFromXml(reader, "ShowFilterContext");
            SettingsObject.Instance.UseReflectionInAsp             = ReadBoolFromXml(reader, "UseReflectionInAsp");
            SettingsObject.Instance.MarkNotLocalizableStringsIndex = ReadIntFromXml(reader, "MarkNotLocalizableStringsIndex");
            SettingsObject.Instance.NamespacePolicyIndex           = ReadIntFromXml(reader, "NamespacePolicyIndex");
            SettingsObject.Instance.BatchMoveSplitterDistance      = ReadIntFromXml(reader, "BatchMoveSplitterDistance");
            SettingsObject.Instance.SelectedKeyIndex    = ReadIntFromXml(reader, "SelectedKeyIndex");
            SettingsObject.Instance.SelectedUseFullName = ReadBoolFromXml(reader, "SelectedUseFullName");

            int    hr;
            string tmp;

            hr = reader.ReadSettingString("SelectedResourceFilePath", out tmp);
            SettingsObject.Instance.SelectedResourceFilePath = tmp;
            Marshal.ThrowExceptionForHR(hr);

            foreach (var pair in SettingsObject.Instance.CommonLocalizabilityCriteria)
            {
                LocalizationCommonCriterion crit = pair.Value;

                string val;
                hr = reader.ReadSettingString(crit.Name, out val);
                if (hr != VSConstants.S_OK)
                {
                    throw new Exception("Error retrieving data from XML.");
                }

                if (val != null)
                {
                    crit.FromRegData(val.ToString());
                }
            }

            SettingsObject.Instance.CustomLocalizabilityCriteria.Clear();
            int customCriteriaCount = 0;

            hr = reader.ReadSettingLong("CustomCriteriaCount", out customCriteriaCount);
            if (hr != VSConstants.S_OK)
            {
                throw new Exception("Error retrieving data from XML.");
            }

            for (int i = 0; i < customCriteriaCount; i++)
            {
                string val;
                hr = reader.ReadSettingString("CustomCriteria" + i, out val);

                if (val != null)
                {
                    LocalizationCustomCriterion crit = new LocalizationCustomCriterion(LocalizationCriterionAction.VALUE, 0);
                    crit.FromRegData(val.ToString());
                    SettingsObject.Instance.CustomLocalizabilityCriteria.Add(crit);
                }
            }

            SettingsObject.Instance.IgnorePropertyChanges = false;
            SettingsObject.Instance.NotifySettingsLoaded();
        }
コード例 #27
0
ファイル: Package.cs プロジェクト: hesam/SketchSharp
        /// <include file='doc\Package.uex' path='docs/doc[@for="Package.ImportSettings"]' />
        /// <devdoc>
        ///     This method implements the IVsUserSettings Interface
        ///     used to manage profiles and import/export settings
        ///     to XML files.
        /// </devdoc>
        int IVsUserSettings.ImportSettings(string strPageGuid, IVsSettingsReader reader, uint flags, ref int restartRequired) {
            
            // nobody should require a restart...
            if(restartRequired > 0)
                restartRequired = 0;

            Debug.Assert(strPageGuid != null && strPageGuid.Length > 0, "Passed page guid cannot be null");
            Debug.Assert(reader != null, "IVsSettingsReader cannot be null");

            bool loadPropsFromRegistry = (flags & (uint)__UserSettingsFlags.USF_ResetOnImport) == 0;

            Guid requestPageGuid = new Guid(strPageGuid);
            IProfileManager profileManager = GetProfileManager(requestPageGuid, loadPropsFromRegistry);
            if(profileManager != null) {
                // we get the live instance (if any) when we load
                profileManager.LoadSettingsFromXml(reader);
                // update the store
                profileManager.SaveSettingsToStorage();
            }
            return NativeMethods.S_OK;
        }
コード例 #28
0
 public void LoadSettingsFromXml(IVsSettingsReader reader)
 {
     throw new NotImplementedException();
 }
コード例 #29
0
        // based on information from : https://github.com/hesam/SketchSharp/blob/master/SpecSharp/SpecSharp/Microsoft.VisualStudio.Shell/DialogPage.cs
        public override void LoadSettingsFromXml(IVsSettingsReader reader)
        {
            int multiMatch;

            reader.ReadSettingLong(ATASettings.Keys.AttachDescriptorDefaultMultipleMatchHandling, out multiMatch);
            MultipleMatchHandlingDefault = multiMatch == 0 ? MultiMatchOptionsGlobal.All: (MultiMatchOptionsGlobal)multiMatch;

            var items = new List <AttachDescriptor>();

            try
            {
                for (var i = 0; i < ATAConstants.MaxCommands; i++)
                {
                    // read from the xml feed
                    var item = new AttachDescriptor();
                    try
                    {
                        var value = reader.ReadSettingString(ATASettings.Keys.AttachDescriptorName, i);
                        if (value != null)
                        {
                            item.Name = value;
                        }

                        var enabled = reader.ReadSettingStringToBoolean(ATASettings.Keys.AttachDescriptorEnabled, i);
                        if (enabled.HasValue)
                        {
                            item.Enabled = enabled.Value;
                        }

                        var multiMatchHandling = reader.ReadSettingLong(ATASettings.Keys.AttachDescriptorMultipleMatchHandling, i);
                        item.MultiMatchHandling = multiMatchHandling == 0 ? MultiMatchOptions.Global : (MultiMatchOptions)multiMatch;

                        value = reader.ReadSettingString(ATASettings.Keys.AttachDescriptorProcessNames, i);
                        if (value != null)
                        {
                            item.ProcessNames = value.Split(new[] { ATAConstants.ProcessNamesSeparator[0] }, StringSplitOptions.RemoveEmptyEntries);
                        }

                        var parsedBool = reader.ReadSettingStringToBoolean(ATASettings.Keys.AttachDescriptorIsProcessNamesRegex, i);
                        if (parsedBool.HasValue)
                        {
                            item.IsProcessNamesRegex = parsedBool.Value;
                        }

                        value = reader.ReadSettingString(ATASettings.Keys.AttachDescriptorUsername, i);
                        if (value != null)
                        {
                            item.Username = value;
                        }

                        parsedBool = reader.ReadSettingStringToBoolean(ATASettings.Keys.AttachDescriptorIsUsernameRegex, i);
                        if (parsedBool.HasValue)
                        {
                            item.IsUsernameRegex = parsedBool.Value;
                        }

                        value = reader.ReadSettingString(ATASettings.Keys.AttachDescriptorAppPool, i);
                        if (value != null)
                        {
                            item.AppPool = value;
                        }

                        parsedBool = reader.ReadSettingStringToBoolean(ATASettings.Keys.AttachDescriptorIsAppPoolRegex, i);
                        if (parsedBool.HasValue)
                        {
                            item.IsAppPoolRegex = parsedBool.Value;
                        }
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine($"Unhandled exception in LoadSettingsFromXml:{ex}");
                    }

                    if (!string.IsNullOrWhiteSpace(item.Name) && item.ProcessNames != null && item.ProcessNames.Any())
                    {
                        items.Add(item);
                    }
                    else
                    {
                        // this ensures it is a clean item if any of the other properties were saved previously.
                        items.Add(new AttachDescriptor());
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"Unhandled exception in LoadSettingsFromXml:{ex}");
            }
            Attachables = new ReadOnlyCollection <AttachDescriptor>(items);
            // notify of newly loaded settings
            OnSettingsLoaded(EventArgs.Empty);
            base.LoadSettingsFromXml(reader);
        }