Beispiel #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            try
            {
                var _mutex = new Mutex(true, "OneInstanceTestOnly", out bool createdNew);
                if (!createdNew)
                {//已经有实例在运行,则激活该实例的主窗体。
                    IntPtr hWnd = Win32Helper.ActiveForm(Config.Text);
                    Win32Helper.SendMessage(hWnd, 0, null);
                    return;
                }
                //TConfig.IMouseMove = true;
                //TConfig.BackColor = Color.Red;
                //TConfig.ForeColor = Color.Red;
                //TConfig.Trans = 100;

                ////被识别的主图
                //Bitmap on = Paway.Helper.BitmapHelper.GetBitmapFormFile(@"d:\0.png");
                ////需要识别的小图
                //Bitmap fo = Paway.Helper.BitmapHelper.GetBitmapFormFile(@"d:\2.png");
                //SearchResult[] result = ImageRecognitionHelper.SearchBitmap_Test(fo, on);

                //Color color = Color.FromArgb(30, 210, 120);
                //int[] list = Paway.Helper.BitmapHelper.RGBToHSL(color);
                //Color temp = Paway.Helper.BitmapHelper.HSLToRGB(list[0], list[1], list[2] + 20);
                //temp = Paway.Helper.BitmapHelper.HSLToRGB(list[0], list[1], list[2] - 20);

                //log4net.Config.XmlConfigurator.Configure();
                log4net.Config.XmlConfigurator.Configure(new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log.xml")));
                Assembly assembly = Assembly.GetExecutingAssembly();
                AssemblyTitleAttribute attrTitle = Attribute.GetCustomAttribute(assembly, typeof(AssemblyTitleAttribute)) as AssemblyTitleAttribute;
                string.Format("{0} v{1} ({2})", attrTitle.Title, assembly.GetName().Version, Environment.MachineName).Log();

                Progress.Initialize();
                TConfig.IAutoHideScroll = true;
                {
                }
                Application.ThreadException += Application_ThreadException;
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
                Application.Run(new FormEmit());
            }
            catch (Exception e)
            {
                e.Show("软件出现未处理的异常,即将退出。", false);
            }
            finally
            {
                Progress.Abort();
                Application.Exit();
            }
        }