Beispiel #1
0
        public async Task <IActionResult> SetUserNotify(ulong userId, [FromBody] NotifyDto notify)
        {
            // Check if user exists
            var user = await _userService.GetOrSetAndGet(userId);

            if (!user)
            {
                return(NotFound("User doesn't exist in Sora's reach"));
            }

            // Make sure he exists in DB
            await _userRepo.GetOrCreateUser(userId);

            // Now we set the notification
            if (notify.Notify)
            {
                await _waifuRequestRepo.ActivateUserNotification(userId);
            }
            else
            {
                await _waifuRequestRepo.RemoveUserNotification(userId);
            }

            return(Ok());
        }
Beispiel #2
0
        private void fsdConsumer_ServerTimerElapsed(object source, ElapsedEventArgs e)
        {
            Client.Write($"SYNC:*:DSERVER:B{DtoCount}:1:\r\n");
            DtoCount++;
            NotifyDto notifyDto = new NotifyDto("*", "DSERVER", DtoCount, 1, 0, "DSERVER", "DSERVER",
                                                "*****@*****.**", "127.0.0.1",
                                                "v1.0", 0, "Toronto, Ontario");

            Client.Write(notifyDto + "\r\n");
            DtoCount++;
        }
Beispiel #3
0
        private void client_DelimiterDataReceived(object sender, Message packet)
        {
            try
            {
                string[] fields = packet.MessageString.Replace("\r", "").Split(":");
                switch (fields[0])
                {
                case "ADDCLIENT":
                    AddClientDto addClientDto = AddClientDto.Deserialize(fields);
                    OnAddClientDtoReceived(new DtoReceivedEventArgs <AddClientDto>(addClientDto));
                    break;

                case "RMCLIENT":
                    RemoveClientDto removeClientDto = RemoveClientDto.Deserialize(fields);
                    OnRemoveClientDtoReceived(new DtoReceivedEventArgs <RemoveClientDto>(removeClientDto));
                    break;

                case "PD":
                    PilotDataDto pilotDataDto = PilotDataDto.Deserialize(fields);
                    OnPilotDataDtoReceived(new DtoReceivedEventArgs <PilotDataDto>(pilotDataDto));
                    break;

                case "AD":
                    AtcDataDto atcDataDto = AtcDataDto.Deserialize(fields);
                    OnAtcDataDtoReceived(new DtoReceivedEventArgs <AtcDataDto>(atcDataDto));
                    break;

                case "PLAN":
                    FlightPlanDto flightPlanDto = FlightPlanDto.Deserialize(fields);
                    OnFlightPlanDtoReceived(new DtoReceivedEventArgs <FlightPlanDto>(flightPlanDto));
                    break;

                case "PING":
                    PingDto pingDto = PingDto.Deserialize(fields);
                    OnPingDtoReceived(new DtoReceivedEventArgs <PingDto>(pingDto));
                    break;

                case "MC":
                    if (fields[5] == "25")
                    {
                        AtisDataDto atisDataDto = AtisDataDto.Deserialize(fields);
                        OnAtisDataDtoReceived(new DtoReceivedEventArgs <AtisDataDto>(atisDataDto));
                    }

                    break;

                case "NOTIFY":
                    NotifyDto notifyDto = NotifyDto.Deserialize(fields);
                    OnNotifyDtoReceived(new DtoReceivedEventArgs <NotifyDto>(notifyDto));
                    break;

                default:
                    // Not a DTO we need to handle...
                    break;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Beispiel #4
0
        private void Client_DelimiterDataReceived(object sender, Message packet)
        {
            try
            {
                string[] fields = packet.MessageString.Replace("\r", "").Split(":", 2);
                switch (fields[0])
                {
                case AddClientDto.Packet:
                    AddClientDto addClientDto = AddClientDto.Deserialize(fields[1]);
                    OnAddClientDtoReceived(new DtoReceivedEventArgs <AddClientDto>(addClientDto));
                    break;

                case RemoveClientDto.Packet:
                    RemoveClientDto removeClientDto = RemoveClientDto.Deserialize(fields[1]);
                    OnRemoveClientDtoReceived(new DtoReceivedEventArgs <RemoveClientDto>(removeClientDto));
                    break;

                case PilotDataDto.Packet:
                    PilotDataDto pilotDataDto = PilotDataDto.Deserialize(fields[1]);
                    OnPilotDataDtoReceived(new DtoReceivedEventArgs <PilotDataDto>(pilotDataDto));
                    break;

                case AtcDataDto.Packet:
                    AtcDataDto atcDataDto = AtcDataDto.Deserialize(fields[1]);
                    OnAtcDataDtoReceived(new DtoReceivedEventArgs <AtcDataDto>(atcDataDto));
                    break;

                case FlightPlanDto.Packet:
                    FlightPlanDto flightPlanDto = FlightPlanDto.Deserialize(fields[1]);
                    OnFlightPlanDtoReceived(new DtoReceivedEventArgs <FlightPlanDto>(flightPlanDto));
                    break;

                case PingDto.Packet:
                    PingDto pingDto = PingDto.Deserialize(fields[1]);
                    OnPingDtoReceived(new DtoReceivedEventArgs <PingDto>(pingDto));
                    break;

                case FlightPlanCancelDto.Packet:
                    FlightPlanCancelDto flighplanCancelDto = FlightPlanCancelDto.Deserialize(fields[1]);
                    OnFlightPlanCancelDtoReceived(new DtoReceivedEventArgs <FlightPlanCancelDto>(flighplanCancelDto));
                    break;

                case NotifyDto.Packet:
                    NotifyDto notifyDto = NotifyDto.Deserialize(fields[1]);
                    OnNotifyDtoReceived(new DtoReceivedEventArgs <NotifyDto>(notifyDto));
                    break;

                case "MC":
                    fields = packet.MessageString.Replace("\r", "").Split(":");
                    switch (fields[5])
                    {
                    case "25":
                    {
                        AtisDataDto atisDataDto = AtisDataDto.Deserialize(fields);
                        OnAtisDataDtoReceived(new DtoReceivedEventArgs <AtisDataDto>(atisDataDto));
                        break;
                    }

                    case "5" when fields[1] == "*S":
                    {
                        WallopDto wallopDto = WallopDto.Deserialize(fields);
                        OnWallopDtoReceived(new DtoReceivedEventArgs <WallopDto>(wallopDto));
                        break;
                    }

                    case "5" when fields[1] == "*":