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

📄 inbox.cs

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

    public class Inbox : IInbox, IEnumerable
    {
        private f a;
        private int b = -1;
        private bool c = false;
        private const int d = 1;

        internal Inbox(ref SMS A_0)
        {
            this.a = A_0.gm;
        }

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

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

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

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

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

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

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

        private void b()
        {
            if (Monitor.TryEnter(this, this.a.@as))
            {
                try
                {
                    this.a.av();
                    this.c = false;
                    this.a.cm = false;
                    bool flag = true;
                    if (this.a.co.Count > 0)
                    {
                        for (int i = this.a.co.Count; i >= 1; i += -1)
                        {
                            if (this.a.co.Count <= 0)
                            {
                                break;
                            }
                            this.a.ae = i;
                            if (!this.Message(i).Delete())
                            {
                                flag = false;
                            }
                        }
                    }
                    else
                    {
                        this.a.a(0x1771L, "Inbox is already empty", "SMSDELETE");
                        this.c = flag;
                        return;
                    }
                    if (!flag)
                    {
                        this.a.a(0x1772L, "Unable to delete at least one message", "SMSDELETE");
                        this.c = flag;
                    }
                    this.c = flag;
                    if (this.a.cn.Count > 0)
                    {
                        this.a.ao();
                    }
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    this.a.a.b("[Inbox:Clear_Method:1] " + exception.Message);
                    ProjectData.ClearProjectError();
                }
                finally
                {
                    Monitor.Exit(this);
                }
            }
            else
            {
                this.a.a(0x2333L, "Thread monitor enter attempt timeout [Inbox:Clear_Method:A]", "SMSDELETE");
                this.c = false;
            }
        }

        public bool Clear()
        {
            Thread thread = new Thread(new ThreadStart(this.b));
            thread.Name = "ClearMethodThread";
            thread.Start();
            while (thread.IsAlive)
            {
                Thread.Sleep(1);
                Application.DoEvents();
            }
            bool c = this.c;
            this.a();
            return c;
        }

        public IEnumerator GetEnumerator()
        {
            return new InboxEnumerator(this);
        }

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

        public bool Refresh()
        {
            Inbox inbox = this;
            mCore.Inbox.a a = new mCore.Inbox.a(ref inbox, ref this.a, MessageType.ReceivedAllMessages, false);
            Thread thread = new Thread(new ThreadStart(a.a));
            thread.Name = "RefreshMethodThread";
            thread.Start();
            while (thread.IsAlive)
            {
                Thread.Sleep(1);
                Application.DoEvents();
            }
            bool e = a.e;
            if (a != null)
            {
                a = null;
            }
            bool flag2 = e;
            this.a();
            return flag2;
        }

        public bool Refresh(MessageType ReadMessageType)
        {
            Inbox inbox = this;
            mCore.Inbox.a a = new mCore.Inbox.a(ref inbox, ref this.a, ReadMessageType, false);
            Thread thread = new Thread(new ThreadStart(a.a));
            thread.Name = "RefreshMethodThread";
            thread.Start();
            while (thread.IsAlive)
            {
                Thread.Sleep(1);
                Application.DoEvents();
            }
            bool e = a.e;
            if (a != null)
            {
                a = null;
            }
            bool flag2 = e;
            this.a();
            return flag2;
        }

        public bool Refresh(MessageType ReadMessageType, bool CleanUpMemory)
        {
            Inbox inbox = this;
            mCore.Inbox.a a = new mCore.Inbox.a(ref inbox, ref this.a, ReadMessageType, CleanUpMemory);
            Thread thread = new Thread(new ThreadStart(a.a));
            thread.Name = "RefreshMethodThread";
            thread.Start();
            while (thread.IsAlive)
            {
                Thread.Sleep(1);
                Application.DoEvents();
            }
            bool e = a.e;
            if (a != null)
            {
                a = null;
            }
            bool flag2 = e;
            this.a();
            return flag2;
        }

        public bool Concatenate
        {
            get
            {
                this.a.av();
                return this.a.bp;
            }
            set
            {
                this.a.av();
                this.a.bp = value;
            }
        }

        public int Count
        {
            get
            {
                int count;
                try
                {
                    this.a.av();
                    count = this.a.co.Count;
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    this.a.a.b("[Inbox:Count:1] " + exception.Message);
                    ProjectData.ClearProjectError();
                }
                this.a();
                return count;
            }
        }

        public bool HasMessages
        {
            get
            {
                bool flag;
                try
                {

⌨️ 快捷键说明

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