示例#1
0
        //---------------------------------------------------------------------
        protected BaseBenchmark(IBase64?encoder)
        {
            _encoder = encoder ?? throw new ArgumentNullException(nameof(encoder));

            var random = new Random(42);

            _data = new byte[ByteArraySize];
            random.NextBytes(_data);
            _dataEncoded = _encoder.Encode(_data);

            _guid        = Guid.NewGuid().ToByteArray();
            _guidEncoded = _encoder.Encode(_guid);
        }
示例#2
0
        /// <summary>
        /// SendMail
        /// </summary>
        /// <param name="base64">Base64 encoder</param>
        /// <param name="smtpServer">The SMTP server</param>
        public SendMail(IBase64 base64, SmtpServer smtpServer)
        {
            this.base64 = base64;
            CheckParameter(smtpServer.Host, String.Concat(nameof(smtpServer), ".", nameof(smtpServer.Host)));
            smtpClient = new SmtpClient(smtpServer.Host, smtpServer.Port)
            {
                DeliveryMethod = SmtpDeliveryMethod.Network,
                EnableSsl      = smtpServer.Ssl
            };
            smtpClient.SendCompleted += SendCompletedCallback;

            smtpClient.UseDefaultCredentials = !smtpServer.RequiresAuthentication;
            smtpClient.Credentials           = smtpServer.RequiresAuthentication
                ? new NetworkCredential(smtpServer.Username, smtpServer.Password)
                : CredentialCache.DefaultNetworkCredentials;

            ForceSmtpAuthentication = true;
            SmtpAuthentication      = SmtpAuthentication.Digest;
            Arguments = null;
        }
示例#3
0
 public SendMail(IBase64 base64, string smtpHost, bool sslEncryption, int port, string username = null, string password = null)
     : this(base64, new SmtpServer(smtpHost, port, sslEncryption, username, password, SmtpAuthentication.Digest))
 {
 }
示例#4
0
 public Base64Controller(IBase64 base64, ILogger <Base64Controller> logger)
 {
     _base64 = base64;
     _logger = logger;
 }
示例#5
0
 public SpotifyService(IHttpClientFactoryWrapper clientFactory, IBase64 base64)
 {
     ClientFactory = clientFactory;
     Base64        = base64;
 }
示例#6
0
文件: Item.cs 项目: 15831944/Sheet
 public ItemSerializer(IServiceLocator serviceLocator)
 {
     this._serviceLocator = serviceLocator;
     this._base64         = serviceLocator.GetInstance <IBase64>();
 }
示例#7
0
 public Authentication(IBase64 base64)
 {
     this.base64 = base64;
 }