2019-07-05 15:37:44 +00:00
|
|
|
using System;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.IO;
|
2019-07-05 18:17:09 +00:00
|
|
|
using Aurora.Proto;
|
|
|
|
using Aurora.Models;
|
2019-07-05 15:37:44 +00:00
|
|
|
|
2019-07-05 18:17:09 +00:00
|
|
|
namespace Aurora.RemoteImpl
|
2019-07-05 15:37:44 +00:00
|
|
|
{
|
|
|
|
public class RemotePlaybackServiceImpl : RemotePlaybackService.RemotePlaybackServiceBase
|
|
|
|
{
|
2019-07-05 18:17:09 +00:00
|
|
|
|
|
|
|
public RemotePlaybackServiceImpl()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-07-05 15:37:44 +00:00
|
|
|
public override async Task GetPartyStream(Empty empty,
|
|
|
|
Grpc.Core.IServerStreamWriter<Chunk> responseStream,
|
|
|
|
Grpc.Core.ServerCallContext context)
|
|
|
|
{
|
|
|
|
throw new NotImplementedException("Working on it");
|
|
|
|
// //Send stream
|
|
|
|
// string cwd = Directory.GetCurrentDirectory();
|
|
|
|
// using (FileStream fs = System.IO.File.OpenRead(Path.Combine(cwd, request.FileName)))
|
|
|
|
// {
|
|
|
|
// Console.WriteLine("Begin sending file");
|
|
|
|
// byte[] buffer = new byte[2048]; // read in chunks of 2KB
|
|
|
|
// int bytesRead;
|
|
|
|
// while ((bytesRead = fs.Read(buffer, 0, buffer.Length)) > 0)
|
|
|
|
// {
|
|
|
|
// Google.Protobuf.ByteString bufferByteString = Google.Protobuf.ByteString.CopyFrom(buffer);
|
|
|
|
// await responseStream.WriteAsync(new Chunk { Content = bufferByteString });
|
|
|
|
// }
|
|
|
|
// Console.WriteLine("Done sending file");
|
|
|
|
// };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|