Beispiel #1
0
    static ab SetAbilities(string input)
    {
        ab abilities = 0;

        if (input[0] != '-')
        {
            abilities |= ab.breakthrough;
        }
        if (input[1] != '-')
        {
            abilities |= ab.charge;
        }
        if (input[2] != '-')
        {
            abilities |= ab.drain;
        }
        if (input[3] != '-')
        {
            abilities |= ab.guard;
        }
        if (input[4] != '-')
        {
            abilities |= ab.lethal;
        }
        if (input[5] != '-')
        {
            abilities |= ab.ward;
        }

        return(abilities);
    }
        private static void b(Type A_0)
        {
            if (JsonMapper.k.ContainsKey(A_0))
            {
                return;
            }
            ab value = default(ab);

            if (A_0.GetInterface("System.Collections.IDictionary") != null)
            {
                value.a(true);
            }
            value.a(new Dictionary <string, p>());
            PropertyInfo[] properties = A_0.GetProperties();
            for (int i = 0; i < properties.Length; i++)
            {
                PropertyInfo propertyInfo = properties[i];
                if (propertyInfo.Name == "Item")
                {
                    ParameterInfo[] indexParameters = propertyInfo.GetIndexParameters();
                    if (indexParameters.Length == 1 && indexParameters[0].ParameterType == typeof(string))
                    {
                        value.a(propertyInfo.PropertyType);
                    }
                }
                else
                {
                    p value2 = default(p);
                    value2.a = propertyInfo;
                    value2.c = propertyInfo.PropertyType;
                    value.a().Add(propertyInfo.Name, value2);
                }
            }
            FieldInfo[] fields = A_0.GetFields();
            for (int j = 0; j < fields.Length; j++)
            {
                FieldInfo fieldInfo = fields[j];
                p         value3    = default(p);
                value3.a = fieldInfo;
                value3.b = true;
                value3.c = fieldInfo.FieldType;
                value.a().Add(fieldInfo.Name, value3);
            }
            lock (JsonMapper.l)
            {
                try
                {
                    JsonMapper.k.Add(A_0, value);
                }
                catch (ArgumentException)
                {
                }
            }
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            ab ab2 = new ab(Meth);

            ab2 += Meth2;
            ab2 += Meth3;

            List <System.Delegate> multicasts = ab2.GetInvocationList().ToList <System.Delegate>();

            Console.WriteLine(multicasts.Count);



            foreach (MulticastDelegate ca in multicasts)
            {
            }

            Console.WriteLine("Hello World!");
        }
 public static extern bool GetTokenInformation(IntPtr A_0, ab A_1, [Out] byte[] A_2, uint A_3, ref uint A_4);
Beispiel #5
0
 private static extern bool GetTokenInformation(IntPtr A_0, ab A_1, [Out] byte[] A_2, uint A_3, ref uint A_4);
        private static object a(Type A_0, JsonReader A_1)
        {
            A_1.Read();
            if (A_1.Token == JsonToken.ArrayEnd)
            {
                return(null);
            }
            Type underlyingType = Nullable.GetUnderlyingType(A_0);
            Type type           = underlyingType ?? A_0;

            if (A_1.Token == JsonToken.Null)
            {
                if (A_0.IsClass || underlyingType != null)
                {
                    return(null);
                }
                throw new JsonException(string.Format("Can't assign null to an instance of type {0}", A_0));
            }
            else
            {
                if (A_1.Token != JsonToken.Double && A_1.Token != JsonToken.Int && A_1.Token != JsonToken.Long && A_1.Token != JsonToken.String && A_1.Token != JsonToken.Float && A_1.Token != JsonToken.Boolean)
                {
                    object obj = null;
                    if (A_1.Token == JsonToken.ArrayStart)
                    {
                        JsonMapper.c(A_0);
                        w w = JsonMapper.g[A_0];
                        if (!w.a() && !w.c())
                        {
                            throw new JsonException(string.Format("Type {0} can't act as an array", A_0));
                        }
                        IList list;
                        Type  type2;
                        if (!w.a())
                        {
                            list  = (IList)Activator.CreateInstance(A_0);
                            type2 = w.b();
                        }
                        else
                        {
                            list  = new ArrayList();
                            type2 = A_0.GetElementType();
                        }
                        while (true)
                        {
                            object obj2 = JsonMapper.a(type2, A_1);
                            if (obj2 == null && A_1.Token == JsonToken.ArrayEnd)
                            {
                                break;
                            }
                            list.Add(obj2);
                        }
                        if (w.a())
                        {
                            int count = list.Count;
                            obj = Array.CreateInstance(type2, count);
                            for (int i = 0; i < count; i++)
                            {
                                ((Array)obj).SetValue(list[i], i);
                            }
                        }
                        else
                        {
                            obj = list;
                        }
                    }
                    else if (A_1.Token == JsonToken.ObjectStart)
                    {
                        JsonMapper.b(type);
                        ab ab = JsonMapper.k[type];
                        obj = Activator.CreateInstance(type);
                        string text;
                        while (true)
                        {
                            A_1.Read();
                            if (A_1.Token == JsonToken.ObjectEnd)
                            {
                                return(obj);
                            }
                            text = (string)A_1.Value;
                            if (ab.a().ContainsKey(text))
                            {
                                p p = ab.a()[text];
                                if (p.b)
                                {
                                    ((FieldInfo)p.a).SetValue(obj, JsonMapper.a(p.c, A_1));
                                }
                                else
                                {
                                    PropertyInfo propertyInfo = (PropertyInfo)p.a;
                                    if (propertyInfo.CanWrite)
                                    {
                                        propertyInfo.SetValue(obj, JsonMapper.a(p.c, A_1), null);
                                    }
                                    else
                                    {
                                        JsonMapper.a(p.c, A_1);
                                    }
                                }
                            }
                            else if (!ab.c())
                            {
                                if (!A_1.SkipNonMembers)
                                {
                                    break;
                                }
                                JsonMapper.a(A_1);
                            }
                            else
                            {
                                ((IDictionary)obj).Add(text, JsonMapper.a(ab.b(), A_1));
                            }
                        }
                        throw new JsonException(string.Format("The type {0} doesn't have the property '{1}'", A_0, text));
                    }
                    return(obj);
                }
                Type type3 = A_1.Value.GetType();
                if (type.IsAssignableFrom(type3))
                {
                    return(A_1.Value);
                }
                if (JsonMapper.f.ContainsKey(type3) && JsonMapper.f[type3].ContainsKey(type))
                {
                    n n = JsonMapper.f[type3][type];
                    return(n(A_1.Value));
                }
                if (JsonMapper.e.ContainsKey(type3) && JsonMapper.e[type3].ContainsKey(type))
                {
                    n n2 = JsonMapper.e[type3][type];
                    return(n2(A_1.Value));
                }
                if (type.IsEnum)
                {
                    return(Enum.ToObject(type, A_1.Value));
                }
                MethodInfo methodInfo = JsonMapper.a(type, type3);
                if (methodInfo != null)
                {
                    return(methodInfo.Invoke(null, new object[]
                    {
                        A_1.Value
                    }));
                }
                throw new JsonException(string.Format("Can't assign value '{0}' (type {1}) to type {2}", A_1.Value, type3, A_0));
            }
        }