Exemplo n.º 1
0
        protected override void InternalSave(ConfigurableObject instance)
        {
            XsoMailboxConfigurationObject configObject = (XsoMailboxConfigurationObject)instance;
            HashSet <string> hashSet = new HashSet <string>(from x in configObject.Schema.AllProperties
                                                            where x is XsoDictionaryPropertyDefinition && configObject.IsModified((XsoDictionaryPropertyDefinition)x)
                                                            select((XsoDictionaryPropertyDefinition)x).UserConfigurationName);

            foreach (string userConfigurationName in hashSet)
            {
                this.SaveConfigObjectToUserConfiguration(userConfigurationName, configObject);
            }
        }
Exemplo n.º 2
0
        private void SaveConfigObjectToUserConfiguration(string userConfigurationName, XsoMailboxConfigurationObject configObject)
        {
            bool flag = false;
            int  num  = 0;

            do
            {
                using (IUserConfiguration userConfiguration = this.getUserConfiguration(base.MailboxSession, userConfigurationName, UserConfigurationTypes.Dictionary, !flag))
                {
                    if (userConfiguration != null)
                    {
                        IDictionary dictionary;
                        try
                        {
                            dictionary = userConfiguration.GetDictionary();
                        }
                        catch (CorruptDataException)
                        {
                            ExTraceGlobals.StorageTracer.TraceDebug <IExchangePrincipal>((long)this.GetHashCode(), "The calendar configuration for {0} is corrupt", base.MailboxSession.MailboxOwner);
                            dictionary = new ConfigurationDictionary();
                        }
                        catch (VirusDetectedException)
                        {
                            ExTraceGlobals.StorageTracer.TraceDebug <IExchangePrincipal>((long)this.GetHashCode(), "The calendar configuration for {0} is virus infected.", base.MailboxSession.MailboxOwner);
                            dictionary = new ConfigurationDictionary();
                        }
                        foreach (PropertyDefinition propertyDefinition in configObject.Schema.AllProperties)
                        {
                            XsoDictionaryPropertyDefinition xsoDictionaryPropertyDefinition = propertyDefinition as XsoDictionaryPropertyDefinition;
                            if (xsoDictionaryPropertyDefinition != null && !xsoDictionaryPropertyDefinition.IsReadOnly && !(xsoDictionaryPropertyDefinition.UserConfigurationName != userConfigurationName) && configObject.IsModified(xsoDictionaryPropertyDefinition))
                            {
                                object obj = configObject[xsoDictionaryPropertyDefinition];
                                if (obj == null || (obj is ICollection && ((ICollection)obj).Count == 0))
                                {
                                    dictionary.Remove(xsoDictionaryPropertyDefinition.Name);
                                }
                                else
                                {
                                    dictionary[xsoDictionaryPropertyDefinition.Name] = StoreValueConverter.ConvertValueToStore(obj);
                                }
                            }
                        }
                        try
                        {
                            ExTraceGlobals.FaultInjectionTracer.TraceTest(4289080637U);
                            userConfiguration.Save();
                            break;
                        }
                        catch (ObjectExistedException)
                        {
                            if (flag)
                            {
                                throw;
                            }
                            flag = true;
                        }
                        catch (SaveConflictException)
                        {
                            if (num >= 5)
                            {
                                throw;
                            }
                            num++;
                            flag = true;
                        }
                    }
                }
            }while (flag);
        }