private static Type SearchRequest(TagTestItem key)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            WatcherComposer watcherComposer = key._0001();

            switch (watcherComposer)
            {
            case WatcherComposer.Integer:
            case WatcherComposer.Float:
            case WatcherComposer.String:
            case WatcherComposer.Boolean:
            case WatcherComposer.Date:
            case WatcherComposer.Bytes:
                return(key._0001());

            case WatcherComposer.Null:
            case WatcherComposer.Undefined:
            case WatcherComposer.EndArray:
                return(typeof(string));

            case WatcherComposer.StartArray:
                key.SortError();
                if (key._0001() == WatcherComposer.StartObject)
                {
                    return(typeof(DataTable));
                }
                return(SearchRequest(key).MakeArrayType());

            default:
                throw StrategyError.PatchComposer(key, "Unexpected JSON token when reading DataTable: {0}".ListReader(CultureInfo.InvariantCulture, watcherComposer));
            }
        }
        private object ChangeRequest(TagTestItem reference)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            IDictionary <string, object> dictionary = new ExpandoObject();

            while (reference._0001())
            {
                switch (reference._0001())
                {
                case WatcherComposer.PropertyName:
                {
                    string key = reference._0001().ToString();
                    if (!reference._0001())
                    {
                        throw StrategyError.PatchComposer(reference, "Unexpected end when reading ExpandoObject.");
                    }
                    object obj2 = dictionary[key] = RemoveRequest(reference);
                    break;
                }

                case WatcherComposer.EndObject:
                    return(dictionary);
                }
            }
            throw StrategyError.PatchComposer(reference, "Unexpected end when reading ExpandoObject.");
        }
        public override object _0001(TagTestItem info, Type b, object c, PrototypeError asset2)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            if (info._0001() == WatcherComposer.Null)
            {
                return(null);
            }
            DataTable dataTable = c as DataTable;

            if (dataTable == null)
            {
                dataTable = ((b == typeof(DataTable)) ? new DataTable() : ((DataTable)Activator.CreateInstance(b)));
            }
            if (info._0001() == WatcherComposer.PropertyName)
            {
                dataTable.TableName = (string)info._0001();
                info.SortError();
                if (info._0001() == WatcherComposer.Null)
                {
                    return(dataTable);
                }
            }
            if (info._0001() != WatcherComposer.StartArray)
            {
                throw StrategyError.PatchComposer(info, "Unexpected JSON token when reading DataTable. Expected StartArray, got {0}.".ListReader(CultureInfo.InvariantCulture, info._0001()));
            }
            info.SortError();
            while (info._0001() != WatcherComposer.EndArray)
            {
                RestartRequest(info, dataTable, asset2);
                info.SortError();
            }
            return(dataTable);
        }
        private byte[] RegisterRequest(TagTestItem spec)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            List <byte> list = new List <byte>();

            while (spec._0001())
            {
                switch (spec._0001())
                {
                case WatcherComposer.Integer:
                    list.Add(Convert.ToByte(spec._0001(), CultureInfo.InvariantCulture));
                    break;

                case WatcherComposer.EndArray:
                    return(list.ToArray());

                default:
                    throw StrategyError.PatchComposer(spec, "Unexpected token when reading bytes: {0}".ListReader(CultureInfo.InvariantCulture, spec._0001()));

                case WatcherComposer.Comment:
                    break;
                }
            }
            throw StrategyError.PatchComposer(spec, "Unexpected end when reading bytes.");
        }
Example #5
0
 internal void SortError()
 {
     //Discarded unreachable code: IL_0002
     //IL_0003: Incompatible stack heights: 0 vs 1
     if (!this._0001())
     {
         throw StrategyError.PatchComposer(this, "Unexpected end when reading JSON.");
     }
 }
Example #6
0
 internal void CallError(ProcTest first, bool iscaller)
 {
     //Discarded unreachable code: IL_0002
     //IL_0003: Incompatible stack heights: 0 vs 1
     if (!PublishError(first, iscaller))
     {
         throw StrategyError.PatchComposer(this, "Unexpected end when reading JSON.");
     }
 }
Example #7
0
        private void SortRequest(TagTestItem spec, AttrBroadcasterFilter connection, CreatorIssuer template, string pred2, XmlNamespaceManager connection3)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            if (SetterTest.StartReader(pred2))
            {
                throw StrategyError.PatchComposer(spec, "XmlNodeConverter cannot convert JSON with an empty property name to XML.");
            }
            Dictionary <string, string> token = null;
            string asset = null;

            if (!_0005())
            {
                token = (CheckIterator(spec) ? DisableIterator(spec, connection3) : null);
                asset = CustomerListAnnotation.CountIssuer(pred2);
                if (pred2.ExcludeReader('@'))
                {
                    string text      = pred2.Substring(1);
                    string reference = CustomerListAnnotation.CountIssuer(text);
                    PublishRequest(spec, connection, template, pred2, text, connection3, reference);
                    return;
                }
                if (pred2.ExcludeReader('$'))
                {
                    switch (pred2)
                    {
                    case "$values":
                        pred2 = pred2.Substring(1);
                        asset = connection3.LookupPrefix("http://james.newtonking.com/projects/json");
                        CallRequest(spec, connection, template, pred2, connection3, asset, token);
                        return;

                    case "$id":
                    case "$ref":
                    case "$type":
                    case "$value":
                    {
                        string v          = pred2.Substring(1);
                        string reference2 = connection3.LookupPrefix("http://james.newtonking.com/projects/json");
                        PublishRequest(spec, connection, template, pred2, v, connection3, reference2);
                        return;
                    }
                    }
                }
            }
            else if (CheckIterator(spec))
            {
                spec.SortError();
            }
            CallRequest(spec, connection, template, pred2, connection3, asset, token);
        }
Example #8
0
        private static void PublishRequest(TagTestItem def, AttrBroadcasterFilter cont, CreatorIssuer consumer, string res2, string v3, XmlNamespaceManager value4, string reference5)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            if (consumer._0001() == XmlNodeType.Document)
            {
                throw StrategyError.PatchComposer(def, "JSON root object has property '{0}' that will be converted to an attribute. A root object cannot have any attribute properties. Consider specifying a DeserializeRootElementName.".ListReader(CultureInfo.InvariantCulture, res2));
            }
            string        text  = XmlConvert.EncodeName(v3);
            string        text2 = WriteRequest(def);
            CreatorIssuer key   = (!SetterTest.StartReader(reference5)) ? cont._0002(text, value4.LookupNamespace(reference5), text2) : cont._0002(text, text2);

            ((InfoRequestStrategy)consumer)._0001(key);
        }
        public override object _0001(TagTestItem config, Type ivk, object template, PrototypeError connection2)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            if (config._0001() == WatcherComposer.Null)
            {
                if (!ResolverErrorFilter.PatchReader(ivk))
                {
                    throw StrategyError.PatchComposer(config, "Cannot convert null value to KeyValuePair.");
                }
                return(null);
            }
            object obj  = null;
            object obj2 = null;

            config.SortError();
            Type res = ResolverErrorFilter.PatchReader(ivk) ? Nullable.GetUnderlyingType(ivk) : ivk;
            ModelInstanceExpression modelInstanceExpression = m_ListenerIssuer.InitReader(res);
            ProcTest procTest  = connection2._0001()._0001(modelInstanceExpression.SetupIssuer("Key"));
            ProcTest procTest2 = connection2._0001()._0001(modelInstanceExpression.SetupIssuer("Value"));

            while (config._0001() == WatcherComposer.PropertyName)
            {
                string a = config._0001().ToString();
                if (string.Equals(a, "Key", StringComparison.OrdinalIgnoreCase))
                {
                    config.CallError(procTest, iscaller: false);
                    obj = connection2.AddComposer(config, procTest._0002());
                }
                else if (string.Equals(a, "Value", StringComparison.OrdinalIgnoreCase))
                {
                    config.CallError(procTest2, iscaller: false);
                    obj2 = connection2.AddComposer(config, procTest2._0002());
                }
                else
                {
                    config.AssetError();
                }
                config.SortError();
            }
            return(modelInstanceExpression._0001()(new object[2]
            {
                obj,
                obj2
            }));
        }
        private object SelectRequest(TagTestItem ident)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            string text = (string)ident._0001();

            if (text.Length > 0 && text[0] == '/')
            {
                int num = text.LastIndexOf('/');
                if (num > 0)
                {
                    string       pattern = text.Substring(1, num - 1);
                    RegexOptions options = CustomerListAnnotation.QueryIssuer(text.Substring(num + 1));
                    return(new Regex(pattern, options));
                }
            }
            throw StrategyError.PatchComposer(ident, "Regex pattern must be enclosed by slashes.");
        }
        private Regex DeleteRequest(TagTestItem config, PrototypeError result)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            string       text         = null;
            RegexOptions?regexOptions = null;

            while (config._0001())
            {
                switch (config._0001())
                {
                case WatcherComposer.PropertyName:
                {
                    string a = config._0001().ToString();
                    if (!config._0001())
                    {
                        throw StrategyError.PatchComposer(config, "Unexpected end when reading Regex.");
                    }
                    if (string.Equals(a, "Pattern", StringComparison.OrdinalIgnoreCase))
                    {
                        text = (string)config._0001();
                    }
                    else if (string.Equals(a, "Options", StringComparison.OrdinalIgnoreCase))
                    {
                        regexOptions = result.CompareComposer <RegexOptions>(config);
                    }
                    else
                    {
                        config.AssetError();
                    }
                    break;
                }

                case WatcherComposer.EndObject:
                    if (text == null)
                    {
                        throw StrategyError.PatchComposer(config, "Error deserializing Regex. No pattern found.");
                    }
                    return(new Regex(text, regexOptions.GetValueOrDefault()));
                }
            }
            throw StrategyError.PatchComposer(config, "Unexpected end when reading Regex.");
        }
        public override object _0001(TagTestItem first, Type result, object pool, PrototypeError spec2)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            switch (first._0001())
            {
            case WatcherComposer.StartObject:
                return(DeleteRequest(first, spec2));

            case WatcherComposer.String:
                return(SelectRequest(first));

            case WatcherComposer.Null:
                return(null);

            default:
                throw StrategyError.PatchComposer(first, "Unexpected token when reading Regex.");
            }
        }
Example #13
0
        private void PatchIterator(TagTestItem setup, AttrBroadcasterFilter selection, CreatorIssuer util)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            string spec   = null;
            string caller = null;
            string state  = null;
            string config = null;

            while (setup._0001() && setup._0001() != WatcherComposer.EndObject)
            {
                switch (setup._0001()?.ToString())
                {
                case "@name":
                    setup.SortError();
                    spec = WriteRequest(setup);
                    break;

                case "@public":
                    setup.SortError();
                    caller = WriteRequest(setup);
                    break;

                case "@system":
                    setup.SortError();
                    state = WriteRequest(setup);
                    break;

                case "@internalSubset":
                    setup.SortError();
                    config = WriteRequest(setup);
                    break;

                default:
                    throw StrategyError.PatchComposer(setup, "Unexpected property name encountered while deserializing XmlDeclaration: " + setup._0001());
                }
            }
            CreatorIssuer asset = selection._0001(spec, caller, state, config);

            util._0001(asset);
        }
Example #14
0
        private void VerifyIterator(TagTestItem setup, AttrBroadcasterFilter visitor, CreatorIssuer temp, string setup2)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            if (setup2 == "?xml")
            {
                string instance = null;
                string caller   = null;
                string tag      = null;
                while (setup._0001() && setup._0001() != WatcherComposer.EndObject)
                {
                    switch (setup._0001()?.ToString())
                    {
                    case "@version":
                        setup.SortError();
                        instance = WriteRequest(setup);
                        break;

                    case "@encoding":
                        setup.SortError();
                        caller = WriteRequest(setup);
                        break;

                    case "@standalone":
                        setup.SortError();
                        tag = WriteRequest(setup);
                        break;

                    default:
                        throw StrategyError.PatchComposer(setup, "Unexpected property name encountered while deserializing XmlDeclaration: " + setup._0001());
                    }
                }
                CreatorIssuer asset = visitor._0001(instance, caller, tag);
                temp._0001(asset);
            }
            else
            {
                CreatorIssuer asset2 = visitor._0001(setup2.Substring(1), WriteRequest(setup));
                temp._0001(asset2);
            }
        }
        public override object _0001(TagTestItem instance, Type pred, object res, PrototypeError reference2)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            if (instance._0001() == WatcherComposer.Null)
            {
                if (!ResolverErrorFilter.VerifyReader(pred))
                {
                    throw StrategyError.PatchComposer(instance, "Cannot convert null value to {0}.".ListReader(CultureInfo.InvariantCulture, pred));
                }
                return(null);
            }
            byte[] array;
            if (instance._0001() == WatcherComposer.StartArray)
            {
                array = RegisterRequest(instance);
            }
            else
            {
                if (instance._0001() != WatcherComposer.String)
                {
                    throw StrategyError.PatchComposer(instance, "Unexpected token parsing binary. Expected String or StartArray, got {0}.".ListReader(CultureInfo.InvariantCulture, instance._0001()));
                }
                array = Convert.FromBase64String(instance._0001().ToString());
            }
            Type type = ResolverErrorFilter.PatchReader(pred) ? Nullable.GetUnderlyingType(pred) : pred;

            if (type.FullName == "System.Data.Linq.Binary")
            {
                ResetRequest(type);
                return(_InfoIssuer._0001()(new object[1]
                {
                    array
                }));
            }
            if (type == typeof(SqlBinary))
            {
                return(new SqlBinary(array));
            }
            throw StrategyError.PatchComposer(instance, "Unexpected object type when writing binary: {0}".ListReader(CultureInfo.InvariantCulture, pred));
        }
        private object PostRequest(TagTestItem init)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            IList <object> list = new List <object>();

            while (init._0001())
            {
                switch (init._0001())
                {
                case WatcherComposer.EndArray:
                    return(list);

                case WatcherComposer.Comment:
                    continue;
                }
                object item = RemoveRequest(init);
                list.Add(item);
            }
            throw StrategyError.PatchComposer(init, "Unexpected end when reading ExpandoObject.");
        }
        private object RemoveRequest(TagTestItem spec)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            if (!spec.RevertError())
            {
                throw StrategyError.PatchComposer(spec, "Unexpected end when reading ExpandoObject.");
            }
            switch (spec._0001())
            {
            case WatcherComposer.StartObject:
                return(ChangeRequest(spec));

            case WatcherComposer.StartArray:
                return(PostRequest(spec));

            default:
                if (RulesClientBridge.StartIssuer(spec._0001()))
                {
                    return(spec._0001());
                }
                throw StrategyError.PatchComposer(spec, "Unexpected token when converting ExpandoObject: {0}".ListReader(CultureInfo.InvariantCulture, spec._0001()));
            }
        }
Example #18
0
        private Dictionary <string, string> DisableIterator(TagTestItem v, XmlNamespaceManager token)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            Dictionary <string, string> dictionary = null;
            bool flag = false;

            while (!flag && v._0001())
            {
                switch (v._0001())
                {
                case WatcherComposer.PropertyName:
                {
                    string text = v._0001().ToString();
                    if (!SetterTest.StartReader(text))
                    {
                        switch (text[0])
                        {
                        case '@':
                        {
                            if (dictionary == null)
                            {
                                dictionary = new Dictionary <string, string>();
                            }
                            text = text.Substring(1);
                            v.SortError();
                            string value = WriteRequest(v);
                            dictionary.Add(text, value);
                            if (OrderIterator(text, out string _0003))
                            {
                                token.AddNamespace(_0003, value);
                            }
                            break;
                        }

                        case '$':
                            switch (text)
                            {
                            case "$values":
                            case "$id":
                            case "$ref":
                            case "$type":
                            case "$value":
                            {
                                string text2 = token.LookupPrefix("http://james.newtonking.com/projects/json");
                                if (text2 == null)
                                {
                                    if (dictionary == null)
                                    {
                                        dictionary = new Dictionary <string, string>();
                                    }
                                    int?num = null;
                                    int?num2;
                                    while (true)
                                    {
                                        num2 = num;
                                        if (token.LookupNamespace("json" + num2) == null)
                                        {
                                            break;
                                        }
                                        num = num.GetValueOrDefault() + 1;
                                    }
                                    num2  = num;
                                    text2 = "json" + num2;
                                    dictionary.Add("xmlns:" + text2, "http://james.newtonking.com/projects/json");
                                    token.AddNamespace(text2, "http://james.newtonking.com/projects/json");
                                }
                                if (text == "$values")
                                {
                                    flag = true;
                                    break;
                                }
                                text = text.Substring(1);
                                v.SortError();
                                if (!RulesClientBridge.StartIssuer(v._0001()))
                                {
                                    throw StrategyError.PatchComposer(v, "Unexpected JsonToken: " + v._0001());
                                }
                                if (dictionary == null)
                                {
                                    dictionary = new Dictionary <string, string>();
                                }
                                string value = v._0001()?.ToString();
                                dictionary.Add(text2 + ":" + text, value);
                                break;
                            }

                            default:
                                flag = true;
                                break;
                            }
                            break;

                        default:
                            flag = true;
                            break;
                        }
                    }
                    else
                    {
                        flag = true;
                    }
                    break;
                }

                case WatcherComposer.Comment:
                case WatcherComposer.EndObject:
                    flag = true;
                    break;

                default:
                    throw StrategyError.PatchComposer(v, "Unexpected JsonToken: " + v._0001());
                }
            }
            return(dictionary);
        }
Example #19
0
        private void ValidateIterator(TagTestItem def, AttrBroadcasterFilter caller, XmlNamespaceManager tag, CreatorIssuer ord2)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            do
            {
                switch (def._0001())
                {
                case WatcherComposer.EndObject:
                case WatcherComposer.EndArray:
                    return;

                case WatcherComposer.PropertyName:
                {
                    if (ord2._0001() == XmlNodeType.Document && caller._0001() != null)
                    {
                        throw StrategyError.PatchComposer(def, "JSON root object has multiple properties. The root object must have a single property in order to create a valid XML document. Consider specifying a DeserializeRootElementName.");
                    }
                    string text = def._0001().ToString();
                    def.SortError();
                    if (def._0001() == WatcherComposer.StartArray)
                    {
                        int num = 0;
                        while (def._0001() && def._0001() != WatcherComposer.EndArray)
                        {
                            CollectRequest(def, caller, tag, text, ord2);
                            num++;
                        }
                        if (num == 1 && this._0003())
                        {
                            CustomerListAnnotation.CustomizeIssuer(text, out string _0003, out string role);
                            string b = SetterTest.StartReader(_0003) ? tag.DefaultNamespace : tag.LookupNamespace(_0003);
                            foreach (CreatorIssuer item in ord2._0001())
                            {
                                InfoRequestStrategy infoRequestStrategy = item as InfoRequestStrategy;
                                if (infoRequestStrategy != null && ((CreatorIssuer)infoRequestStrategy)._0001() == role && infoRequestStrategy._0003() == b)
                                {
                                    LoginIterator(infoRequestStrategy, caller);
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        CollectRequest(def, caller, tag, text, ord2);
                    }
                    break;
                }

                case WatcherComposer.StartConstructor:
                {
                    string reg = def._0001().ToString();
                    while (def._0001() && def._0001() != WatcherComposer.EndConstructor)
                    {
                        CollectRequest(def, caller, tag, reg, ord2);
                    }
                    break;
                }

                case WatcherComposer.Comment:
                    ord2._0001(caller._0001((string)def._0001()));
                    break;

                default:
                    throw StrategyError.PatchComposer(def, "Unexpected JsonToken when deserializing node: " + def._0001());
                }
            }while (def._0001());
        }
Example #20
0
        public override object _0001(TagTestItem param, Type reg, object serv, PrototypeError first2)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            switch (param._0001())
            {
            case WatcherComposer.Null:
                return(null);

            default:
                throw StrategyError.PatchComposer(param, "XmlNodeConverter can only convert JSON that begins with an object.");

            case WatcherComposer.StartObject:
            {
                XmlNamespaceManager   xmlNamespaceManager   = new XmlNamespaceManager(new NameTable());
                AttrBroadcasterFilter attrBroadcasterFilter = null;
                CreatorIssuer         creatorIssuer         = null;
                if (typeof(XObject).IsAssignableFrom(reg))
                {
                    if (reg != typeof(XContainer) && reg != typeof(XDocument) && reg != typeof(XElement) && reg != typeof(XNode) && reg != typeof(XObject))
                    {
                        throw StrategyError.PatchComposer(param, "XmlNodeConverter only supports deserializing XDocument, XElement, XContainer, XNode or XObject.");
                    }
                    attrBroadcasterFilter = new AuthenticationComposerPool(new XDocument());
                    creatorIssuer         = attrBroadcasterFilter;
                }
                if (typeof(XmlNode).IsAssignableFrom(reg))
                {
                    if (reg != typeof(XmlDocument) && reg != typeof(XmlElement) && reg != typeof(XmlNode))
                    {
                        throw StrategyError.PatchComposer(param, "XmlNodeConverter only supports deserializing XmlDocument, XmlElement or XmlNode.");
                    }
                    attrBroadcasterFilter = new ConnectionComposerWorker(new XmlDocument
                        {
                            XmlResolver = null
                        });
                    creatorIssuer = attrBroadcasterFilter;
                }
                if (attrBroadcasterFilter == null || creatorIssuer == null)
                {
                    throw StrategyError.PatchComposer(param, "Unexpected type when converting XML: " + reg);
                }
                if (!SetterTest.StartReader(_0001()))
                {
                    SortRequest(param, attrBroadcasterFilter, creatorIssuer, _0001(), xmlNamespaceManager);
                }
                else
                {
                    param.SortError();
                    ValidateIterator(param, attrBroadcasterFilter, xmlNamespaceManager, creatorIssuer);
                }
                if (reg == typeof(XElement))
                {
                    XElement obj = (XElement)((CreatorIssuer)attrBroadcasterFilter._0001())._0001();
                    obj.Remove();
                    return(obj);
                }
                if (reg == typeof(XmlElement))
                {
                    return(((CreatorIssuer)attrBroadcasterFilter._0001())._0001());
                }
                return(((CreatorIssuer)attrBroadcasterFilter)._0001());
            }
            }
        }
Example #21
0
        private static string WriteRequest(TagTestItem init)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            switch (init._0001())
            {
            case WatcherComposer.String:
                return(init._0001()?.ToString());

            case WatcherComposer.Integer:
            {
                object obj = init._0001();
                if (obj is BigInteger)
                {
                    return(((BigInteger)obj).ToString(CultureInfo.InvariantCulture));
                }
                return(XmlConvert.ToString(Convert.ToInt64(init._0001(), CultureInfo.InvariantCulture)));
            }

            case WatcherComposer.Float:
            {
                object obj = init._0001();
                if (obj is decimal)
                {
                    decimal value3 = (decimal)obj;
                    return(XmlConvert.ToString(value3));
                }
                obj = init._0001();
                if (obj is float)
                {
                    float value4 = (float)obj;
                    return(XmlConvert.ToString(value4));
                }
                return(XmlConvert.ToString(Convert.ToDouble(init._0001(), CultureInfo.InvariantCulture)));
            }

            case WatcherComposer.Boolean:
                return(XmlConvert.ToString(Convert.ToBoolean(init._0001(), CultureInfo.InvariantCulture)));

            case WatcherComposer.Date:
            {
                object obj = init._0001();
                if (obj is DateTimeOffset)
                {
                    DateTimeOffset value = (DateTimeOffset)obj;
                    return(XmlConvert.ToString(value));
                }
                DateTime value2 = Convert.ToDateTime(init._0001(), CultureInfo.InvariantCulture);
                return(XmlConvert.ToString(value2, DescriptorIteratorMapping.UpdateProperty(value2.Kind)));
            }

            case WatcherComposer.Bytes:
                return(Convert.ToBase64String((byte[])init._0001()));

            case WatcherComposer.Null:
                return(null);

            default:
                throw StrategyError.PatchComposer(init, "Cannot get an XML string value from token type '{0}'.".ListReader(CultureInfo.InvariantCulture, init._0001()));
            }
        }
Example #22
0
        public override object _0001(TagTestItem ident, Type b, object field, PrototypeError config2)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            if (ident._0001() == WatcherComposer.Null)
            {
                return(null);
            }
            FactoryDicCandidate factoryDicCandidate = null;
            string text = null;
            InstanceClassDispatcher instanceClassDispatcher = null;

            ident.SortError();
            while (ident._0001() == WatcherComposer.PropertyName)
            {
                string text2 = ident._0001().ToString();
                if (string.Equals(text2, "Case", StringComparison.OrdinalIgnoreCase))
                {
                    ident.SortError();
                    UtilsClientBridge utilsClientBridge = m_ParameterIssuer.InitReader(b);
                    text = ident._0001().ToString();
                    factoryDicCandidate = utilsClientBridge.m_StatusIssuer.SingleOrDefault((FactoryDicCandidate P_0) => P_0._HelperIssuer == text);
                    if (factoryDicCandidate == null)
                    {
                        throw StrategyError.PatchComposer(ident, "No union type found with the name '{0}'.".ListReader(CultureInfo.InvariantCulture, text));
                    }
                }
                else
                {
                    if (!string.Equals(text2, "Fields", StringComparison.OrdinalIgnoreCase))
                    {
                        throw StrategyError.PatchComposer(ident, "Unexpected property '{0}' found when reading union.".ListReader(CultureInfo.InvariantCulture, text2));
                    }
                    ident.SortError();
                    if (ident._0001() != WatcherComposer.StartArray)
                    {
                        throw StrategyError.PatchComposer(ident, "Union fields must been an array.");
                    }
                    instanceClassDispatcher = (InstanceClassDispatcher)ParserFilterResolver.SelectClass(ident);
                }
                ident.SortError();
            }
            if (factoryDicCandidate == null)
            {
                throw StrategyError.PatchComposer(ident, "No '{0}' property with union name found.".ListReader(CultureInfo.InvariantCulture, "Case"));
            }
            object[] array = new object[factoryDicCandidate.exceptionIssuer.Length];
            if (factoryDicCandidate.exceptionIssuer.Length != 0 && instanceClassDispatcher == null)
            {
                throw StrategyError.PatchComposer(ident, "No '{0}' property with union fields found.".ListReader(CultureInfo.InvariantCulture, "Fields"));
            }
            if (instanceClassDispatcher != null)
            {
                if (factoryDicCandidate.exceptionIssuer.Length != instanceClassDispatcher.get_Count())
                {
                    throw StrategyError.PatchComposer(ident, "The number of field values does not match the number of properties defined by union '{0}'.".ListReader(CultureInfo.InvariantCulture, text));
                }
                for (int i = 0; i < instanceClassDispatcher.get_Count(); i++)
                {
                    ParserFilterResolver parserFilterResolver = instanceClassDispatcher[i];
                    PropertyInfo         propertyInfo         = factoryDicCandidate.exceptionIssuer[i];
                    array[i] = parserFilterResolver.ListClass(propertyInfo.PropertyType, config2);
                }
            }
            object[] task = new object[1]
            {
                array
            };
            return(factoryDicCandidate.m_DatabaseIssuer.ConnectIssuer(task));
        }