This repository has been archived on 2020-12-20. You can view files and clone it, but cannot push or open issues or pull requests.
aurora-sharp-desktop/Aurora/Services/Server/Controllers/PartyController.cs

59 lines
1.9 KiB
C#
Raw Normal View History

using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using Aurora.Proto.PartyV2;
using Google.Protobuf.WellKnownTypes;
namespace Aurora.Services.Server.Controllers
{
public partial class RemotePartyController : RemotePartyService.RemotePartyServiceBase
{
private string _partyResourceName = "party/party1";
private string _displayName;
private string _description;
private Member _hostMember;
private DateTime _startDateTime;
private EventManager.EventManager _eventManager;
/// <summary>
/// Constructor for partial class
/// </summary>
public RemotePartyController(string partyName, string description)
{
this._startDateTime = DateTime.UtcNow;
this._displayName = partyName;
this._description = description;
this._memberList = new SortedList<string, Member>();
2020-01-20 23:38:05 +00:00
string userName = "testUser";
this._eventManager = new EventManager.EventManager();
this._hostMember = new Member()
{
Name = GetNewMemberResourceName(_partyResourceName, ServerService.GetLocalIPAddress(), userName),
UserName = userName,
IpAddress = ServerService.GetLocalIPAddress(),
};
2020-01-20 23:38:05 +00:00
this._memberList.Add(_hostMember.Name, _hostMember);
}
public override Task<Party> GetParty(Proto.General.Empty request, Grpc.Core.ServerCallContext context)
{
Party party = new Party()
{
Name = _partyResourceName,
DisplayName = this._displayName,
Description = this._description,
HostIp = ServerService.GetLocalIPAddress(),
HostMember = this._hostMember,
CreatedOn = Timestamp.FromDateTime(_startDateTime)
};
return Task.FromResult(party);
}
}
}