Esempio n. 1
0
        static void Main()
        {
            // *******************************************************************
            // Set some default application configuration
            // *******************************************************************
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            /*while (!System.Diagnostics.Debugger.IsAttached)
             *  System.Threading.Thread.Sleep(100);*/

            // *******************************************************************
            // Load correct Windows form
            // *******************************************************************
            Form oForm = null;

            string[] asArgv = Environment.GetCommandLineArgs();



            int parIdx = Math.Max(Math.Max(Math.Max(Array.IndexOf(asArgv, "--install"),
                                                    Array.IndexOf(asArgv, "--upgrade-inplace")),
                                           Array.IndexOf(asArgv, "--configure")),
                                  Array.IndexOf(asArgv, "--uninstall"));

            if (parIdx >= 0)
            {
                if (asArgv[parIdx] == "--configure")
                {
                    oForm = new ConfigureWindow();
                }
                else if (asArgv[parIdx] == "--upgrade-inplace")
                {
                    oForm = new InstallWindow(true);
                }
                else if (asArgv[parIdx] == "--install")
                {
                    oForm = new InstallWindow();
                }
                else if (asArgv[parIdx] == "--uninstall")
                {
                    oForm = new UninstallWindow();
                }
            }
            else
            {
                int debugIdx = Array.IndexOf(asArgv, "--debug");
                oForm = new MainWindow(debugIdx >= 0);
            }

            if (oForm != null)
            {
                Application.Run(oForm);
            }
        }
Esempio n. 2
0
        static void Main()
        {
            // *******************************************************************
            // Set some default application configuration
            // *******************************************************************
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            /*while (!System.Diagnostics.Debugger.IsAttached)
                System.Threading.Thread.Sleep(100);*/

            // *******************************************************************
            // Load correct Windows form
            // *******************************************************************
            Form oForm = null;
            string[] asArgv = Environment.GetCommandLineArgs();



            int parIdx = Math.Max(Math.Max(Math.Max(Array.IndexOf(asArgv, "--install"),
                Array.IndexOf(asArgv, "--upgrade-inplace")),
                Array.IndexOf(asArgv, "--configure")),
                Array.IndexOf(asArgv, "--uninstall"));

            if (parIdx >= 0)
            {
                if (asArgv[parIdx] == "--configure")
                {
                    oForm = new ConfigureWindow();
                }
                else if (asArgv[parIdx] == "--upgrade-inplace")
                {
                    oForm = new InstallWindow(true);
                }
                else if (asArgv[parIdx] == "--install")
                {
                    oForm = new InstallWindow();
                }
                else if (asArgv[parIdx] == "--uninstall")
                {
                    oForm = new UninstallWindow();
                }
            }
            else
            {
                int debugIdx = Array.IndexOf(asArgv, "--debug");
                oForm = new MainWindow(debugIdx >= 0);
            }

            if (oForm != null)
            {
                Application.Run(oForm);
            }
        }
Esempio n. 3
0
        static void Main()
        {
            // *******************************************************************
            // Set some default application configuration
            // *******************************************************************
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // *******************************************************************
            // Variables
            // *******************************************************************
            string[] asArgv = Environment.GetCommandLineArgs();

            // *******************************************************************
            // Load correct Windows form
            // *******************************************************************
            ExchangeServer oExchange = new ExchangeServer();
            Form oForm = null;

            if (Array.IndexOf(asArgv, "--install") >= 0)
            {
                oForm = new InstallWindow(null);
            }
            else if(Array.IndexOf(asArgv, "--upgrade") >= 0)
            {
                int parIdx = Array.IndexOf(asArgv, "--upgrade");
                string updateZipUrl = null;
                if (asArgv.Length > parIdx + 1)
                    updateZipUrl = asArgv[parIdx + 1];
                oForm = new InstallWindow(updateZipUrl);
            }
            //else if (Array.IndexOf(asArgv, "--uninstall") >= 0)
            //{
            //    // Delete Itself
            //    ProcessStartInfo Info=new ProcessStartInfo();
            //    Info.Arguments="/C choice /C Y /N /D Y /T 5 & Del "+ Application.ExecutablePath;
            //    Info.WindowStyle=ProcessWindowStyle.Hidden;
            //    Info.CreateNoWindow=true;
            //    Info.FileName="cmd.exe";
            //    Process.Start(Info); 
            //}
            else
            {
                oForm = new MainWindow();    
            }

            Application.Run(oForm);
        }
Esempio n. 4
0
        static void Main()
        {
            // *******************************************************************
            // Set some default application configuration
            // *******************************************************************
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // *******************************************************************
            // Load correct Windows form
            // *******************************************************************
            Form oForm = null;
            string[] asArgv = Environment.GetCommandLineArgs();

            int parIdx = Math.Max(Math.Max(Array.IndexOf(asArgv, "--install"), Array.IndexOf(asArgv, "--upgrade")), Array.IndexOf(asArgv, "--configure"));
            if (parIdx >= 0)
            {
                if (asArgv[parIdx] == "--configure")
                {
                    oForm = new ConfigureWindow();
                }
                else if (asArgv[parIdx] == "--install" || asArgv[parIdx] == "--upgrade")
                {
                    string installZipUrl = null;
                    if (asArgv.Length > parIdx + 1)
                    {
                        installZipUrl = asArgv[parIdx + 1];
                    }

                    oForm = new InstallWindow(installZipUrl);
                }
                //else if (asArgv[parIdx] == "--uninstall") { }
                else
                {
                    Application.Exit();
                }
            }
            else
            {
                int debugIdx = Array.IndexOf(asArgv, "--debug");
                oForm = new MainWindow(debugIdx >= 0);
            }

            Application.Run(oForm);
        }
Esempio n. 5
0
        static void Main()
        {
            // *******************************************************************
            // Set some default application configuration
            // *******************************************************************
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            /*while (!System.Diagnostics.Debugger.IsAttached)
             *  System.Threading.Thread.Sleep(100);*/

            // *******************************************************************
            // Load correct Windows form
            // *******************************************************************
            Form oForm = null;

            string[] asArgv = Environment.GetCommandLineArgs();

            int parIdx = Math.Max(Math.Max(Math.Max(Array.IndexOf(asArgv, "--install"),
                                                    Array.IndexOf(asArgv, "--upgrade-inplace")),
                                           Array.IndexOf(asArgv, "--configure")),
                                  Array.IndexOf(asArgv, "--uninstall"));

            if (parIdx >= 0)
            {
                if (asArgv[parIdx] == "--configure")
                {
                    oForm = new ConfigureWindow();
                }
                else if (asArgv[parIdx] == "--upgrade-inplace")
                {
                    oForm = new InstallWindow(true);
                }
                else if (asArgv[parIdx] == "--install")
                {
                    try
                    {
                        if (!Exchange.ExchangeServer.IsDkimAgentTransportInstalled())
                        {
                            oForm = new InstallWindow();
                        }
                    }
                    catch
                    {
                        int debugIdx = Array.IndexOf(asArgv, "--debug");
                        MessageBox.Show(
                            "The check to see whether DKIM Signer is installed crashed!" + Environment.NewLine + Environment.NewLine +
                            "This probably means you are running the application on a machine" + Environment.NewLine +
                            "which does not have Exchange installed. The program will still" + Environment.NewLine +
                            "open but it won't be of much use.", Application.ProductName, MessageBoxButtons.OK);
                        oForm = new MainWindow(debugIdx >= 0);
                    }
                }
                else if (asArgv[parIdx] == "--uninstall")
                {
                    oForm = new UninstallWindow();
                }
            }
            else
            {
                int debugIdx = Array.IndexOf(asArgv, "--debug");
                // Quick check to see if binary and DLL exist - ensures UI opens quickly if program is installed
                if (File.Exists("" + Constants.DkimSignerPath + "\\" + Constants.DkimSignerAgentDll) && File.Exists("" + Constants.DkimSignerPath + "\\" + Constants.DkimSignerConfigurationExe))
                {
                    oForm = new MainWindow(debugIdx >= 0);
                }
                else
                {
                    try
                    {
                        // If the quick check fails, perform a thorough check before launching the installer. This also
                        // ensures the installer doesn't crash when Exhange isn't installed (useless but user friendly).
                        if (!Exchange.ExchangeServer.IsDkimAgentTransportInstalled())
                        {
                            oForm = new InstallWindow();
                        }
                    }
                    catch
                    {
                        MessageBox.Show(
                            "The check to see whether DKIM Signer is installed crashed!" + Environment.NewLine + Environment.NewLine +
                            "This probably means you are running the application on a machine" + Environment.NewLine +
                            "which does not have Exchange installed. The program will still" + Environment.NewLine +
                            "open but it won't be of much use.", Application.ProductName, MessageBoxButtons.OK);
                        oForm = new MainWindow(debugIdx >= 0);
                    }
                }
            }

            if (oForm != null)
            {
                Application.Run(oForm);
            }
        }