/// <summary>
    /// Implements transport callback
    /// </summary>
    /// <param name="requestArgs"></param>
    /// <param name="callback"></param>
    public void SendAsynchronous(TransferData.ContentMode contentMode, HttpRequestArgs requestArgs, SingleAction<HttpResponseArgs> callback)
    {
        ShowDebugInfo(System.Reflection.MethodBase.GetCurrentMethod(), contentMode, requestArgs);

        TransferData td = new TransferData(false)
                              {
                                  m_contentMode = contentMode,
                                  m_synchronous = false,
                                  m_requestArgs = requestArgs,
                                  m_callback = callback
                              };

        AddToTransferData(td);
    }
        public static async Task <RenderToStringResult> BuildPrerender(this HttpRequest Request)
        {
            var nodeServices = Request.HttpContext.RequestServices.GetRequiredService <INodeServices>();
            var hostEnv      = Request.HttpContext.RequestServices.GetRequiredService <IHostingEnvironment>();

            var applicationBasePath   = hostEnv.ContentRootPath;
            var requestFeature        = Request.HttpContext.Features.Get <IHttpRequestFeature>();
            var unencodedPathAndQuery = requestFeature.RawTarget;
            var unencodedAbsoluteUrl  = $"{Request.Scheme}://{Request.Host}{unencodedPathAndQuery}";

            // ** TransferData concept **
            // Here we can pass any Custom Data we want !

            // By default we're passing down Cookies, Headers, Host from the Request object here
            TransferData transferData = new TransferData();

            transferData.request            = Request.AbstractRequestInfo();
            transferData.thisCameFromDotNET = "Hi Angular it's asp.net :)";
            // Add more customData here, add it to the TransferData class

            //Prerender now needs CancellationToken
            System.Threading.CancellationTokenSource cancelSource = new System.Threading.CancellationTokenSource();
            System.Threading.CancellationToken       cancelToken  = cancelSource.Token;

            // Prerender / Serialize application (with Universal)
            return(await Prerenderer.RenderToString(
                       "/",
                       nodeServices,
                       cancelToken,
                       new JavaScriptModuleExport(applicationBasePath + "/ClientApp/dist/main-server"),
                       unencodedAbsoluteUrl,
                       unencodedPathAndQuery,
                       transferData, // Our simplified Request object & any other CustommData you want to send!
                       30000,
                       Request.PathBase.ToString()
                       ));
        }
        private async Task UploadChunkAsync(TransferData transferData)
        {
            Debug.Assert(null != transferData, "transferData object expected");
            Debug.Assert(
                this.state == State.Upload || this.state == State.Error,
                "UploadChunkAsync called, but state isn't Upload or Error",
                "Current state is {0}",
                this.state);

            // If a parallel operation caused the controller to be placed in
            // error state exit early to avoid unnecessary I/O.
            if (this.state == State.Error)
            {
                return;
            }

            bool allZero = true;

            for (int i = 0; i < transferData.MemoryBuffer.Length; ++i)
            {
                if (0 != transferData.MemoryBuffer[i])
                {
                    allZero = false;
                    break;
                }
            }

            this.Controller.CheckCancellation();

            if (!allZero)
            {
                transferData.Stream = new MemoryStream(transferData.MemoryBuffer, 0, transferData.Length);
                await this.WriteRangeAsync(transferData);
            }

            this.FinishChunk(transferData);
        }
Beispiel #4
0
        IEnumerator CreateGold(TransferData data)
        {
            Vector3 startPos = data.GetValue <Vector3>("startPos");
            Vector3 endPos   = data.GetValue <Vector3>("endPos");

            yield return(0);


            for (int i = 0; i < m_goldSum; i++)
            {
                //m_createPosOffset = Mathf.Abs(m_createPosOffset);


                GameObject go = ItemPool_NiuNiu.Instance.GetObjectFromPool(m_goldName, m_goldParent, startPos);
                //go.transform.localPosition = m_createPosOffset;
                //Vector3 aaa = m_goldParent.position - go.transform.position;
                //startPos += aaa;
                //改变开始位置
                //startPos += new Vector3(Random.Range(-m_createPosOffset, m_createPosOffset), Random.Range(-m_createPosOffset, m_createPosOffset));

                //错开
                RectTransform rt = null;
                rt = go.transform.FindChild(ConstDefine_NiuNiu.GoldImage_NiuNiu).GetComponent <RectTransform>();
                if (rt != null)
                {
                    float posx = Random.Range(-50, 50);
                    float posy = Random.Range(-50, 50);
                    rt.anchoredPosition = new Vector2(posx, posy);

                    //金币移动动画
                }

                NiuNiuWindWordAni.GoldFlowingAni(go.transform, rt, startPos, endPos);

                yield return(new WaitForSeconds(m_createGoldTime));
            }
        }
Beispiel #5
0
    /// <summary>
    /// 获取排行列表回调
    /// </summary>
    /// <param name="args"></param>
    private void OnRequestRankingListCallBack(NetWorkHttp.CallBackArgs args)
    {
        m_isBusy = false;
        if (args.HasError)
        {
            ShowMessage("错误", "网络连接失败");
        }
        else
        {
            if (args.Value.code < 0)
            {
                ShowMessage("提示", args.Value.msg);
                return;
            }

            List <RankingEntity> lst = LitJson.JsonMapper.ToObject <List <RankingEntity> >(args.Value.data.ToJson());

            TransferData        data       = new TransferData();
            List <TransferData> lstRanking = new List <TransferData>();
            for (int i = 0; i < lst.Count; ++i)
            {
                TransferData rankingData = new TransferData();
                rankingData.SetValue("Top", lst[i].top);
                rankingData.SetValue("PlayerId", lst[i].playerId);
                rankingData.SetValue("NickName", lst[i].nickname);
                rankingData.SetValue("Avatar", lst[i].avatar);
                rankingData.SetValue("Score", lst[i].score);
                lstRanking.Add(rankingData);
            }
            data.SetValue("Ranking", lstRanking);
            data.SetValue("RankingType", m_CurrentType);
            if (m_UIRankingView != null)
            {
                m_UIRankingView.SetUI(data);
            }
        }
    }
Beispiel #6
0
    /// <summary>
    /// 进入房间
    /// </summary>
    /// <param name="groupId"></param>
    /// <param name="roomId"></param>
    /// <param name="playerId"></param>
    public void EnterRoom(int groupId, int roomId, int playerId)
    {
        ChatGroupEntity group = GetGroup(groupId);

        if (group == null)
        {
            return;
        }
        RoomEntityBase room = GetRoom(groupId, roomId);

        if (room == null)
        {
            return;
        }
        PlayerEntity player = GetMember(groupId, playerId);

        if (player == null)
        {
            return;
        }
        Debug.Log("玩家" + player.nickname + "进入房间" + room.roomId);
        for (int i = 0; i < room.players.Count; ++i)
        {
            if (room.players[i] == null)
            {
                room.players[i] = player;
                break;
            }
        }

        TransferData data = new TransferData();

        data.SetValue("GroupEntity", group);
        data.SetValue("RoomId", roomId);
        data.SetValue("PlayerEntity", player);
        SendNotification(ON_ENTER_ROOM, data);
    }
Beispiel #7
0
        public void ParseValidTransferAction(Action action, PackedTransaction packedTransaction,
                                             GetBlockResponse blockResponse)
        {
            TransferData transferData = JsonHelper.DeserializeObject <TransferData>(action.Data.ToString());

            if (String.IsNullOrEmpty(transferData.Quantity))
            {
                return;
            }
            if (transferData.Symbol() == CryptoCurrency.VAKA)
            {
                // If receiver doesn't exist in wallet table then stop
                if (!_walletBusiness.CheckExistedAndUpdateByAddress(transferData.To, transferData.Amount(),
                                                                    transferData.Symbol()))
                {
                    return;
                }

                // Save to table in db
                _vakacoinBusiness.CreateDepositTransaction(packedTransaction.Id, (int)blockResponse.BlockNum,
                                                           transferData.Symbol(), transferData.Amount(), transferData.From, transferData.To, 0,
                                                           Status.STATUS_SUCCESS);

                //create pending email
                var createEmailResult = CreatePendingEmail(transferData);
                if (createEmailResult.Status == Status.STATUS_SUCCESS)
                {
                    logger.Info("Create pending email success");
                }
                else
                {
                    logger.Error("Create Pending email error!!!" + createEmailResult.Message);
                }

                logger.Info(String.Format("{0} was received {1}", transferData.To, transferData.Quantity));
            }
        }
Beispiel #8
0
        static void Main(string[] args)
        {
            CommandLineOptions options = null;

            Parser.Default.ParseArguments <CommandLineOptions>(args).WithParsed <CommandLineOptions>(o => options = o);

            if (options == null)
            {
                System.Console.WriteLine("No valid options found");
                System.Console.ReadLine();
                return;
            }
            var clientRef  = options.ClientRef;
            int?companyRef = options.CompanyRef;

            LoggingService logger          = new LoggingService();
            var            transferService = new TransferService(options, logger);
            var            clientdata      = new ClientData();

            clientdata.OldClientRef = clientRef;
            var transferData = new TransferData
            {
                ClientData            = transferService.GetClientDataFromSource(clientRef),
                AccountDataList       = transferService.GetAccountDataFromSource(clientRef).ToList(),
                ClientAccountDataList = transferService.GetClientAccountDataFromSource(clientRef).ToList(),
                AddressData           = transferService.GetAddressDataFromSource(clientRef)
            };

            if (companyRef != null)
            {
                UpdateCompanyRef(transferData, (int)companyRef);
            }

            transferService.Execute(transferData);

            System.Console.ReadLine();
        }
        //处理开牌结算数据
        public void RoomOpenPokerSettle(NN_ROOM_CHECK proto)
        {
            //同步数据
            CurrentRoom.SetRoom(proto.nn_room);
            CurrentRoom.roomStatus = NN_ENUM_ROOM_STATUS.RSETTLE;


            //Debug.Log(string.Format("-----------------开牌结算------------------------------------------------ "));
            //for (int i = 0; i < CurrentRoom.SeatList.Count; i++)
            //{
            //    if (CurrentRoom.SeatList[i].PlayerId > 0)
            //    {
            //        if (CurrentRoom.SeatList[i].PokerList[0].index > 0)
            //        {
            //            for (int j = 0; j < CurrentRoom.SeatList[i].PokerList.Count; j++)
            //            {
            //                Poker poker = CurrentRoom.SeatList[i].PokerList[j];
            //                Debug.Log(string.Format("------------------------------------- 玩家手牌  {0}   {1}    {2}", poker.index, poker.color, poker.size));
            //            }

            //        }

            //    }
            //}


            //SetCountDown();

            //处理小结算SceneView
            TransferData data = new TransferData();

            data.SetValue <NiuNiu.Room>("CurrentRoom", CurrentRoom);
            SendNotification(ConstDefine_NiuNiu.ObKey_RoomOpenPokerSettle, data);

            SendRoomInfoChangeNotify();
        }
Beispiel #10
0
        /// <summary>
        /// 准备
        /// </summary>
        /// <param name="pbSeat"></param>
        public void Ready(NN_SEAT_READY proto)
        {
            NiuNiu.Seat seat = GetSeatBySeatPos(proto.nn_seat.pos);
            if (seat == null)
            {
                return;
            }
            seat.IsReady = true;

            //--------------设置开始按钮遮罩---------------
            bool isEnable = false;

            for (int i = 0; i < CurrentRoom.SeatList.Count; i++)
            {
                NiuNiu.Seat readySeat = GetSeatBySeatIndex(i);

                if (readySeat != null && readySeat.PlayerId > 0)
                {
                    Debug.Log(string.Format("座位{0} 玩家是否准备{1}", readySeat.Pos, readySeat.IsReady));
                    if (readySeat.IsReady == false)
                    {
                        isEnable = true;
                        break;
                    }
                }
            }
            Debug.Log("bool isEnable:" + isEnable);
            Debug.Log("bool isEnable设置开始按钮遮罩");
            TransferData dataMask = new TransferData();

            dataMask.SetValue <bool>("OnOff", isEnable);
            ModelDispatcher.Instance.Dispatch(ConstDefine_NiuNiu.ObKey_EnableAllowStartBtn, dataMask);//设置开始游戏按钮遮罩

            //刷新座位UI
            SendRoomInfoChangeNotify();
        }
Beispiel #11
0
    /// <summary>
    /// 添加申请人
    /// </summary>
    /// <param name="groupId"></param>
    /// <param name="entity"></param>
    public void AddApply(int groupId, PlayerEntity entity)
    {
        ChatGroupEntity group = GetGroup(groupId);

        if (group == null)
        {
            return;
        }
        group.hasNewApply = false;
        for (int i = 0; i < group.ApplyList.Count; ++i)
        {
            if (group.ApplyList[i].id == entity.id)
            {
                return;
            }
        }
        group.ApplyList.Add(entity);

        TransferData data = new TransferData();

        data.SetValue("GroupId", groupId);
        data.SetValue("PlayerEntity", entity);
        SendNotification(ON_GROUP_ADD_APPLY, data);
    }
Beispiel #12
0
    /// <summary>
    /// 离开房间
    /// </summary>
    /// <param name="groupId"></param>
    /// <param name="roomId"></param>
    /// <param name="playerId"></param>
    public void LeaveRoom(int groupId, int roomId, int playerId)
    {
        RoomEntityBase room = GetRoom(groupId, roomId);

        if (room == null)
        {
            return;
        }
        PlayerEntity player = GetMember(groupId, playerId);

        if (player == null)
        {
            return;
        }
        Debug.Log("玩家" + playerId.ToString() + "离开房间" + roomId.ToString());
        for (int i = 0; i < room.players.Count; ++i)
        {
            if (room.players[i] == null)
            {
                continue;
            }

            if (room.players[i].id == playerId)
            {
                room.players[i] = null;
                break;
            }
        }

        TransferData data = new TransferData();

        data.SetValue("GroupId", groupId);
        data.SetValue("RoomId", roomId);
        data.SetValue("PlayerId", playerId);
        SendNotification(ON_LEAVE_ROOM, data);
    }
Beispiel #13
0
    /// <summary>
    /// 更新房间信息
    /// </summary>
    public void UpdateRoom(int groupId, int roomId, int loop, RoomEntityBase.RoomStatus status)
    {
        ChatGroupEntity group = GetGroup(groupId);

        if (group == null)
        {
            return;
        }
        RoomEntityBase room = GetRoom(groupId, roomId);

        if (room == null)
        {
            return;
        }
        room.currentLoop = loop;
        room.roomStatus  = status;

        TransferData data = new TransferData();

        data.SetValue("GroupEntity", group);
        data.SetValue("RoomEntity", room);
        SendNotification(ON_ROOM_INFO_CHANGED, data);
        SendGroupInfoChangedNotification(group);
    }
Beispiel #14
0
    /// <summary>
    /// 隐藏加注按钮
    /// </summary>
    public void HidFen(TransferData data)
    {
        SeatEntity seat = data.GetValue <SeatEntity>("Seat");

        if (seat == null)
        {
            return;
        }
        if (seat == RoomZhaJHProxy.Instance.PlayerSeat)
        {
            float fen        = data.GetValue <float>("Fen");
            int   totalRound = data.GetValue <int>("totalRound");
            float jZF        = RoomZhaJHProxy.Instance.CurrentRoom.roomSettingId != RoomMode.Senior || (RoomZhaJHProxy.Instance.CurrentRoom.roomSettingId == RoomMode.Senior && RoomZhaJHProxy.Instance.CurrentRoom.scores == 2) ? 20 : 10;
            if (fen == jZF)
            {
                RoomZhaJHProxy.Instance.CurrentRoom.jiazhuScroc = false;
                m_jiaZhuHui.gameObject.SetActive(true);
            }
            else
            {
                if (fen == 50)
                {
                    m_jiaZhuHui.gameObject.SetActive(true);
                }
                else if (fen == 100)
                {
                    m_jiaZhuHui.gameObject.SetActive(true);
                    m_xuePinHui.gameObject.SetActive(true);
                }
                else
                {
                    m_jiaZhuHui.gameObject.SetActive(false);
                }
            }
        }
    }
    /// <summary>
    /// 设置座位牌
    /// </summary>
    /// <param name="data"></param>
    private void OnSeatInfoChanged(TransferData data)
    {
        SeatEntity seat     = data.GetValue <SeatEntity>("Seat");
        RoomEntity room     = data.GetValue <RoomEntity>("Room");
        bool       isPlayer = data.GetValue <bool>("IsPlayer");

        if (m_nSeatIndex == seat.Index)
        {
            if (room.roomStatus != ROOM_STATUS.IDLE && room.roomStatus != ROOM_STATUS.READY && room.roomStatus != ROOM_STATUS.GRABBANKER && room.roomStatus != ROOM_STATUS.GRABBANKERDONE)
            {
                if (seat.IsBanker)
                {
                    LoadDealEmptyPoker(room.RemainPokerNum);
                }
                if (room.roomStatus == ROOM_STATUS.CHECK)
                {
                    if (seat.drawPokerList.Count == 0)
                    {
                        SeatCtrlBreak(seat);
                    }
                    else
                    {
                        SeatCtrlBreak(seat, true);
                    }
                }
                else if (room.roomStatus == ROOM_STATUS.GROUPPOKER)
                {
                    //SeatCtrlBreak(seat);
                }
                else
                {
                    SeatCtrlBreak(seat);
                }
            }
        }
    }
Beispiel #16
0
        /// <summary>
        /// 新增转让
        /// </summary>
        /// <returns></returns>
        public JsonResult AddTransfer()
        {
            AjaxStatusModel ajax = new AjaxStatusModel(); //功能操作类的返回类型都是AjaxStatusModel,数据放到AjaxStatusModel.data中,前台获取json后加载

            ajax.status = EnumAjaxStatus.Error;           //默认失败
            ajax.msg    = "新增失败!";                        //前台获取,用于显示提示信息
            var data = Request["data"];                   //获取前台传递的数据,主要序列化

            if (string.IsNullOrEmpty(data))
            {
                return(Json(ajax));
            }
            Transfer rb = (Transfer)(JsonConvert.DeserializeObject(data.ToString(), typeof(Transfer)));

            rb.StateID    = 1;                    //状态1为待审核,2为审核,3为不通过
            rb.CreateTime = DateTime.Now;         //创建时间
            rb.CreatorId  = UserSession.userid;   //创建人
            if (TransferData.AddTransfer(rb) > 0) //注意时间类型,而且需要在前台把所有的值
            {
                ajax.msg    = "新增成功!";
                ajax.status = EnumAjaxStatus.Success;
            }
            return(Json(ajax));
        }
Beispiel #17
0
        /// <summary>
        /// 下注
        /// </summary>
        /// <param name="obj"></param>
        private void OnSeatBet(TransferData data)
        {
            SeatEntity seat = data.GetValue <SeatEntity>("SeatEntity");

            if (seat == null)
            {
                return;
            }
            if (seat.Index != m_Index)
            {
                return;
            }

            if (m_arrScoreParent)
            {
                m_arrScoreParent.gameObject.SetActive(true);
            }

            for (int i = 0; i < m_arrScore.Length; ++i)
            {
                m_arrScore[i].SafeSetActive(m_arrScore[i].name.ToInt() == seat.bet);
            }

            string audioSuffix;

            if (m_gender == 1)
            {
                audioSuffix = "Man";
            }
            else
            {
                audioSuffix = "Woman";
            }

            PlayAudio("bet" + seat.bet + audioSuffix);
        }
Beispiel #18
0
        //=====================================================================================================



        //---------------------------------

        #region
        #endregion



        #region
        /// <summary>
        /// 抢庄动画
        /// </summary>
        /// <param name="data"></param>
        public void SetRobBankerAni(TransferData data)
        {
            NiuNiu.Room CurrentRoom = data.GetValue <NiuNiu.Room>("CurrentRoom");
            //关闭
            for (int i = 0; i < CurrentRoom.SeatList.Count; i++)
            {
                if (CurrentRoom.SeatList[i].PlayerId > 0)
                {
                    playersItem[CurrentRoom.SeatList[i].Index].SetChooseBankerHint(false);
                }
            }


            bool isOnOff = data.GetValue <bool>("isOnOff");

            if (isOnOff)
            {
                StartCoroutine("RobBankerAni", CurrentRoom);
            }
            else
            {
                StopCoroutine("RobBankerAni");
            }
        }
Beispiel #19
0
    /// <summary>
    /// 刷新申请
    /// </summary>
    /// <param name="data"></param>
    private void OnRefreshApply(TransferData data)
    {
        int groupId = data.GetValue <int>("GroupId");

        if (groupId != m_GroupId)
        {
            return;
        }
        List <PlayerEntity> applyList = data.GetValue <List <PlayerEntity> >("ApplyList");

        for (int i = m_PlayerList.Count - 1; i >= 0; --i)
        {
            UIPoolManager.Instance.Despawn(m_PlayerList[i].transform);
            m_PlayerList.Remove(m_PlayerList[i]);
        }
        for (int i = 0; i < applyList.Count; ++i)
        {
            PlayerEntity         player = applyList[i];
            UIItemChatGroupApply item   = UIPoolManager.Instance.Spawn("UIItemChatGroupApply").GetComponent <UIItemChatGroupApply>();
            item.SetUI(groupId, player.id, player.nickname, player.avatar);
            item.gameObject.SetParent(m_Container);
            m_PlayerList.Add(item);
        }
    }
Beispiel #20
0
    /// <summary>
    /// 房间信息变更
    /// </summary>
    /// <param name="obj"></param>
    private void OnRoomInfoChanged(TransferData data)
    {
        ChatGroupEntity group = data.GetValue <ChatGroupEntity>("GroupEntity");

        if (group == null)
        {
            return;
        }
        RoomEntityBase room = data.GetValue <RoomEntityBase>("RoomEntity");

        if (room == null)
        {
            return;
        }

        for (int i = 0; i < m_RoomList.Count; ++i)
        {
            if (m_RoomList[i].RoomId == room.roomId)
            {
                m_RoomList[i].SetUI(group.id, room.roomId, room.roomStatus == RoomEntityBase.RoomStatus.Gaming, room.GameName);
                break;
            }
        }
    }
Beispiel #21
0
    /// <summary>
    /// 断线重连和创建房间用
    /// </summary>
    private void OnSeatInfoChanged(TransferData data)
    {
        SeatEntity  seat       = data.GetValue <SeatEntity>("Seat");
        ROOM_STATUS roomStatus = data.GetValue <ROOM_STATUS>("RoomStatus");
        bool        IsPlayer   = data.GetValue <bool>("IsPlayer");

#if IS_BAODINGQIPAI
        if (seat.IsBanker)
        {
            ZhuangScore           = seat.firstPour;
            m_betSlider.maxValue += seat.firstPour;
        }
#else
        if (seat.IsBanker)
        {
            ZhuangScore = seat.firstPour;
        }
#endif

        if (IsPlayer)
        {
            SetPourScore(seat, roomStatus);
        }
    }
        public IActionResult Edit(long id)
        {
            var dpInDb = _context.DroppedPassports.SingleOrDefault(dp => dp.Id == id);

            if (dpInDb == null)
            {
                return(NotFound());
            }

            var dpDto = new DroppedPassportDto();

            TransferData.Transfer(dpInDb, dpDto, _context);

            var viewModel = new DroppedPassportFormViewModel()
            {
                OldPassportNo = dpInDb.PassportNo,
                DpDto         = dpDto,
                DropCauses    = _context.DropCauses.ToList(),
                PassportTypes = _context.PassportTypes.ToList(),
                Sources       = _context.Sources.ToList()
            };

            return(View("DroppedPassportForm", viewModel));
        }
Beispiel #23
0
        /// <summary>
        /// 座位信息变更回调
        /// </summary>
        /// <param name="obj"></param>
        private void OnSeatInfoChanged(TransferData data)
        {
            SeatEntity  seat             = data.GetValue <SeatEntity>("Seat");             //座位
            bool        isPlayer         = data.GetValue <bool>("IsPlayer");               //是否自己
            ROOM_STATUS roomStatus       = data.GetValue <ROOM_STATUS>("RoomStatus");      //房间状态
            RoomEntity  currentRoom      = data.GetValue <RoomEntity>("CurrentRoom");      //当前房间
            SeatEntity  BankerSeat       = data.GetValue <SeatEntity>("BankerSeat");       //庄家座位
            SeatEntity  ChooseBankerSeat = data.GetValue <SeatEntity>("ChooseBankerSeat"); //当前选庄座位

            if (isPlayer)
            {
                Debug.Log("自己座位准备状态:" + seat.seatStatus.ToString());
                m_ButtonReady.gameObject.SetActive(!seat.isReady && seat.seatStatus == SEAT_STATUS.IDLE);
                m_ButtonShare.gameObject.SetActive(roomStatus == ROOM_STATUS.IDLE);

                //设置开始按钮
                SetStartBtn(currentRoom, seat);

                if (!SystemProxy.Instance.IsInstallWeChat)
                {
                    m_ButtonShare.gameObject.SetActive(false);
                }
                //m_CancelAuto.gameObject.SetActive(seat.IsTrustee);


                //=================================设置下注按钮=================================================================================
                //                                                             是庄 自己未下注                                    不是庄 自己未下注 庄家已下注
                // m_Operater.NoticeJetton(roomStatus == ROOM_STATUS.POUR && (BankerSeat != null) && ((seat.IsBanker && seat.Pour <= 0) || ((seat.Pour <= 0) && (!seat.IsBanker) && BankerSeat.Pour > 0)), seat);
                m_Operater.NoticeJetton(roomStatus == ROOM_STATUS.GAME && seat.seatStatus == SEAT_STATUS.POUR, seat, currentRoom.baseScore);
                //RoomJuYouProxy

                //=================================设置选庄=================================================================================
                //选庄按钮
                // m_Operater.ChooseBanker(roomStatus == ROOM_STATUS.CHOOSEBANKER && currentRoom.ChooseBankerSeat != null && currentRoom.ChooseBankerSeat == seat);
            }
        }
        private void FinishChunk(TransferData transferData)
        {
            Debug.Assert(null != transferData, "transferData object expected");
            Debug.Assert(
                this.state == State.Upload || this.state == State.Error,
                "FinishChunk called, but state isn't Upload or Error",
                "Current state is {0}",
                this.state);

            // If a parallel operation caused the controller to be placed in
            // error state exit, make sure not to accidentally change it to
            // the Commit state.
            if (this.state == State.Error)
            {
                return;
            }

            lock (this.TransferJob.CheckPoint.TransferWindowLock)
            {
                this.TransferJob.CheckPoint.TransferWindow.Remove(transferData.StartOffset);
            }

            this.Controller.UpdateProgressAddBytesTransferred(transferData.Length);

            if (this.toUploadChunksCountdownEvent.Signal())
            {
                this.SetCommit();
            }
        }
        private async Task DownloadChunkAsync(ReadDataState asyncState)
        {
            Debug.Assert(null != asyncState, "asyncState object expected");

            // If a parallel operation caused the controller to be placed in
            // error state exit early to avoid unnecessary I/O.
            if (this.Controller.ErrorOccurred)
            {
                return;
            }

            AccessCondition accessCondition = Utils.GenerateIfMatchConditionWithCustomerCondition(
                 this.blob.Properties.ETag,
                 this.transferLocation.AccessCondition);

            // We're to download this block.
            asyncState.MemoryStream =
                new MemoryStream(
                    asyncState.MemoryBuffer,
                    0,
                    asyncState.Length);

            await this.blob.DownloadRangeToStreamAsync(
                        asyncState.MemoryStream,
                        asyncState.StartOffset,
                        asyncState.Length,
                        accessCondition,
                        Utils.GenerateBlobRequestOptions(this.transferLocation.BlobRequestOptions),
                        Utils.GenerateOperationContext(this.Controller.TransferContext),
                        this.CancellationToken);

            TransferData transferData = new TransferData(this.Scheduler.MemoryManager)
            {
                StartOffset = asyncState.StartOffset,
                Length = asyncState.Length,
                MemoryBuffer = asyncState.MemoryBuffer
            };

            this.SharedTransferData.AvailableData.TryAdd(transferData.StartOffset, transferData);

            // Set memory buffer to null. We don't want its dispose method to 
            // be called once our asyncState is disposed. The memory should 
            // not be reused yet, we still need to write it to disk.
            asyncState.MemoryBuffer = null;

            this.SetFinish();
            this.SetBlockDownloadHasWork();
        }
 protected abstract Task WriteRangeAsync(TransferData transferData);
Beispiel #27
0
 public List <Song> DoCommand(List <Song> songs, TransferData transferData, Transfer transfer)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Add to proxy data
 /// </summary>
 /// <param name="td"></param>
 private void AddToTransferData(TransferData td)
 {
     m_transferData.Add(td);
 }
Beispiel #29
0
    private void isSendMethod(TransferData data)
    {
        bool isSend = data.GetValue <bool>("isSend");

        this.isSend = isSend;
    }
 protected override async Task WriteRangeAsync(TransferData transferData)
 {
     await this.cloudFile.WriteRangeAsync(
         transferData.Stream,
         transferData.StartOffset,
         null,
         null,
         Utils.GenerateFileRequestOptions(this.destLocation.FileRequestOptions),
         Utils.GenerateOperationContext(this.Controller.TransferContext),
         this.CancellationToken);
 }
Beispiel #31
0
 public void Handle(string eventName, TransferData data)
 {
     InitIdentity(data.Info);
     Handle(data.Info);
 }
 /// <summary>
 /// Show info for debugging
 /// </summary>
 /// <param name="info"></param>
 /// <param name="requestArgs"></param>
 private void ShowDebugInfo(System.Reflection.MethodBase info, TransferData.ContentMode contentMode, HttpRequestArgs requestArgs)
 {
     try
     {
         Debug.Log(string.Format("Method={0} url={1} content={2} sender={3} OnRequestCreated={4} OnResponseReceived={5}",
                    (null == info) ? "(empty)" : info.ToString(),
                    (null == requestArgs || string.IsNullOrEmpty(requestArgs.Url))
                        ? "(empty)"
                        : requestArgs.Url,
                        contentMode == TransferData.ContentMode.Binary ? GetBinaryContent(requestArgs) : GetTextContent(requestArgs),
                    (null == requestArgs || null == requestArgs.Sender) ? "(empty)" : requestArgs.Sender,
                    (null == requestArgs || null == requestArgs.OnRequestCreated ||
                     null == requestArgs.OnRequestCreated.Target)
                        ? "(empty)"
                        : requestArgs.OnRequestCreated.Target.ToString(),
                    (null == requestArgs || null == requestArgs.OnResponseReceived ||
                     null == requestArgs.OnResponseReceived.Target)
                        ? "(empty)"
                        : requestArgs.OnResponseReceived.Target.ToString()));
     }
     catch (System.Exception)
     {
     }
 }
        private async Task UploadChunkAsync(TransferData transferData)
        {
            Debug.Assert(null != transferData, "transferData object expected");
            Debug.Assert(
                this.state == State.Upload || this.state == State.Error,
                "UploadChunkAsync called, but state isn't Upload or Error",
                "Current state is {0}",
                this.state);

            // If a parallel operation caused the controller to be placed in
            // error state exit early to avoid unnecessary I/O.
            if (this.state == State.Error)
            {
                return;
            }

            bool allZero = true;

            for (int i = 0; i < transferData.MemoryBuffer.Length; ++i)
            {
                if (0 != transferData.MemoryBuffer[i])
                {
                    allZero = false;
                    break;
                }
            }

            this.Controller.CheckCancellation();

            if (!allZero)
            {
                transferData.Stream = new MemoryStream(transferData.MemoryBuffer, 0, transferData.Length);
                await this.WriteRangeAsync(transferData);
            }

            this.FinishChunk(transferData);
        }
        private static bool CanTransfer(IMyConveyorEndpointBlock start, IMyConveyorEndpointBlock endPoint, MyDefinitionId itemId, bool isPush)
        {
            MyGridConveyorSystem conveyorSystem = (start as MyCubeBlock).CubeGrid.GridSystems.ConveyorSystem;
            MyGridConveyorSystem.ConveyorEndpointMapping endpoints = conveyorSystem.GetConveyorEndpointMapping(start);

            // Verify that this item can, in fact, make it past sorters, etc
            bool canTransfer = true;
            if (endpoints.TryGetTransfer(endPoint, itemId, false, out canTransfer))
            {
                return canTransfer;
            }
            else
            {
                Tuple<IMyConveyorEndpointBlock, IMyConveyorEndpointBlock> tuple = new Tuple<IMyConveyorEndpointBlock, IMyConveyorEndpointBlock>(start, endPoint);
                lock (m_currentTransferComputationTasks)
                {
                    if (!m_currentTransferComputationTasks.ContainsKey(tuple))
                    {
                        TransferData transferData = new TransferData(start, endPoint, itemId, isPush);
                        ParallelTasks.Task task = ParallelTasks.Parallel.Start(ComputeTransferData, OnTransferDataComputed, transferData);
                        m_currentTransferComputationTasks.Add(tuple, task);
                    }
                }
                return false;
            }
        }
    /// <summary>
    /// Implements transport callback
    /// </summary>
    /// <param name="requestArgs"></param>
    /// <returns></returns>
    public HttpResponseArgs SendSynchronous(TransferData.ContentMode contentMode, HttpRequestArgs requestArgs)
    {
        ShowDebugInfo(System.Reflection.MethodBase.GetCurrentMethod(), contentMode, requestArgs);

        TransferData td = new TransferData(true)
                              {
                                  m_contentMode = contentMode,
                                  m_synchronous = true,
                                  m_requestArgs = requestArgs
                              };

        AddToTransferData(td);

        while (!td.m_isDone)
        {
            System.Threading.Thread.Sleep(0);
        }

        return td.m_responseArgs;
    }
Beispiel #36
0
    //把加注分数按钮变成灰色的
    public void HidFen(TransferData data)
    {
        SeatEntity seat = data.GetValue <SeatEntity>("Seat");

        if (seat == RoomZhaJHProxy.Instance.PlayerSeat)
        {
            float fen = data.GetValue <float>("Fen");

            if (fen == 0)
            {
                if (m_liangHui != null)
                {
                    m_liangHui.gameObject.SetActive(false);
                }
                if (m_wuHui != null)
                {
                    m_wuHui.gameObject.SetActive(false);
                }
                if (m_shiHui != null)
                {
                    m_shiHui.gameObject.SetActive(false);
                }
                if (m_wuShiHui != null)
                {
                    m_wuShiHui.gameObject.SetActive(false);
                }
            }
            for (int i = 0; i <= fen; i++)
            {
                switch (i)
                {
                case 2:
                    if (m_liangHui != null)
                    {
                        m_liangHui.gameObject.SetActive(true);
                    }
                    break;

                case 5:
                    if (m_wuHui != null)
                    {
                        m_wuHui.gameObject.SetActive(true);
                    }
                    break;

                case 10:
                    if (m_shiHui != null)
                    {
                        m_shiHui.gameObject.SetActive(true);
                    }
                    break;

                case 50:
                    if (m_wuShiHui != null)
                    {
                        m_wuShiHui.gameObject.SetActive(true);
                    }
                    break;
                }
            }
        }
    }
        private bool MakeTransfer(TransferData data)
        {
            MyEnvironmentItems.ItemInfo itemInfo;
            if (!data.From.TryGetItemInfoById(data.LocalId, out itemInfo))
            {
                // the item was removed or never existed
                return false;
            }

            data.From.RemoveItem(data.LocalId, true);
            if (!data.To.IsBatching)
                data.To.BeginBatch(true);
            data.To.BatchAddItem(itemInfo.Transform.Position, data.SubtypeId, true);
            return true;
        }
 protected abstract Task WriteRangeAsync(TransferData transferData);
 protected override async Task WriteRangeAsync(TransferData transferData)
 {
     await this.pageBlob.WritePagesAsync(
         transferData.Stream,
         transferData.StartOffset,
         null,
         Utils.GenerateConditionWithCustomerCondition(this.destLocation.AccessCondition),
         Utils.GenerateBlobRequestOptions(this.destLocation.BlobRequestOptions),
         Utils.GenerateOperationContext(this.Controller.TransferContext),
         this.CancellationToken);
 }
        private async Task UploadBlobAsync()
        {
            Debug.Assert(State.UploadBlob == this.state, "Calling UploadBlobAsync, state should be UploadBlob");

            if (Interlocked.CompareExchange(ref workToken, 0, 1) == 0)
            {
                return;
            }

            TransferData transferData = null;

            if (!this.SharedTransferData.AvailableData.TryRemove(this.expectedOffset, out transferData))
            {
                this.workToken = 1;
                return;
            }

            if (null != transferData)
            {
                using (transferData)
                {
                    long currentOffset = this.expectedOffset;
                    if (0 != transferData.Length)
                    {
                        this.expectedOffset += transferData.Length;

                        if (transferData.MemoryBuffer.Length == 1)
                        {
                            transferData.Stream = new MemoryStream(transferData.MemoryBuffer[0], 0, transferData.Length);
                        }
                        else
                        {
                            transferData.Stream = new ChunkedMemoryStream(transferData.MemoryBuffer, 0, transferData.Length);
                        }

                        AccessCondition accessCondition = Utils.GenerateConditionWithCustomerCondition(this.destLocation.AccessCondition, true) ?? new AccessCondition();
                        accessCondition.IfAppendPositionEqual = currentOffset;

                        bool             needToCheckContent      = false;
                        StorageException catchedStorageException = null;


                        try
                        {
                            await Utils.ExecuteXsclApiCallAsync(
                                async() => await this.appendBlob.AppendBlockAsync(
                                    transferData.Stream,
                                    null,
                                    accessCondition,
                                    Utils.GenerateBlobRequestOptions(this.destLocation.BlobRequestOptions),
                                    Utils.GenerateOperationContext(this.Controller.TransferContext),
                                    this.CancellationToken).ConfigureAwait(false),
                                this.CancellationToken).ConfigureAwait(false);
                        }
#if EXPECT_INTERNAL_WRAPPEDSTORAGEEXCEPTION
                        catch (Exception e) when(e is StorageException || (e is AggregateException && e.InnerException is StorageException))
                        {
                            var se = e as StorageException ?? e.InnerException as StorageException;
#else
                        catch (StorageException se)
                        {
#endif
                            if ((null != se.RequestInformation) &&
                                ((int)HttpStatusCode.PreconditionFailed == se.RequestInformation.HttpStatusCode) &&
                                (se.RequestInformation.ErrorCode == BlobErrorCodeStrings.InvalidAppendCondition))
                            {
                                needToCheckContent      = true;
                                catchedStorageException = se;
                            }
                            else
                            {
                                throw;
                            }
                        }

                        if (needToCheckContent &&
                            (!await this.ValidateUploadedChunkAsync(transferData.MemoryBuffer, currentOffset, (long)transferData.Length).ConfigureAwait(false)))
                        {
                            throw new InvalidOperationException(Resources.DestinationChangedException, catchedStorageException);
                        }
                    }

                    this.Controller.UpdateProgress(() =>
                    {
                        lock (this.SharedTransferData.TransferJob.CheckPoint.TransferWindowLock)
                        {
                            this.SharedTransferData.TransferJob.CheckPoint.TransferWindow.Remove(currentOffset);
                        }
                        this.SharedTransferData.TransferJob.Transfer.UpdateJournal();

                        // update progress
                        this.Controller.UpdateProgressAddBytesTransferred(transferData.Length);
                    });

                    if (this.expectedOffset == this.SharedTransferData.TotalLength)
                    {
                        this.state = State.Commit;
                    }

                    this.workToken = 1;
                }
            }
        }
        private async Task DownloadRangeAsync(RangeBasedDownloadState asyncState)
        {
            Debug.Assert(null != asyncState, "asyncState object expected");
            Debug.Assert(
                this.state == State.Download || this.state == State.Error,
                "DownloadRangeAsync called, but state isn't Download or Error");

            // If a parallel operation caused the controller to be placed in
            // error state exit early to avoid unnecessary I/O.
            if (this.state == State.Error)
            {
                return;
            }

            if (asyncState.Range.HasData)
            {
                await this.DoDownloadRangeToStreamAsync(asyncState);
            }
            else
            {
                // Zero memory buffer.
                asyncState.DownloadStream.SetAllZero();
            }

            asyncState.DownloadStream.FinishWrite();
            asyncState.DownloadStream.ReserveBuffer = true;

            foreach (var buffer in asyncState.DownloadStream.GetBuffers())
            {
                // Two download streams can refer to the same download buffer instance. It may cause the download
                // buffer be added into shared transfer data twice if only buffer.Finished is checked here:
                //   Thread A: FinishedWrite()
                //   Thread B: FinishedWrite(), buffer.Finished is true now
                //   Thread A: Check buffer.Finished
                //   Thread B: Check buffer.Finished
                //   Thread A: Add buffer into sharedTransferData
                //   Thread C: Writer remove buffer from sharedTransferData
                //   Thread B: Add buffer into sharedTransferData again
                // So call MarkAsProcessed to make sure buffer is added exactly once.
                if (buffer.Finished && buffer.MarkAsProcessed())
                {
                    TransferData transferData = new TransferData(this.Scheduler.MemoryManager)
                    {
                        StartOffset = buffer.StartOffset,
                        Length = buffer.Length,
                        MemoryBuffer = buffer.MemoryBuffer
                    };

                    this.SharedTransferData.AvailableData.TryAdd(buffer.StartOffset, transferData);
                }
            }
        }
        public TransferData Signal(Guid workerId, TransferData data)
        {
            var resultData = JobRunner.Runner.Signal(workerId, data.GetData());

            return(new TransferData(resultData));
        }
        private async Task ReadChunkAsync(ReadDataState asyncState)
        {
            Debug.Assert(null != asyncState, "asyncState object expected");
            Debug.Assert(
                this.state == State.ReadStream || this.state == State.Error,
                "ReadChunkAsync called, but state isn't Upload or Error");

            int readBytes = await this.md5HashStream.ReadAsync(
                asyncState.StartOffset + asyncState.BytesRead,
                asyncState.MemoryBuffer,
                asyncState.BytesRead,
                asyncState.Length - asyncState.BytesRead,
                this.CancellationToken);

            // If a parallel operation caused the controller to be placed in
            // error state exit early to avoid unnecessary I/O.
            // Note that this check needs to be after the EndRead operation
            // above to avoid leaking resources.
            if (this.state == State.Error)
            {
                return;
            }

            asyncState.BytesRead += readBytes;

            if (asyncState.BytesRead < asyncState.Length)
            {
                await this.ReadChunkAsync(asyncState);
            }
            else
            {
                this.Controller.CheckCancellation();

                if (!this.md5HashStream.MD5HashTransformBlock(asyncState.StartOffset, asyncState.MemoryBuffer, 0, asyncState.Length, null, 0))
                {
                    // Error info has been set in Calculate MD5 action, just return
                    return;
                }

                TransferData transferData = new TransferData(this.Scheduler.MemoryManager)
                {
                    StartOffset = asyncState.StartOffset,
                    Length = asyncState.Length,
                    MemoryBuffer = asyncState.MemoryBuffer
                };

                asyncState.MemoryBuffer = null;

                this.SharedTransferData.AvailableData.TryAdd(transferData.StartOffset, transferData);

                this.SetChunkFinish();
            }
        }
Beispiel #44
0
        public override void OnButtonClick(string btnName, object tag)
        {
            if (btnName == string.Empty)
            {
                return;
            }

            switch (btnName)
            {
            case "BaseBTN":
                if (!SubrootCheck())
                {
                    return;
                }
                _currentBase        = ((TransferData)tag).Manager;
                _currentData        = (TransferData)tag;
                _baseNameLabel.text = _currentBase.GetBaseName();

                if (_currentData.ButtonType == ButtonType.Home)
                {
                    GoToPage(TerminalPages.BaseItemsDirect);
                }
                else if (_currentData.ButtonType == ButtonType.Base)
                {
                    _gettingData.text = string.Format(AuxPatchers.GettingData(), _currentBase.GetBaseName());
                    GoToPage(TerminalPages.BaseItems);
                }

                Refresh();
                break;

            case "HomeBTN":
                GoToPage(TerminalPages.Home);
                break;

            case "ItemBTN":
                _currentBase?.RemoveItemFromContainer((TechType)tag);
                break;

            case "DumpBTN":
                _currentBase?.OpenDump(_currentData);
                break;

            case "VehicleDumpBTN":
                _vehicleContainersGrid.DrawPage();
                GoToPage(TerminalPages.StorageContainer);
                break;

            case "VehicleContainerBTN":
                _mono.Manager.DockingManager.OpenContainer(_currentVehicle, ((TransferData)tag).Container);
                break;

            case "TerminalColorBTN":
                GoToPage(TerminalPages.TerminalColorPage);
                _currentColorPage = ColorPage.Terminal;
                break;

            case "AntennaColorBTN":
                var antennas = _mono.Manager.GetCurrentBaseAntenna();

                if (antennas != null)
                {
                    GoToPage(TerminalPages.AntennaColorPage);
                    _currentColorPage = ColorPage.Antenna;
                    UpdateAntennaColorPage();
                }
                else if (_mono.Manager.Habitat.isBase)
                {
                    QuickLogger.Message(AuxPatchers.NoAntennaOnBase(), true);
                }
                else if (_mono.Manager.Habitat.isCyclops)
                {
                    QuickLogger.Message(AuxPatchers.CannotChangeCyclopsAntenna(), true);
                }
                break;

            case "ColorPickerBTN":
                GoToPage(TerminalPages.ColorPageMain);
                break;

            case "ColorItem":
                if (_currentColorPage == ColorPage.Terminal)
                {
                    _mono.TerminalColorManager.ChangeColorMask((Color)tag);
                }
                else
                {
                    ChangeAntennaColor((Color)tag);
                }
                break;

            case "RenameBTN":
                _mono.Manager.ChangeBaseName();
                break;

            case "PowerBTN":
                _mono.Manager.ToggleBreaker();
                break;

            case "SettingsBTN":
                GoToPage(TerminalPages.SettingsPage);
                break;

            case "VehiclesPageBTN":
                if (_mono.Manager.DockingManager.HasVehicles(true))
                {
                    _vehicleGrid.DrawPage();
                    GoToPage(TerminalPages.VehiclesPage);
                }
                else
                {
                    GoToPage(TerminalPages.Home);
                }
                break;

            case "VehicleBTN":
                _currentVehicle = ((TransferData)tag).Vehicle;
                _vehicleContainersGrid.DrawPage();
                GoToPage(TerminalPages.StorageContainer);
                break;

            case "AutoDockBTN":
                _toggle.isOn = _mono.Manager.DockingManager.GetToggleState();
                GoToPage(TerminalPages.DockSettingPage);
                break;

            case "FilterBTN":
                var data = (FilterTransferData)tag;
                if (Mod.IsFilterAdded(data.Filter))
                {
                    Mod.RemoveBlackListFilter(data.Filter);
                    return;
                }
                Mod.AddBlackListFilter(data.Filter);
                break;
            }
        }
 ConfirmationStatus ITransferService.ReceiveTransfer(TransferData transferData)
 {
     System.Windows.Forms.MessageBox.Show("Test");
       return new ConfirmationStatus();
 }