コード例 #1
0
    // Token: 0x0600068D RID: 1677 RVA: 0x0002BAE8 File Offset: 0x00029CE8
    private static int?smethod_8(string string_0, object object_0, object object_1, int int_0, int int_1, StringComparison stringComparison_0)
    {
        int?result = Class53.smethod_9(object_1, string_0, int_0, int_1, stringComparison_0);

        if (result == null)
        {
            result = Class53.smethod_9(object_0, string_0, int_0, int_1, stringComparison_0);
        }
        return(result);
    }
コード例 #2
0
 private static Assembly smethod_0(object object_0, ResolveEventArgs resolveEventArgs_0)
 {
     lock (hashtable_0)
     {
         string str  = resolveEventArgs_0.Name.Trim();
         object obj2 = hashtable_0[str];
         if (obj2 == null)
         {
             try
             {
                 string str2 = smethod_1(str);
                 foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
                 {
                     if (assembly.GetName().Name.ToUpper() == str2.ToUpper())
                     {
                         return(assembly);
                     }
                 }
             }
             catch
             {
             }
         }
         if (obj2 == null)
         {
             try
             {
                 RSACryptoServiceProvider.UseMachineKeyStore = true;
                 string s     = smethod_1(str);
                 byte[] bytes = Encoding.Unicode.GetBytes(s);
                 string name  = "b0494a1f-4bd3-" + Convert.ToBase64String(Class53.smethod_9(bytes));
                 Stream manifestResourceStream = typeof(Class57).Assembly.GetManifestResourceStream(name);
                 if (manifestResourceStream != null)
                 {
                     try
                     {
                         BinaryReader reader = new BinaryReader(manifestResourceStream)
                         {
                             BaseStream = { Position = 0L }
                         };
                         byte[] buffer = new byte[manifestResourceStream.Length];
                         reader.Read(buffer, 0, buffer.Length);
                         reader.Close();
                         bool     flag      = false;
                         Assembly assembly2 = null;
                         try
                         {
                             assembly2 = Assembly.Load(buffer);
                         }
                         catch (FileLoadException)
                         {
                             flag = true;
                         }
                         catch (BadImageFormatException)
                         {
                             flag = true;
                         }
                         if (flag)
                         {
                             string path = Path.Combine(Path.Combine(Path.GetTempPath(), name), s + ".dll");
                             if (!File.Exists(path))
                             {
                                 Directory.CreateDirectory(Path.GetDirectoryName(path));
                                 FileStream stream2 = new FileStream(path, FileMode.Create, FileAccess.Write);
                                 stream2.Write(buffer, 0, buffer.Length);
                                 stream2.Close();
                             }
                             assembly2 = Assembly.LoadFile(path);
                             hashtable_0.Add(str, assembly2);
                             return(assembly2);
                         }
                         hashtable_0.Add(str, assembly2);
                         return(assembly2);
                     }
                     catch
                     {
                     }
                 }
             }
             catch
             {
             }
             return(null);
         }
         return((Assembly)obj2);
     }
 }
コード例 #3
0
    // Token: 0x0600068C RID: 1676 RVA: 0x0002B8A8 File Offset: 0x00029AA8
    public static object smethod_7(Type type_0, object object_0, string string_0, bool bool_0)
    {
        Class101.smethod_0(type_0, "enumType");
        Class101.smethod_0(string_0, "value");
        if (!type_0.smethod_8())
        {
            throw new ArgumentException("Type provided must be an Enum.", "enumType");
        }
        Class52 @class = Class53.class99_0.Get(new Struct9 <Type, NamingStrategy>(type_0, object_0));

        string[] string_  = @class.string_0;
        string[] string_2 = @class.string_1;
        ulong[]  ulong_   = @class.ulong_0;
        int?     num      = Class53.smethod_9(string_2, string_0, 0, string_0.Length, StringComparison.Ordinal);

        if (num != null)
        {
            return(Enum.ToObject(type_0, ulong_[num.Value]));
        }
        int num2 = -1;
        int i    = 0;

        while (i < string_0.Length)
        {
            if (char.IsWhiteSpace(string_0[i]))
            {
                i++;
            }
            else
            {
                num2 = i;
IL_A9:
                if (num2 == -1)
                {
                    throw new ArgumentException("Must specify valid information for parsing in the string.");
                }
                char c = string_0[num2];
                if (char.IsDigit(c) || c == '-' || c == '+')
                {
                    Type underlyingType = Enum.GetUnderlyingType(type_0);
                    string_0 = string_0.Trim();
                    object obj = null;
                    try
                    {
                        obj = Convert.ChangeType(string_0, underlyingType, CultureInfo.InvariantCulture);
                    }
                    catch (FormatException)
                    {
                    }
                    if (obj != null)
                    {
                        if (bool_0)
                        {
                            throw new FormatException("Integer string '{0}' is not allowed.".smethod_0(CultureInfo.InvariantCulture, string_0));
                        }
                        return(Enum.ToObject(type_0, obj));
                    }
                }
                ulong num3 = 0UL;
                int   j    = num2;
                while (j <= string_0.Length)
                {
                    int num4 = string_0.IndexOf(',', j);
                    if (num4 == -1)
                    {
                        num4 = string_0.Length;
                    }
                    int num5 = num4;
                    while (j < num4 && char.IsWhiteSpace(string_0[j]))
                    {
                        j++;
                    }
                    while (num5 > j && char.IsWhiteSpace(string_0[num5 - 1]))
                    {
                        num5--;
                    }
                    int int_ = num5 - j;
                    num = Class53.smethod_8(string_0, string_, string_2, j, int_, StringComparison.Ordinal);
                    if (num == null)
                    {
                        num = Class53.smethod_8(string_0, string_, string_2, j, int_, StringComparison.OrdinalIgnoreCase);
                    }
                    if (num != null)
                    {
                        num3 |= ulong_[num.Value];
                        j     = num4 + 1;
                    }
                    else
                    {
                        num = Class53.smethod_9(string_2, string_0, 0, string_0.Length, StringComparison.OrdinalIgnoreCase);
                        if (num == null)
                        {
                            throw new ArgumentException("Requested value '{0}' was not found.".smethod_0(CultureInfo.InvariantCulture, string_0));
                        }
                        return(Enum.ToObject(type_0, ulong_[num.Value]));
                    }
                }
                return(Enum.ToObject(type_0, num3));
            }
        }
        goto IL_A9;
    }