Beispiel #1
0
        private async void OpenConnection_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                DefaultWampChannelFactory channelFactory = new DefaultWampChannelFactory();

                IWampChannel channel = channelFactory.CreateJsonChannel(location, "realm1");

                IWampRealmProxy realmProxy = channel.RealmProxy;

                await channel.Open();

                // Host WAMP application components

                // await openTask;
                //openTask.Wait();

                IArgumentsService instance = new ArgumentsService();

                IWampRealmProxy realm = channel.RealmProxy;

                Task <IAsyncDisposable> registrationTask = realm.Services.RegisterCallee(instance);
                // await registrationTask;
                registrationTask.Wait();
            }
            catch (Exception ex)
            {
                MessageBox.Show(WampShared.Misc.GetErrorMessage(ex), "", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Configure dependency injection
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        internal static IContainer GlobalScope(string[] args)
        {
            var builder = new ContainerBuilder();
            var logger  = new LogService();

            if (args.Contains("--verbose"))
            {
                logger.SetVerbose();
            }
            var pluginService    = new PluginService(logger);
            var argumentsParser  = new ArgumentsParser(logger, pluginService, args);
            var argumentsService = new ArgumentsService(logger, argumentsParser);

            if (!argumentsService.Valid)
            {
                return(null);
            }
            var settingsService = new SettingsService(logger, argumentsService);

            if (!settingsService.Valid)
            {
                return(null);
            }
            logger.SetDiskLoggingPath(settingsService.Client.LogPath);

            _ = builder.RegisterInstance(argumentsService);
            _ = builder.RegisterInstance(argumentsParser);
            _ = builder.RegisterInstance(logger).As <ILogService>();
            _ = builder.RegisterInstance(settingsService).As <ISettingsService>();
            _ = builder.RegisterInstance(argumentsService).As <IArgumentsService>();
            _ = builder.RegisterInstance(pluginService).As <IPluginService>();
            _ = builder.RegisterType <UserRoleService>().SingleInstance();
            _ = builder.RegisterType <InputService>().As <IInputService>().SingleInstance();
            _ = builder.RegisterType <ProxyService>().SingleInstance();
            _ = builder.RegisterType <PasswordGenerator>().SingleInstance();
            _ = builder.RegisterType <RenewalStoreDisk>().As <IRenewalStore>().SingleInstance();

            pluginService.Configure(builder);

            _ = builder.RegisterType <DomainParseService>().SingleInstance();
            _ = builder.RegisterType <IISClient>().As <IIISClient>().SingleInstance();
            _ = builder.RegisterType <IISHelper>().SingleInstance();
            _ = builder.RegisterType <ExceptionHandler>().SingleInstance();
            _ = builder.RegisterType <UnattendedResolver>();
            _ = builder.RegisterType <InteractiveResolver>();
            _ = builder.RegisterType <AutofacBuilder>().As <IAutofacBuilder>().SingleInstance();
            _ = builder.RegisterType <AcmeClient>().SingleInstance();
            _ = builder.RegisterType <PemService>().SingleInstance();
            _ = builder.RegisterType <EmailClient>().SingleInstance();
            _ = builder.RegisterType <ScriptClient>().SingleInstance();
            _ = builder.RegisterType <LookupClientProvider>().SingleInstance();
            _ = builder.RegisterType <CertificateService>().As <ICertificateService>().SingleInstance();
            _ = builder.RegisterType <TaskSchedulerService>().SingleInstance();
            _ = builder.RegisterType <NotificationService>().SingleInstance();
            _ = builder.RegisterType <RenewalExecutor>().SingleInstance();
            _ = builder.RegisterType <RenewalManager>().SingleInstance();
            _ = builder.Register(c => c.Resolve <IArgumentsService>().MainArguments).SingleInstance();

            return(builder.Build());
        }
Beispiel #3
0
        private IISSiteOptions Options(string commandLine)
        {
            var optionsParser = new ArgumentsParser(log, plugins, commandLine.Split(' '));
            var arguments     = new ArgumentsService(log, optionsParser);
            var x             = new IISSiteOptionsFactory(log, iis, helper, arguments, userRoleService);

            return(x.Default().Result);
        }
Beispiel #4
0
        private IISBindingOptions Options(string commandLine)
        {
            var x             = new IISBindingOptionsFactory(log, iis, helper);
            var optionsParser = new ArgumentsParser(log, plugins, commandLine.Split(' '));
            var arguments     = new ArgumentsService(log, optionsParser);

            return(x.Default(arguments));
        }
Beispiel #5
0
        private ManualOptions Options(string commandLine)
        {
            var x             = new ManualOptionsFactory(log);
            var optionsParser = new ArgumentsParser(log, plugins, commandLine.Split(' '));
            var arguments     = new ArgumentsService(log, optionsParser);

            return(x.Default(arguments));
        }
Beispiel #6
0
        private ScriptOptions Options(string commandLine)
        {
            var optionsParser = new ArgumentsParser(log, plugins, commandLine.Split(' '));
            var arguments     = new ArgumentsService(log, optionsParser);
            var x             = new ScriptOptionsFactory(log, arguments);
            var target        = new Target();

            return(x.Default(target).Result);
        }
        private string?TestScript(string parameters)
        {
            var argParser = new ArgumentsParser(log, new MockPluginService(log),
                                                $"--scriptparameters {parameters} --verbose".Split(' '));
            var argService = new ArgumentsService(log, argParser);
            var args       = argService.GetArguments <ScriptArguments>();

            return(args?.ScriptParameters);
        }
Beispiel #8
0
        internal static IContainer GlobalScope(string[] args)
        {
            var builder          = new ContainerBuilder();
            var logger           = new LogService();
            var pluginService    = new PluginService(logger);
            var argumentsParser  = new ArgumentsParser(logger, pluginService, args);
            var argumentsService = new ArgumentsService(logger, argumentsParser);
            var settingsService  = new SettingsService(logger, argumentsService);

            logger.SetDiskLoggingPath(settingsService.LogPath);

            builder.RegisterInstance(argumentsService);
            builder.RegisterInstance(argumentsParser);
            builder.RegisterInstance(logger).As <ILogService>();
            builder.RegisterInstance(settingsService).As <ISettingsService>();
            builder.RegisterInstance(argumentsService).As <IArgumentsService>();
            builder.RegisterInstance(pluginService);

            builder.RegisterType <InputService>().
            As <IInputService>().
            SingleInstance();

            builder.RegisterType <ProxyService>().
            SingleInstance();

            builder.RegisterType <PasswordGenerator>().
            SingleInstance();

            builder.RegisterType <RenewalService>().
            As <IRenewalService>().
            SingleInstance();

            builder.RegisterType <DotNetVersionService>().
            SingleInstance();

            pluginService.Configure(builder);

            builder.RegisterType <DomainParseService>().SingleInstance();
            builder.RegisterType <IISClient>().As <IIISClient>().SingleInstance();
            builder.RegisterType <IISBindingHelper>().SingleInstance();
            builder.RegisterType <IISSiteHelper>().SingleInstance();
            builder.RegisterType <UnattendedResolver>();
            builder.RegisterType <InteractiveResolver>();
            builder.RegisterType <AutofacBuilder>().SingleInstance();
            builder.RegisterType <AcmeClient>().SingleInstance();
            builder.RegisterType <PemService>().SingleInstance();
            builder.RegisterType <EmailClient>().SingleInstance();
            builder.RegisterType <LookupClientProvider>().SingleInstance();
            builder.RegisterType <CertificateService>().As <ICertificateService>().SingleInstance();
            builder.RegisterType <TaskSchedulerService>().SingleInstance();
            builder.RegisterType <NotificationService>().SingleInstance();


            return(builder.Build());
        }
Beispiel #9
0
        public Calleee()
        {
            DefaultWampChannelFactory channelFactory = new DefaultWampChannelFactory();

            IWampChannel channel = channelFactory.CreateJsonChannel(location, "realm1");

            Task openTask = channel.Open();

            // await openTask;
            openTask.Wait();

            IArgumentsService instance = new ArgumentsService();

            IWampRealmProxy realm = channel.RealmProxy;

            Task <IAsyncDisposable> registrationTask = realm.Services.RegisterCallee(instance);

            // await registrationTask;
            registrationTask.Wait();
        }
Beispiel #10
0
        /// <summary>
        /// Configure dependency injection
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        internal static IContainer GlobalScope(string[] args)
        {
            var builder = new ContainerBuilder();
            var logger  = new LogService();

            if (Verbose)
            {
                logger.SetVerbose();
            }
            // Not used but should be called anyway because it
            // checks if we're not running as dotnet.exe and also
            // prints some verbose messages that are interesting
            // to know very early in the start up process
            var versionService   = new VersionService(logger);
            var pluginService    = new PluginService(logger);
            var argumentsParser  = new ArgumentsParser(logger, pluginService, args);
            var argumentsService = new ArgumentsService(logger, argumentsParser);

            if (!argumentsService.Valid)
            {
                return(null);
            }
            var settingsService = new SettingsService(logger, argumentsService);

            if (!settingsService.Valid)
            {
                return(null);
            }
            logger.SetDiskLoggingPath(settingsService.Client.LogPath);

            _ = builder.RegisterInstance(argumentsService);
            _ = builder.RegisterInstance(argumentsParser);
            _ = builder.RegisterInstance(logger).As <ILogService>();
            _ = builder.RegisterInstance(settingsService).As <ISettingsService>();
            _ = builder.RegisterInstance(argumentsService).As <IArgumentsService>();
            _ = builder.RegisterInstance(pluginService).As <IPluginService>();
            _ = builder.RegisterType <UserRoleService>().As <IUserRoleService>().SingleInstance();
            _ = builder.RegisterType <InputService>().As <IInputService>().SingleInstance();
            _ = builder.RegisterType <ProxyService>().As <IProxyService>().SingleInstance();
            _ = builder.RegisterType <UpdateClient>().SingleInstance();
            _ = builder.RegisterType <PasswordGenerator>().SingleInstance();
            _ = builder.RegisterType <RenewalStoreDisk>().As <IRenewalStore>().SingleInstance();

            pluginService.Configure(builder);

            _ = builder.RegisterType <DomainParseService>().SingleInstance();
            _ = builder.RegisterType <IISClient>().As <IIISClient>().InstancePerLifetimeScope();
            _ = builder.RegisterType <IISHelper>().SingleInstance();
            _ = builder.RegisterType <ExceptionHandler>().SingleInstance();
            _ = builder.RegisterType <UnattendedResolver>();
            _ = builder.RegisterType <InteractiveResolver>();
            _ = builder.RegisterType <AutofacBuilder>().As <IAutofacBuilder>().SingleInstance();
            _ = builder.RegisterType <AccountManager>().SingleInstance();
            _ = builder.RegisterType <AcmeClient>().SingleInstance();
            _ = builder.RegisterType <ZeroSsl>().SingleInstance();
            _ = builder.RegisterType <OrderManager>().SingleInstance();
            _ = builder.RegisterType <PemService>().SingleInstance();
            _ = builder.RegisterType <EmailClient>().SingleInstance();
            _ = builder.RegisterType <ScriptClient>().SingleInstance();
            _ = builder.RegisterType <LookupClientProvider>().SingleInstance();
            _ = builder.RegisterType <CertificateService>().As <ICertificateService>().SingleInstance();
            _ = builder.RegisterType <SecretServiceManager>().SingleInstance();
            _ = builder.RegisterType <JsonSecretService>().As <ISecretService>().SingleInstance();
            _ = builder.RegisterType <TaskSchedulerService>().SingleInstance();
            _ = builder.RegisterType <NotificationService>().SingleInstance();
            _ = builder.RegisterType <RenewalExecutor>().SingleInstance();
            _ = builder.RegisterType <RenewalValidator>().SingleInstance();
            _ = builder.RegisterType <RenewalManager>().SingleInstance();
            _ = builder.RegisterType <RenewalCreator>().SingleInstance();
            _ = builder.Register(c => c.Resolve <IArgumentsService>().MainArguments).SingleInstance();

            _ = builder.RegisterType <Wacs>();

            return(builder.Build());
        }