Example #1
0
        public XmlValidator(IRegistrationHelper helper)
        {
            if (helper == null)
            {
                throw new ArgumentNullException("helper",
                                                "The helper parameter cannot be null (or Nothing).");
            }

            _regHelper = helper;
            _xmlSchema = Path.Combine(Path.GetDirectoryName(
                                          Assembly.GetExecutingAssembly().Location), "register.xsd");

            if (File.Exists(_xmlSchema) == false)
            {
                _xmlSchema = null;
                Assembly currentAssembly = Assembly.GetExecutingAssembly();
                try
                {
                    _xmlStream = currentAssembly.GetManifestResourceStream(
                        "Sandcastle.HelpRegister.Properties.Register.xsd");

                    _schemaExists = (_xmlStream != null && _xmlStream.Length != 0);
                }
                catch
                {
                }
            }
            else
            {
                _schemaExists = true;
            }
        }
Example #2
0
 public static void ClearExtensions()
 {
     Reset();
     ContainerExtension = null;
     Registrator        = null;
     With.ClearExtensions();
 }
 public HomeController(ILogger <HomeController> logger, IRegistrationService registrationService, ReminderController reminder, IRegistrationHelper helper)
 {
     _logger = logger;
     _registrationService = registrationService;
     _reminder            = reminder;
     _helper = helper;
 }
Example #4
0
 public WindsorExtension(IRegistrationHelper registrationHelper, IBootstrapperContainerExtensionOptions options) : base(registrationHelper)
 {
     Options    = new WindsorOptions(options);
     facilities = new List <IFacility>();
     Bootstrapper.Excluding.Assembly("Castle");
     Bootstrapper.Excluding.Assembly("Castle.Facilities.FactorySupport");
 }
 /// <summary>
 /// The pluggable windsor.
 /// </summary>
 /// <param name="extensions">
 /// The extensions.
 /// </param>
 /// <param name="helper">
 /// The helper.
 /// </param>
 /// <param name="facilities">
 /// The facilities.
 /// </param>
 /// <returns>
 /// The <see cref="WindsorOptions"/>.
 /// </returns>
 public static WindsorOptions PluggableWindsor(
     this BootstrapperExtensions extensions, IRegistrationHelper helper, params IFacility[] facilities)
 {
     var windsorExtension = new WindsorExtension(helper, new BootstrapperContainerExtensionOptions());
     facilities.ForEach(windsorExtension.AddFacility);
     extensions.Extension(windsorExtension);
     return windsorExtension.Options;
 }
Example #6
0
        public void Add(IRegistrationHelper handler)
        {
            if (handler == null || _listHandlers == null)
            {
                return;
            }

            _listHandlers.Add(handler);
        }
Example #7
0
        public void Remove(IRegistrationHelper handler)
        {
            if (handler == null || _listHandlers == null)
            {
                return;
            }

            _listHandlers.Remove(handler);
        }
Example #8
0
 public RegisterModel(
     UserManager <WannaWhatUser> userManager,
     SignInManager <WannaWhatUser> signInManager,
     ILogger <RegisterModel> logger,
     IEmailSender emailSender,
     IRegistrationHelper regHlper)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _logger        = logger;
     _emailSender   = emailSender;
     _regHelper     = regHlper;
 }
 public void Initialize()
 {
     Bootstrapper.ClearExtensions();
     registrationHelper = A.Fake <IRegistrationHelper>();
     A.CallTo(() => registrationHelper.GetInstancesOfTypesImplementing <IStartupTask>())
     .Returns(new List <IStartupTask>
     {
         new TaskAlpha(),
         new TaskBeta(),
         new TaskGamma(),
         new TaskOmega(),
         new TestStartupTask(),
         new InternalTestStartupTask()
     });
 }
Example #10
0
        public void WriteLine()
        {
            if (_listHandlers == null || _listHandlers.Count == 0)
            {
                return;
            }
            int itemCount = _listHandlers.Count;

            for (int i = 0; i < itemCount; i++)
            {
                IRegistrationHelper handler = _listHandlers[i];
                if (handler != null)
                {
                    handler.WriteLine();
                }
            }
        }
Example #11
0
 public void Register(IRegistrationHelper registrationHelper)
 {
     registrationHelper
     .RegisterEndPoints(EndPoints)
     .Register <InProcessClient1, IDummyAPI1>(EndPointType.InProcess, APINames.DummyAPI1, ProviderName.MSSQL)
     .Register <InProcessClient1, IDummyAPI1>(EndPointType.InProcess, APINames.DummyAPI1)
     .Register <InProcessClient3, IDummyAPI1>(EndPointType.InProcess, APINames.DummyAPI1, ProviderName.MySQL)
     .Register <WebAPIClient1, IDummyAPI1>(EndPointType.HTTP, APINames.DummyAPI1)
     .Register <InProcessClient2, IDummyAPI2>(EndPointType.InProcess, APINames.DummyAPI2)
     .Register <WebAPIClient2, IDummyAPI2>(EndPointType.HTTP, APINames.DummyAPI1)
     .RegisterEndPointValidator <InProcessEndPointValidator>(EndPointType.InProcess, ProviderName.MSSQL)
     .RegisterEndPointValidator <InProcessEndPointValidator>(EndPointType.InProcess, ProviderName.MySQL)
     .RegisterEndPointValidator <InProcessEndPointValidator>(EndPointType.InProcess)
     .RegisterEndPointValidator <HttpEndPointValidator>(EndPointType.WCF, null)
     .RegisterEndPointValidator <HttpEndPointValidator>(EndPointType.HTTP, null)
     .RegisterLogger(Logger);
 }
Example #12
0
        public void Write(string text)
        {
            if (String.IsNullOrEmpty(text) == true ||
                _listHandlers == null || _listHandlers.Count == 0)
            {
                return;
            }
            int itemCount = _listHandlers.Count;

            for (int i = 0; i < itemCount; i++)
            {
                IRegistrationHelper handler = _listHandlers[i];
                if (handler != null)
                {
                    handler.Write(text);
                }
            }
        }
Example #13
0
        public void WriteLine(COMException exception)
        {
            if (_ignoreExceptions || exception == null ||
                _listHandlers == null || _listHandlers.Count == 0)
            {
                return;
            }
            int itemCount = _listHandlers.Count;

            for (int i = 0; i < itemCount; i++)
            {
                IRegistrationHelper handler = _listHandlers[i];
                if (handler != null)
                {
                    handler.WriteLine(exception);
                }
            }
        }
Example #14
0
 public SimpleInjectorExtension(IRegistrationHelper registrationHelper, IBootstrapperContainerExtensionOptions options) : base(registrationHelper)
 {
     Options = new SimpleInjectorOptions(options);
     Bootstrapper.Excluding.Assembly("SimpleInjector");
 }
Example #15
0
 public StructureMapExtension(IRegistrationHelper registrationHelper, IBootstrapperContainerExtensionOptions options) : base(registrationHelper)
 {
     Options = new StructureMapOptions(options);
     Bootstrapper.Excluding.Assembly("StructureMap");
 }
Example #16
0
 public MOTService(IRegistrationHelper helper, IEmailService emailService)
 {
     _helper       = helper;
     _emailService = emailService;
 }
Example #17
0
 protected BootstrapperContainerExtension(IRegistrationHelper registrationHelper)
 {
     Registrator = registrationHelper;
     Bootstrapper.Excluding.Assembly("Microsoft.Practices");
 }
Example #18
0
 public void InitializeBootstrapper()
 {
     Bootstrapper.ClearExtensions();
     registrationHelper = A.Fake <IRegistrationHelper>();
     options            = A.Fake <IBootstrapperContainerExtensionOptions>();
 }
Example #19
0
 public MongoExtension(IRegistrationHelper registrationHelper)
 {
     Bootstrap.Bootstrapper.Excluding.Assembly("MongoDB.Bson");
     Bootstrap.Bootstrapper.Excluding.Assembly("MongoDB.Driver");
     this.registrationHelper = registrationHelper;
 }
Example #20
0
 public AutofacExtension(IRegistrationHelper registrationHelper, IBootstrapperContainerExtensionOptions options) : base(registrationHelper)
 {
     Options = new AutofacOptions(options);
     Bootstrapper.Excluding.Assembly("Autofac");
 }
Example #21
0
        static int Main(string[] args)
        {
            // 1. Parse the commandline options to determine the requested task...
            RegistrationOptions options = new RegistrationOptions();
            bool argValid = options.Parse(args);

            // 2. Get a pointer to the forground window.  The idea here is that
            // If the user is starting our application from an existing console
            // shell, that shell will be the uppermost window.  We'll get it
            // and attach to it.
            // Uses this idea from, Jeffrey Knight, since it fits our model instead
            // of the recommended ATTACH_PARENT_PROCESS (DWORD)-1 parameter
            bool   startedInConsole = false;
            IntPtr ptr       = GetForegroundWindow();
            int    processId = -1;

            GetWindowThreadProcessId(ptr, out processId);
            Process process = Process.GetProcessById(processId);

            startedInConsole = process != null && String.Equals(process.ProcessName,
                                                                "cmd", StringComparison.InvariantCultureIgnoreCase);

            // 3. If the command option is invalid, or we just needed to show help...
            int returnValue = -1;

            if (!argValid || options.ShowHelp)
            {
                IRegistrationHelper helper = null;

                bool consoleSuccess = false;
                if (startedInConsole)
                {
                    consoleSuccess = CreateConsole(startedInConsole, process);
                    helper         = new ConsoleHelper();
                }
                else
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);

                    helper = new FormsHelper();
                }
                if (helper != null)
                {
                    helper.DisplayHelp();
                }
                if (consoleSuccess)
                {
                    FreeConsole();
                }

                return(returnValue);
            }

            // 4. If requested to open the help file, process it...
            if (options.IsViewer)
            {
                bool consoleSuccess        = false;
                IRegistrationHelper helper = null;

                try
                {
                    if (startedInConsole)
                    {
                        consoleSuccess = CreateConsole(startedInConsole, process);
                        helper         = new ConsoleHelper();
                    }
                    else
                    {
                        helper = new NoneHelper();
                    }

                    RegistrationHandler register = new RegistrationHandler();

                    returnValue = register.Run(options, helper);
                }
                catch (Exception ex)
                {
                    if (startedInConsole)
                    {
                        if (helper != null)
                        {
                            helper.WriteLine(ex);
                        }
                    }
                    else
                    {
                        MessageBox.Show(ex.ToString());
                    }
                }
                if (consoleSuccess)
                {
                    FreeConsole();
                }

                return(returnValue);
            }

            // If started from the console, we will ignore any GUI request...
            if (startedInConsole && !options.IsConsole)
            {
                options.SetMode(startedInConsole);
            }

            if (options.IsConsole)
            {
                bool consoleSuccess = false;
                try
                {
                    consoleSuccess = CreateConsole(startedInConsole, process);

                    if (consoleSuccess)
                    {
                        ConsoleHelper helper = new ConsoleHelper();

                        RegistrationHandler register = new RegistrationHandler();

                        returnValue = register.Run(options, helper);
                    }
                }
                catch
                {
                    FormsHelper helper = new FormsHelper();
                    helper.DisplayHelp();
                }
                finally
                {
                    if (consoleSuccess)
                    {
                        FreeConsole();
                    }
                }
            }
            else
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                MainForm mainForm = new MainForm();

                mainForm.SetOptions(options);

                Application.Run(mainForm);

                returnValue = mainForm.Result;
            }

            return(returnValue);
        }
Example #22
0
 public NinjectExtension(IRegistrationHelper registrationHelper, IBootstrapperContainerExtensionOptions options) : base(registrationHelper)
 {
     Options = new NinjectOptions(options);
     Bootstrapper.Excluding.Assembly("Ninject");
 }
 public void Initialize()
 {
     registrationHelper = new RegistrationHelper(new LoadedAssemblyProvider());
 }
        public int Run(RegistrationOptions options, IRegistrationHelper helper)
        {
            if (options == null || helper == null)
            {
                return(-1);
            }

            _regOptions = options;
            _regHelper  = helper;

            RegistrationHelper.Instance.Add(_regHelper);

            if (options.IsViewer)
            {
                this.DoViewerStuff();

                return(0);
            }

            bool isErrorCodes = _regOptions.ErrorCodes;

            if (_regOptions.ShowLogo)
            {
                _regHelper.DisplayLogo();
            }
            if (_regOptions.ShowHelp || _regOptions.Count == 0)
            {
                _regHelper.DisplayHelp();

                return(isErrorCodes ? 1 : -1);
            }

            if (!ApplicationHelpers.IsClassRegistered(
                    "{31411198-A502-11D2-BBCA-00C04F8EC294}"))
            {
                if (!_regOptions.IsQuiet)
                {
                    _regHelper.WriteLine(String.Format(ResourcesHelper.GetString(
                                                           "ErrorNoHelp2Environment")));
                }

                return(isErrorCodes ? 2 : -1);
            }

            if (!ApplicationHelpers.IsThisUserPrivileged())
            {
                if (!_regOptions.IsQuiet)
                {
                    _regHelper.WriteLine(String.Format(ResourcesHelper.GetString(
                                                           "ErrorInvalidPrivileges")));
                }

                return(isErrorCodes ? 3 : -1);
            }

            string actionParam = _regOptions.ActionParam;

            if (actionParam != "/r" && actionParam != "/u" && actionParam != "+r" &&
                actionParam != "-r" && actionParam != "+p" && actionParam != "-p" &&
                actionParam != "/v" && actionParam != "-v")
            {
                if (!_regOptions.IsQuiet)
                {
                    _regHelper.WriteLine(String.Format(ResourcesHelper.GetString(
                                                           "ErrorInvalidCommandLine"), actionParam));
                }

                return(isErrorCodes ? 4 : -1);
            }

            if (String.IsNullOrEmpty(_regOptions.FileName) ||
                !File.Exists(_regOptions.FileName))
            {
                if (!_regOptions.IsQuiet)
                {
                    _regHelper.WriteLine(String.Format(ResourcesHelper.GetString(
                                                           "ErrorInvalidXmlFile"), _regOptions.FileName));
                }

                return(isErrorCodes ? 5 : -1);
            }

            XmlValidator schemaValidator = new XmlValidator(helper);

            if (!schemaValidator.SchemaExists)
            {
                if (!_regOptions.IsQuiet)
                {
                    _regHelper.WriteLine(String.Format(ResourcesHelper.GetString(
                                                           "ErrorCannotValidateXmlFile"), _regOptions.FileName));
                }

                return(isErrorCodes ? 6 : -1);
            }

            if (!schemaValidator.Validate(_regOptions.FileName, _regOptions.IsQuiet))
            {
                // get a message from the validator class
                return(isErrorCodes ? 6 : -1);
            }

            if (actionParam != "/v" && actionParam != "-v")
            {
                _regHelper.CloseViewers();
            }

            if (actionParam == "/r" || actionParam == "+r")
            {
                this.DoHelpStuff(true);
            }
            if (actionParam == "/r" || actionParam == "+p")
            {
                this.DoPluginStuff(true);
            }
            if (actionParam == "/u" || actionParam == "-p")
            {
                this.DoPluginStuff(false);
            }
            if (actionParam == "/u" || actionParam == "-r")
            {
                this.DoHelpStuff(false);
            }
            if (actionParam == "/v" || actionParam == "-v" ||
                _regOptions.ViewHelp)
            {
                this.DoViewerStuff();
            }

            return(0);
        }
 public void Initialize()
 {
     registrationHelper = A.Fake <IRegistrationHelper>();
 }
 public StartupTasksExtension(IRegistrationHelper registrationHelper)
 {
     Options     = new StartupTasksOptions();
     taskGroups  = new List <TaskGroup>();
     Registrator = registrationHelper;
 }
Example #27
0
 public void Initialize()
 {
     Bootstrapper.ClearExtensions();
     registrationHelper = A.Fake <IRegistrationHelper>();
 }
 // -------------------------------------------------------------------------------------
 // Constructors
 // -------------------------------------------------------------------------------------
 public BackgroundProcessesExtension(IRegistrationHelper registrationHelper)
 {
     this._registrationHelper = registrationHelper;
 }
 public AutoMapperExtension(IRegistrationHelper registrationHelper)
 {
     Bootstrapper.Excluding.Assembly("AutoMapper");
     this.registrationHelper = registrationHelper;
 }
Example #30
0
 public VehicleServiceInterceptor(IRegistrationHelper helper)
 {
     _helper = helper;
 }
Example #31
0
 public WannaWhatProfileService(UserManager <WannaWhatUser> userManager, IUserClaimsPrincipalFactory <WannaWhatUser> claimsFactory, IRegistrationHelper regHelper)
 {
     _userManager   = userManager;
     _claimsFactory = claimsFactory;
     _regHelper     = regHelper;
 }
Example #32
0
 public GetCustomerDetailsViewBlockCustom(IGetLocalizedCustomerStatusPipeline getLocalizedCustomerStatusPipeline, IRegistrationHelper registrationHelper)
     : base((string)null)
 {
     this._getLocalizedCustomerStatusPipeline = getLocalizedCustomerStatusPipeline;
     _registrationHelper = registrationHelper;
 }