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

📄 sms.cs

📁 老外Logix Mobile mCoreLib短信控件源码 通过串口或者手机数据线进行连接,可对手机进行 读写操作.
💻 CS
📖 第 1 页 / 共 5 页
字号:
namespace mCore
{
    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Diagnostics;
    using System.IO;
    using System.IO.Ports;
    using System.Runtime.CompilerServices;
    using System.Security.Cryptography;
    using System.Text;
    using System.Threading;
    using System.Windows.Forms;

    public class SMS : ISMS, IDisposable
    {
        private mCore.MessageMemory aa;
        private bool ab = false;
        private bool ac;
        private string ad = "";
        private string ae = "";
        private string af = "";
        private string ag = "";
        private string ah = "";
        private int ai;
        private int aj;
        private string ak = "";
        private string al = "";
        private string am = "";
        private string an = "";
        private int ao;
        private string ap = "";
        private bool aq = false;
        private bool ar = false;
        private bool @as = false;
        private bool at = false;
        private const int au = 1;
        private bool av = false;
        [AccessedThroughProperty("gm")]
        private f o;
        [AccessedThroughProperty("objQueue")]
        private mCore.Queue p;
        internal mCore.License q;
        internal o r;
        internal mCore.WapPush s;
        internal mCore.vCard t;
        internal mCore.vCalendar u;
        internal c v;
        internal mCore.Inbox w;
        private string x = "";
        private bool y = false;
        private mCore.MessageMemory z;

        //public event NewDeliveryReportEventHandler mCore.ISMS.NewDeliveryReport;

        //public event NewIncomingCallEventHandler mCore.ISMS.NewIncomingCall;

        //public event NewMessageReceivedEventHandler mCore.ISMS.NewMessageReceived;

        //public event NewUSSDReceivedEventhandler mCore.ISMS.NewUSSDReceived;

        //public event QueueSmartMessageSendingEventHandler mCore.ISMS.QueueSmartMessageSending;

        //public event QueueSmartMessageSentEventHandler mCore.ISMS.QueueSmartMessageSent;

        //public event QueueSMSSendingEventHandler mCore.ISMS.QueueSMSSending;

        //public event QueueSMSSentEventHandler mCore.ISMS.QueueSMSSent;

        //public event QueueVCalendarSendingEventHandler mCore.ISMS.QueueVCalendarSending;

        //public event QueueVCalendarSentEventHandler mCore.ISMS.QueueVCalendarSent;

        //public event QueueVCardSendingEventHandler mCore.ISMS.QueueVCardSending;

        //public event QueueVCardSentEventHandler mCore.ISMS.QueueVCardSent;

        //public event QueueWapPushSendingEventHandler mCore.ISMS.QueueWapPushSending;

        //public event QueueWapPushSentEventHandler mCore.ISMS.QueueWapPushSent;

        public event NewDeliveryReportEventHandler NewDeliveryReport;

        public event NewIncomingCallEventHandler NewIncomingCall;

        public event NewMessageReceivedEventHandler NewMessageReceived;

        public event NewUSSDReceivedEventhandler NewUSSDReceived;

        public event QueueSmartMessageSendingEventHandler QueueSmartMessageSending;

        public event QueueSmartMessageSentEventHandler QueueSmartMessageSent;

        public event QueueSMSSendingEventHandler QueueSMSSending;

        public event QueueSMSSentEventHandler QueueSMSSent;

        public event QueueVCalendarSendingEventHandler QueueVCalendarSending;

        public event QueueVCalendarSentEventHandler QueueVCalendarSent;

        public event QueueVCardSendingEventHandler QueueVCardSending;

        public event QueueVCardSentEventHandler QueueVCardSent;

        public event QueueWapPushSendingEventHandler QueueWapPushSending;

        public event QueueWapPushSentEventHandler QueueWapPushSent;

        public SMS()
        {
            this.gm = new f();
            SMS sms = this;
            this.objQueue = new mCore.Queue(ref sms);
            sms = this;
            this.r = new o(ref sms);
            sms = this;
            this.q = new mCore.License(ref sms);
            sms = this;
            this.s = new mCore.WapPush(ref sms);
            sms = this;
            this.t = new mCore.vCard(ref sms);
            sms = this;
            this.u = new mCore.vCalendar(ref sms);
            sms = this;
            this.v = new c(ref sms);
            sms = this;
            this.w = new mCore.Inbox(ref sms);
            this.gm.a = this.r;
            this.gm.b = this.q;
            this.gm.c = this.v;
            this.gm.b8 = this.a(this.gm.l("P") + this.gm.b7 + this.gm.l("V"));
            this.gm.b9 = this.a(this.gm.l("H") + this.gm.b7 + this.gm.l("M"));
            this.gm.ca = this.a(this.gm.l("T") + this.gm.b7 + this.gm.l("V"));
            this.gm.cb = this.a(this.gm.l("@") + this.gm.b7 + this.gm.l("M"));
            this.gm.ah = this.gm.b8;
            this.r.b(0);
            this.r.a(this.gm.q);
            this.gm.a(new f.d(this.a));
            this.gm.a(new f.b(this.a));
            this.gm.a(new f.c(this.a));
            this.gm.a(new f.a(this.a));
            this.objQueue.b(new mCore.Queue.d(this.a));
            this.objQueue.b(new mCore.Queue.c(this.a));
            this.objQueue.b(new mCore.Queue.i(this.a));
            this.objQueue.a(new mCore.Queue.j(this.a));
            this.objQueue.b(new mCore.Queue.g(this.a));
            this.objQueue.b(new mCore.Queue.f(this.a));
            this.objQueue.a(new mCore.Queue.e(this.a));
            this.objQueue.b(new mCore.Queue.h(this.a));
            this.objQueue.b(new mCore.Queue.a(this.a));
            this.objQueue.a(new mCore.Queue.b(this.a));
        }

        private void a()
        {
            if (this.gm.ac.Length > 0)
            {
                switch (this.gm.ac.ToUpper())
                {
                    case "GENERAL":
                        throw new GeneralException("ERROR " + this.gm.z.ToString() + ": " + this.gm.y);

                    case "SMSSEND":
                        throw new SMSSendException("ERROR " + this.gm.z.ToString() + ": " + this.gm.y);

                    case "SMSREAD":
                        throw new SMSReadException("ERROR " + this.gm.z.ToString() + ": " + this.gm.y);

                    case "SMSDELETE":
                        throw new SMSDeleteException("ERROR " + this.gm.z.ToString() + ": " + this.gm.y);

                    case "WAPPUSH":
                        throw new WapPushException("ERROR " + this.gm.z.ToString() + ": " + this.gm.y);

                    case "VCARD":
                        throw new vCardException("ERROR " + this.gm.z.ToString() + ": " + this.gm.y);

                    case "VCALENDAR":
                        throw new vCalendarException("ERROR " + this.gm.z.ToString() + ": " + this.gm.y);
                }
            }
        }

        private void a(NewDeliveryReportEventArgs A_0)
        {
            NewDeliveryReportEventHandler b = this.b;
            if (b != null)
            {
                b(this, A_0);
            }
        }

        private void a(NewIncomingCallEventArgs A_0)
        {
            NewIncomingCallEventHandler c = this.c;
            if (c != null)
            {
                c(this, A_0);
            }
        }

        private void a(NewMessageReceivedEventArgs A_0)
        {
            NewMessageReceivedEventHandler a = this.a;
            if (a != null)
            {
                a(this, A_0);
            }
        }

        private void a(NewUSSDReceivedEventArgs A_0)
        {
            NewUSSDReceivedEventhandler d = this.d;
            if (d != null)
            {
                d(this, A_0);
            }
        }

        private void a(QueueSmartMessageSendingEventArgs A_0)
        {
            QueueSmartMessageSendingEventHandler n = this.n;
            if (n != null)
            {
                n(this, A_0);
            }
        }

        private void a(QueueSmartMessageSentEventArgs A_0)
        {
            QueueSmartMessageSentEventHandler i = this.i;
            if (i != null)
            {
                i(this, A_0);
            }
        }

        private void a(QueueSMSSendingEventArgs A_0)
        {
            QueueSMSSendingEventHandler j = this.j;
            if (j != null)
            {
                j(this, A_0);
            }
        }

        private void a(QueueSMSSentEventArgs A_0)
        {
            QueueSMSSentEventHandler e = this.e;
            if (e != null)
            {
                e(this, A_0);
            }
        }

        private void a(QueueVCalendarSendingEventArgs A_0)
        {
            QueueVCalendarSendingEventHandler m = this.m;
            if (m != null)
            {
                m(this, A_0);
            }
        }

        private void a(QueueVCalendarSentEventArgs A_0)
        {
            QueueVCalendarSentEventHandler h = this.h;
            if (h != null)
            {
                h(this, A_0);
            }
        }

        private void a(QueueVCardSendingEventArgs A_0)
        {
            QueueVCardSendingEventHandler l = this.l;
            if (l != null)
            {
                l(this, A_0);
            }
        }

        private void a(QueueVCardSentEventArgs A_0)
        {
            QueueVCardSentEventHandler g = this.g;
            if (g != null)
            {
                g(this, A_0);
            }
        }

        private void a(QueueWapPushSendingEventArgs A_0)
        {
            QueueWapPushSendingEventHandler k = this.k;
            if (k != null)
            {
                k(this, A_0);
            }
        }

        private void a(QueueWapPushSentEventArgs A_0)
        {
            QueueWapPushSentEventHandler f = this.f;
            if (f != null)
            {
                f(this, A_0);
            }
        }

        private string a(string A_0)
        {
            string str2 = "";
            try
            {
                UnicodeEncoding encoding = new UnicodeEncoding();
                MD5CryptoServiceProvider provider = new MD5CryptoServiceProvider();
                str2 = BitConverter.ToString(provider.ComputeHash(encoding.GetBytes(A_0))).Replace("-", "");
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                this.gm.a.b("[SMS:MD5Encrypt:1] " + exception.Message);
                str2 = "";
                ProjectData.ClearProjectError();
            }
            return str2;
        }

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

        private void c()
        {
            if (Monitor.TryEnter(this.gm, this.gm.@as))
            {
                try
                {
                    this.gm.av();
                    this.gm.v = this.at;
                    this.gm.q();
                }
                finally
                {
                    Monitor.Exit(this.gm);
                }
            }
            else
            {
                this.gm.a(0x2333L, "Thread monitor enter attempt timeout [IncomingCallIndication_Set]", "GENERAL");
            }
        }

        public bool CancelUSSDSession()
        {
            SMS sms = this;
            mCore.SMS.c c = new mCore.SMS.c(ref sms, "2");
            Thread thread = new Thread(new ThreadStart(c.a));
            thread.Name = "CancelUSSDMethodThread";
            thread.Priority = ThreadPriority.AboveNormal;
            thread.Start();
            while (thread.IsAlive)
            {
                Thread.Sleep(1);
                Application.DoEvents();
            }
            bool d = c.d;
            this.a();
            return true;
        }

        public bool ClearLog()
        {
            this.gm.av();
            bool flag = this.r.a(0);
            this.a();
            return flag;
        }

        public bool ClearLog(int KeepLinesInLog)
        {
            this.gm.av();
            bool flag = this.r.a(KeepLinesInLog);
            this.a();
            return flag;
        }

        public string Command(string ATCommand)
        {
            string c = "";
            f gm = this.gm;

⌨️ 快捷键说明

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