public void DLLExistTest()
 {
     MediaInfoDll.EnsureDllExists();
     if (!File.Exists(@"MediaInfo.dll"))
     {
         Assert.Fail(@"MediaInfo.dll Not Found");
     }
 }
Пример #2
0
        private static void Main(string[] args)
        {
            var isSilent = false;

            foreach (var arg in args)
            {
                if (string.Equals(arg, @"--silent", StringComparison.InvariantCultureIgnoreCase))
                {
                    isSilent = true;
                }

                if (string.Equals(arg, @"--setAutoRun", StringComparison.InvariantCultureIgnoreCase))
                {
                    if (!Controller.AutoStartup.Switch())
                    {
                        Environment.ExitCode = 1;
                    }

                    return;
                }
            }

            using (var mutex = new Mutex(false, $@"Global\{ExeName}_" + Application.StartupPath.GetHashCode()))
            {
                if (!mutex.WaitOne(0, false))
                {
                    MessageBox.Show(
                        $@"{ExeName} 已经在运行!" + Environment.NewLine +
                        $@"请在任务栏里寻找 {ExeName} 图标。" + Environment.NewLine +
                        @"如果想启动多份,建议另外复制一份到别的目录。",
                        $@"{ExeName} 已经在运行", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                MediaInfoDll.EnsureDllExists();
                var mainForm = new MainForm();
                mainForm.Show();
                if (isSilent)
                {
                    mainForm.Hide();
                }

                Application.Run();
            }
        }