Exemplo n.º 1
0
        // Token: 0x06000987 RID: 2439 RVA: 0x00043410 File Offset: 0x00041610
        public FormValue LookupForm(FormKey formKey)
        {
            ExTraceGlobals.FormsRegistryCallTracer.TraceDebug <string>((long)this.GetHashCode(), "FormsRegistry.LookupForm in registry {0}", this.name);
            if (!this.forms.ContainsKey(formKey))
            {
                ExTraceGlobals.FormsRegistryDataTracer.TraceDebug <FormKey>((long)this.GetHashCode(), "FormsRegistry.LookupForm - no form found - key = ({0})", formKey);
                return(null);
            }
            FormValue formValue = this.forms[formKey];

            ExTraceGlobals.FormsRegistryDataTracer.TraceDebug <object, FormKey>((long)this.GetHashCode(), "FormsRegistry.LookupForm - found form - form = {0}, key = ({1})", formValue.Value, formKey);
            return(formValue);
        }
Exemplo n.º 2
0
 public FormValue this[FormKey formKey]
 {
     get
     {
         string text = this.FindMatchingKeyClass(formKey, this.matchMode);
         if (text == null)
         {
             return(null);
         }
         string @class = formKey.Class;
         formKey.Class = text;
         FormValue result = this.formDictionary[formKey];
         formKey.Class = @class;
         return(result);
     }
 }
        private static FormValue LookupFormInExperiences(FormKey formKey, Experience[] experiences)
        {
            ExTraceGlobals.FormsRegistryCallTracer.TraceDebug <FormKey>(0L, "FormsRegistryManager.LookupFormInExperiences key = {0}", formKey);
            FormValue formValue = null;
            int       num       = experiences.Length;

            for (int i = 0; i < num; i++)
            {
                Experience experience = experiences[i];
                formKey.Experience = experience.Name;
                formValue          = experience.FormsRegistry.LookupForm(formKey);
                if (formValue != null)
                {
                    break;
                }
            }
            return(formValue);
        }
        public static FormValue LookupForm(FormKey formKey, Experience[] experiences)
        {
            ExTraceGlobals.FormsRegistryCallTracer.TraceDebug <FormKey>(0L, "FormsRegistryManager.LookupForm key = {0}", formKey);
            if (experiences == null)
            {
                throw new ArgumentNullException("experiences", "There must be at least one experience provided");
            }
            if (experiences.Length == 0)
            {
                throw new ArgumentOutOfRangeException("experiences", "There must be at least one experience provided");
            }
            FormValue formValue = FormsRegistryManager.LookupFormInExperiences(formKey, experiences);

            if (formValue == null)
            {
                ExTraceGlobals.FormsRegistryTracer.TraceDebug(0L, "Downgrading state to wildcard");
                formKey.State = string.Empty;
                formValue     = FormsRegistryManager.LookupFormInExperiences(formKey, experiences);
                if (formValue == null)
                {
                    ExTraceGlobals.FormsRegistryTracer.TraceDebug(0L, "Downgrading action to wildcard");
                    string action = formKey.Action;
                    formKey.Action = string.Empty;
                    formValue      = FormsRegistryManager.LookupFormInExperiences(formKey, experiences);
                    if (formValue == null)
                    {
                        ExTraceGlobals.FormsRegistryTracer.TraceDebug(0L, "Downgrading class to wildcard");
                        formKey.Class  = string.Empty;
                        formKey.Action = action;
                        ExTraceGlobals.FormsRegistryTracer.TraceDebug(0L, "Restoring action");
                        formValue = FormsRegistryManager.LookupFormInExperiences(formKey, experiences);
                        if (formValue == null)
                        {
                            formKey.Action = string.Empty;
                            ExTraceGlobals.FormsRegistryTracer.TraceDebug(0L, "Downgrading action to wildcard");
                            formValue = FormsRegistryManager.LookupFormInExperiences(formKey, experiences);
                        }
                    }
                }
            }
            return(formValue);
        }
Exemplo n.º 5
0
        // Token: 0x06000986 RID: 2438 RVA: 0x000432FC File Offset: 0x000414FC
        public void AddPreForm(FormKey formKey, string preFormTypeString, ulong segmentationFlags)
        {
            if (formKey == null)
            {
                throw new OwaInvalidInputException("Formkey is empty", null, this);
            }
            if (preFormTypeString == null)
            {
                throw new OwaInvalidInputException("preFormTypeString is empty", null, this);
            }
            ExTraceGlobals.FormsRegistryCallTracer.TraceDebug <string>((long)this.GetHashCode(), "FormsRegistry.AddPreForm - looking up type - typestring = ({0})", preFormTypeString);
            Type type = null;

            try
            {
                type = Type.GetType(preFormTypeString, true);
            }
            catch (TypeLoadException)
            {
                throw new OwaInvalidInputException("A forms registry preform type must be inherited from IPreformAction Interface - failed loading Class " + preFormTypeString, null, this);
            }
            catch (TargetInvocationException)
            {
                throw new OwaInvalidInputException("A forms registry preform type must be inherited from IPreformAction Interface - failed loading Class " + preFormTypeString, null, this);
            }
            if (type.IsClass && typeof(IPreFormAction).IsAssignableFrom(type))
            {
                this.AddFormDictionaryEntry(formKey, new FormValue(type, segmentationFlags, this.isCustomRegistry));
                ExTraceGlobals.FormsRegistryDataTracer.TraceDebug <string>((long)this.GetHashCode(), "FormsRegistry.AddPreForm - added type - type = ({0})", type.FullName);
                return;
            }
            string message = "A forms registry preform type must be inherited from IPreformAction Interface - failed loading Class " + preFormTypeString;

            ExTraceGlobals.FormsRegistryTracer.TraceDebug <string>((long)this.GetHashCode(), "FormsRegistry.AddPreForm - failed to add type - type = ({0})", type.FullName);
            throw new OwaInvalidInputException(message, null, this);
        }
Exemplo n.º 6
0
 public override bool Equals(object value)
 {
     return(FormKey.Equals(value, this));
 }
Exemplo n.º 7
0
        private void ParseElementClass(string experience, ApplicationElement applicationElement)
        {
            ExTraceGlobals.FormsRegistryCallTracer.TraceDebug((long)this.GetHashCode(), "FormsRegistryParser.ParseElementClass");
            bool   flag      = false;
            string itemClass = string.Empty;

            if (this.reader.MoveToAttribute(FormsRegistryParser.nameTableValues[14]))
            {
                itemClass = this.reader.Value;
            }
            ulong num = 0UL;

            if (this.reader.MoveToAttribute(FormsRegistryParser.nameTableValues[18]))
            {
                num = this.ParseRequiredFeatures(this.reader.Value);
            }
            while (!flag && this.reader.Read())
            {
                XmlNodeType nodeType = this.reader.NodeType;
                if (nodeType != XmlNodeType.Element)
                {
                    if (nodeType == XmlNodeType.EndElement)
                    {
                        if (this.reader.Name == FormsRegistryParser.nameTableValues[12])
                        {
                            flag = true;
                        }
                    }
                }
                else
                {
                    if (this.reader.Name == FormsRegistryParser.nameTableValues[13])
                    {
                        string text              = string.Empty;
                        string action            = string.Empty;
                        string state             = string.Empty;
                        ulong  segmentationFlags = num;
                        if (this.reader.MoveToAttribute(FormsRegistryParser.nameTableValues[16]))
                        {
                            action = this.reader.Value;
                        }
                        if (this.reader.MoveToAttribute(FormsRegistryParser.nameTableValues[17]))
                        {
                            state = this.reader.Value;
                        }
                        if (this.reader.MoveToAttribute(FormsRegistryParser.nameTableValues[18]))
                        {
                            segmentationFlags = this.ParseRequiredFeatures(this.reader.Value);
                        }
                        if (!this.reader.MoveToAttribute(FormsRegistryParser.nameTableValues[15]))
                        {
                            this.ThrowExpectedAttributeException(FormsRegistryParser.NameTableValues.Form);
                        }
                        text = this.reader.Value;
                        FormKey formKey = new FormKey(experience, applicationElement, itemClass, action, state);
                        ExTraceGlobals.FormsRegistryDataTracer.TraceDebug <FormKey, string>((long)this.GetHashCode(), "Parsed Mapping - key = ({0}), form = {1}", formKey, text);
                        try
                        {
                            if (applicationElement == ApplicationElement.PreFormAction)
                            {
                                this.registry.AddPreForm(formKey, text, segmentationFlags);
                            }
                            else
                            {
                                this.registry.AddForm(formKey, text, segmentationFlags);
                            }
                            continue;
                        }
                        catch (OwaInvalidInputException ex)
                        {
                            OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_FormsRegistryParseError, ex.Message, new object[]
                            {
                                this.registryFile,
                                this.reader.LineNumber.ToString(CultureInfo.InvariantCulture),
                                this.reader.LinePosition.ToString(CultureInfo.InvariantCulture),
                                ex.Message
                            });
                            throw ex;
                        }
                    }
                    this.ThrowExpectedElementException(FormsRegistryParser.NameTableValues.Mapping);
                }
            }
        }
Exemplo n.º 8
0
        private string FindMatchingKeyClass(FormKey formKey, FormDictionary.MatchMode matchMode)
        {
            ExTraceGlobals.FormsRegistryCallTracer.TraceDebug((long)this.GetHashCode(), "FormDictionary.FindMatchingKeyClass");
            if (this.formDictionary.ContainsKey(formKey))
            {
                ExTraceGlobals.FormsRegistryDataTracer.TraceDebug <string>((long)this.GetHashCode(), "FindMatchingKeyClass found exact key match, MessageClass = '{0}'", formKey.Class);
                return(formKey.Class);
            }
            string text = null;

            if (matchMode == FormDictionary.MatchMode.DowngradeMatch)
            {
                ExTraceGlobals.FormsRegistryTracer.TraceDebug <string>((long)this.GetHashCode(), "FormDictionary is doing the down-grade lookup, MessageClass = '{0}'", formKey.Class);
                string @class = formKey.Class;
                string text2  = null;
                int    num    = @class.LastIndexOf('.');
                int    num2;
                if (@class.StartsWith("REPORT.", StringComparison.OrdinalIgnoreCase))
                {
                    num2  = @class.IndexOf('.', "REPORT.".Length);
                    text2 = @class.Substring(num);
                }
                else
                {
                    num2 = @class.IndexOf('.');
                }
                if (num2 < 0 || num2 == num)
                {
                    return(null);
                }
                string text3 = formKey.Class = @class.Substring(0, num);
                while (!this.formDictionary.ContainsKey(formKey))
                {
                    num2 = ((text2 == null) ? text3.IndexOf('.') : text3.IndexOf('.', "REPORT.".Length));
                    num  = text3.LastIndexOf('.');
                    if (num2 >= 0 && num2 != num)
                    {
                        formKey.Class = text3.Substring(0, num);
                        text3         = formKey.Class;
                        if (text2 == null)
                        {
                            continue;
                        }
                        string class2 = formKey.Class;
                        formKey.Class += text2;
                        if (!this.formDictionary.ContainsKey(formKey))
                        {
                            formKey.Class = class2;
                            continue;
                        }
                        text = formKey.Class;
                    }
IL_17C:
                    formKey.Class = @class;
                    goto IL_183;
                }
                text = formKey.Class;
                goto IL_17C;
            }
IL_183:
            ExTraceGlobals.FormsRegistryDataTracer.TraceDebug <string>((long)this.GetHashCode(), "FormDictionary is returning the down-graded MessageClass: '{0}'", text);
            return(text);
        }
Exemplo n.º 9
0
 public void Add(FormKey formKey, FormValue formValue)
 {
     this.formDictionary.Add(formKey, formValue);
 }
Exemplo n.º 10
0
 public bool ContainsKey(FormKey formKey, FormDictionary.MatchMode matchMode)
 {
     return(this.FindMatchingKeyClass(formKey, matchMode) != null);
 }
Exemplo n.º 11
0
 public bool ContainsKey(FormKey formKey)
 {
     return(this.FindMatchingKeyClass(formKey, this.matchMode) != null);
 }