public static decimal FromString(string Value, NumberFormatInfo NumberFormat)
        {
            decimal num;

            if (Value == null)
            {
                return(decimal.Zero);
            }
            try
            {
                long num2;
                if (Utils.IsHexOrOctValue(Value, ref num2))
                {
                    return(new decimal(num2));
                }
                num = Parse(Value, NumberFormat);
            }
            catch (OverflowException)
            {
                throw ExceptionUtils.VbMakeException(6);
            }
            catch (FormatException)
            {
                throw new InvalidCastException(Utils.GetResourceString("InvalidCast_FromStringTo", new string[] { Strings.Left(Value, 0x20), "Decimal" }));
            }
            return(num);
        }
 internal override long LOC()
 {
     if (base.m_lRecordLen == 0)
     {
         throw ExceptionUtils.VbMakeException(0x33);
     }
     return(((base.m_position + base.m_lRecordLen) - 1L) / ((long)base.m_lRecordLen));
 }
        public static IEnumerator ForEachInArr(Array ary)
        {
            IEnumerator enumerator = ary.GetEnumerator();

            if (enumerator == null)
            {
                throw ExceptionUtils.VbMakeException(0x5c);
            }
            return(enumerator);
        }
Пример #4
0
 internal Container(Type Type)
 {
     if (Type == null)
     {
         throw ExceptionUtils.VbMakeException(0x5b);
     }
     this.m_Instance            = null;
     this.m_Type                = Type;
     this.m_IReflect            = Type;
     this.m_UseCustomReflection = false;
     this.CheckForClassExtendingCOMClass();
 }
Пример #5
0
        internal override void Seek(long BaseOnePosition)
        {
            if (BaseOnePosition <= 0L)
            {
                throw ExceptionUtils.VbMakeException(0x3f);
            }
            long num = BaseOnePosition - 1L;

            base.m_file.Position = num;
            base.m_position      = num;
            if (base.m_sr != null)
            {
                base.m_sr.DiscardBufferedData();
            }
        }
Пример #6
0
        internal static int GetRecordLength(object o, int PackSize = -1)
        {
            if (o == null)
            {
                return(0);
            }
            StructByteLengthHandler handler     = new StructByteLengthHandler(PackSize);
            IRecordEnum             intfRecEnum = handler;

            if (intfRecEnum == null)
            {
                throw ExceptionUtils.VbMakeException(5);
            }
            EnumerateUDT((ValueType)o, intfRecEnum, false);
            return(handler.Length);
        }
 private void OpenFileHelper(FileMode fm, OpenAccess fa)
 {
     try
     {
         base.m_file = new FileStream(base.m_sFullPath, fm, (FileAccess)fa, (FileShare)base.m_share);
     }
     catch (FileNotFoundException exception)
     {
         throw ExceptionUtils.VbMakeException(exception, 0x35);
     }
     catch (DirectoryNotFoundException exception2)
     {
         throw ExceptionUtils.VbMakeException(exception2, 0x4c);
     }
     catch (SecurityException exception3)
     {
         throw ExceptionUtils.VbMakeException(exception3, 0x35);
     }
     catch (IOException exception4)
     {
         throw ExceptionUtils.VbMakeException(exception4, 0x4b);
     }
     catch (UnauthorizedAccessException exception5)
     {
         throw ExceptionUtils.VbMakeException(exception5, 0x4b);
     }
     catch (ArgumentException exception6)
     {
         throw ExceptionUtils.VbMakeException(exception6, 0x4b);
     }
     catch (StackOverflowException exception7)
     {
         throw exception7;
     }
     catch (OutOfMemoryException exception8)
     {
         throw exception8;
     }
     catch (ThreadAbortException exception9)
     {
         throw exception9;
     }
     catch (Exception)
     {
         throw ExceptionUtils.VbMakeException(0x33);
     }
 }
 internal override void OpenFile()
 {
     try
     {
         if (base.m_fAppend)
         {
             if (File.Exists(base.m_sFullPath))
             {
                 base.m_file = new FileStream(base.m_sFullPath, FileMode.Open, (FileAccess)base.m_access, (FileShare)base.m_share);
             }
             else
             {
                 base.m_file = new FileStream(base.m_sFullPath, FileMode.Create, (FileAccess)base.m_access, (FileShare)base.m_share);
             }
         }
         else
         {
             base.m_file = new FileStream(base.m_sFullPath, FileMode.Create, (FileAccess)base.m_access, (FileShare)base.m_share);
         }
     }
     catch (FileNotFoundException exception)
     {
         throw ExceptionUtils.VbMakeException(exception, 0x35);
     }
     catch (SecurityException exception2)
     {
         throw ExceptionUtils.VbMakeException(exception2, 0x35);
     }
     catch (DirectoryNotFoundException exception3)
     {
         throw ExceptionUtils.VbMakeException(exception3, 0x4c);
     }
     catch (IOException exception4)
     {
         throw ExceptionUtils.VbMakeException(exception4, 0x4b);
     }
     base.m_Encoding     = Utils.GetFileIOEncoding();
     base.m_sw           = new StreamWriter(base.m_file, base.m_Encoding);
     base.m_sw.AutoFlush = true;
     if (base.m_fAppend)
     {
         long length = base.m_file.Length;
         base.m_file.Position = length;
         base.m_position      = length;
     }
 }
Пример #9
0
 public static Array CopyArray(Array arySrc, Array aryDest)
 {
     if (arySrc != null)
     {
         int length = arySrc.Length;
         if (length == 0)
         {
             return(aryDest);
         }
         if (aryDest.Rank != arySrc.Rank)
         {
             throw ExceptionUtils.VbMakeException(new InvalidCastException(GetResourceString("Array_RankMismatch")), 9);
         }
         int num8 = aryDest.Rank - 2;
         for (int i = 0; i <= num8; i++)
         {
             if (aryDest.GetUpperBound(i) != arySrc.GetUpperBound(i))
             {
                 throw ExceptionUtils.VbMakeException(new ArrayTypeMismatchException(GetResourceString("Array_TypeMismatch")), 9);
             }
         }
         if (length > aryDest.Length)
         {
             length = aryDest.Length;
         }
         if (arySrc.Rank > 1)
         {
             int rank = arySrc.Rank;
             int num7 = arySrc.GetLength(rank - 1);
             int num6 = aryDest.GetLength(rank - 1);
             if (num6 != 0)
             {
                 int num5 = Math.Min(num7, num6);
                 int num9 = (arySrc.Length / num7) - 1;
                 for (int j = 0; j <= num9; j++)
                 {
                     Array.Copy(arySrc, j * num7, aryDest, j * num6, num5);
                 }
             }
             return(aryDest);
         }
         Array.Copy(arySrc, aryDest, length);
     }
     return(aryDest);
 }
Пример #10
0
            internal bool Callback(FieldInfo field_info, ref object vValue)
            {
                int  num;
                int  num2;
                Type fieldType = field_info.FieldType;

                if (fieldType == null)
                {
                    throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_UnsupportedFieldType2", new string[] { field_info.Name, "Empty" })), 5);
                }
                if (fieldType.IsArray)
                {
                    VBFixedArrayAttribute attribute;
                    int      length;
                    int      num4;
                    object[] customAttributes = field_info.GetCustomAttributes(typeof(VBFixedArrayAttribute), false);
                    if ((customAttributes != null) && (customAttributes.Length != 0))
                    {
                        attribute = (VBFixedArrayAttribute)customAttributes[0];
                    }
                    else
                    {
                        attribute = null;
                    }
                    Type elementType = fieldType.GetElementType();
                    if (attribute == null)
                    {
                        length = 1;
                        num4   = 4;
                    }
                    else
                    {
                        length = attribute.Length;
                        this.GetFieldSize(field_info, elementType, ref num, ref num4);
                    }
                    this.SetAlignment(num);
                    this.m_StructLength += length * num4;
                    return(false);
                }
                this.GetFieldSize(field_info, fieldType, ref num, ref num2);
                this.SetAlignment(num);
                this.m_StructLength += num2;
                return(false);
            }
 internal override void OpenFile()
 {
     try
     {
         base.m_file = new FileStream(base.m_sFullPath, FileMode.Open, (FileAccess)base.m_access, (FileShare)base.m_share);
     }
     catch (FileNotFoundException exception)
     {
         throw ExceptionUtils.VbMakeException(exception, 0x35);
     }
     catch (SecurityException)
     {
         throw ExceptionUtils.VbMakeException(0x35);
     }
     catch (DirectoryNotFoundException exception3)
     {
         throw ExceptionUtils.VbMakeException(exception3, 0x4c);
     }
     catch (IOException exception4)
     {
         throw ExceptionUtils.VbMakeException(exception4, 0x4b);
     }
     catch (StackOverflowException exception5)
     {
         throw exception5;
     }
     catch (OutOfMemoryException exception6)
     {
         throw exception6;
     }
     catch (ThreadAbortException exception7)
     {
         throw exception7;
     }
     catch (Exception exception8)
     {
         throw ExceptionUtils.VbMakeException(exception8, 0x4c);
     }
     base.m_Encoding = Utils.GetFileIOEncoding();
     base.m_sr       = new StreamReader(base.m_file, base.m_Encoding, false, 0x80);
     base.m_eof      = base.m_file.Length == 0L;
 }
Пример #12
0
 internal Container(object Instance)
 {
     if (Instance == null)
     {
         throw ExceptionUtils.VbMakeException(0x5b);
     }
     this.m_Instance            = Instance;
     this.m_Type                = Instance.GetType();
     this.m_UseCustomReflection = false;
     if (!this.m_Type.IsCOMObject && !(Instance is Type))
     {
         this.m_IReflect = Instance as IReflect;
         if (this.m_IReflect != null)
         {
             this.m_UseCustomReflection = true;
         }
     }
     if (!this.m_UseCustomReflection)
     {
         this.m_IReflect = this.m_Type;
     }
     this.CheckForClassExtendingCOMClass();
 }
Пример #13
0
        internal static object EnumerateUDT(ValueType oStruct, IRecordEnum intfRecEnum, bool fGet)
        {
            Type typ = oStruct.GetType();

            if ((Information.VarTypeFromComType(typ) != VariantType.UserDefinedType) || typ.IsPrimitive)
            {
                throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue1", new string[] { "oStruct" }));
            }
            FieldInfo[] fields = typ.GetFields(BindingFlags.Public | BindingFlags.Instance);
            int         num2   = 0;
            int         num4   = fields.GetUpperBound(0);

            for (int i = num2; i <= num4; i++)
            {
                FieldInfo fieldInfo = fields[i];
                Type      fieldType = fieldInfo.FieldType;
                object    obj3      = fieldInfo.GetValue(oStruct);
                if (Information.VarTypeFromComType(fieldType) == VariantType.UserDefinedType)
                {
                    if (fieldType.IsPrimitive)
                    {
                        throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_UnsupportedFieldType2", new string[] { fieldInfo.Name, fieldType.Name })), 5);
                    }
                    EnumerateUDT((ValueType)obj3, intfRecEnum, fGet);
                }
                else
                {
                    intfRecEnum.Callback(fieldInfo, ref obj3);
                }
                if (fGet)
                {
                    fieldInfo.SetValue(oStruct, obj3);
                }
            }
            return(null);
        }
        public static IEnumerator ForEachInObj(object obj)
        {
            IEnumerable enumerable;

            if (obj == null)
            {
                throw ExceptionUtils.VbMakeException(0x5b);
            }
            try
            {
                enumerable = (IEnumerable)obj;
            }
            catch (StackOverflowException exception)
            {
                throw exception;
            }
            catch (OutOfMemoryException exception2)
            {
                throw exception2;
            }
            catch (ThreadAbortException exception3)
            {
                throw exception3;
            }
            catch (Exception)
            {
                throw ExceptionUtils.MakeException1(100, obj.GetType().ToString());
            }
            IEnumerator enumerator = enumerable.GetEnumerator();

            if (enumerator == null)
            {
                throw ExceptionUtils.MakeException1(100, obj.GetType().ToString());
            }
            return(enumerator);
        }
Пример #15
0
            private void GetFieldSize(FieldInfo field_info, Type FieldType, ref int align, ref int size)
            {
                switch (Type.GetTypeCode(FieldType))
                {
                case TypeCode.DBNull:
                    throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_UnsupportedFieldType2", new string[] { field_info.Name, "DBNull" })), 5);

                case TypeCode.Boolean:
                    align = 2;
                    size  = 2;
                    break;

                case TypeCode.Char:
                    align = 2;
                    size  = 2;
                    break;

                case TypeCode.Byte:
                    align = 1;
                    size  = 1;
                    break;

                case TypeCode.Int16:
                    align = 2;
                    size  = 2;
                    break;

                case TypeCode.Int32:
                    align = 4;
                    size  = 4;
                    break;

                case TypeCode.Int64:
                    align = 8;
                    size  = 8;
                    break;

                case TypeCode.Single:
                    align = 4;
                    size  = 4;
                    break;

                case TypeCode.Double:
                    align = 8;
                    size  = 8;
                    break;

                case TypeCode.Decimal:
                    align = 0x10;
                    size  = 0x10;
                    break;

                case TypeCode.DateTime:
                    align = 8;
                    size  = 8;
                    break;

                case TypeCode.String:
                {
                    object[] customAttributes = field_info.GetCustomAttributes(typeof(VBFixedStringAttribute), false);
                    if ((customAttributes != null) && (customAttributes.Length != 0))
                    {
                        VBFixedStringAttribute attribute = (VBFixedStringAttribute)customAttributes[0];
                        int length = attribute.Length;
                        if (length == 0)
                        {
                            length = -1;
                        }
                        size = length;
                        break;
                    }
                    align = 4;
                    size  = 4;
                    break;
                }
                }
                if (FieldType == typeof(Exception))
                {
                    throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_UnsupportedFieldType2", new string[] { field_info.Name, "Exception" })), 5);
                }
                if (FieldType == typeof(Missing))
                {
                    throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_UnsupportedFieldType2", new string[] { field_info.Name, "Missing" })), 5);
                }
                if (FieldType == typeof(object))
                {
                    throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_UnsupportedFieldType2", new string[] { field_info.Name, "Object" })), 5);
                }
            }
        public static bool ForNextCheckObj(object Counter, object LoopObj, ref object CounterResult)
        {
            TypeCode code;
            TypeCode widestType;

            if (LoopObj == null)
            {
                throw ExceptionUtils.VbMakeException(0x5c);
            }
            if (Counter == null)
            {
                throw new NullReferenceException(Utils.GetResourceString("Argument_InvalidNullValue1", new string[] { "Counter" }));
            }
            ObjectFor loopFor  = (ObjectFor)LoopObj;
            TypeCode  typeCode = ((IConvertible)Counter).GetTypeCode();
            TypeCode  code3    = ((IConvertible)loopFor.StepValue).GetTypeCode();

            if ((typeCode == code3) && (typeCode != TypeCode.String))
            {
                widestType = typeCode;
            }
            else
            {
                widestType = ObjectType.GetWidestType(typeCode, code3);
                if (widestType == TypeCode.String)
                {
                    widestType = TypeCode.Double;
                }
                if (code == TypeCode.Object)
                {
                    throw new ArgumentException(Utils.GetResourceString("ForLoop_CommonType2", new string[] { Utils.VBFriendlyName(ObjectType.TypeFromTypeCode(typeCode)), Utils.VBFriendlyName(ObjectType.TypeFromTypeCode(code3)) }));
                }
                try
                {
                    Counter = ObjectType.CTypeHelper(Counter, widestType);
                }
                catch (StackOverflowException exception)
                {
                    throw exception;
                }
                catch (OutOfMemoryException exception2)
                {
                    throw exception2;
                }
                catch (ThreadAbortException exception3)
                {
                    throw exception3;
                }
                catch (Exception)
                {
                    throw new ArgumentException(Utils.GetResourceString("ForLoop_ConvertToType3", new string[] { "Start", Utils.VBFriendlyName(Counter.GetType()), Utils.VBFriendlyName(ObjectType.TypeFromTypeCode(widestType)) }));
                }
                try
                {
                    loopFor.Limit = ObjectType.CTypeHelper(loopFor.Limit, widestType);
                }
                catch (StackOverflowException exception4)
                {
                    throw exception4;
                }
                catch (OutOfMemoryException exception5)
                {
                    throw exception5;
                }
                catch (ThreadAbortException exception6)
                {
                    throw exception6;
                }
                catch (Exception)
                {
                    throw new ArgumentException(Utils.GetResourceString("ForLoop_ConvertToType3", new string[] { "Limit", Utils.VBFriendlyName(loopFor.Limit.GetType()), Utils.VBFriendlyName(ObjectType.TypeFromTypeCode(widestType)) }));
                }
                try
                {
                    loopFor.StepValue = ObjectType.CTypeHelper(loopFor.StepValue, widestType);
                }
                catch (StackOverflowException exception7)
                {
                    throw exception7;
                }
                catch (OutOfMemoryException exception8)
                {
                    throw exception8;
                }
                catch (ThreadAbortException exception9)
                {
                    throw exception9;
                }
                catch (Exception)
                {
                    throw new ArgumentException(Utils.GetResourceString("ForLoop_ConvertToType3", new string[] { "Step", Utils.VBFriendlyName(loopFor.StepValue.GetType()), Utils.VBFriendlyName(ObjectType.TypeFromTypeCode(widestType)) }));
                }
            }
            loopFor.Counter = ObjectType.AddObj(Counter, loopFor.StepValue);
            code            = ((IConvertible)loopFor.Counter).GetTypeCode();
            if (loopFor.EnumType != null)
            {
                CounterResult = Enum.ToObject(loopFor.EnumType, loopFor.Counter);
            }
            else
            {
                CounterResult = loopFor.Counter;
            }
            if (code != widestType)
            {
                loopFor.Limit     = ObjectType.CTypeHelper(loopFor.Limit, code);
                loopFor.StepValue = ObjectType.CTypeHelper(loopFor.StepValue, code);
                return(false);
            }
            return(CheckContinueLoop(loopFor));
        }
        public bool Callback(FieldInfo field_info, ref object vValue)
        {
            bool   flag;
            string str;
            Type   fieldType = field_info.FieldType;

            if (fieldType == null)
            {
                throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_UnsupportedFieldType2", new string[] { field_info.Name, "Empty" })), 5);
            }
            if (fieldType.IsArray)
            {
                VBFixedArrayAttribute attribute;
                int      fixedStringLength = -1;
                object[] objArray          = field_info.GetCustomAttributes(typeof(VBFixedArrayAttribute), false);
                if ((objArray != null) && (objArray.Length != 0))
                {
                    attribute = (VBFixedArrayAttribute)objArray[0];
                }
                else
                {
                    attribute = null;
                }
                Type elementType = fieldType.GetElementType();
                if (elementType == typeof(string))
                {
                    objArray = field_info.GetCustomAttributes(typeof(VBFixedStringAttribute), false);
                    if ((objArray == null) || (objArray.Length == 0))
                    {
                        fixedStringLength = -1;
                    }
                    else
                    {
                        fixedStringLength = ((VBFixedStringAttribute)objArray[0]).Length;
                    }
                }
                if (attribute == null)
                {
                    this.m_oFile.PutDynamicArray(0L, (Array)vValue, false, fixedStringLength);
                    return(flag);
                }
                this.m_oFile.PutFixedArray(0L, (Array)vValue, elementType, fixedStringLength, attribute.FirstBound, attribute.SecondBound);
                return(flag);
            }
            switch (Type.GetTypeCode(fieldType))
            {
            case TypeCode.DBNull:
                throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_UnsupportedFieldType2", new string[] { field_info.Name, "DBNull" })), 5);

            case TypeCode.Boolean:
                this.m_oFile.PutBoolean(0L, BooleanType.FromObject(vValue), false);
                return(flag);

            case TypeCode.Char:
                this.m_oFile.PutChar(0L, Microsoft.VisualBasic.CompilerServices.CharType.FromObject(vValue), false);
                return(flag);

            case TypeCode.Byte:
                this.m_oFile.PutByte(0L, ByteType.FromObject(vValue), false);
                return(flag);

            case TypeCode.Int16:
                this.m_oFile.PutShort(0L, ShortType.FromObject(vValue), false);
                return(flag);

            case TypeCode.Int32:
                this.m_oFile.PutInteger(0L, IntegerType.FromObject(vValue), false);
                return(flag);

            case TypeCode.Int64:
                this.m_oFile.PutLong(0L, LongType.FromObject(vValue), false);
                return(flag);

            case TypeCode.Single:
                this.m_oFile.PutSingle(0L, SingleType.FromObject(vValue), false);
                return(flag);

            case TypeCode.Double:
                this.m_oFile.PutDouble(0L, DoubleType.FromObject(vValue), false);
                return(flag);

            case TypeCode.Decimal:
                this.m_oFile.PutDecimal(0L, DecimalType.FromObject(vValue), false);
                return(flag);

            case TypeCode.DateTime:
                this.m_oFile.PutDate(0L, DateType.FromObject(vValue), false);
                return(flag);

            case TypeCode.String:
                if (vValue == null)
                {
                    str = null;
                    break;
                }
                str = vValue.ToString();
                break;

            default:
                if (fieldType == typeof(object))
                {
                    this.m_oFile.PutObject(vValue, 0L, true);
                    return(flag);
                }
                if (fieldType == typeof(Exception))
                {
                    throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_UnsupportedFieldType2", new string[] { field_info.Name, "Exception" })), 5);
                }
                if (fieldType == typeof(Missing))
                {
                    throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_UnsupportedFieldType2", new string[] { field_info.Name, "Missing" })), 5);
                }
                throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_UnsupportedFieldType2", new string[] { field_info.Name, fieldType.Name })), 5);
            }
            object[] customAttributes = field_info.GetCustomAttributes(typeof(VBFixedStringAttribute), false);
            if ((customAttributes == null) || (customAttributes.Length == 0))
            {
                this.m_oFile.PutStringWithLength(0L, str);
                return(flag);
            }
            VBFixedStringAttribute attribute2 = (VBFixedStringAttribute)customAttributes[0];
            int length = attribute2.Length;

            if (length == 0)
            {
                length = -1;
            }
            this.m_oFile.PutFixedLengthString(0L, str, length);
            return(flag);
        }
Пример #18
0
        internal static object InternalLateCall(object o, Type objType, string name, object[] args, string[] paramnames, bool[] CopyBack, bool IgnoreReturn)
        {
            object       obj2;
            BindingFlags flags = BindingFlags.OptionalParamBinding | BindingFlags.InvokeMethod | BindingFlags.FlattenHierarchy | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.IgnoreCase;

            if (IgnoreReturn)
            {
                flags |= BindingFlags.IgnoreReturn;
            }
            if (objType == null)
            {
                if (o == null)
                {
                    throw ExceptionUtils.VbMakeException(0x5b);
                }
                objType = o.GetType();
            }
            IReflect correctIReflect = GetCorrectIReflect(o, objType);

            if (objType.IsCOMObject)
            {
                CheckForClassExtendingCOMClass(objType);
            }
            if (name == null)
            {
                name = "";
            }
            VBBinder binder = new VBBinder(CopyBack);

            if (!objType.IsCOMObject)
            {
                MemberInfo[] mi = GetMembersByName(correctIReflect, name, flags);
                if ((mi == null) || (mi.Length == 0))
                {
                    throw new MissingMemberException(Utils.GetResourceString("MissingMember_MemberNotFoundOnType2", new string[] { name, Utils.VBFriendlyName(objType, o) }));
                }
                if (MemberIsField(mi))
                {
                    throw new ArgumentException(Utils.GetResourceString("ExpressionNotProcedure", new string[] { name, Utils.VBFriendlyName(objType, o) }));
                }
                if ((mi.Length == 1) && ((paramnames == null) || (paramnames.Length == 0)))
                {
                    MemberInfo getMethod = mi[0];
                    if (getMethod.MemberType == MemberTypes.Property)
                    {
                        getMethod = ((PropertyInfo)getMethod).GetGetMethod();
                        if (getMethod == null)
                        {
                            throw new MissingMemberException(Utils.GetResourceString("MissingMember_MemberNotFoundOnType2", new string[] { name, Utils.VBFriendlyName(objType, o) }));
                        }
                    }
                    MethodBase      method     = (MethodBase)getMethod;
                    ParameterInfo[] parameters = method.GetParameters();
                    int             length     = args.Length;
                    int             num2       = parameters.Length;
                    if (num2 == length)
                    {
                        if (num2 == 0)
                        {
                            return(FastCall(o, method, parameters, args, objType, correctIReflect));
                        }
                        if ((CopyBack == null) && NoByrefs(parameters))
                        {
                            ParameterInfo info2 = parameters[num2 - 1];
                            if (!info2.ParameterType.IsArray)
                            {
                                return(FastCall(o, method, parameters, args, objType, correctIReflect));
                            }
                            object[] customAttributes = info2.GetCustomAttributes(typeof(ParamArrayAttribute), false);
                            if ((customAttributes == null) || (customAttributes.Length == 0))
                            {
                                return(FastCall(o, method, parameters, args, objType, correctIReflect));
                            }
                        }
                    }
                }
            }
            try
            {
                obj2 = binder.InvokeMember(name, flags, objType, correctIReflect, o, args, paramnames);
            }
            catch (MissingMemberException)
            {
                throw;
            }
            catch when(?)
                {
                    throw new MissingMemberException(Utils.GetResourceString("MissingMember_MemberNotFoundOnType2", new string[] { name, Utils.VBFriendlyName(objType, o) }));
                }
        public bool Callback(FieldInfo field_info, ref object vValue)
        {
            bool flag;
            Type fieldType = field_info.FieldType;

            if (fieldType == null)
            {
                throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_UnsupportedFieldType2", new string[] { field_info.Name, "Empty" })), 5);
            }
            if (fieldType.IsArray)
            {
                object[] customAttributes = field_info.GetCustomAttributes(typeof(VBFixedArrayAttribute), false);
                Array    arr = null;
                int      fixedStringLength = -1;
                object[] objArray2         = field_info.GetCustomAttributes(typeof(VBFixedStringAttribute), false);
                if ((objArray2 != null) && (objArray2.Length > 0))
                {
                    VBFixedStringAttribute attribute = (VBFixedStringAttribute)objArray2[0];
                    if (attribute.Length > 0)
                    {
                        fixedStringLength = attribute.Length;
                    }
                }
                if ((customAttributes == null) || (customAttributes.Length == 0))
                {
                    this.m_oFile.GetDynamicArray(ref arr, fieldType.GetElementType(), fixedStringLength);
                }
                else
                {
                    VBFixedArrayAttribute attribute2 = (VBFixedArrayAttribute)customAttributes[0];
                    int firstBound  = attribute2.FirstBound;
                    int secondBound = attribute2.SecondBound;
                    arr = (Array)vValue;
                    this.m_oFile.GetFixedArray(0L, ref arr, fieldType.GetElementType(), firstBound, secondBound, fixedStringLength);
                }
                vValue = arr;
                return(flag);
            }
            switch (Type.GetTypeCode(fieldType))
            {
            case TypeCode.DBNull:
                throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_UnsupportedFieldType2", new string[] { field_info.Name, "DBNull" })), 5);

            case TypeCode.Boolean:
                vValue = this.m_oFile.GetBoolean(0L);
                return(flag);

            case TypeCode.Char:
                vValue = this.m_oFile.GetChar(0L);
                return(flag);

            case TypeCode.Byte:
                vValue = this.m_oFile.GetByte(0L);
                return(flag);

            case TypeCode.Int16:
                vValue = this.m_oFile.GetShort(0L);
                return(flag);

            case TypeCode.Int32:
                vValue = this.m_oFile.GetInteger(0L);
                return(flag);

            case TypeCode.Int64:
                vValue = this.m_oFile.GetLong(0L);
                return(flag);

            case TypeCode.Single:
                vValue = this.m_oFile.GetSingle(0L);
                return(flag);

            case TypeCode.Double:
                vValue = this.m_oFile.GetDouble(0L);
                return(flag);

            case TypeCode.Decimal:
                vValue = this.m_oFile.GetDecimal(0L);
                return(flag);

            case TypeCode.DateTime:
                vValue = this.m_oFile.GetDate(0L);
                return(flag);

            case TypeCode.String:
            {
                object[] objArray3 = field_info.GetCustomAttributes(typeof(VBFixedStringAttribute), false);
                if ((objArray3 != null) && (objArray3.Length != 0))
                {
                    VBFixedStringAttribute attribute3 = (VBFixedStringAttribute)objArray3[0];
                    int length = attribute3.Length;
                    if (length == 0)
                    {
                        length = -1;
                    }
                    vValue = this.m_oFile.GetFixedLengthString(0L, length);
                    return(flag);
                }
                vValue = this.m_oFile.GetLengthPrefixedString(0L);
                return(flag);
            }
            }
            if (fieldType == typeof(object))
            {
                this.m_oFile.GetObject(ref vValue, 0L, true);
                return(flag);
            }
            if (fieldType == typeof(Exception))
            {
                throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_UnsupportedFieldType2", new string[] { field_info.Name, "Exception" })), 5);
            }
            if (fieldType == typeof(Missing))
            {
                throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_UnsupportedFieldType2", new string[] { field_info.Name, "Missing" })), 5);
            }
            throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_UnsupportedFieldType2", new string[] { field_info.Name, fieldType.Name })), 5);
        }
Пример #20
0
        internal static string FindFirstFile(Assembly assem, string PathName, FileAttributes Attributes)
        {
            string fullPath = null;
            string fileName;

            FileSystemInfo[] fileSystemInfos;
            if ((PathName.Length > 0) && (PathName[PathName.Length - 1] == Path.DirectorySeparatorChar))
            {
                fullPath = Path.GetFullPath(PathName);
                fileName = "*.*";
            }
            else
            {
                if (PathName.Length == 0)
                {
                    fileName = "*.*";
                }
                else
                {
                    fileName = Path.GetFileName(PathName);
                    fullPath = Path.GetDirectoryName(PathName);
                    if (((fileName == null) || (fileName.Length == 0)) || (fileName == "."))
                    {
                        fileName = "*.*";
                    }
                }
                if ((fullPath == null) || (fullPath.Length == 0))
                {
                    if (Path.IsPathRooted(PathName))
                    {
                        fullPath = Path.GetPathRoot(PathName);
                    }
                    else
                    {
                        fullPath = Environment.CurrentDirectory;
                        if (fullPath[fullPath.Length - 1] != Path.DirectorySeparatorChar)
                        {
                            fullPath = fullPath + Conversions.ToString(Path.DirectorySeparatorChar);
                        }
                    }
                }
                else if (fullPath[fullPath.Length - 1] != Path.DirectorySeparatorChar)
                {
                    fullPath = fullPath + Conversions.ToString(Path.DirectorySeparatorChar);
                }
                if (fileName == "..")
                {
                    fullPath = fullPath + @"..\";
                    fileName = "*.*";
                }
            }
            try
            {
                fileSystemInfos = Directory.GetParent(fullPath + fileName).GetFileSystemInfos(fileName);
            }
            catch (SecurityException exception)
            {
                throw exception;
            }
            catch when(?)
                {
                    throw ExceptionUtils.VbMakeException(0x34);
                }
        internal override void PutObject(object Value, long RecordNumber = 0L, bool ContainedInVariant = true)
        {
            this.ValidateWriteable();
            if (Value == null)
            {
                this.PutEmpty(RecordNumber);
            }
            else
            {
                Type enumType = Value.GetType();
                if (enumType == null)
                {
                    throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_UnsupportedIOType1", new string[] { "Empty" })), 5);
                }
                if (enumType.IsArray)
                {
                    this.PutDynamicArray(RecordNumber, (Array)Value, true, -1);
                }
                else
                {
                    if (enumType.IsEnum)
                    {
                        enumType = Enum.GetUnderlyingType(enumType);
                    }
                    switch (Type.GetTypeCode(enumType))
                    {
                    case TypeCode.DBNull:
                        this.PutShort(RecordNumber, 1, false);
                        return;

                    case TypeCode.Boolean:
                        this.PutBoolean(RecordNumber, BooleanType.FromObject(Value), ContainedInVariant);
                        return;

                    case TypeCode.Char:
                        this.PutChar(RecordNumber, Microsoft.VisualBasic.CompilerServices.CharType.FromObject(Value), ContainedInVariant);
                        return;

                    case TypeCode.Byte:
                        this.PutByte(RecordNumber, ByteType.FromObject(Value), ContainedInVariant);
                        return;

                    case TypeCode.Int16:
                        this.PutShort(RecordNumber, ShortType.FromObject(Value), ContainedInVariant);
                        return;

                    case TypeCode.Int32:
                        this.PutInteger(RecordNumber, IntegerType.FromObject(Value), ContainedInVariant);
                        return;

                    case TypeCode.Int64:
                        this.PutLong(RecordNumber, LongType.FromObject(Value), ContainedInVariant);
                        return;

                    case TypeCode.Single:
                        this.PutSingle(RecordNumber, SingleType.FromObject(Value), ContainedInVariant);
                        return;

                    case TypeCode.Double:
                        this.PutDouble(RecordNumber, DoubleType.FromObject(Value), ContainedInVariant);
                        return;

                    case TypeCode.Decimal:
                        this.PutDecimal(RecordNumber, DecimalType.FromObject(Value), ContainedInVariant);
                        return;

                    case TypeCode.DateTime:
                        this.PutDate(RecordNumber, DateType.FromObject(Value), ContainedInVariant);
                        return;

                    case TypeCode.String:
                        this.PutVariantString(RecordNumber, Value.ToString());
                        return;
                    }
                    if (enumType == typeof(Missing))
                    {
                        throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_UnsupportedIOType1", new string[] { "Missing" })), 5);
                    }
                    if (enumType.IsValueType && !ContainedInVariant)
                    {
                        this.PutRecord(RecordNumber, (ValueType)Value);
                    }
                    else
                    {
                        if (ContainedInVariant && enumType.IsValueType)
                        {
                            throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_PutObjectOfValueType1", new string[] { Utils.VBFriendlyName(enumType, Value) })), 5);
                        }
                        throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_UnsupportedIOType1", new string[] { Utils.VBFriendlyName(enumType, Value) })), 5);
                    }
                }
            }
        }
Пример #22
0
            public static bool ForNextCheckObj(object Counter, object LoopObj, ref object CounterResult)
            {
                if (LoopObj == null)
                {
                    throw ExceptionUtils.VbMakeException(0x5c);
                }
                if (Counter == null)
                {
                    throw new NullReferenceException(Utils.GetResourceString("Argument_InvalidNullValue1", new string[] { "Counter" }));
                }
                ObjectFlowControl.ForLoopControl loopFor = (ObjectFlowControl.ForLoopControl)LoopObj;
                bool flag2 = false;

                if (!loopFor.UseUserDefinedOperators)
                {
                    TypeCode typeCode = ((IConvertible)Counter).GetTypeCode();
                    if ((typeCode != loopFor.WidestTypeCode) || (typeCode == TypeCode.String))
                    {
                        if (typeCode == TypeCode.Object)
                        {
                            throw new ArgumentException(Utils.GetResourceString("ForLoop_CommonType2", new string[] { Utils.VBFriendlyName(Symbols.MapTypeCodeToType(typeCode)), Utils.VBFriendlyName(loopFor.WidestType) }));
                        }
                        TypeCode code2 = Symbols.GetTypeCode(GetWidestType(Symbols.MapTypeCodeToType(typeCode), loopFor.WidestType));
                        if (code2 == TypeCode.String)
                        {
                            code2 = TypeCode.Double;
                        }
                        loopFor.WidestTypeCode = code2;
                        loopFor.WidestType     = Symbols.MapTypeCodeToType(code2);
                        flag2 = true;
                    }
                }
                if (flag2 || loopFor.UseUserDefinedOperators)
                {
                    Counter = ConvertLoopElement("Start", Counter, Counter.GetType(), loopFor.WidestType);
                    if (!loopFor.UseUserDefinedOperators)
                    {
                        loopFor.Limit     = ConvertLoopElement("Limit", loopFor.Limit, loopFor.Limit.GetType(), loopFor.WidestType);
                        loopFor.StepValue = ConvertLoopElement("Step", loopFor.StepValue, loopFor.StepValue.GetType(), loopFor.WidestType);
                    }
                }
                if (!loopFor.UseUserDefinedOperators)
                {
                    loopFor.Counter = Operators.AddObject(Counter, loopFor.StepValue);
                    TypeCode code3 = ((IConvertible)loopFor.Counter).GetTypeCode();
                    if (loopFor.EnumType != null)
                    {
                        CounterResult = Enum.ToObject(loopFor.EnumType, loopFor.Counter);
                    }
                    else
                    {
                        CounterResult = loopFor.Counter;
                    }
                    if (code3 != loopFor.WidestTypeCode)
                    {
                        loopFor.Limit     = Conversions.ChangeType(loopFor.Limit, Symbols.MapTypeCodeToType(code3));
                        loopFor.StepValue = Conversions.ChangeType(loopFor.StepValue, Symbols.MapTypeCodeToType(code3));
                        return(false);
                    }
                }
                else
                {
                    loopFor.Counter = Operators.InvokeUserDefinedOperator(loopFor.OperatorPlus, true, new object[] { Counter, loopFor.StepValue });
                    if (loopFor.Counter.GetType() != loopFor.WidestType)
                    {
                        loopFor.Counter = ConvertLoopElement("Start", loopFor.Counter, loopFor.Counter.GetType(), loopFor.WidestType);
                    }
                    CounterResult = loopFor.Counter;
                }
                return(CheckContinueLoop(loopFor));
            }
        internal override void GetObject(ref object Value, long RecordNumber = 0L, bool ContainedInVariant = true)
        {
            Type type = null;
            VT   variant;

            this.ValidateReadable();
            this.SetRecord(RecordNumber);
            if (ContainedInVariant)
            {
                variant          = (VT)base.m_br.ReadInt16();
                base.m_position += 2L;
            }
            else
            {
                type = Value.GetType();
                switch (Type.GetTypeCode(type))
                {
                case TypeCode.Object:
                    if (!type.IsValueType)
                    {
                        variant = VT.Variant;
                    }
                    else
                    {
                        variant = VT.Structure;
                    }
                    goto Label_00D7;

                case TypeCode.Boolean:
                    variant = VT.Boolean;
                    goto Label_00D7;

                case TypeCode.Char:
                    variant = VT.Char;
                    goto Label_00D7;

                case TypeCode.Byte:
                    variant = VT.Byte;
                    goto Label_00D7;

                case TypeCode.Int16:
                    variant = VT.Short;
                    goto Label_00D7;

                case TypeCode.Int32:
                    variant = VT.Integer;
                    goto Label_00D7;

                case TypeCode.Int64:
                    variant = VT.Long;
                    goto Label_00D7;

                case TypeCode.Single:
                    variant = VT.Single;
                    goto Label_00D7;

                case TypeCode.Double:
                    variant = VT.Double;
                    goto Label_00D7;

                case TypeCode.Decimal:
                    variant = VT.Decimal;
                    goto Label_00D7;

                case TypeCode.DateTime:
                    variant = VT.Date;
                    goto Label_00D7;

                case TypeCode.String:
                    variant = VT.String;
                    goto Label_00D7;
                }
                variant = VT.Variant;
            }
Label_00D7:
            if ((variant & VT.Array) != VT.Empty)
            {
                Array arr   = null;
                VT    vtype = variant ^ VT.Array;
                this.GetDynamicArray(ref arr, this.ComTypeFromVT(vtype), -1);
                Value = arr;
            }
            else
            {
                switch (variant)
                {
                case VT.String:
                    Value = this.GetLengthPrefixedString(0L);
                    return;

                case VT.Short:
                    Value = this.GetShort(0L);
                    return;

                case VT.Integer:
                    Value = this.GetInteger(0L);
                    return;

                case VT.Long:
                    Value = this.GetLong(0L);
                    return;

                case VT.Byte:
                    Value = this.GetByte(0L);
                    return;

                case VT.Date:
                    Value = this.GetDate(0L);
                    return;

                case VT.Double:
                    Value = this.GetDouble(0L);
                    return;

                case VT.Single:
                    Value = this.GetSingle(0L);
                    return;

                case VT.Currency:
                    Value = this.GetCurrency(0L);
                    return;

                case VT.Decimal:
                    Value = this.GetDecimal(0L);
                    return;

                case VT.Boolean:
                    Value = this.GetBoolean(0L);
                    return;

                case VT.Char:
                    Value = this.GetChar(0L);
                    return;

                case VT.Structure:
                {
                    ValueType o = (ValueType)Value;
                    this.GetRecord(0L, ref o, false);
                    Value = o;
                    return;
                }
                }
                if ((variant == VT.DBNull) && ContainedInVariant)
                {
                    Value = DBNull.Value;
                }
                else
                {
                    if (variant == VT.DBNull)
                    {
                        throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_UnsupportedIOType1", new string[] { "DBNull" })), 5);
                    }
                    if (variant == VT.Empty)
                    {
                        Value = null;
                    }
                    else
                    {
                        if (variant == VT.Currency)
                        {
                            throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_UnsupportedIOType1", new string[] { "Currency" })), 5);
                        }
                        throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_UnsupportedIOType1", new string[] { type.FullName })), 5);
                    }
                }
            }
        }
Пример #24
0
 public static void ThrowException(int hr)
 {
     throw ExceptionUtils.VbMakeException(hr);
 }
        public static bool StrLikeBinary(string Source, string Pattern)
        {
            bool flag;
            int  length;
            int  num2;
            char ch3;
            int  num4;
            int  num5;
            bool flag2 = false;

            if (Pattern == null)
            {
                length = 0;
            }
            else
            {
                length = Pattern.Length;
            }
            if (Source == null)
            {
                num4 = 0;
            }
            else
            {
                num4 = Source.Length;
            }
            if (num5 < num4)
            {
                ch3 = Source[num5];
            }
            while (num2 < length)
            {
                char p = Pattern[num2];
                if ((p == '*') && !flag)
                {
                    int num3 = AsteriskSkip(Pattern.Substring(num2 + 1), Source.Substring(num5), num4 - num5, CompareMethod.Binary, Strings.m_InvariantCompareInfo);
                    if (num3 < 0)
                    {
                        return(false);
                    }
                    if (num3 > 0)
                    {
                        num5 += num3;
                        if (num5 < num4)
                        {
                            ch3 = Source[num5];
                        }
                    }
                }
                else if ((p == '?') && !flag)
                {
                    num5++;
                    if (num5 < num4)
                    {
                        ch3 = Source[num5];
                    }
                }
                else if ((p == '#') && !flag)
                {
                    if (!char.IsDigit(ch3))
                    {
                        break;
                    }
                    num5++;
                    if (num5 < num4)
                    {
                        ch3 = Source[num5];
                    }
                }
                else
                {
                    bool flag4;
                    bool flag5;
                    if ((((p == '-') && flag) && (flag5 && !flag2)) && (!flag4 && (((num2 + 1) >= length) || (Pattern[num2 + 1] != ']'))))
                    {
                        flag4 = true;
                    }
                    else
                    {
                        bool flag3;
                        bool flag6;
                        if (((p == '!') && flag) && !flag6)
                        {
                            flag6 = true;
                            flag3 = true;
                        }
                        else
                        {
                            char ch;
                            char ch4;
                            if ((p == '[') && !flag)
                            {
                                flag  = true;
                                ch4   = '\0';
                                ch    = '\0';
                                flag5 = false;
                            }
                            else if ((p == ']') && flag)
                            {
                                flag = false;
                                if (flag5)
                                {
                                    if (!flag3)
                                    {
                                        break;
                                    }
                                    num5++;
                                    if (num5 < num4)
                                    {
                                        ch3 = Source[num5];
                                    }
                                }
                                else if (flag4)
                                {
                                    if (!flag3)
                                    {
                                        break;
                                    }
                                }
                                else if (flag6)
                                {
                                    if ('!' != ch3)
                                    {
                                        break;
                                    }
                                    num5++;
                                    if (num5 < num4)
                                    {
                                        ch3 = Source[num5];
                                    }
                                }
                                flag3 = false;
                                flag5 = false;
                                flag6 = false;
                                flag4 = false;
                            }
                            else
                            {
                                flag5 = true;
                                flag2 = false;
                                if (flag)
                                {
                                    if (flag4)
                                    {
                                        flag4 = false;
                                        flag2 = true;
                                        ch    = p;
                                        if (ch4 > ch)
                                        {
                                            throw ExceptionUtils.VbMakeException(0x5d);
                                        }
                                        if ((flag6 && flag3) || (!flag6 && !flag3))
                                        {
                                            flag3 = (ch3 > ch4) && (ch3 <= ch);
                                            if (flag6)
                                            {
                                                flag3 = !flag3;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        ch4   = p;
                                        flag3 = StrLikeCompareBinary(flag6, flag3, p, ch3);
                                    }
                                }
                                else
                                {
                                    if ((p != ch3) && !flag6)
                                    {
                                        break;
                                    }
                                    flag6 = false;
                                    num5++;
                                    if (num5 < num4)
                                    {
                                        ch3 = Source[num5];
                                    }
                                    else if (num5 > num4)
                                    {
                                        return(false);
                                    }
                                }
                            }
                        }
                    }
                }
                num2++;
            }
            if (flag)
            {
                if (num4 != 0)
                {
                    throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue1", new string[] { "Pattern" }));
                }
                return(false);
            }
            return((num2 == length) && (num5 == num4));
        }
        public static bool StrLikeText(string Source, string Pattern)
        {
            bool flag;
            int  length;
            int  num2;
            char ch3;
            int  num4;
            int  num5;
            bool flag2 = false;

            if (Pattern == null)
            {
                length = 0;
            }
            else
            {
                length = Pattern.Length;
            }
            if (Source == null)
            {
                num4 = 0;
            }
            else
            {
                num4 = Source.Length;
            }
            if (num5 < num4)
            {
                ch3 = Source[num5];
            }
            CompareInfo    compareInfo = Utils.GetCultureInfo().CompareInfo;
            CompareOptions options     = CompareOptions.IgnoreWidth | CompareOptions.IgnoreKanaType | CompareOptions.IgnoreNonSpace | CompareOptions.IgnoreCase;

            while (num2 < length)
            {
                char p = Pattern[num2];
                if ((p == '*') && !flag)
                {
                    int num3 = AsteriskSkip(Pattern.Substring(num2 + 1), Source.Substring(num5), num4 - num5, CompareMethod.Text, compareInfo);
                    if (num3 < 0)
                    {
                        return(false);
                    }
                    if (num3 > 0)
                    {
                        num5 += num3;
                        if (num5 < num4)
                        {
                            ch3 = Source[num5];
                        }
                    }
                }
                else if ((p == '?') && !flag)
                {
                    num5++;
                    if (num5 < num4)
                    {
                        ch3 = Source[num5];
                    }
                }
                else if ((p == '#') && !flag)
                {
                    if (!char.IsDigit(ch3))
                    {
                        break;
                    }
                    num5++;
                    if (num5 < num4)
                    {
                        ch3 = Source[num5];
                    }
                }
                else
                {
                    bool flag4;
                    bool flag5;
                    if ((((p == '-') && flag) && (flag5 && !flag2)) && (!flag4 && (((num2 + 1) >= length) || (Pattern[num2 + 1] != ']'))))
                    {
                        flag4 = true;
                    }
                    else
                    {
                        bool flag3;
                        bool flag6;
                        if (((p == '!') && flag) && !flag6)
                        {
                            flag6 = true;
                            flag3 = true;
                        }
                        else
                        {
                            char ch;
                            char ch4;
                            if ((p == '[') && !flag)
                            {
                                flag  = true;
                                ch4   = '\0';
                                ch    = '\0';
                                flag5 = false;
                            }
                            else if ((p == ']') && flag)
                            {
                                flag = false;
                                if (flag5)
                                {
                                    if (!flag3)
                                    {
                                        break;
                                    }
                                    num5++;
                                    if (num5 < num4)
                                    {
                                        ch3 = Source[num5];
                                    }
                                }
                                else if (flag4)
                                {
                                    if (!flag3)
                                    {
                                        break;
                                    }
                                }
                                else if (flag6)
                                {
                                    if (compareInfo.Compare("!", Conversions.ToString(ch3)) != 0)
                                    {
                                        break;
                                    }
                                    num5++;
                                    if (num5 < num4)
                                    {
                                        ch3 = Source[num5];
                                    }
                                }
                                flag3 = false;
                                flag5 = false;
                                flag6 = false;
                                flag4 = false;
                            }
                            else
                            {
                                flag5 = true;
                                flag2 = false;
                                if (flag)
                                {
                                    if (flag4)
                                    {
                                        flag4 = false;
                                        flag2 = true;
                                        ch    = p;
                                        if (ch4 > ch)
                                        {
                                            throw ExceptionUtils.VbMakeException(0x5d);
                                        }
                                        if ((flag6 && flag3) || (!flag6 && !flag3))
                                        {
                                            if (options == CompareOptions.Ordinal)
                                            {
                                                flag3 = (ch3 > ch4) && (ch3 <= ch);
                                            }
                                            else
                                            {
                                                flag3 = (compareInfo.Compare(Conversions.ToString(ch4), Conversions.ToString(ch3), options) < 0) && (compareInfo.Compare(Conversions.ToString(ch), Conversions.ToString(ch3), options) >= 0);
                                            }
                                            if (flag6)
                                            {
                                                flag3 = !flag3;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        ch4   = p;
                                        flag3 = StrLikeCompare(compareInfo, flag6, flag3, p, ch3, options);
                                    }
                                }
                                else
                                {
                                    if (options == CompareOptions.Ordinal)
                                    {
                                        if ((p != ch3) && !flag6)
                                        {
                                            break;
                                        }
                                    }
                                    else
                                    {
                                        string str  = Conversions.ToString(p);
                                        string str2 = Conversions.ToString(ch3);
                                        while (((num2 + 1) < length) && ((UnicodeCategory.ModifierSymbol == char.GetUnicodeCategory(Pattern[num2 + 1])) || (UnicodeCategory.NonSpacingMark == char.GetUnicodeCategory(Pattern[num2 + 1]))))
                                        {
                                            str = str + Conversions.ToString(Pattern[num2 + 1]);
                                            num2++;
                                        }
                                        while (((num5 + 1) < num4) && ((UnicodeCategory.ModifierSymbol == char.GetUnicodeCategory(Source[num5 + 1])) || (UnicodeCategory.NonSpacingMark == char.GetUnicodeCategory(Source[num5 + 1]))))
                                        {
                                            str2 = str2 + Conversions.ToString(Source[num5 + 1]);
                                            num5++;
                                        }
                                        if ((compareInfo.Compare(str, str2, CompareOptions.IgnoreWidth | CompareOptions.IgnoreKanaType | CompareOptions.IgnoreCase) != 0) && !flag6)
                                        {
                                            break;
                                        }
                                    }
                                    flag6 = false;
                                    num5++;
                                    if (num5 < num4)
                                    {
                                        ch3 = Source[num5];
                                    }
                                    else if (num5 > num4)
                                    {
                                        return(false);
                                    }
                                }
                            }
                        }
                    }
                }
                num2++;
            }
            if (flag)
            {
                if (num4 != 0)
                {
                    throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue1", new string[] { "Pattern" }));
                }
                return(false);
            }
            return((num2 == length) && (num5 == num4));
        }