static async Task Main(string[] args)
        {
            var channel = GrpcChannel.ForAddress("https://*****:*****@"C:\Users\Furkan\Desktop\c6bdb32b-0e8b-4967-991f-f6454ff711ff.jpg";

            byte[] buffer = new byte[2048];
            using FileStream fileStream = new FileStream(file, FileMode.Open);
            var content = new AllFile
            {
                FileSize = fileStream.Length,
                Info     = new GrpcFileService.FileInfo
                {
                    FileName      = Path.GetFileNameWithoutExtension(fileStream.Name),
                    FileExtention = Path.GetExtension(fileStream.Name),
                },
                ReadedByte = 0
            };
            var result = client.FileUpload();

            while ((content.ReadedByte = await fileStream.ReadAsync(buffer, 0, buffer.Length)) > 0)
            {
                content.Buffers = ByteString.CopyFrom(buffer);
                await result.RequestStream.WriteAsync(content);
            }
            CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();

            while (await result.ResponseStream.MoveNext(cancellationTokenSource.Token))
            {
                Console.WriteLine($"{result.ResponseStream.Current.Message} - %{result.ResponseStream.Current.Percent}");
            }
        }
Пример #2
0
 public VideoStreamService(
     ILogger <VideoStreamService> logger,
     FileServer.FileServerClient fileServerClient,
     VideoRepository repo,
     ConnectionMultiplexer redisMultiplexer
     ) : base()
 {
     _logger           = logger;
     _fileServerClient = fileServerClient;
     _repo             = repo;
     _redisMultiplexer = redisMultiplexer;
 }
Пример #3
0
 public VideoStreamService(ILogger <VideoStreamService> logger, FileServer.FileServerClient fileServerClient, VideoRepository repo) : base()
 {
     _logger           = logger;
     _fileServerClient = fileServerClient;
     _repo             = repo;
 }