コード例 #1
0
        private static void Main(string[] args)
        {
            // LdapTest.testing();

            string sConsoleFile = null;

            if (args.Length == 1 && !args[0].StartsWith("--"))
            {
                sConsoleFile = args[0];
            }

            // Enable themes
            Application.EnableVisualStyles();

            // Set the user interface to display in the
            // same culture as that set in Control Panel.
            Thread.CurrentThread.CurrentUICulture =
                Thread.CurrentThread.CurrentCulture;

            try
            {
                // process command line args
                if (args.Length > 0 && args[0].StartsWith("--"))
                {
                    parseCommandLineArgs(args, out sConsoleFile);
                }

                if (Configurations.currentPlatform == LikewiseTargetPlatform.Unknown)
                {
                    Configurations.determineTargetPlatform();
                }
                Configurations.setPlatformFeatures();
                Configurations.verifyEnvironment();

                Logger.Log("Likewise Management Console started");
                Logger.Log("Current LogLevel = " + Logger.currentLogLevel);

                //make sure a local, persistent, user-writeable data path exists.
                if (!System.IO.Directory.Exists(Application.UserAppDataPath))
                {
                    System.IO.Directory.CreateDirectory(Application.UserAppDataPath);
                }

                Hostinfo hnTemp = new Hostinfo();

                // create a mainform, show it and peg it
                LMCMainForm mf = new LMCMainForm(sConsoleFile);

                // Display the real form
                mf.TopLevel = true;
                mf.Show();

                // hide the splash window since we're getting ready to show a real one
                mf.Activate();

                // start running
                Application.Run(mf);
            }
            catch (ShowUsageException)
            {
            }
            catch (DllNotFoundException ex)
            {
                Logger.LogMsgBox(String.Format(
                                     "Likewise Management Console encountered a fatal error: Could not find DLL: {0}",
                                     ex.Message));
                Logger.Log(String.Format("EXCEPTION (caught in LMCAppMain.cs): \n{0}",
                                         ex), Logger.LogLevel.Panic);
            }
            catch (Exception ex)
            {
                int ex_id = 0;
                MessageBox.Show("Likewise Management Console encountered a fatal error.",
                                CommonResources.GetString("Caption_Console"),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                Logger.Log(String.Format("EXCEPTION #{0} (caught in LMCAppMain.cs): \n{1}",
                                         ex_id++, ex), Logger.LogLevel.Panic);

                for (Exception in_ex = ex.InnerException; in_ex != null; in_ex = in_ex.InnerException)
                {
                    Logger.Log(String.Format(
                                   "\n\nEXCEPTION #{0}: \n{1}", ex_id++, in_ex), Logger.LogLevel.Panic);
                }
            }

            //Only in the debug build, make sure all the unmanaged objects have been freed
#if DEBUG
            Likewise.LMC.Utilities.DebugMarshal.CheckAllFreed();
#endif

            return;
        }
コード例 #2
0
        private static void Main(string[] args)
        {
           // LdapTest.testing();

            string sConsoleFile = null;

            if (args.Length == 1 && !args[0].StartsWith("--"))
                sConsoleFile = args[0];

            // Enable themes
            Application.EnableVisualStyles();

            // Set the user interface to display in the
            // same culture as that set in Control Panel.
            Thread.CurrentThread.CurrentUICulture =
                Thread.CurrentThread.CurrentCulture;

            try
            {
                // process command line args
                if (args.Length>0 && args[0].StartsWith("--"))
                    parseCommandLineArgs(args, out sConsoleFile);

                if (Configurations.currentPlatform == LikewiseTargetPlatform.Unknown) {
                    Configurations.determineTargetPlatform();
                }
                Configurations.setPlatformFeatures();
                Configurations.verifyEnvironment();

                Logger.Log("Likewise Management Console started");
                Logger.Log("Current LogLevel = " + Logger.currentLogLevel);

                //make sure a local, persistent, user-writeable data path exists.
                if (! System.IO.Directory.Exists(Application.UserAppDataPath))
                {
                    System.IO.Directory.CreateDirectory(Application.UserAppDataPath);
                }

                Hostinfo hnTemp = new Hostinfo();

                // create a mainform, show it and peg it
                LMCMainForm mf = new LMCMainForm(sConsoleFile);

                // Display the real form
                mf.TopLevel = true;
                mf.Show();

                // hide the splash window since we're getting ready to show a real one
                mf.Activate();

                // start running
                Application.Run(mf);
            }
            catch (ShowUsageException)
            {
            }
            catch (DllNotFoundException ex)
            {
                Logger.LogMsgBox(String.Format(
                    "Likewise Management Console encountered a fatal error: Could not find DLL: {0}",
                    ex.Message));
                Logger.Log(String.Format("EXCEPTION (caught in LMCAppMain.cs): \n{0}",
                     ex), Logger.LogLevel.Panic);
            }
            catch (Exception ex)
            {
                int ex_id = 0;
                MessageBox.Show("Likewise Management Console encountered a fatal error.",
                    CommonResources.GetString("Caption_Console"),
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                Logger.Log(String.Format("EXCEPTION #{0} (caught in LMCAppMain.cs): \n{1}",
                    ex_id++, ex), Logger.LogLevel.Panic);

                for (Exception in_ex = ex.InnerException; in_ex != null; in_ex = in_ex.InnerException)
                {
                    Logger.Log(String.Format(
                        "\n\nEXCEPTION #{0}: \n{1}", ex_id++, in_ex), Logger.LogLevel.Panic);
                }
            }

            //Only in the debug build, make sure all the unmanaged objects have been freed
#if DEBUG
            Likewise.LMC.Utilities.DebugMarshal.CheckAllFreed();
#endif

            return;
        }