Example #1
0
        public async Task RunAsync()
        {
            try {
                await EnsureCertificateAsync();
            } catch (LetsEncryptException ex) {
                if (ErrorHandler != null)
                {
                    var errorInfo = new ErrorInfo {
                        Continue  = ContinueHandler != null,
                        Exception = ex
                    };

                    ErrorHandler(errorInfo);

                    if (!errorInfo.Continue)
                    {
                        ContinueHandler = null;
                    }
                }
            }

            // Retrieve the certificate from loader
            CertificateLoader.TryLoad(Options.Hostname, out var certificate);

            // This starts the actual web app
            await ContinueHandler
            ?.Invoke(certificate)
            ?.RunAsync();
        }
Example #2
0
        public void Run()
        {
            try {
                EnsureCertificate();
            } catch (LetsEncryptException ex) {
                Logger?.LogError(ex, ex.InnerException?.Message);

                if (ErrorHandler != null)
                {
                    var errorInfo = new ErrorInfo {
                        Continue  = ContinueHandler != null,
                        Exception = ex
                    };

                    ErrorHandler(errorInfo);

                    if (!errorInfo.Continue)
                    {
                        ContinueHandler = null;
                    }
                }
            }

            // Retrieve the certificate from loader
            CertificateLoader.TryLoad(Options.Hostname, out var certificate);

            // This starts the actual web app
            ContinueHandler
            ?.Invoke(certificate)
            ?.Run();
        }
Example #3
0
 public BitsException(string message, Exception exception, Stream file, long position, BitsRequest request, ContinueHandler handler, RequestProgressHandler progressHandler, object result) : base(message, exception)
 {
     this.Position  = position;
     this.Request   = request;
     this.Content   = file;
     this.Continue += handler;
     this.Handler   = progressHandler;
     Result         = result;
 }