コード例 #1
0
 public ProfileAvatarData(Stream inputData, long dataLength, string contentType, IOutputStreamFactory outputStreamFactory)
 {
     InputData           = inputData;
     DataLength          = dataLength;
     ContentType         = contentType;
     OutputStreamFactory = outputStreamFactory;
 }
コード例 #2
0
 public static OutputWriter Make(CompilerArguments arguments, string file, IOutputStreamFactory streamFactory)
 {
     return(new(
                TransformerChainFactory.Create(arguments),
                streamFactory.Make(file)
                ));
 }
コード例 #3
0
        private async Task <byte[]> UploadAttachment(CancellationToken token, string method, string url, Stream data, long dataSize,
                                                     IOutputStreamFactory outputStreamFactory, IProgressListener listener)
        {
            // buffer payload in memory...
            MemoryStream          tmpStream     = new MemoryStream();
            DigestingOutputStream outputStream  = outputStreamFactory.CreateFor(tmpStream);
            StreamContent         streamContent = new StreamContent(tmpStream);

            data.CopyTo(outputStream);
            outputStream.Flush();
            tmpStream.Position = 0;

            // ... and upload it!
            var request = new HttpRequestMessage(HttpMethod.Put, url)
            {
                Content = new StreamContent(tmpStream)
            };

            request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
            request.Headers.ConnectionClose     = true;
            HttpClient          client   = Util.CreateHttpClient();
            HttpResponseMessage response = await client.SendAsync(request, token);

            if (response.StatusCode != HttpStatusCode.OK)
            {
                throw new IOException($"Bad response: {response.StatusCode} {await response.Content.ReadAsStringAsync()}");
            }

            return(outputStream.GetTransmittedDigest());
        }
コード例 #4
0
 public ActiveDirectorySyncJob(ILogger logger,
                               JobElement jobConfig,
                               IActiveDirectoryService activeDirectoryService,
                               IOutputStreamFactory outputStreamFactory) : base(logger, jobConfig)
 {
     ActiveDirectoryService = activeDirectoryService;
     OutputStreamFactory    = outputStreamFactory;
 }
コード例 #5
0
 public PushAttachmentData(String contentType, Stream data, long dataSize, IOutputStreamFactory outputStreamFactory, IProgressListener listener)
 {
     ContentType   = contentType;
     Data          = data;
     DataSize      = dataSize;
     OutputFactory = outputStreamFactory;
     Listener      = listener;
 }
コード例 #6
0
        private void AddOutputStreamFactory(Type type)
        {
            IOutputStreamFactory factory = null;
            var constructor = type.GetConstructor(Type.EmptyTypes);

            if (constructor != null)
            {
                factory = constructor.Invoke(null) as IOutputStreamFactory;
            }
            else if ((constructor = type.GetConstructor(new Type[] { typeof(PeerCast) })) != null)
            {
                factory = constructor.Invoke(new object[] { peerCast }) as IOutputStreamFactory;
            }
            if (factory != null)
            {
                peerCast.OutputStreamFactories.Add(factory);
            }
        }
コード例 #7
0
        public ProcessStream(ProcessConfiguration config, IOutputStreamFactory outputFactory)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            if (outputFactory == null)
            {
                throw new ArgumentNullException(nameof(outputFactory));
            }

            if (string.IsNullOrEmpty(config.FileName))
            {
                throw new ArgumentNullException("fileName", "Process filename must be supplied");
            }

            this.config        = config;
            this.outputFactory = outputFactory;
        }
コード例 #8
0
 public DigestingRequestBody(Stream inputStream,
                             IOutputStreamFactory outputStreamFactory,
                             string contentType, long contentLength,
                             IProgressListener?progressListener,
                             CancellationToken?cancellationToken)
 {
     this.inputStream         = inputStream;
     this.outputStreamFactory = outputStreamFactory;
     this.contentType         = contentType;
     this.contentLength       = contentLength;
     this.progressListener    = progressListener;
     if (!cancellationToken.HasValue)
     {
         this.cancellationToken = CancellationToken.None;
     }
     else
     {
         this.cancellationToken = cancellationToken.Value;
     }
 }
コード例 #9
0
        private void UploadToCdn(string acl, string key, string policy, string algorithm, string credential, string date,
                                 string signature, Stream inputData, string contentType, long dataLength, IOutputStreamFactory outputStreamFactory)
        {
            SignalUrl signalUrl  = GetRandom(SignalConnectionInformation.SignalCdnUrls);
            string    url        = signalUrl.Url;
            string    hostHeader = signalUrl.HostHeader;

            throw new NotImplementedException(); //TODO
        }