public void Raise(int Number, object Source = null, object Description = null, object HelpFile = null, object HelpContext = null)
        {
            if (Number == 0)
            {
                throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue1", new string[] { "Number" }));
            }
            this.Number = Number;
            if (Source != null)
            {
                this.Source = Conversions.ToString(Source);
            }
            else
            {
                IVbHost vBHost = HostServices.VBHost;
                if (vBHost == null)
                {
                    string fullName = Assembly.GetCallingAssembly().FullName;
                    int    num      = Strings.InStr(fullName, ",", CompareMethod.Binary);
                    if (num < 1)
                    {
                        this.Source = fullName;
                    }
                    else
                    {
                        this.Source = Strings.Left(fullName, num - 1);
                    }
                }
                else
                {
                    this.Source = vBHost.GetWindowTitle();
                }
            }
            if (HelpFile != null)
            {
                this.HelpFile = Conversions.ToString(HelpFile);
            }
            if (HelpContext != null)
            {
                this.HelpContext = Conversions.ToInteger(HelpContext);
            }
            if (Description != null)
            {
                this.Description = Conversions.ToString(Description);
            }
            else if (!this.m_DescriptionIsSet)
            {
                this.Description = Utils.GetResourceString((vbErrors)this.m_curNumber);
            }
            Exception exception = this.MapNumberToException(this.m_curNumber, this.m_curDescription);

            exception.Source      = this.m_curSource;
            exception.HelpLink    = this.MakeHelpLink(this.m_curHelpFile, this.m_curHelpContext);
            this.m_ClearOnCapture = false;
            throw exception;
        }
Beispiel #2
0
        internal static string OldVbTypeName(string UrtName)
        {
            UrtName = Strings.Trim(UrtName).ToUpperInvariant();
            if (Strings.Left(UrtName, 7) == "SYSTEM.")
            {
                UrtName = Strings.Mid(UrtName, 8);
            }
            switch (UrtName)
            {
            case "OBJECT":
                return("Object");

            case "INT16":
                return("Short");

            case "INT32":
                return("Integer");

            case "SINGLE":
                return("Single");

            case "DOUBLE":
                return("Double");

            case "DATETIME":
                return("Date");

            case "STRING":
                return("String");

            case "BOOLEAN":
                return("Boolean");

            case "DECIMAL":
                return("Decimal");

            case "BYTE":
                return("Byte");

            case "CHAR":
                return("Char");

            case "INT64":
                return("Long");
            }
            return(null);
        }