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

📄 o.cs

📁 老外Logix Mobile mCoreLib短信控件源码 通过串口或者手机数据线进行连接,可对手机进行 读写操作.
💻 CS
字号:
using mCore;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
using System;
using System.IO;
using System.Threading;

internal class o
{
    private int a;
    private string b = "";
    private f c;
    private Collection d = new Collection();

    internal o(ref SMS A_0)
    {
        this.c = A_0.gm;
    }

    internal string a()
    {
        return this.b;
    }

    internal bool a(int A_0)
    {
        string path = "";
        string contents = "";
        Monitor.TryEnter(this.d, this.c.@as);
        bool flag = false;
        path = this.b + "mCoreLib.log";
        try
        {
            if (!File.Exists(path))
            {
                return flag;
            }
            if (A_0 == 0)
            {
                File.Delete(path);
                File.AppendAllText(path, "");
                return flag;
            }
            string[] strArray = File.ReadAllLines(path);
            if (strArray.GetUpperBound(0) < 0)
            {
                return flag;
            }
            File.Delete(path);
            int upperBound = strArray.GetUpperBound(0);
            for (int i = 0; i <= upperBound; i++)
            {
                if (i >= (strArray.GetUpperBound(0) - A_0))
                {
                    contents = strArray[i] + "\r\n";
                }
            }
            File.AppendAllText(path, contents);
        }
        catch (Exception exception1)
        {
            ProjectData.SetProjectError(exception1);
            Exception exception = exception1;
            this.c.a(0x232eL, "Error clearing log file. " + exception.Message, "GENERAL");
            ProjectData.ClearProjectError();
        }
        finally
        {
            Monitor.Exit(this.d);
        }
        return flag;
    }

    internal void a(string A_0)
    {
        string b = this.b;
        Monitor.TryEnter(this.d, this.c.@as);
        try
        {
            if (A_0.EndsWith(@"\"))
            {
                this.b = A_0;
            }
            else
            {
                this.b = A_0 + @"\";
            }
        }
        catch (Exception exception1)
        {
            ProjectData.SetProjectError(exception1);
            Exception exception = exception1;
            this.b = b;
            this.c.a(0x232fL, "Error setting log folder path " + exception.Message, "GENERAL");
            ProjectData.ClearProjectError();
        }
        finally
        {
            Monitor.Exit(this.d);
        }
    }

    internal void a(long A_0, string A_1)
    {
        string contents = "";
        Monitor.TryEnter(this.d, this.c.@as);
        try
        {
            if (((this.a >= 1) & (A_0 != 0L)) & (A_0 != 0x232dL))
            {
                contents = DateTime.Now.ToString() + ": ERROR [" + A_0.ToString() + "] " + A_1 + "\r\n";
                File.AppendAllText(this.b + "mCoreLib.log", contents);
            }
        }
        catch (Exception exception1)
        {
            ProjectData.SetProjectError(exception1);
            Exception exception = exception1;
            this.a = 0;
            this.c.a(0x232dL, "Error opening log file. " + exception.Message, "GENERAL");
            ProjectData.ClearProjectError();
        }
        finally
        {
            Monitor.Exit(this.d);
        }
    }

    internal int b()
    {
        return this.a;
    }

    internal void b(int A_0)
    {
        this.a = A_0;
    }

    internal void b(string A_0)
    {
        string contents = "";
        Monitor.TryEnter(this.d, this.c.@as);
        try
        {
            if ((this.a >= 2) & (A_0.Trim().Length != 0))
            {
                A_0 = A_0.Replace("\r", "<cr>").Replace("\n", "<lf>");
                contents = DateTime.Now.ToString() + ": " + A_0 + "\r\n";
                File.AppendAllText(this.b + "mCoreLib.log", contents);
            }
        }
        catch (Exception exception1)
        {
            ProjectData.SetProjectError(exception1);
            Exception exception = exception1;
            this.a = 0;
            this.c.a(0x232dL, "Error opening log file. " + exception.Message, "GENERAL");
            ProjectData.ClearProjectError();
        }
        finally
        {
            Monitor.Exit(this.d);
        }
    }

    internal long c()
    {
        long num;
        Monitor.TryEnter(this.d, this.c.@as);
        try
        {
            num = File.ReadAllLines(this.b + "mCoreLib.log").GetUpperBound(0) + 1;
        }
        catch (Exception exception1)
        {
            ProjectData.SetProjectError(exception1);
            Exception exception = exception1;
            this.c.a(0x232cL, "Error getting log file size. " + exception.Message, "GENERAL");
            ProjectData.ClearProjectError();
        }
        finally
        {
            Monitor.Exit(this.d);
        }
        return num;
    }
}

⌨️ 快捷键说明

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