Protobufs compile

This commit is contained in:
watsonb8 2019-05-31 10:17:14 -04:00
parent 9354c0b27b
commit 6503d2c410
9 changed files with 228 additions and 42 deletions

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Grpc.Tools.1.21.0\build\Grpc.Tools.props" Condition="Exists('..\packages\Grpc.Tools.1.21.0\build\Grpc.Tools.props')" />
<Import Project="..\packages\Xamarin.Forms.3.6.0.344457\build\Xamarin.Forms.props" Condition="Exists('..\packages\Xamarin.Forms.3.6.0.344457\build\Xamarin.Forms.props')" /> <Import Project="..\packages\Xamarin.Forms.3.6.0.344457\build\Xamarin.Forms.props" Condition="Exists('..\packages\Xamarin.Forms.3.6.0.344457\build\Xamarin.Forms.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -110,6 +111,19 @@
<Reference Include="LibVLCSharp.Forms.Platforms.GTK"> <Reference Include="LibVLCSharp.Forms.Platforms.GTK">
<HintPath>..\packages\LibVLCSharp.Forms.GTK.3.0.0\lib\net47\LibVLCSharp.Forms.Platforms.GTK.dll</HintPath> <HintPath>..\packages\LibVLCSharp.Forms.GTK.3.0.0\lib\net47\LibVLCSharp.Forms.Platforms.GTK.dll</HintPath>
</Reference> </Reference>
<Reference Include="Google.Protobuf">
<HintPath>..\packages\Google.Protobuf.3.8.0\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="System.Interactive.Async">
<HintPath>..\packages\System.Interactive.Async.3.2.0\lib\net46\System.Interactive.Async.dll</HintPath>
</Reference>
<Reference Include="Grpc.Core.Api">
<HintPath>..\packages\Grpc.Core.Api.1.21.0\lib\net45\Grpc.Core.Api.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Grpc.Core">
<HintPath>..\packages\Grpc.Core.1.21.0\lib\net45\Grpc.Core.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="gtk-gui\gui.stetic"> <EmbeddedResource Include="gtk-gui\gui.stetic">
@ -463,4 +477,6 @@
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Xamarin.Forms.3.6.0.344457\build\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.3.6.0.344457\build\Xamarin.Forms.targets')" /> <Import Project="..\packages\Xamarin.Forms.3.6.0.344457\build\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.3.6.0.344457\build\Xamarin.Forms.targets')" />
<Import Project="..\packages\VideoLAN.LibVLC.Mac.3.1.2\build\VideoLAN.LibVLC.Mac.targets" Condition="Exists('..\packages\VideoLAN.LibVLC.Mac.3.1.2\build\VideoLAN.LibVLC.Mac.targets')" /> <Import Project="..\packages\VideoLAN.LibVLC.Mac.3.1.2\build\VideoLAN.LibVLC.Mac.targets" Condition="Exists('..\packages\VideoLAN.LibVLC.Mac.3.1.2\build\VideoLAN.LibVLC.Mac.targets')" />
<Import Project="..\packages\Grpc.Tools.1.21.0\build\Grpc.Tools.targets" Condition="Exists('..\packages\Grpc.Tools.1.21.0\build\Grpc.Tools.targets')" />
<Import Project="..\packages\Grpc.Core.1.21.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.21.0\build\net45\Grpc.Core.targets')" />
</Project> </Project>

View File

@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Google.Protobuf" version="3.8.0" targetFramework="net47" />
<package id="Grpc" version="1.21.0" targetFramework="net47" />
<package id="Grpc.Core" version="1.21.0" targetFramework="net47" />
<package id="Grpc.Core.Api" version="1.21.0" targetFramework="net47" />
<package id="Grpc.Tools" version="1.21.0" targetFramework="net47" developmentDependency="true" />
<package id="LibVLCSharp" version="3.0.0" targetFramework="net47" /> <package id="LibVLCSharp" version="3.0.0" targetFramework="net47" />
<package id="LibVLCSharp.Forms" version="3.0.0" targetFramework="net47" /> <package id="LibVLCSharp.Forms" version="3.0.0" targetFramework="net47" />
<package id="LibVLCSharp.Forms.GTK" version="3.0.0" targetFramework="net47" /> <package id="LibVLCSharp.Forms.GTK" version="3.0.0" targetFramework="net47" />
@ -7,6 +12,7 @@
<package id="Microsoft.Bcl" version="1.1.8" targetFramework="net47" /> <package id="Microsoft.Bcl" version="1.1.8" targetFramework="net47" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net47" /> <package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net47" />
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net47" /> <package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net47" />
<package id="System.Interactive.Async" version="3.2.0" targetFramework="net47" />
<package id="System.Reflection" version="4.3.0" targetFramework="net47" /> <package id="System.Reflection" version="4.3.0" targetFramework="net47" />
<package id="System.Reflection.TypeExtensions" version="4.4.0" targetFramework="net47" /> <package id="System.Reflection.TypeExtensions" version="4.4.0" targetFramework="net47" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net47" /> <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net47" />

View File

@ -1,43 +1,94 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project
Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<ProduceAssemblyReference>true</ProduceAssemblyReference> <ProduceAssemblyReference>true</ProduceAssemblyReference>
</PropertyGroup> </PropertyGroup>
<PropertyGroup
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<ItemGroup> <PackageReference
<PackageReference Include="Xamarin.Forms" Version="3.6.0.264807" /> Include="Xamarin.Forms"
<PackageReference Include="Xamarin.Essentials" Version="1.0.1" /> Version="3.6.0.264807"/>
<PackageReference Include="Xamarin.Forms.DataGrid" Version="3.1.0" /> <PackageReference
<PackageReference Include="taglib-sharp-netstandard2.0" Version="2.1.0" /> Include="Xamarin.Essentials"
<PackageReference Include="LibVLCSharp.Forms" Version="3.0.0" /> Version="1.0.1"/>
<PackageReference Include="VideoLAN.LibVLC.Mac" Version="3.1.3" /> <PackageReference
</ItemGroup> Include="Xamarin.Forms.DataGrid"
<ItemGroup> Version="3.1.0"/>
<Folder Include="Frontend\" /> <PackageReference
<Folder Include="Backend\" /> Include="taglib-sharp-netstandard2.0"
<Folder Include="Frontend\Components\" /> Version="2.1.0"/>
<Folder Include="Frontend\Views\" /> <PackageReference
<Folder Include="Frontend\Views\Songs\" /> Include="LibVLCSharp.Forms"
<Folder Include="Frontend\Views\MainView\" /> Version="3.0.0"/>
<Folder Include="Frontend\Behaviors\" /> <PackageReference
<Folder Include="Frontend\Components\NavigationMenu\" /> Include="VideoLAN.LibVLC.Mac"
<Folder Include="Frontend\Views\Albums\" /> Version="3.1.3"/>
<Folder Include="Frontend\Views\Artists\" /> <PackageReference
<Folder Include="Frontend\Views\Stations\" /> Include="Grpc"
<Folder Include="Frontend\Components\MusicPlayer\" /> Version="1.21.0"/>
<Folder Include="Backend\Utils\" /> <PackageReference
<Folder Include="Backend\Models\" /> Include="Grpc.Tools"
<Folder Include="Backend\Services\" /> Version="1.21.0"
</ItemGroup> PrivateAssests="All"/>
<ItemGroup> <PackageReference
<Compile Update="Frontend\Components\MusicPlayer\Player.xaml.cs"> Include="Google.Protobuf"
<DependentUpon>Player.xaml</DependentUpon> Version="3.8.0"/>
</Compile> </ItemGroup>
</ItemGroup> <ItemGroup>
<Folder
Include="Frontend\"/>
<Folder
Include="Backend\"/>
<Folder
Include="Frontend\Components\"/>
<Folder
Include="Frontend\Views\"/>
<Folder
Include="Frontend\Views\Songs\"/>
<Folder
Include="Frontend\Views\MainView\"/>
<Folder
Include="Frontend\Behaviors\"/>
<Folder
Include="Frontend\Components\NavigationMenu\"/>
<Folder
Include="Frontend\Views\Albums\"/>
<Folder
Include="Frontend\Views\Artists\"/>
<Folder
Include="Frontend\Views\Stations\"/>
<Folder
Include="Backend\Utils\"/>
<Folder
Include="Backend\Models\"/>
<Folder
Include="Backend\Services\"/>
<Folder
Include="Frontend\Views\Party\"/>
<Folder
Include="Frontend\Components\HostSelector\"/>
<Folder
Include="Frontend\Components\MemberList\"/>
<Folder
Include="Frontend\Components\Queue\"/>
</ItemGroup>
<ItemGroup>
<Compile
Update="Frontend\Components\MusicPlayer\Player.xaml.cs">
<DependentUpon>Player.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Protobuf
Include="Backend\Proto\PartyService\party.proto"/>
<Protobuf
Include="Backend\Proto\PlaybackService\playback.proto"/>
<Protobuf
Include="Backend\Proto\general.proto"/>
</ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,34 @@
syntax = "proto3";
package Aurora.Backend.Proto;
// PartyServic definition
service PartyService{
//Party Service
rpc JoinParty(JoinPartyRequest) returns (JoinPartyResponse);
rpc LeaveParty(LeavePartyRequest) returns (LeavePartyResponse);
}
message JoinPartyRequest {
string clientId = 1;
string userName = 2;
string ipAddress = 3;
string port = 4;
}
message JoinPartyResponse {
PartyJoinedStatusEnum status = 1;
}
message LeavePartyRequest {
string clientId = 1;
}
message LeavePartyResponse {
PartyJoinedStatusEnum status = 1;
}
enum PartyJoinedStatusEnum {
Connected = 0;
Disconnected = 1;
}

View File

@ -0,0 +1,21 @@
syntax = "proto3";
package Aurora.Backend.Proto;
import "Backend/Proto/general.proto";
service PlaybackService {
//Playback Service
rpc GetPartyStream(Empty) returns (stream Chunk) {};
}
enum TransferStatusCode {
Unknown = 0;
Ok = 1;
Failed = 2;
}
message TransferStatus {
string Message = 1;
TransferStatusCode Code = 2;
}

View File

@ -0,0 +1,10 @@
syntax = "proto3";
package Aurora.Backend.Proto;
message Chunk {
bytes Content = 1;
}
message Empty{
}

View File

@ -0,0 +1,10 @@
using System;
using Aurora.Backend.Proto;
namespace Aurora.Backend.Services.Server
{
class PartyServiceImpl : PartyService.PartyServiceBase
{
}
}

View File

@ -0,0 +1,10 @@
using System;
using Aurora.Backend.Proto;
namespace Aurora.Backend.Services.Server
{
class PlaybackServiceImpl : PlaybackService.PlaybackServiceBase
{
}
}

View File

@ -0,0 +1,28 @@
using System;
using Grpc.Core;
using Aurora.Backend.Proto;
namespace Aurora.Backend.Services.Server
{
public class ServerService : BaseService<ServerService>
{
const int Port = 50051;
public ServerService()
{
Grpc.Core.Server server = new Grpc.Core.Server
{
Services = {
PartyService.BindService(new PartyServiceImpl()),
PlaybackService.BindService(new PlaybackServiceImpl()) },
Ports = { new ServerPort("localhost", Port, ServerCredentials.Insecure) }
};
server.Start();
Console.WriteLine("Aurora server listening on port " + Port);
Console.WriteLine("Press any key to stop the server...");
Console.ReadKey();
server.ShutdownAsync().Wait();
}
}
}