Esempio n. 1
0
        private void HandleGameListResponse(BlockGameListResponsePayload response)
        {
            //TODO: This is just for testing, we try to join the first one list
            GameListEntry entry = response.GameEntries.First();

            SendService.SendMessage(new SharedMenuSelectionRequestPayload(entry.Listing), DeliveryMethod.ReliableOrdered);
        }
 public TransactionsController(
     SendService sendService,
     LastInTransactionsService lastInTransactionsService)
 {
     _sendService = sendService;
     _lastInTransactionsService = lastInTransactionsService;
 }
Esempio n. 3
0
        protected override void OnEventFired(object source, EntityCreationFinishedEventArgs args)
        {
            GameObject entity = GameObjectMappable.RetrieveEntity(args.EntityGuid);

            //Adding a test/demo collider to allow for a clicking volume.
            BoxCollider collider = entity.AddComponent <BoxCollider>();

            collider.isTrigger = true;
            entity.AddComponent <OnMouseClickedComponent>().OnMouseClicked += (sender, eventArgs) =>
            {
                if (eventArgs.Type == MouseButtonClickEventArgs.MouseType.Left)
                {
                    //Check if they are selectable
                    if (!EntityDataFieldMappable.RetrieveEntity(args.EntityGuid).HasBaseObjectFieldFlag(BaseObjectFieldFlags.UNIT_FLAG_NOT_SELECTABLE))
                    {
                        SendService.SendMessage(new ClientInteractNetworkedObjectRequestPayload(args.EntityGuid, ClientInteractNetworkedObjectRequestPayload.InteractType.Selection));

                        //Client side prediction of player target
                        LocalPlayerDetails.EntityData.SetFieldValue(EntityObjectField.UNIT_FIELD_TARGET, args.EntityGuid);
                    }
                }
                else
                {
                    //Check if the entity is interactable before sending a packet.
                    if (EntityDataFieldMappable.RetrieveEntity(args.EntityGuid).HasBaseObjectFieldFlag(BaseObjectFieldFlags.UNIT_FLAG_INTERACTABLE))
                    {
                        SendService.SendMessage(new ClientInteractNetworkedObjectRequestPayload(args.EntityGuid, ClientInteractNetworkedObjectRequestPayload.InteractType.Interaction));
                    }
                }
            };
        }
Esempio n. 4
0
        private IEnumerator BroadcastTransformPosition()
        {
            while (true)
            {
                if (Vector3.Magnitude(lastPosition - transform.position) > Vector3.kEpsilon)
                {
                    lastPosition     = transform.position;
                    isFinishedMoving = false;
                    SendService.SendMessage(new Sub60MovingFastPositionSetCommand(Identity.EntityId,
                                                                                  UnitScaler.UnScaleYtoZ(transform.position)).ToPayload());
                }
                else if (!isFinishedMoving)
                {
                    lastPosition     = transform.position;
                    isFinishedMoving = true;

                    //TODO: Handle rotation
                    //Send a stop if we stopped moving
                    SendService.SendMessage(new Sub60FinishedMovingCommand(Identity.EntityId,
                                                                           UnitScaler.ScaleYRotation(transform.rotation.eulerAngles.y),
                                                                           UnitScaler.UnScale(transform.position).ToNetworkVector3(), RoomQueryService.RoomIdForPlayerById(Identity.EntityId), ZoneData.ZoneId).ToPayload());
                }

                yield return(new WaitForSeconds(1.0f / BroadcastsPerSecond));
            }
        }
Esempio n. 5
0
 /// <inheritdoc />
 protected override async void OnEventFired(object source, EventArgs args)
 {
     //TODO: Check result
     //We don't need to be on the main thread to send a session claim request.
     await SendService.SendMessage(new ClientSessionClaimRequestPayload(AuthTokenRepository.RetrieveWithType(), CharacterDataRepository.CharacterId))
     .ConfigureAwait(false);
 }
Esempio n. 6
0
    protected void btnUnSubscription_OnClick(object sender, EventArgs e)
    {
        SendService sendService = new SendService();
        string      endUserId   = string.Empty;



        try
        {
            endUserId = Request.QueryString["endUserId"].ToString();
        }
        catch (Exception exception)
        {
            endUserId = "";
        }
        string query = @"SELECT subscriptionId
  FROM[DPDP].[dbo].[tblBase]
  where ServiceId = '13' and MSISDN = '" + endUserId + "' and RegStatus = 1";

        object subscriptionId = new CDA().getSingleValue(query, "DPDP");

        string json = new JavaScriptSerializer().Serialize(new
        {
            Id             = "",
            servicekey     = "afef69c7cbbe4b55bb10d47dd5969677",
            endUserId      = endUserId,
            subscriptionId = subscriptionId.ToString(),
            accesschannel  = "WAP"
        });

        sendService.Send("http://192.168.14.16/DPDPClient/api/Unsubscribe", json);
        Thread.Sleep(5000);
        Response.Redirect("~/Default.aspx");
    }
Esempio n. 7
0
        private void button15_Click(object sender, EventArgs e)
        {
            var sendInfo = new SendService();
            var sss      = sendInfo.SendData(textBox1.Text, "");

            textBox2.Text = sss;
        }
        protected override void OnEventFired(object source, EventArgs args)
        {
            //Once connection to the instance server is established
            //we must attempt to claim out session on to actually fully enter.
            EventQueueable.Enqueue(async() =>
            {
                try
                {
                    CharacterListResponse listResponse = await CharacterService.GetCharacters();

                    await CharacterService.TryEnterSession(listResponse.CharacterIds.First());

                    CharacterDataRepository.UpdateCharacterId(listResponse.CharacterIds.First());

                    //TODO: When it comes to community servers, we should not expose the sensitive JWT to them. We need a better way to deal with auth against untrusted instance servers
                    await SendService.SendMessage(new ClientSessionClaimRequestPayload(AuthTokenRepository.RetrieveWithType(), listResponse.CharacterIds.First()));
                }
                catch (Exception e)
                {
                    if (Logger.IsErrorEnabled)
                    {
                        Logger.Error($"Failed to authenticate to instance server as character. Reason: {e.ToString()}");
                    }

                    throw;
                }
            });
        }
        private void setConfig(string configFile, string configAga, String path7Zdll)
        {
            try
            {
                using (StreamReader file = File.OpenText(@configFile))
                {
                    JsonSerializer jsonConfig = new JsonSerializer();
                    this.config = (Config)jsonConfig.Deserialize(file, typeof(Config));
                }

                if (configAga != null)
                {
                    using (StreamReader file = File.OpenText(@configAga))
                    {
                        JsonSerializer jsonConfig = new JsonSerializer();
                        this.configAga = (ConfigAga)jsonConfig.Deserialize(file, typeof(ConfigAga));
                    }
                }

                this.sendService         = SendService.getInstance(this.config, this.configAga, path7Zdll);
                this.lotService          = LotService.getInstance(this.config);
                this.notificationService = NotificationService.getInstance(this.config);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                Debug.WriteLine(ex.StackTrace);
            }
        }
 private async Task SendNetworkedMenuClick(MenuItemIdentifier buttonIdentifier)
 {
     //We should just send that we clicked this menu id.
     //if it's successful it should redirect connection to that ship.
     //We must properly handle redirection to move the scene forward.
     await SendService.SendMessage(new SharedMenuSelectionRequestPayload(buttonIdentifier));
 }
Esempio n. 11
0
        public void ClickMenuItem(uint menuId, uint itemId)
        {
            //Disable the ship panel
            MenuPanelObject.SetActive(false);

            //Send the menu selection request. The server will redirect us if it's success.
            SendService.SendMessage(new SharedMenuSelectionRequestPayload(new MenuItemIdentifier(menuId, itemId)));
        }
Esempio n. 12
0
    public bool Send()
    {
        // An object which interfaces with the web service
        SendService ss = new SendService();

        // The sending of the message (A synchronous event - We wait untill finished)
        return(ss.SendMessage("*****@*****.**", "d1a1n1", this.from, this.To, this.msg));
    }
        public ReplyListViewForDefaultViewModel(CancellationTokenSource cts, int threadId, ListView replyListView, Action beforeLoad, Action <int, int> afterLoad, Action <int> listViewScroll)
        {
            _threadId       = threadId;
            _replyListView  = replyListView;
            _beforeLoad     = beforeLoad;
            _afterLoad      = afterLoad;
            _listViewScroll = listViewScroll;
            _ds             = new ReplyListService();

            AddToFavoritesCommand = new DelegateCommand();
            AddToFavoritesCommand.ExecuteAction = async(p) =>
            {
                await SendService.SendAddToFavoritesActionAsync(cts, threadId, _ds.GetThreadTitle(threadId));
            };

            RefreshReplyCommand = new DelegateCommand();
            RefreshReplyCommand.ExecuteAction = (p) =>
            {
                _ds.ClearReplyData(_threadId);
                LoadData(1);
            };

            LoadPrevPageDataCommand = new DelegateCommand();
            LoadPrevPageDataCommand.ExecuteAction = (p) =>
            {
                if (_startPageNo > 1)
                {
                    _ds.ClearReplyData(_threadId);
                    LoadData(_startPageNo - 1);
                }
            };

            LoadLastPageDataCommand = new DelegateCommand();
            LoadLastPageDataCommand.ExecuteAction = (p) =>
            {
                _ds.ClearReplyData(_threadId);
                LoadLastData(cts);
            };

            CopyUrlCommand = new DelegateCommand();
            CopyUrlCommand.ExecuteAction = (p) =>
            {
                string url         = $"http://www.hi-pda.com/forum/viewthread.php?tid={_threadId}";
                var    dataPackage = new DataPackage();
                dataPackage.SetText(url);
                Clipboard.SetContent(dataPackage);
            };

            OpenInBrowserCommand = new DelegateCommand();
            OpenInBrowserCommand.ExecuteAction = async(p) =>
            {
                var url = $"http://www.hi-pda.com/forum/viewthread.php?tid={_threadId}";
                Uri uri = new Uri(url, UriKind.Absolute);
                await Launcher.LaunchUriAsync(uri);
            };

            LoadData(_startPageNo);
        }
Esempio n. 14
0
        public void SendChatMessage(string message)
        {
            if (string.IsNullOrEmpty(message))
            {
                return;
            }

            SendService.SendMessage(new BlockTextChatMessageRequestPayload(message));
        }
Esempio n. 15
0
        public void SendMessage(string phoneNumber, string message, SendService service)
        {
            string phoneNumberWithoutFormat = "", ret = "";

            try
            {
                switch (service)
                {
                case SendService.LocaSMS:
                    phoneNumberWithoutFormat = phoneNumber
                                               .Replace("+", "")
                                               .Replace("(", "")
                                               .Replace(")", "")
                                               .Replace(" ", "")
                                               .Replace("-", "");

                    // Remove código internacional
                    phoneNumberWithoutFormat = phoneNumberWithoutFormat.Remove(0, 2);

                    ret = _locaSMS.SendSMS(phoneNumberWithoutFormat, message);

                    if (ret.Split(':').Length < 2)
                    {
                        throw new Exception("Erro no retorno do serviço de SMS");
                    }
                    else if (int.Parse(ret.Split(':')[0]) == 0)
                    {
                        throw new Exception(ret.Split(':')[1]);
                    }
                    break;

                case SendService.ViaNett:
                    phoneNumberWithoutFormat = phoneNumber
                                               .Replace("+", "")
                                               .Replace("(", "")
                                               .Replace(")", "")
                                               .Replace(" ", "")
                                               .Replace("-", "");

                    ret = _viaNett.SendSMSSimple1(long.Parse(phoneNumberWithoutFormat), message);

                    if (ret.Split(':').Length < 2)
                    {
                        throw new Exception("Erro no retorno do serviço de SMS");
                    }
                    else if (int.Parse(ret.Split(':')[0]) == 0)
                    {
                        throw new Exception(ret.Split(':')[1]);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 16
0
        public void SendEmail([FromBody] EmailModel emailModel)
        {
            string url      = _configuration["Email:EmailSendServiceBaseURL"];
            string username = _configuration["Email:EmailSendServiceUsername"];
            string password = _configuration["Email:EmailSendServicePassword"];

            var service = new SendService(username, password, url);

            var status = service.SendEmail("*****@*****.**", "CloudXdb", emailModel.EmailTo, emailModel.Subject, emailModel.Content);
        }
        public void SendCharacterSelection()
        {
            if (Logger.IsDebugEnabled)
            {
                Logger.Debug($"Sending CharSelection: {SelectedModel.SlotSelected}");
            }

            //Just send the request
            SendService.SendMessage(new CharacterCharacterSelectionRequestPayload((byte)SelectedModel.SlotSelected, CharacterSelectionType.PlaySelection));
        }
Esempio n. 18
0
        private async void AddBuddy_Click(object sender, RoutedEventArgs e)
        {
            if (PopupUserId == 0 || string.IsNullOrEmpty(PopupUsername))
            {
                return;
            }

            var cts = new CancellationTokenSource();
            await SendService.SendAddBuddyActionAsync(cts, PopupUserId, PopupUsername);
        }
Esempio n. 19
0
        private async void AddToFavorites_Click(object sender, RoutedEventArgs e)
        {
            if (PopupThreadId == 0 || string.IsNullOrEmpty(PopupThreadTitle))
            {
                return;
            }

            var cts = new CancellationTokenSource();
            await SendService.SendAddToFavoritesActionAsync(cts, PopupThreadId, PopupThreadTitle);
        }
Esempio n. 20
0
 public SearchController(
     SearchService searchService,
     SonicSearchService sonicSearchService,
     SendService sendService
     )
 {
     this.searchService      = searchService;
     this.sonicSearchService = sonicSearchService;
     this.sendService        = sendService;
 }
        public SendPage(UserSearchResult userSearchResult)
        {
            _messageServise   = new MessageServise();
            _blacklistService = new BlacklistService(new PathService());
            _sendService      = new SendService(_messageServise, new UserService(), _blacklistService);

            InitializeComponent();
            InitTimer();

            _userSearchResult = userSearchResult;
            _sendModel        = new SendModel();
        }
Esempio n. 22
0
        protected override void OnEventFired(object source, EventArgs args)
        {
            //Once connection to the instance server is established
            //we must attempt to claim out session on to actually fully enter.

            //We send time sync first since we need to have a good grasp of the current network time before
            //we even spawn into the world and start recieveing the world states.
            SendService.SendMessageImmediately(new ServerTimeSyncronizationRequestPayload(DateTime.UtcNow.Ticks))
            .ConfigureAwaitFalse();

            //TODO: When it comes to community servers, we should not expose the sensitive JWT to them. We need a better way to deal with auth against untrusted instance servers
            SendService.SendMessage(new ClientSessionClaimRequestPayload(AuthTokenRepository.RetrieveWithType(), CharacterDataRepository.CharacterId));
        }
Esempio n. 23
0
        /// <inheritdoc />
        protected override void OnEventFired(object source, LoginResultEventArgs args)
        {
            if (!args.isSuccessful)
            {
                return;
            }

            if (Logger.IsInfoEnabled)
            {
                Logger.Info($"OnLogin: Sending {nameof(CharacterCharacterSelectionRequestPayload)} with Id: {SlotModel.SlotSelected}");
            }

            SendService.SendMessage(new CharacterCharacterSelectionRequestPayload(SlotModel.SlotSelected, CharacterSelectionType.PlaySelection))
            .ConfigureAwait(false);
        }
Esempio n. 24
0
        protected override void OnEventFired(object source, MovementInputChangedEventArgs args)
        {
            //We send remote time instead of remoteTime + latency because
            //our client is going to move right away and we want EVERYONE
            //to view us as if we had started moving at the same time as the
            //local client percieves it.
            long timeStamp = TimeService.CurrentRemoteTime;

            //We also are going to send a position hint to the server.
            //Server has authority in rejecting this hint, and it should if it finds its
            //WAY off. However this is how we deal with the issue of desyncronization
            //by having the client be semi-authorative about where it is.
            WorldTransform entity = TransformMap.RetrieveEntity(PlayerDetails.LocalPlayerGuid);

            SendService.SendMessage(new ClientMovementDataUpdateRequest(new Vector2(args.NewHorizontalInput, args.NewVerticalInput), timeStamp, new Vector3(entity.PositionX, entity.PositionY, entity.PositionZ)));
        }
        private async Task ReadGuildCardDataFromServer()
        {
            if (Logger.IsDebugEnabled)
            {
                Logger.Debug("Sending GuildData request.");
            }

            CharacterGuildCardDataHeaderResponsePayload payload = await SendService.SendRequestAsync <CharacterGuildCardDataHeaderResponsePayload>(new CharacterGuildHeaderRequestPayload());

            if (Logger.IsDebugEnabled)
            {
                Logger.Debug($"Guild Data Size: {payload.Length}.");
            }

            //TODO: Validate length
            //At this point we have recieved a guildcard data header.
            //This header contains information needed to async read all the guild card data from the server
            byte[] guildcardDataBytes = new byte[payload.Length];

            //With the header we know how many bytes we should read
            for (uint chunkNumber = 0, byteReadCount = 0; byteReadCount < payload.Length; chunkNumber++)
            {
                //TODO: Should continue ever be false?
                CharacterGuildCardChunkResponsePayload response = await SendService.SendRequestAsync <CharacterGuildCardChunkResponsePayload>(new CharacterGuildCardChunkRequestPayload(chunkNumber, true));

                if (Logger.IsDebugEnabled)
                {
                    Logger.Debug($"Recieved Chunk: {response.ChunkNumber} Size: {response.PartialData.Length}.");
                }

                //Read the bytes into the created buffer
                Buffer.BlockCopy(response.PartialData, 0, guildcardDataBytes, (int)byteReadCount, response.PartialData.Length);
                byteReadCount += (uint)response.PartialData.Length;
            }

            if (Logger.IsDebugEnabled)
            {
                Logger.Debug($"Finished guild card data. Sending final ack.");
            }

            //At this point we've read all bytes async from the server for guild card data.
            //However the client also sends a final chunk request with a cont of 0
            await PayloadSendService.SendMessage(new CharacterGuildCardChunkRequestPayload(0, false));

            await Task.Delay(500);             //enough time for server to see.
        }
Esempio n. 26
0
        static void Main(string[] args)
        {
            Console.WriteLine("消息生产者开始生产数据!");
            Console.WriteLine("输入exit退出!");
            Console.WriteLine(args.ToString());

            ISendService sendService = new SendService();

            string input;

            do
            {
                input = Console.ReadLine();

                sendService.SendMsg("Clent1", input);
            } while (input.Trim().ToLower() != "exit");
        }
 public SearchNextPageController(
     ITelegramBotClient botClient,
     SendMessage Send,
     IDistributedCache Cache,
     ILogger <SearchNextPageController> logger,
     SearchService searchService,
     SonicSearchService sonicSearchService,
     SendService sendService
     )
 {
     this.sendService        = sendService;
     this.searchService      = searchService;
     this.Send               = Send;
     this.Cache              = Cache;
     this.logger             = logger;
     this.botClient          = botClient;
     this.sonicSearchService = sonicSearchService;
 }
Esempio n. 28
0
        public ReplyListViewForSpecifiedPostViewModel(CancellationTokenSource cts, int postId, ListView replyListView, Action beforeLoad, Action <int, int> afterLoad, Action <int> listViewScroll)
        {
            _postId         = postId;
            _replyListView  = replyListView;
            _beforeLoad     = beforeLoad;
            _afterLoad      = afterLoad;
            _listViewScroll = listViewScroll;
            _ds             = new ReplyListService();

            AddToFavoritesCommand = new DelegateCommand();
            AddToFavoritesCommand.ExecuteAction = async(p) =>
            {
                await SendService.SendAddToFavoritesActionAsync(cts, _threadId, _ds.GetThreadTitle(_threadId));
            };

            RefreshReplyCommand = new DelegateCommand();
            RefreshReplyCommand.ExecuteAction = (p) =>
            {
                _ds.ClearReplyData(_threadId);
                LoadData(1);
            };

            LoadPrevPageDataCommand = new DelegateCommand();
            LoadPrevPageDataCommand.ExecuteAction = (p) =>
            {
                if (_startPageNo > 1)
                {
                    _ds.ClearReplyData(_threadId);
                    LoadData(_startPageNo - 1);
                }
            };

            LoadLastPageDataCommand = new DelegateCommand();
            LoadLastPageDataCommand.ExecuteAction = (p) =>
            {
                _ds.ClearReplyData(_threadId);
                LoadData(_ds.GetReplyMaxPageNo());
            };

            FirstLoad(cts);
        }
        /// <inheritdoc />
        protected override async void OnEventFired(object source, LocalPlayerWorldObjectSpawnedEventArgs args)
        {
            //TODO: We should extract this into a warping service.

            //TODO: Send rotation
            //TODO: What should the W coord be? How sould we handle this poition?
            //We can't do anything with the data right now
            await SendService.SendMessage(new Sub60TeleportToPositionCommand((byte)EntityGuid.GetEntityId(args.EntityGuid),
                                                                             ScalerService.UnScale(args.WorldObject.transform.position).ToNetworkVector3()).ToPayload());

            //Now we have to send a 1F to start the warp
            //Tell the server we're warping now
            await SendService.SendMessage(new Sub60WarpToNewAreaCommand((byte)EntityGuid.GetEntityId(args.EntityGuid), ZoneSettings.ZoneId).ToPayload());

            //TODO: is it save to send this in the lobby??
            await SendService.SendMessage(new Sub60FinishedMapLoadCommand(EntityGuid.GetEntityId(args.EntityGuid)).ToPayload());

            //TODO: Should we send ClientId with this one too?
            //We can just send a finished right away, we have nothing to load really
            await SendService.SendMessage(new Sub60FinishedWarpingBurstingCommand((byte)EntityGuid.GetEntityId(args.EntityGuid)).ToPayload());
        }
        async void ShowUnusedImage(CancellationTokenSource cts)
        {
            var unusedImageAttachList = await SendService.LoadUnusedAttachFilesAsync(cts);

            if (unusedImageAttachList != null && unusedImageAttachList.Count > 0)
            {
                if (AttachFileList == null)
                {
                    AttachFileList = new ObservableCollection <AttachFileItemModel>();
                }

                var list = AttachFileList.ToList();
                foreach (var item in unusedImageAttachList)
                {
                    if (list.Count(i => i.Id.Equals(item.Id)) == 0)
                    {
                        AttachFileList.Add(item);
                    }
                }
            }
        }