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

📄 sms.cs

📁 老外Logix Mobile mCoreLib短信控件源码 通过串口或者手机数据线进行连接,可对手机进行 读写操作.
💻 CS
📖 第 1 页 / 共 5 页
字号:
            this.gm = gm;
            mCore.SMS.a a = new mCore.SMS.a(ref gm, ATCommand);
            Thread thread = new Thread(new ThreadStart(a.a));
            thread.Name = "CommandMethodThread";
            thread.Priority = ThreadPriority.Normal;
            thread.Start();
            while (thread.IsAlive)
            {
                Thread.Sleep(1);
                Application.DoEvents();
            }
            c = a.c;
            if (a != null)
            {
                a = null;
            }
            string str = c;
            this.a();
            return str;
        }

        public bool Connect()
        {
            Thread thread = new Thread(new ThreadStart(this.t));
            thread.Name = "ConnectMethodThread";
            thread.Priority = ThreadPriority.AboveNormal;
            thread.Start();
            while (thread.IsAlive)
            {
                Thread.Sleep(1);
                Application.DoEvents();
            }
            bool ab = this.ab;
            this.a();
            return ab;
        }

        private void d()
        {
            if (Monitor.TryEnter(this.gm, this.gm.@as))
            {
                try
                {
                    this.gm.av();
                    this.gm.x = this.@as;
                    this.gm.b(3);
                }
                finally
                {
                    Monitor.Exit(this.gm);
                }
            }
            else
            {
                this.gm.a(0x2333L, "Thread monitor enter attempt timeout [AutoDeleteNewMessage_Set]", "GENERAL");
            }
        }

        public bool Disconnect()
        {
            Thread thread = new Thread(new ThreadStart(this.s));
            thread.Name = "DisconnectMethodThread";
            thread.Start();
            while (thread.IsAlive)
            {
                Thread.Sleep(1);
                Application.DoEvents();
            }
            bool ab = this.ab;
            this.a();
            return ab;
        }

        public void Dispose()
        {
            this.Dispose(true);
            GC.SuppressFinalize(this);
        }

        protected virtual void Dispose(bool disposing)
        {
            if ((!this.av && disposing) && (this.gm != null))
            {
                this.gm.ad();
                this.gm = null;
            }
            this.av = true;
        }

        private void e()
        {
            if (Monitor.TryEnter(this.gm, this.gm.@as))
            {
                try
                {
                    this.gm.av();
                    this.gm.s = this.ar;
                    this.gm.b(1);
                }
                finally
                {
                    Monitor.Exit(this.gm);
                }
            }
            else
            {
                this.gm.a(0x2333L, "Thread monitor enter attempt timeout [NewMessageIndication_Set]", "GENERAL");
            }
        }

        private void f()
        {
            if (Monitor.TryEnter(this.gm, this.gm.@as))
            {
                try
                {
                    this.gm.av();
                    this.gm.bi = this.aq;
                    this.gm.u = this.aq;
                    this.gm.b(2);
                }
                finally
                {
                    Monitor.Exit(this.gm);
                }
            }
            else
            {
                this.gm.a(0x2333L, "Thread monitor enter attempt timeout [DeliveryReport_Set]", "GENERAL");
            }
        }

        protected override void Finalize()
        {
            this.Dispose(false);
            base.Finalize();
        }

        private void g()
        {
            if (Monitor.TryEnter(this.gm, this.gm.@as))
            {
                try
                {
                    this.gm.av();
                    this.gm.a3 = "";
                    this.gm.aa();
                    if (this.gm.a3.Length <= 0)
                    {
                        this.gm.a(0x7ebL, "Cannot read own number", "GENERAL");
                    }
                    this.ap = this.gm.a3;
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    this.gm.a.b("[SMS:OwnNumber_Get:1] " + exception.Message);
                    ProjectData.ClearProjectError();
                }
                finally
                {
                    Monitor.Exit(this.gm);
                }
            }
            else
            {
                this.gm.a(0x2333L, "Thread monitor enter attempt timeout [OwnNumber_Get]", "GENERAL");
            }
        }

        private void h()
        {
            if (Monitor.TryEnter(this.gm, this.gm.@as))
            {
                this.gm.av();
                this.gm.a2 = -1;
                try
                {
                    this.gm.ae();
                    if (this.gm.a2 < 0)
                    {
                        this.gm.a(0x7eaL, "Cannot read battery charge level", "GENERAL");
                    }
                    this.ao = this.gm.a2;
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    this.gm.a.b("[SMS:BatteryLevel_Get:1] " + exception.Message);
                    ProjectData.ClearProjectError();
                }
                finally
                {
                    Monitor.Exit(this.gm);
                }
            }
            else
            {
                this.gm.a(0x2333L, "Thread monitor enter attempt timeout [BatteryLevel_Get]", "GENERAL");
            }
        }

        private void i()
        {
            if (Monitor.TryEnter(this.gm, this.gm.@as))
            {
                string str = "";
                this.am = "";
                try
                {
                    this.gm.av();
                    str = this.gm.@as();
                    this.am = str;
                    if ((str.Length == 0) && (this.gm.z == 0L))
                    {
                        this.gm.a(0xbc1L, "Unable to read network information", "GENERAL");
                    }
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    this.gm.a.b("[SMS:Network_Get:1] " + exception.Message);
                    ProjectData.ClearProjectError();
                }
                finally
                {
                    Monitor.Exit(this.gm);
                }
            }
            else
            {
                this.gm.a(0x2333L, "Thread monitor enter attempt timeout [Network_Get]", "GENERAL");
            }
        }

        public mCore.Inbox Inbox()
        {
            SMS sms;
            if (this.v == null)
            {
                sms = this;
                this.v = new c(ref sms);
            }
            if (this.w == null)
            {
                sms = this;
                this.w = new mCore.Inbox(ref sms);
            }
            return this.w;
        }

        public mCore.Message Inbox(int Index)
        {
            mCore.Message message = null;
            try
            {
                this.gm.av();
                if ((Index <= 0) | (Index > this.gm.co.Count))
                {
                    this.gm.ae = 0;
                    this.gm.a(0x1389L, "Invalid inbox message index", "SMSREAD");
                    return null;
                }
                this.gm.ae = Index;
                message = (mCore.Message) this.gm.co[Index.ToString()];
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                this.gm.a.b("[SMS:Inbox:1] " + exception.Message);
                ProjectData.ClearProjectError();
            }
            return message;
        }

        public bool IsError()
        {
            bool flag = false;
            if (this.gm.z != 0L)
            {
                flag = true;
            }
            return flag;
        }

        public bool IsError(bool ShowMsgBox)
        {
            bool flag = false;
            if (this.gm.z == 0L)
            {
                return flag;
            }
            if (ShowMsgBox)
            {
                Interaction.MsgBox("ERROR " + this.gm.z.ToString() + ": " + this.gm.y, MsgBoxStyle.Critical, "mCore Library Error");
            }
            return true;
        }

        public bool IsError(bool ShowMsgBox, string MsgBoxTitle)
        {
            bool flag = false;
            if (this.gm.z == 0L)
            {
                return flag;
            }
            if (ShowMsgBox)
            {
                Interaction.MsgBox("ERROR " + this.gm.z.ToString() + ": " + this.gm.y, MsgBoxStyle.Critical, MsgBoxTitle);
            }
            return true;
        }

        private void j()
        {
            if (Monitor.TryEnter(this.gm, this.gm.@as))
            {
                try
                {
                    this.gm.av();
                    if (this.al == null)
                    {
                        this.al = "";
                    }
                    if (!this.gm.o(this.al) && (this.gm.z == 0L))
                    {
                        this.gm.a(0x7e9L, "Unable to save SMSC", "GENERAL");
                    }
                }
                finally
                {
                    Monitor.Exit(this.gm);
                }
            }
            else
            {
                this.gm.a(0x2333L, "Thread monitor enter attempt timeout [SMSC_Set]", "GENERAL");
            }
        }

        private void k()
        {
            if (Monitor.TryEnter(this.gm, this.gm.@as))
            {
                string str = "";
                this.ak = "";
                try
                {
                    this.gm.av();
                    str = this.gm.ap();
                    this.ak = str;
                    if ((str.Length == 0) && (this.gm.z == 0L))
                    {
                        this.gm.a(0x7e8L, "Unable to read SMSC from SIM", "GENERAL");
                    }
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    this.gm.a.b("[SMS:SMSC_Get:1] " + exception.Message);
                    ProjectData.ClearProjectError();
                }
                finally
                {
                    Monitor.Exit(this.gm);
                }
            }
            else
            {
                this.gm.a(0x2333L, "Thread monitor enter attempt timeout [SMSC_Get]", "GENERAL");
            }
        }

        private void l()
        {
            if (Monitor.TryEnter(this.gm, this.gm.@as))
            {
                this.aj = 0x63;
                try
                {
                    this.gm.av();
                    int num = this.gm.aq();
                    this.aj = num;
                    if ((num == 0x63) && (this.gm.z == 0L))
                    {
                        this.gm.a(0xbb9L, "Signal strength not known or not detectable", "GENERAL");
                    }
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    this.gm.a.b("[SMS:SignalStrengthDB_Get:1] " + exception.Message);
                    ProjectData.ClearProjectError();
                }
                finally
                {
                    Monitor.Exit(this.gm);
                }
            }
            else
            {
                this.gm.a(0x2333L, "Thread monitor enter attempt timeout [SignalStrengthDB_Get]", "GENERAL");
            }

⌨️ 快捷键说明

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