예제 #1
0
        protected override void OnAfterCommandLineArgObjectLoaded(string[] commandLineArgs)
        {
            ChoShellExtensionActionMode?sem = GetShellExtensionActionMode();

            if (DisplayAvailProperties || DisplayAvailTypeParsersNFormatters)
            {
                if (DisplayAvailProperties)
                {
                    ChoApplication.DisplayMsg(ChoPropertyManagerSettings.Me.GetHelpText(), null, ConsoleColor.Yellow);
                }
                if (DisplayAvailTypeParsersNFormatters)
                {
                    ChoApplication.DisplayMsg(ChoTypesManager.GetHelpText(), null, ConsoleColor.Green);
                }
                if (!ConfigObjectTypeName.IsNullOrWhiteSpace())
                {
                    ChoApplication.DisplayMsg(ChoConfigurationManager.GetHelpText(ChoType.GetType(ConfigObjectTypeName)), null, ConsoleColor.Green);
                }
                Environment.Exit(0);
            }
            else if (!ConfigObjectTypeName.IsNullOrWhiteSpace())
            {
                ChoApplication.DisplayMsg(ChoConfigurationManager.GetHelpText(ChoType.GetType(ConfigObjectTypeName)), null, ConsoleColor.Green);
                Environment.Exit(0);
            }
            else if (sem != null)
            {
                if (sem.Value == ChoShellExtensionActionMode.Register)
                {
                    ChoShellExtension.Register();
                    ChoTrace.WriteLine("Shell Extensions registered successfully.");

                    ChoShellFileAssociation.Register();
                    ChoTrace.WriteLine("File Associations registered successfully.");

                    Environment.Exit(0);
                }
                else if (sem.Value == ChoShellExtensionActionMode.Unregister)
                {
                    ChoShellExtension.Unregister();
                    ChoTrace.WriteLine("Shell Extensions unregistered successfully.");

                    ChoShellFileAssociation.Unregister();
                    ChoTrace.WriteLine("File Associations unregistered successfully.");

                    Environment.Exit(0);
                }
            }

            if (ChoShellExtension.ExecuteShellExtensionMethodIfAnySpecified(commandLineArgs))
            {
                ChoTrace.WriteLine("Shell Extension ran successfully.");
                Environment.Exit(0);
            }

            base.OnAfterCommandLineArgObjectLoaded(commandLineArgs);
        }