⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 f.cs

📁 老外Logix Mobile mCoreLib短信控件源码 通过串口或者手机数据线进行连接,可对手机进行 读写操作.
💻 CS
📖 第 1 页 / 共 5 页
字号:
                        continue;
                    }
                    str3 = str;
                    args = new NewUSSDReceivedEventArgs(str, (USSDStatus) num2);
                    try
                    {
                        if (args != null)
                        {
                            f.a j = this.j;
                            if (j != null)
                            {
                                j(args);
                            }
                        }
                        continue;
                    }
                    catch (Exception exception5)
                    {
                        ProjectData.SetProjectError(exception5);
                        Exception exception2 = exception5;
                        ProjectData.ClearProjectError();
                        continue;
                    }
                }
                catch (Exception exception6)
                {
                    ProjectData.SetProjectError(exception6);
                    Exception exception3 = exception6;
                    this.a.b("[GSM:NewUSSD:C] " + exception3.Message);
                    ProjectData.ClearProjectError();
                    continue;
                }
            }
        }
        catch (Exception exception7)
        {
            ProjectData.SetProjectError(exception7);
            Exception exception4 = exception7;
            ProjectData.ClearProjectError();
        }
        finally
        {
            if (Monitor.TryEnter(this.m, this.@as))
            {
                try
                {
                    m = this.m;
                    m.g--;
                }
                finally
                {
                    Monitor.Exit(this.m);
                }
            }
            else
            {
                this.a(0x2333L, "Thread monitor enter attempt timeout [GSM:NewUSSD:D]", "GENERAL");
                this.av();
            }
        }
    }

    [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
    internal void a(f.a A_0)
    {
        this.j = (f.a) Delegate.Combine(this.j, A_0);
    }

    [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
    internal void a(f.b A_0)
    {
        this.h = (f.b) Delegate.Combine(this.h, A_0);
    }

    [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
    internal void a(f.c A_0)
    {
        this.i = (f.c) Delegate.Combine(this.i, A_0);
    }

    [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
    internal void a(f.d A_0)
    {
        this.g = (f.d) Delegate.Combine(this.g, A_0);
    }

    protected virtual void a(bool A_0)
    {
        if ((!this.de && A_0) && (this.b != null))
        {
            this.b.Dispose();
            this.b = null;
        }
        this.de = true;
    }

    internal string a(DateTime A_0)
    {
        string str7;
        string str10 = "";
        string str4 = "";
        string str = "";
        string str2 = "";
        string str3 = "";
        string str5 = "";
        long num = 0L;
        long num2 = 0L;
        long num3 = 0L;
        string str6 = "+";
        string str8 = "";
        string str9 = "";
        try
        {
            num = (long) Math.Round(TimeZone.CurrentTimeZone.GetUtcOffset(DateAndTime.Now).TotalMinutes);
            num3 = num % 60L;
            num2 = (long) Math.Round((double) (((double) (num - num3)) / 60.0));
            if (num < 0L)
            {
                str6 = "-";
                num3 = -1L * num3;
                num2 = -1L * num2;
            }
            str8 = num2.ToString();
            str9 = num3.ToString();
            if (str8.Length < 2)
            {
                str8 = "0" + str8;
            }
            if (str9.Length < 2)
            {
                str9 = "0" + str9;
            }
            str10 = DateAndTime.Year(A_0).ToString();
            str4 = DateAndTime.Month(A_0).ToString();
            if (str4.Length < 2)
            {
                str4 = "0" + str4;
            }
            str = DateAndTime.Day(A_0).ToString();
            if (str.Length < 2)
            {
                str = "0" + str;
            }
            str2 = DateAndTime.Hour(A_0).ToString();
            if (str2.Length < 2)
            {
                str2 = "0" + str2;
            }
            str3 = DateAndTime.Minute(A_0).ToString();
            if (str3.Length < 2)
            {
                str3 = "0" + str3;
            }
            str5 = DateAndTime.Second(A_0).ToString();
            if (str5.Length < 2)
            {
                str5 = "0" + str5;
            }
            str7 = str10 + str4 + str + "T" + str2 + str3 + str5 + str6 + str8 + str9;
        }
        catch (Exception exception1)
        {
            ProjectData.SetProjectError(exception1);
            Exception exception = exception1;
            this.a.b("[GSM:ToISO8601:1] " + exception.Message);
            str7 = "";
            ProjectData.ClearProjectError();
        }
        return str7;
    }

    private int a(int A_0)
    {
        int num;
        try
        {
            if (A_0 != 0x63)
            {
                if (A_0 <= -113)
                {
                    return 0;
                }
                if (A_0 >= -51)
                {
                    return 100;
                }
                return (int) Math.Round(Math.Round((double) ((((double) (A_0 + 0x71)) / 62.0) * 100.0), 1));
            }
            num = -1;
        }
        catch (Exception exception1)
        {
            ProjectData.SetProjectError(exception1);
            Exception exception = exception1;
            this.a.b("[GSM:dB2Percent:1] " + exception.Message);
            num = -1;
            ProjectData.ClearProjectError();
        }
        return num;
    }

    [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
    internal virtual void a(SerialPort A_0)
    {
        this.am = A_0;
    }

    private string a(string A_0)
    {
        string str2 = "";
        int num = 1;
        try
        {
            num = 1;
            do
            {
                str2 = this.n(A_0).ToUpper();
                if (!(((str2.Length > 0) & (str2.Contains("CMS ERROR") | str2.Contains("CME ERROR"))) & str2.Contains("515")))
                {
                    return str2;
                }
                if (num >= 30)
                {
                    return str2;
                }
                this.a.b("Modem is busy initializing or previous command processing in progress");
                Thread.Sleep(0x3e8);
                this.a.b("Retrying command after " + 0x3e8.ToString() + "ms delay");
                num++;
            }
            while (num <= 30);
        }
        catch (Exception exception1)
        {
            ProjectData.SetProjectError(exception1);
            Exception exception = exception1;
            this.a.b("[GSM:SendATCommandWithBusyCheck:1] " + exception.Message);
            str2 = "";
            ProjectData.ClearProjectError();
        }
        return str2;
    }

    internal bool a(int A_0, bool A_1)
    {
        string text = "";
        string strA = "";
        char[] trimChars = "\r\n".ToCharArray();
        this.bt = "";
        this.bu = 0L;
        bool flag2 = false;
        this.a.b("Reading incoming messages [Option-" + A_0.ToString() + "]");
        this.c.a();
        if (!this.r().IsOpen)
        {
            if (!this.u())
            {
                return false;
            }
            if (this.z != 0L)
            {
                return false;
            }
        }
        if (!this.av)
        {
            if (!this.i(this.aw))
            {
                return false;
            }
            if (this.z != 0L)
            {
                return false;
            }
        }
        if ((!this.a9 | (this.a5 != "READY")) && !this.ai())
        {
            this.bt = this.ba;
            this.bu = this.bb;
            return false;
        }
        if (!this.bj && !this.au())
        {
            this.bt = "Cannot check PDU mode support";
            this.bu = 0x138cL;
            return false;
        }
        if (!this.bk)
        {
            this.bt = "Modem does not support PDU mode";
            this.bu = 0x138dL;
            return false;
        }
        try
        {
            int num2;
            int num3;
            switch (A_0)
            {
                case 0:
                    num3 = 0;
                    num2 = 0;
                    break;

                case 1:
                    num3 = 1;
                    num2 = 1;
                    break;

                case 2:
                    num3 = 0;
                    num2 = 1;
                    break;
            }
            int num7 = num3;
            for (int i = num2; i >= num7; i += -1)
            {
                DateTime now;
                if (!this.r().IsOpen)
                {
                    this.u();
                }
                if (!this.r().IsOpen | (this.z != 0L))
                {
                    this.bt = "Cannot connect to modem for reading message";
                    this.bu = 0x138eL;
                    return false;
                }
                bool flag = false;
                text = "AT+CMGL=" + i.ToString() + "\r";
                try
                {
                    this.cr = true;
                    this.cu = true;
                    if (Monitor.TryEnter(this.l, this.@as))
                    {
                        try
                        {
                            this.k.a = "";
                        }
                        catch (Exception exception1)
                        {
                            ProjectData.SetProjectError(exception1);
                            Exception exception = exception1;
                            ProjectData.ClearProjectError();
                        }
                        finally
                        {
                            Monitor.Exit(this.l);
                        }
                    }
                    else
                    {
                        this.cr = false;
                        this.cu = false;
                        this.br = "Thread monitor enter attempt timeout [GSM:ReadInbox:A]";
                        this.bs = 0x2333L;
                        this.aj();
                        return false;
                    }
                    this.r().Write(text);
                    now = DateTime.Now;
                    this.a.b("Modem Command: " + text);
                    goto Label_03B0;
                }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -