Ejemplo n.º 1
0
 private static int Compare(SettingOverride override1, SettingOverride override2)
 {
     if (override1.WhenCreated == null && override2.WhenCreated != null)
     {
         return(1);
     }
     if (override1.WhenCreated != null && override2.WhenCreated == null)
     {
         return(-1);
     }
     if (override1.WhenCreated != null && override2.WhenCreated != null)
     {
         if (override1.WhenCreated < override2.WhenCreated)
         {
             return(1);
         }
         if (override1.WhenCreated > override2.WhenCreated)
         {
             return(-1);
         }
     }
     return(string.Compare(override1.Id.Name, override2.Id.Name, true));
 }
Ejemplo n.º 2
0
 public void SetName(string name, bool isFlight)
 {
     base.SetId(SettingOverride.GetContainerId(isFlight).GetChildId(name));
 }
Ejemplo n.º 3
0
 public static void Validate(VariantConfigurationOverride o, bool criticalOnly)
 {
     try
     {
         new VariantConfigurationOverrideValidation(o, criticalOnly).Validate();
     }
     catch (NullOverrideException innerException)
     {
         throw new SettingOverrideNullException(innerException);
     }
     catch (FlightNameValidationException ex)
     {
         throw new SettingOverrideInvalidFlightNameException(ex.Override.ComponentName, string.Join(", ", ex.AllowedValues), ex);
     }
     catch (ComponentNameValidationException ex2)
     {
         throw new SettingOverrideInvalidComponentNameException(ex2.Override.ComponentName, string.Join(", ", ex2.AllowedValues), ex2);
     }
     catch (SectionNameValidationException ex3)
     {
         throw new SettingOverrideInvalidSectionNameException(ex3.Override.ComponentName, ex3.Override.SectionName, string.Join(", ", ex3.AllowedValues), ex3);
     }
     catch (ParameterNameValidationException ex4)
     {
         throw new SettingOverrideInvalidParameterNameException(ex4.Override.ComponentName, ex4.Override.SectionName, ex4.ParameterName, string.Join(", ", ex4.AllowedValues), ex4);
     }
     catch (ParameterSyntaxValidationException ex5)
     {
         throw new SettingOverrideInvalidParameterSyntaxException(ex5.Override.ComponentName, ex5.Override.SectionName, ex5.ParameterLine, ex5);
     }
     catch (VariantNameValidationException ex6)
     {
         throw new SettingOverrideInvalidVariantNameException(ex6.Override.ComponentName, ex6.Override.SectionName, ex6.VariantName, string.Join(", ", ex6.AllowedValues), ex6);
     }
     catch (VariantValueValidationException ex7)
     {
         throw new SettingOverrideInvalidVariantValueException(ex7.Override.ComponentName, ex7.Override.SectionName, ex7.Value, ex7.Variant.Type.Name, ex7.Format, ex7);
     }
     catch (SyntaxValidationException ex8)
     {
         throw new SettingOverrideSyntaxException(ex8.Override.ComponentName, ex8.Override.SectionName, "@(\"" + string.Join("\", \"", Array.ConvertAll <string, string>(ex8.Override.Parameters, (string parameter) => parameter.Replace("\"", "^\""))) + "\")", (ex8.InnerException != null) ? ex8.InnerException.Message : ex8.Message, ex8);
     }
     catch (OverrideValidationException ex9)
     {
         throw new SettingOverrideGenericException(ex9.GetType().Name, ex9.Override.ComponentName, ex9.Override.SectionName, SettingOverride.FormatParameters(ex9.Override.Parameters), ex9);
     }
     catch (Exception ex10)
     {
         throw new SettingOverrideUnexpectedException(ex10.GetType().Name, ex10);
     }
 }
Ejemplo n.º 4
0
 public static void Validate(VariantConfigurationOverride o)
 {
     SettingOverride.Validate(o, false);
 }
Ejemplo n.º 5
0
 public SettingOverrideDiagnosticInfo(SettingOverride o, SettingOverrideSync.OverrideStatus status, SettingOverrideException e)
 {
     this.Override            = o;
     this.Status              = status;
     this.ValidationException = e;
 }
Ejemplo n.º 6
0
        private IEnumerable <SettingOverrideSync.SettingOverrideDiagnosticInfo> ReadOverrides()
        {
            ADOperationResult      adoperationResult = null;
            List <SettingOverride> list = new List <SettingOverride>();
            List <SettingOverrideSync.SettingOverrideDiagnosticInfo> list2 = new List <SettingOverrideSync.SettingOverrideDiagnosticInfo>();

            try
            {
                bool[] array = new bool[]
                {
                    default(bool),
                    true
                };
                for (int i = 0; i < array.Length; i++)
                {
                    SettingOverrideSync.< > c__DisplayClass1a CS$ < > 8__locals1 = new SettingOverrideSync.< > c__DisplayClass1a();
                    CS$ < > 8__locals1.isFlight = array[i];
                    SettingOverride[] adOverridesSubset = null;
                    adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate()
                    {
                        adOverridesSubset = this.session.Find <SettingOverride>(SettingOverride.GetContainerId(CS$ < > 8__locals1.isFlight), QueryScope.OneLevel, null, null, int.MaxValue);
                    }, 3);
                    if (adOverridesSubset != null)
                    {
                        list.AddRange(adOverridesSubset);
                    }
                }
            }
            catch (LocalizedException innerException)
            {
                throw new ConfigurationSettingsADConfigDriverException(innerException);
            }
            catch (InvalidOperationException innerException2)
            {
                throw new ConfigurationSettingsADConfigDriverException(innerException2);
            }
            if (!adoperationResult.Succeeded)
            {
                throw new ConfigurationSettingsADNotificationException(adoperationResult.Exception);
            }
            list.Sort(new Comparison <SettingOverride>(SettingOverrideSync.Compare));
            List <SettingOverrideException> list3 = new List <SettingOverrideException>();

            foreach (SettingOverride settingOverride in list)
            {
                if (!settingOverride.Applies)
                {
                    list2.Add(new SettingOverrideSync.SettingOverrideDiagnosticInfo(settingOverride, SettingOverrideSync.OverrideStatus.NotApplicable, null));
                }
                else
                {
                    try
                    {
                        SettingOverride.Validate(settingOverride.GetVariantConfigurationOverride(), true);
                    }
                    catch (SettingOverrideException ex)
                    {
                        list3.Add(ex);
                        list2.Add(new SettingOverrideSync.SettingOverrideDiagnosticInfo(settingOverride, SettingOverrideSync.OverrideStatus.Invalid, ex));
                        continue;
                    }
                    list2.Add(new SettingOverrideSync.SettingOverrideDiagnosticInfo(settingOverride, SettingOverrideSync.OverrideStatus.Accepted, null));
                }
            }
            this.HandleSettingOverrideException(list3);
            return(list2);
        }