CaptureItPlus/Program.cs

(完整代码) 1KB

namespace CaptureItPlus
{
    using CaptureItPlus.Libs;
    using System;
    using System.Diagnostics;
    using System.IO;
    using System.Windows.Forms;

    static class Program
    {
        private static bool _isCaptureIsActive;
        public static bool IsCaptureIsActive
        {
            get
            {
                return _isCaptureIsActive;
            }
            set
            {
                _isCaptureIsActive = value;
            }
        }

        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ThreadException += Application_ThreadException;
            Process currentProcess = Process.GetCurrentProcess();
            Process[] processItems = Process.GetProcessesByName(currentProcess.ProcessName);
            foreach (Process item in processItems)
            {
                if (item.Id != currentProcess.Id)
                {
                    MessageBox.Show(Constants.APP_ALREADY_RUNNING, Constants.APP_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }
            Application.Run(new frmSettings());
        }

        static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
        {
            string logPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            string file = Path.ChangeExtension("captureitplus_log", ".txt");
            string logFile = Path.Combine(logPath, file);
            var logger = new Logger(logFile);
            logger.WriteLog(e.Exception);
            MessageBox.Show(string.Format(Constants.APP_EXCEPTION, Environment.NewLine), Constants.APP_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error);
            Process.Start(logFile);
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。