Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            string resource  = "Hashing.Newtonsoft.Json.dll";
            string resource2 = "Hashing.Crc32.NET.dll";

            EmbeddedAssembly.Load(resource, "Newtonsoft.Json.dll");
            EmbeddedAssembly.Load(resource2, "Crc32.NET.dll");

            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);

            Options.LoadSettings();

            if (Options.CurrentOptions.SingleInstance)
            {
                using (MUTEX = new Mutex(true, _mutexGuid, out _notRunning))
                {
                    if (_notRunning)
                    {
                        Application.Run(new MainForm(args));
                    }
                    else
                    {
                        MessageBox.Show("Hashing is already running in the background!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Environment.Exit(0);
                    }
                }
            }
            else
            {
                Application.Run(new MainForm(args));
            }
        }
Ejemplo n.º 2
0
 static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
 {
     return(EmbeddedAssembly.Get(args.Name));
 }