Example #1
0
 void Jubao()
 {
     NodeManager.OpenNode <ReportNode>(null, null, false).Inits(curInfo.userId, true);
 }
 public JsValue GetChainLevel(long number)
 {
     return(NodeManager.PostJint("debug_getChainLevel", number).Result);
 }
        public void Translate_OnClick(object sender, EventArgs e)
        {
            var translateNodeID = TranslateUtils.ToInt(ddlTranslateNodeID.SelectedValue);

            if (translateNodeID == 0)
            {
                FailMessage("转移失败,必须选择转移目标");
                return;
            }
            try
            {
                contentInfo.SetExtendedAttribute(GovInteractContentAttribute.TranslateFromNodeId, contentInfo.NodeId.ToString());
                contentInfo.NodeId = translateNodeID;
                DataProvider.ContentDao.Update(PublishmentSystemInfo.AuxiliaryTableForGovInteract, PublishmentSystemInfo, contentInfo);

                if (!string.IsNullOrEmpty(tbTranslateRemark.Text))
                {
                    var remarkInfo = new GovInteractRemarkInfo(0, PublishmentSystemId, contentInfo.NodeId, contentInfo.Id, EGovInteractRemarkType.Translate, tbTranslateRemark.Text, Body.AdministratorInfo.DepartmentId, Body.AdministratorName, DateTime.Now);
                    DataProvider.GovInteractRemarkDao.Insert(remarkInfo);
                }

                GovInteractApplyManager.LogTranslate(PublishmentSystemId, contentInfo.NodeId, contentInfo.Id, NodeManager.GetNodeName(PublishmentSystemId, contentInfo.NodeId), Body.AdministratorName, Body.AdministratorInfo.DepartmentId);

                SuccessMessage("办件转移成功");
                if (!PublishmentSystemInfo.Additional.GovInteractApplyIsOpenWindow)
                {
                    AddWaitAndRedirectScript(ListPageUrl);
                }
            }
            catch (Exception ex)
            {
                FailMessage(ex, ex.Message);
            }
        }
Example #4
0
        public void TestConstructor4()
        {
            NodeManager nodeManager = new NodeManager(4, false, engine);

            Assert.IsTrue(nodeManager.TaskExecutionModule.GetExecutionModuleMode() == TaskExecutionModule.TaskExecutionModuleMode.MultiProcFullNodeMode, "Expected Task Mode to be MultiProc");
        }
Example #5
0
 public string GetConfigValue(string category, string name)
 {
     return(NodeManager.Post <string>("debug_getConfigValue", category, name).Result);
 }
Example #6
0
    /// <summary>
    /// 解析收到的消息
    /// </summary>
    IEnumerator AnalysisMessage()
    {
        while (true)
        {
            if (allPackages.Count > 0)
            {
                G2CMessage message   = allPackages.Dequeue();
                MessageId  messageId = message.msgid;
                if (messageId != MessageId.G2C_HeartBeatResp && messageId != MessageId.G2C_SystemNotice)
                {
                    LoadingNode.CloseLoadingNode();
                    UIUtils.Log("收到消息:" + messageId.ToString() + ",result::" + message.result);
                }
                if (message.result == 1)
                {
                    #region ...消息处理
                    switch (messageId)
                    {
                        #region ...登录注册相关
                    case MessageId.G2C_Kick_ReLogin:
                        LoginPage.TakeLogin();
                        break;

                    case MessageId.G2C_Kick:
                        TipManager.Instance.OpenTip(TipType.ChooseTip, "您被踢出登录是否重登?", 0, () =>
                        {
                            PageManager.Instance.OpenPage <LoginPage>();
                        });
                        break;

                    case MessageId.G2C_LoginResp:
                        UserInfoModel.userInfo.inDzz   = message.loginresp.inDdz;
                        UserInfoModel.userInfo.release = message.loginresp.vno;
                        LoginPage.LoginResult(message.loginresp.token);
                        print("是否在斗地主:" + message.loginresp.inDdz);
                        break;

                    case MessageId.G2C_UserFlushData:
                        UserInfoModel.userInfo.InitUserData(message.flushdata);
                        break;

                    case MessageId.G2C_UserSysNotice:
                        //message.UserSysNotice.msg
                        break;

                        #endregion
                        #region  大厅相关
                    case MessageId.G2C_QueryAmountOfPlayerInGameResp:
                        var mainPage = PageManager.Instance.GetPage <MainPage>();
                        if (mainPage)
                        {
                            mainPage.SetOnlineNum(message.queryAmountOfPlayerInGameResp);
                        }
                        break;

                    case MessageId.G2C_QueryUserMsgResp:
                        MessageModel.Instance.QueryUserMsgFinish(message.UserMsg);
                        break;

                    case MessageId.G2C_ReadUserMsgResp:
                        NodeManager.GetNode <MessageNode>().ReadMsg(message.ReadMsgResp);
                        break;

                    case MessageId.G2C_QueryGoodsResp:
                        NodeManager.GetNode <BagNode>().goodsPanel.SetData(message.QueryGoodsResp.goods);
                        break;

                    case MessageId.G2C_UseGoodsResp:
                        NodeManager.GetNode <BagNode>().goodsPanel.cashPanel.OnClickTrueFinish(message.UseGoodsResult.result);
                        break;

                    case MessageId.G2C_SaleUserGoodsResp:
                        NodeManager.GetNode <BagNode>().goodsPanel.salePanel.OnClickTrueFinish(message.SaleUserGoodsResp.result);
                        break;

                    case MessageId.G2C_QueryTickRecordResp:
                        NodeManager.GetNode <BagNode>().redeemPanel.QueryTickFinish(message.QueryTickRecordResp);
                        break;

                    case MessageId.G2C_UpdateUserSafeBoxResp:
                        NodeManager.GetNode <SafeBoxNode>().OnClickTrueFinish(message.UpdateUserSafeBoxResp.result);
                        break;

                    case MessageId.G2C_BuyGoodsInStoreResp:    //购买物品
                        StoreNode.ShowRechargeResult(message.BuyGoodsInStoreResp);
                        break;

                    case MessageId.G2C_ChargeNotic:    //sdk购买回调
                        StoreNode.ChargeNoticFinish(message.ChargeNotice);
                        break;

                    case MessageId.G2C_QueryRankResp:
                        RankNode.QueryRankFinish(message.queryRankResp);
                        break;

                    case MessageId.G2C_UpdateUser:
                        TipManager.Instance.OpenTip(TipType.SimpleTip, "操作成功");
                        break;

                    case MessageId.G2C_IsVipUserResp:
                        UserInfoNode.FinishVipDay(message.IsVipUserResp);
                        BqPanel.FinishVipDay(message.IsVipUserResp);
                        break;

                    case MessageId.G2C_QueryTableInfoResp:    //请求房间信息
                        JoinGameRoonNode.G2C_EnterSuccess(message.queryTableInfoResp);
                        break;

                    case MessageId.G2C_YuePaiTableResp:
                        if (MaJangPage.Instance)
                        {
                            int finalIndex = message.yuePaiTableResp.yuePaiTable.Count - 1;
                            GameLogNode.G2C_Load(message.yuePaiTableResp.yuePaiTable[finalIndex]);
                        }
                        else if (PageManager.Instance.CurrentPage is LandlordsPage)
                        {
                            int finalIndex = message.yuePaiTableResp.yuePaiTable.Count - 1;
                            CardResultShowNode cardResultNode = NodeManager.GetNode <CardResultShowNode>();
                            if (cardResultNode)
                            {
                                cardResultNode.Inits(message.yuePaiTableResp.yuePaiTable[finalIndex]);
                            }
                            else
                            {
                                GameLogNode.G2C_Load(message.yuePaiTableResp.yuePaiTable[finalIndex]);
                            }
                        }
                        else if (PageManager.Instance.CurrentPage is MainPage)
                        {
                            YuepaiLogNode.G2C_ReceiveLog(message.yuePaiTableResp);
                        }
                        break;

                    case MessageId.G2C_UnifiedOrder:
                        SDKManager.Instance.SendWechatPay(message.UnifiedOrderResp);
                        break;

                    case MessageId.G2C_AliOrder:
                        SDKManager.Instance.SendAliPay(message.AliOrderResp);
                        break;

                    case MessageId.G2C_QueryGameRoomResp:
                        SelectRoomPage.Instance.QueryGameRoomFinish(message.queryGameRoomResp);
                        break;

                    case MessageId.G2C_SystemNotice:    //系统消息
                        for (int i = 0; i < message.SystemNotice.notice.Count; i++)
                        {
                            NoticeNode.Add(message.SystemNotice.notice[i]);
                        }
                        break;

                        #region 好友相关
                    case MessageId.G2C_QueryFriendResp:    //好友列表
                        SocialNode node = NodeManager.GetNode <SocialNode>();
                        if (node)
                        {
                            node.friendRankPanel.G2C_FriendRank(message.queryFriendResp.friendInfo);
                        }
                        else
                        {
                            InvateNode.G2C_OnLineFriend(message.queryFriendResp.friendInfo);
                        }
                        break;

                    case MessageId.G2C_QueryRenshiResp:    //认识的人
                        KnowPanelPanel.G2C_Know(message.queryRenshiResp.friendInfo);
                        break;

                    case MessageId.G2C_QueryNearbyResp:    //附近的人
                        NearPanel.G2C_Near(message.queryNearbyResp.friendInfo);
                        break;

                    case MessageId.G2C_SharePositionResp:    //位置分享
                        TipManager.Instance.OpenTip(TipType.SimpleTip, "分享位置信息成功!");
                        //请求附近的人
                        AddSendMessageQueue(new C2GMessage()
                        {
                            msgid = MessageId.C2G_QueryNearbyReq
                        });
                        break;

                    case MessageId.G2C_ApplyFriendNotice:    //有人加我好友
                        NodeManager.OpenNode <AddFriendTipNode>(null, null, false, false).Inits(message.applyFriendNotice.friendInfo);
                        SocialNode socialsNode = NodeManager.GetNode <SocialNode>();
                        if (socialsNode)
                        {
                            socialsNode.messagePanel.G2C_AddFriends(new List <FriendInfo>()
                            {
                                message.applyFriendNotice.friendInfo
                            });
                        }
                        break;

                    case MessageId.G2C_ApplyFriendResp:    //加好友结果
                        TipManager.Instance.OpenTip(TipType.SimpleTip, "发送成功,等待验证");
                        break;

                    case MessageId.G2C_ReplyFriendNotice:
                        if (message.replyFriendNotice.friendInfo.userId == UserInfoModel.userInfo.userId)
                        {
                            break;
                        }
                        string tipStr = "";
                        switch (message.replyFriendNotice.friendInfo.relation)
                        {
                        case -1:
                            tipStr = message.replyFriendNotice.friendInfo.nickname + " 已拒绝您的好友申请";
                            break;

                        case 1:
                            FriendRankPanel.Inits();
                            tipStr = message.replyFriendNotice.friendInfo.nickname + " 已同意您的好友申请";
                            break;
                        }
                        TipManager.Instance.OpenTip(TipType.SimpleTip, tipStr);
                        RankNode ranknode = NodeManager.GetNode <RankNode>();
                        if (ranknode)
                        {
                            ranknode.playinfoPanel.QueryRelation(message.replyFriendNotice.friendInfo.userId);
                        }
                        break;

                    case MessageId.G2C_ReplyFriendResp:
                        FriendRankPanel.Inits();
                        break;

                    case MessageId.G2C_FindFriendResp:    //查找好友
                        FindFriendPanel.G2C_Find(message.findFriendResp);
                        break;

                    case MessageId.G2C_FriendChatResp:    //收到好友聊天
                        SocialModel.Instance.ReceiveMessage(message.friendChatResp);
                        SocialModel.Instance.isHaveNewMessage = true;
                        if (PageManager.Instance.CurrentPage is MainPage)
                        {
                            PageManager.Instance.GetPage <MainPage>().SetFriendRed();
                        }
                        else if (PageManager.Instance.CurrentPage is SelectRoomPage)
                        {
                            PageManager.Instance.GetPage <SelectRoomPage>().bottomPanel.SetFriendRedPoint();
                        }
                        break;

                    case MessageId.G2C_GiveSilver:    //赠送成功
                        TipManager.Instance.OpenTip(TipType.SimpleTip, "赠送成功!");
                        break;

                    case MessageId.G2C_QueryFriendOfflineChatResp:
                        SocialNode social_node = NodeManager.GetNode <SocialNode>();
                        if (social_node)
                        {
                            social_node.messagePanel.G2C_RecentContacts(message.queryFriendOfflineChatResp.friendOfflineChat);
                        }
                        break;

                    case MessageId.G2C_QueryRelationResp:
                        GameRoleInfoNode gameRole_node = NodeManager.GetNode <GameRoleInfoNode>();
                        if (gameRole_node)
                        {
                            gameRole_node.SetFriend(message.queryRelationResp.relation);
                        }
                        RankNode rankNode = NodeManager.GetNode <RankNode>();
                        if (rankNode)
                        {
                            rankNode.playinfoPanel.QueryRelationFinish(message.queryRelationResp.relation);
                        }
                        MatchReadyNode matchReadyNode = NodeManager.GetNode <MatchReadyNode>();
                        if (matchReadyNode)
                        {
                            matchReadyNode.chatPanel.CurItem.QueryRelationFinish(message.queryRelationResp.relation);
                        }
                        break;

                    case MessageId.G2C_QueryApplicantsResp:
                        SocialNode socialNode = NodeManager.GetNode <SocialNode>();
                        if (socialNode)
                        {
                            socialNode.messagePanel.G2C_AddFriends(message.queryApplicantsResp.friendInfo);
                        }
                        break;

                    case MessageId.G2C_RemoveFriendResp:
                        TipManager.Instance.OpenTip(TipType.SimpleTip, "删除成功!");
                        FriendRankPanel.Inits();
                        break;
                        #endregion

                        #region 意见反馈
                    case MessageId.G2C_QueryOpinionResp:    //我的历史反馈
                        FeedbackNode feed_node = NodeManager.GetNode <FeedbackNode>();
                        if (feed_node != null)
                        {
                            feed_node.G2C_LoadItems(message.queryOpinionResp.opinion);
                        }
                        break;

                    case MessageId.G2C_SubmitOpinionResp:
                        TipManager.Instance.OpenTip(TipType.SimpleTip, "提交成功");
                        FeedbackNode.G2C_Submit();
                        break;
                        #endregion

                        #region 任务
                    case MessageId.G2C_DaliyTask:    //每日任务列表
                        TaskNode.TaskRefresh(message.DailyTaskResp.dailyTask);
                        break;

                    case MessageId.G2C_CashingPrize:    //领奖
                        TaskNode.Reward(message.CashingPrizeResp.awardCount);
                        break;

                    case MessageId.G2C_Complete1Task:    //完成任务
                        TaskNode.ReqTasks();
                        break;

                        #endregion
                        #endregion
                        #region  比赛
                    case MessageId.G2C_LoadMatcherResp:
                        MatchModel.Instance.LoadMatcherFinish(message.loadMatcherResp);
                        break;

                    case MessageId.G2C_JoinMatcherResp:
                        MatchApplyNode.JoinMatcherFinish(message.JoinMatcherResp);
                        break;

                    case MessageId.G2C_PrepareMatcherResp:
                        MatchModel.Instance.PrepareMatcherFinish(message.prepareMatcherResp);
                        break;

                    case MessageId.G2C_QuitMatcherResp:
                        var readyNode = NodeManager.GetNode <MatchReadyNode>();
                        if (readyNode)
                        {
                            readyNode.QuitMatcher();
                        }
                        var waitNode = NodeManager.GetNode <MatchWaitNode>();
                        if (waitNode)
                        {
                            waitNode.QuitMatcher();
                        }
                        break;

                    case MessageId.G2C_MatcherRiseSuccess:
                        var waitNode2 = NodeManager.GetNode <MatchWaitNode>();
                        if (waitNode2)
                        {
                            waitNode2.MatcherRise(message.waitMatcherRiseResp);
                        }
                        break;

                    case MessageId.G2C_StartMatcher:
                        MatchReadyNode.StartMatch();
                        break;

                    case MessageId.G2C_MatcherCountResp:
                        MatchModel.Instance.MatcherCountFinish(message.matcherCountResp);
                        break;

                    case MessageId.G2C_UserMatcherRewardResp:
                        MatchModel.Instance.UserMatcherRewardFinish(message.userMatcherRewardResp);
                        break;

                    case MessageId.G2C_MatcherHistoryResp:
                        MatchModel.Instance.MatcherHistoryFinish(message.matcherHistoryResp);
                        break;

                    case MessageId.G2C_UserMatcherFriendRankResp:
                        MatchModel.Instance.MatcherFriendRankFinish(message.userMatcherFriendRankResp);
                        break;

                    case MessageId.G2C_MatcherChatResp:
                        MatchReadyNode.MatcherChat(message.matcherChatResp);
                        break;

                    case MessageId.G2C_MatcherJoinCount:
                        MatchReadyNode.JoinCountFlush(message.matcherJoinCount);
                        break;

                    case MessageId.G2C_WaitMatcherRiseResp:
                        MatchWaitNode.OpenMatchWait(message.waitMatcherRiseResp);
                        break;

                    case MessageId.G2C_MatcherPlayerRankingResp:    //比赛排行
                        MatchRankRewardNode.QueryRankFinish(message.matcherPlayerRankingResp);
                        MatchWaitRankRewardPanel.QueryRankFinish(message.matcherPlayerRankingResp);
                        break;

                    case MessageId.G2C_DieMatcherPlayerResp:
                        NodeManager.OpenNode <MatchResultNode>("match", null, true, false).DieMatcherFinish(message.dieMatcherPlayerResp);
                        break;

                    case MessageId.G2C_MedalResp:
                        NodeManager.OpenNode <MatchResultNode>("match", null, true, false).MedalFinish(message.medalResp);
                        break;

                    case MessageId.G2C_CurrentMatcherInfoResp:    //收到比赛消息
                        MatchRulesNode.DisplayMatchInfo(message.currentMatcherInfoResp);
                        //LandlordsNet.BisaiInfoResp(message.currentMatcherInfoResp);
                        break;

                    case MessageId.G2C_MyMatcherRankingResp:    //收到我的排行信息
                        if (PageManager.Instance.GetPage <LandlordsPage>())
                        {
                            LandlordsNet.BisaiMyRankInfoResp(message.myMatcherRankingResp);
                        }
                        else if (PageManager.Instance.GetPage <MaJangPage>())
                        {
                            MaJangPage.Instance.RefreshMatchInfo(message.myMatcherRankingResp);
                        }
                        break;

                    case MessageId.G2C_MatcherFriendResp:
                        MatchReadyNode.InviteFriend(message.matcherFriendResp);
                        break;

                    case MessageId.G2C_InviteFriendMatcherResp:
                        var inviteResp = message.inviteFriendMatcherResp;
                        if (inviteResp.code == 1)
                        {
                            TipManager.Instance.OpenTip(TipType.SimpleTip, "已发送邀请");
                        }
                        else if (inviteResp.code == 2)
                        {
                            TipManager.Instance.OpenTip(
                                TipType.ChooseTip,
                                "您的好友 " + inviteResp.hostName + " 邀请您参加" + inviteResp.matcherName,
                                10f,
                                delegate
                            {
                                MatchModel.Instance.JoinMatch((int)inviteResp.cost, inviteResp.costType, inviteResp.matcherId, inviteResp.matcherName);
                                MatcherInfo cur = new MatcherInfo()
                                {
                                    matchId = inviteResp.matcherId
                                };
                                MatchModel.Instance.CurData = cur;
                            }
                                );
                        }
                        break;

                    case MessageId.G2C_InviteFriendYuePaiResp:
                        if (message.inviteFriendYuePaiResp.code == 3)
                        {
                            TipManager.Instance.OpenTip(TipType.SimpleTip, "对方已拒绝您的邀请");
                        }
                        break;

                    case MessageId.G2C_MatcherTickUser:
                        if (NodeManager.GetNode <MatchReadyNode>())
                        {
                            NodeManager.CloseTargetNode <MatchReadyNode>();
                            MatchModel.Instance.CurData = null;
                            TipManager.Instance.OpenTip(TipType.SimpleTip, "人数不符合比赛要求,请重新报名");
                        }
                        break;

                        #endregion
                        #region ...麻将相关
                    case MessageId.G2C_CreateTableResp:
                        PageManager.Instance.OpenPage <MaJangPage>();
                        break;

                    case MessageId.G2C_GameJoinTableResp:
                    case MessageId.G2C_MjChangeTableResp:
                        if (!PageManager.Instance.GetPage <MaJangPage>())
                        {
                            PageManager.Instance.OpenPage <MaJangPage>();
                        }
                        MaJangPage.Instance.JoinRoomResult(message.GameJoinTableResp.user, message.GameJoinTableResp.detail, message.GameJoinTableResp.isChangeTable);
                        break;

                    case MessageId.G2C_GameJoinTableNotice:
                        if (MaJangPage.Instance)
                        {
                            MaJangPage.Instance.OtherJoinRoomResult(message.GameJoinTableNotice.user);
                        }
                        break;

                    case MessageId.G2C_GameLeaveTableResp:
                        if (MaJangPage.Instance)
                        {
                            MaJangPage.Instance.LeaveByPos(message.GameLeaveTableResp.pos, false);
                        }
                        break;

                    case MessageId.G2C_GamePrepareNotice:
                        if (MaJangPage.Instance)
                        {
                            MaJangPage.Instance.Ready(message.GamePrepareNotice.pos, message.GamePrepareNotice.prepared);
                        }
                        break;

                    case MessageId.G2C_GameStartResp:
                        if (message.GameStartResp.isReconnect)
                        {
                            PageManager.Instance.OpenPage <MaJangPage>();
                        }
                        MaJangPage.Instance.StartOrReConnectGame(message.GameStartResp);
                        if (message.GameStartResp.isReconnect && message.GameStartResp.state != 4)
                        {
                            canHandleMessage = false;    //重连完成前,禁止处理所有消息
                        }
                        break;

                    case MessageId.G2C_UserStepOverNotice:
                        if (MaJangPage.Instance)
                        {
                            MaJangPage.Instance.StartOutMj(message.UserStepOverNotice);
                        }
                        break;

                    case MessageId.G2C_UserGetMjResp:
                        if (MaJangPage.Instance)
                        {
                            MaJangPage.Instance.GetUserGetMj(message.UserGetMjResp);
                        }
                        break;

                    case MessageId.G2C_UserActionNotice:
                        if (MaJangPage.Instance)
                        {
                            MaJangPage.Instance.GetUserAction(message.UserActionNotice);
                        }
                        break;

                    case MessageId.G2C_UserMjActionResp:
                        if (MaJangPage.Instance)
                        {
                            MaJangPage.Instance.currentPlayer.ExecuteAction(message.UserActionResp);
                        }
                        break;

                    case MessageId.G2C_ChangeBaoPaiNotice:
                        if (MaJangPage.Instance)
                        {
                            MaJangPage.Instance.OpenBao(message.changeBaoPaiNotice);
                        }
                        break;

                    case MessageId.G2C_MjResult:
                        if (MaJangPage.Instance)
                        {
                            if (message.MjResult.isFinal)
                            {
                                MaJangPage.Instance.GameResult(message.MjResult);
                                canHandleMessage = false;    //弹出当前局结算后,禁止处理所有消息
                            }
                            else
                            {
                                MaJangPage.Instance.Xjxd(message.MjResult);
                            }
                        }
                        break;

                    case MessageId.G2C_MjChangePosResp:
                        if (MaJangPage.Instance)
                        {
                            MaJangPage.Instance.ChangeSeatResult(message.mjChangePosResp);
                        }
                        break;

                    case MessageId.G2C_MjChangePosApplyResp:
                        if (MaJangPage.Instance)
                        {
                            MaJangPage.Instance.ChangeSeatReply(message.mjChangePosApplyResp);
                        }
                        break;

                    case MessageId.G2C_MjChangePosNotice:
                        if (MaJangPage.Instance)
                        {
                            MaJangPage.Instance.OtherPlayerChangeSeat(message.mjChangePosNotice.pos1, message.mjChangePosNotice.pos2);
                        }
                        break;

                    case MessageId.G2C_MjTuoguanResp:
                        if (MaJangPage.Instance)
                        {
                            MaJangPage.Instance.TrusteeshipResult(true);
                        }
                        break;

                    case MessageId.G2C_MjCancelTuoguanResp:
                        if (MaJangPage.Instance)
                        {
                            MaJangPage.Instance.TrusteeshipResult(false);
                        }
                        break;

                    case MessageId.G2C_MjTuoguanNotice:
                        if (MaJangPage.Instance)
                        {
                            MaJangPage.Instance.TrusteeshipResult(true, message.mjTuoguanNotice.pos);
                        }
                        break;

                    case MessageId.G2C_MjCancelTuoguanNotice:
                        if (MaJangPage.Instance)
                        {
                            MaJangPage.Instance.TrusteeshipResult(false, message.mjCancelTuoguanNotice.pos);
                        }
                        break;

                    case MessageId.G2C_UserStateChangeNotice:
                        if (MaJangPage.Instance)
                        {
                            MaJangPage.Instance.SetPlayerStatu(message.UserStateChangeNotice);
                        }
                        break;

                    case MessageId.G2C_DisbandChooiseNotice:
                        JiesanNode.G2C_Vote(message.DisbandChooiseNotice.pos, message.DisbandChooiseNotice.agree);
                        break;

                    case MessageId.G2C_DisbandChooiseResult:
                        if (message.DisbandChooiseResult.disband)
                        {
                            if (message.DisbandChooiseResult.YuePaiTable != null)
                            {
                                NodeManager.OpenNode <CardResultShowNode>().Inits(message.DisbandChooiseResult.YuePaiTable);
                            }
                            else
                            {
                                PageManager.Instance.OpenPage <MainPage>();
                                TipManager.Instance.OpenTip(TipType.SimpleTip, "房间解散成功!");
                            }
                        }
                        else
                        {
                            TipManager.Instance.OpenTip(TipType.SimpleTip, "房间解散失败,有人拒绝解散");
                        }
                        break;

                    case MessageId.G2C_DisbandNotice:
                        NodeManager.OpenNode <JiesanNode>().Inits(message.DisbandNotice.applyPos);
                        break;

                    case MessageId.G2C_DisbandResp:
                        TipManager.Instance.OpenTip(TipType.SimpleTip, "解散申请已发出");
                        break;

                    case MessageId.G2C_UserTalkResp:    //麻将聊天
                        if (MaJangPage.Instance)
                        {
                            MaJangPage.Instance.PlayerChat(message.UserTalkResp);
                        }
                        break;

                    case MessageId.G2C_MjKickPlayerRNotice:    //麻将踢人
                        MaJangPage.Instance.LeaveById(message.mjKickedPlayerNotice.userId, true);
                        break;

                    case MessageId.G2C_MjKickPlayerResp:
                        PageManager.Instance.OpenPage <MainPage>();
                        TipManager.Instance.OpenTip(TipType.SimpleTip, "您被踢出房间");
                        break;

                        #endregion
                        #region 斗地主
                    case MessageId.G2C_EnterDdzRoomResp:    //进房间
                        LandlordsNet.G2C_EnterRoom(message.enterDdzRoomResp);
                        break;

                    case MessageId.G2C_DdzPrepareResp:
                        LandlordsNet.G2C_ZhunbeiResp(message.ddzPrepareResp);
                        break;

                    case MessageId.G2C_PlayerRemovedNotice:    //有玩家强退房间推送
                        for (int i = 0; i < message.playerRemovedNotice.userId.Count; i++)
                        {
                            LandlordsNet.G2C_LeaveRoomResp(message.playerRemovedNotice.userId[i].ToString(), message.playerRemovedNotice.reason);
                        }
                        break;

                    case MessageId.G2C_DdzLeaveRoomResp:    //有玩家退出房间推送
                        LandlordsNet.G2C_LeaveRoomResp(message.ddzLeaveRoomResp.userId.ToString(), 0);
                        break;

                    case MessageId.G2C_DdzKickedPlayerNotice:    //我被踢
                        LandlordsNet.MeKicked();
                        break;

                    case MessageId.G2C_DdzQueryPokerResp:    //记牌器
                        LandlordsPage.Instance.componentView.jipaiqiPanel.InitValue(message.ddzQueryPokerResp.ddzPokerCounter);
                        break;

                    case MessageId.G2C_DdzFaPaiResp:    //发牌推送
                        LandlordsNet.G2C_DealCard(message.ddzFaPaiResp);
                        break;

                    case MessageId.G2C_DdzJiaoFenNotice:    //该我叫分推送
                        LandlordsNet.G2C_MeCallFen();
                        break;

                    case MessageId.G2C_DdzQdzNotice:    //该我叫地主
                        LandlordsNet.G2C_MeCallLandlords();
                        break;

                    case MessageId.G2C_DdzChuPaiNotice:    //该我出牌推送
                        LandlordsNet.G2C_MePop();
                        break;

                    case MessageId.G2C_DdzJiaoFenResp:    //叫分推送
                        LandlordsNet.G2C_PlayerCallResp(message.ddzJiaoFenResp);
                        break;

                    case MessageId.G2C_DdzQdzResp:    //叫分推送
                        LandlordsNet.G2C_PlayerQdzResp(message.ddzQdzResp);
                        break;

                    case MessageId.G2C_DdzChuPaiResp:    //出牌推送
                        LandlordsNet.G2C_PopResp(message.ddzChuPaiResp);
                        break;

                    case MessageId.G2C_DdzTuoguanResp:    //托管推送
                        LandlordsNet.G2C_TuoguanResp(message.ddzTuoguanResp);
                        break;

                    case MessageId.G2C_DdzJieSuanResp:    //结算单局推送
                        LandlordsNet.G2C_Result(message.ddzJieSuanResp);
                        break;

                    case MessageId.G2C_DdzYuePaiResult:    //房卡房总结算
                        //NodeManager.OpenNode<CardResultShowNode>().Inits(message.yuePaiTableResp);
                        break;

                    case MessageId.G2C_DdzReconnectResp:    //断线重连回应
                        if (message.ddzReconnectResp.tnf == 1)
                        {
                            TipManager.Instance.OpenTip(TipType.SimpleTip, "重连斗地主失败,进入大厅");
                            UserInfoModel.userInfo.inDzz = false;
                            break;
                        }
                        StartCoroutine(LandlordsNet.G2C_Reconnect(message.ddzReconnectResp));
                        break;

                    case MessageId.G2C_RemoveCRTable:
                        PageManager.Instance.OpenPage <MainPage>();
                        break;

                    case MessageId.G2C_DdzCanLeaveResp:    //是否可以离开房间响应
                        LandlordsNet.G2C_IsCanLeaveResp(message.ddzCanLeaveResp);
                        break;

                    case MessageId.G2C_DdzJieSanNotice:    //收到有人发起解散
                        if (message.ddzJieSanNotice.userId != UserInfoModel.userInfo.userId)
                        {
                            NodeManager.OpenNode <JiesanNode>().Inits(message.ddzJieSanNotice.userId);
                        }
                        break;

                    case MessageId.G2C_DdzVoteNotice:    //收到有人投票
                        JiesanNode.G2C_Vote(message.ddzVoteNotice.userId, message.ddzVoteNotice.yn);
                        break;

                    case MessageId.G2C_DdzJieSanResp:    //推送解散结果
                        LandlordsNet.G2C_JiesanResult(message.ddzJieSanResp.success);
                        break;

                    case MessageId.G2C_DdzReplaceTableResp:
                        if (message.ddzReplaceTableResp.userId == UserInfoModel.userInfo.userId)
                        {
                            LandlordsModel.Instance.Clear();
                            LandlordsPage.Instance.InitRoom();
                        }
                        else
                        {
                            LandlordsNet.G2C_LeaveRoomResp(message.ddzReplaceTableResp.userId.ToString(), 0);
                        }
                        break;

                    //case MessageId.inva
                    //TipManager.Instance.OpenTip(TipType.ChooseTip, string.Format("您的好友{0}邀请您进入{1}一起玩耍", name, game), 0, () =>
                    //    {
                    //        NodeManager.OpenNode<TipsEnterNode>().Inits();
                    //    });
                    //break;
                    case MessageId.G2C_DdzChatResp:    //聊天
                        LandlordsNet.G2C_ChatResp(message.ddzChatResp);
                        break;

                    case MessageId.G2C_QueryPlayerBaseInfoResp:    //请求玩家信息(弹框)
                        GameRoleInfoNode.SetPlayerInfo(message.playerBaseInfo);
                        break;

                        #endregion
                        #region 喇叭
                    case MessageId.G2C_BroadCastMsg:    //有人发喇叭
                        GameMessage msg = new GameMessage()
                        {
                            type   = message.broadCastMsg.horn.type,
                            sender = message.broadCastMsg.horn.nickname,
                            value  = message.broadCastMsg.horn.content
                        };
                        ChatModel.chatList.Add(msg);
                        if (ChatModel.chatList.Count > ChatModel.MaxChatCount)
                        {
                            ChatModel.chatList[0] = msg;
                            ChatModel.chatList.RemoveAt(ChatModel.chatList.Count - 1);
                        }

                        TrumpetNode trump_node = NodeManager.GetNode <TrumpetNode>();
                        if (trump_node)
                        {
                            trump_node.LoadItem(msg);
                        }
                        NoticeNode.Add(string.Format("{0}:{1}", msg.sender, msg.value));
                        if (message.broadCastMsg.horn.nickname == UserInfoModel.userInfo.nickName)
                        {
                            TipManager.Instance.OpenTip(TipType.SimpleTip, "喇叭发送成功!");
                        }
                        break;

                        #endregion
                    //case MessageId.G2C_InviteFriendYuePaiResp:
                    //  TipManager.Instance.OpenTip(TipType.ChooseTip,"您的好友邀请您进入"+message.inviteFriendYuePaiResp.)
                    //break;
                    default:
                        if (messageId != MessageId.G2C_HeartBeatResp)
                        {
                            UIUtils.Log("未处理的消息id :" + messageId);
                        }
                        break;
                    }
                    #endregion
                }
                else
                {
                    ErrorMessage(message);
                }
            }
            while (!canHandleMessage)
            {
                yield return(new WaitForSecondsRealtime(0.1f));
            }
            yield return(new WaitForSecondsRealtime(0.005f));
        }
    }
 public bool LockAccount(string addressHex)
 {
     return(NodeManager.Post <bool>($"personal_lockAccount", addressHex).Result);
 }
Example #8
0
 void Start()
 {
     nm = GameObject.Find("Canvas").GetComponent<NodeManager>();
 }
 public JsValue ListAccounts()
 {
     return(NodeManager.PostJint($"personal_listAccounts").Result);
 }
Example #10
0
 public string NewAccount(string password)
 {
     return(NodeManager.Post <string>($"personal_newAccount", password).Result);
 }
Example #11
0
    // Use this for initialization
    void Start()
    {
        nodeManager = GetComponent <NodeManager>();

        Camera.main.orthographicSize = GlobalElements.zoomLevel;
    }
Example #12
0
 public object GetTracked() => NodeManager.PostJint(
     "baseline_getTracked").Result;
Example #13
0
 public string Track(string contactAddress) => NodeManager.Post(
     "baseline_track",
     CliParseAddress(contactAddress)).Result;
 public JsValue TraceBlockByNumber(string number, object options)
 {
     return(NodeManager.PostJint("debug_traceBlockByNumber", number, options).Result);
 }
Example #15
0
 public bool UnlockAccount(string addressHex, string password)
 {
     return(NodeManager.Post <bool>($"personal_unlockAccount", addressHex, password).Result);
 }
Example #16
0
    public MapManager(XmlDocument XMLFile)
    {
        XmlNode node = XMLFile["osm"];
        Debug.Log(node.InnerText);

        nm = new NodeManager();
        nodes = new List<Node>();
        ways = new List<Way>();
        trees = new List<Node>();

        // How to traverse nodes in the file
        // (this loops over just the declaration and the root, since they are the only
        // two top-level children of the XmlDocument object)
        foreach (XmlElement cnode in node.ChildNodes)
        {

            if(cnode.LocalName == "node")
            {
                Node tempNode = new Node();
                tempNode.id = long.Parse(cnode.GetAttribute("id"));

                tempNode.changeset = long.Parse(cnode.GetAttribute("changeset"));

                tempNode.lat = double.Parse(cnode.GetAttribute("lat"));

                tempNode.lon = double.Parse(cnode.GetAttribute("lon"));

                tempNode.timestamp = cnode.GetAttribute("timestamp");

                tempNode.uid = long.Parse(cnode.GetAttribute("uid"));

                tempNode.user = cnode.GetAttribute("user");

                tempNode.version = int.Parse(cnode.GetAttribute("version"));

                convertor = new GeoUTMConverter();

                convertor.ToUTM(tempNode.lat,tempNode.lon);

                tempNode.northing = convertor.Y;

                tempNode.easthing = convertor.X;

                XmlNode xmlNode = cnode as XmlNode;

                foreach (XmlElement xmlNodeRef in xmlNode.ChildNodes)
                {
                    if(xmlNodeRef.LocalName == "tag")
                    {
                        string key = xmlNodeRef.GetAttribute("k");
                        string value = xmlNodeRef.GetAttribute("v");

                        if (key.Contains("natural"))
                        {
                            if (value.Contains("tree"))
                            {
                                tempNode.type = NodeType.Tree;
                                trees.Add(tempNode);
                            }
                        }
                    }
                }

                nm.nodes[tempNode.id] = tempNode;

                nodes.Add(tempNode);
            }
            if(cnode.LocalName == "way")
            {
                GeoUTMConverter converter = new GeoUTMConverter();
                XmlNode xmlWay = cnode as XmlNode;
                Way tempWay = new Way();
                tempWay.type = WayType.Residential;
                tempWay.changeset = long.Parse(cnode.GetAttribute("changeset"));
                tempWay.id = long.Parse(cnode.GetAttribute("id"));
                tempWay.timestamp = cnode.GetAttribute("timestamp");
                tempWay.uid = long.Parse(cnode.GetAttribute("uid"));
                tempWay.user = cnode.GetAttribute("user");
                tempWay.version = int.Parse(cnode.GetAttribute("version"));

                bool toAdd = true;
                foreach (XmlElement xmlNodeRef in xmlWay.ChildNodes)
                {
                    if(xmlNodeRef.LocalName == "nd")
                    {
                        long nodeRef = long.Parse(xmlNodeRef.GetAttribute("ref"));
                        Node tempNode = nm.nodes[nodeRef];

                        tempWay.nodes.Add(tempNode);
                    }
                    if(xmlNodeRef.LocalName == "tag")
                    {
                        string key = xmlNodeRef.GetAttribute("k");
                        string value = xmlNodeRef.GetAttribute("v");
                        if(key.Contains("building"))
                        {
                            tempWay.type = WayType.Building;
                        }
                        if(key.Contains("amenity"))
                        {
                            if(value.Contains("parking"))
                                tempWay.type = WayType.Parking;
                        }
                        if(key.Contains ("landuse"))
                        {
                            if(value.Contains("grass"))
                            {
                                tempWay.type = WayType.Park;
                            }
                        }
                        if(key.Contains("highway"))
                        {
                            tempWay.type = WayType.Residential;
                            if(value.Contains("residential"))
                            {
                                tempWay.type = WayType.Residential;
                            }
                            else if(value.Contains("footway"))
                            {
                                tempWay.type = WayType.Footway;
                            }
                            else if(value.Contains("motorway"))
                            {
                                tempWay.type = WayType.Motorway;
                            }
                        }

                        if(key.Contains("leisure"))
                        {
                            if(value.Contains("park"))
                            {
                                tempWay.type = WayType.Park;
                            }
                        }
                        if(key.Contains("waterway"))
                        {
                            if(value.Contains("river"))
                                tempWay.type = WayType.River;
                            if (value.Contains("riverbank"))
                                tempWay.type = WayType.RiverBank;
                        }
                        if(key.Contains("bridge"))
                        {
                            tempWay.height += 3;
                        }
                        if(key.Contains("name"))
                        {
                            tempWay.name = value;
                        }
                        if(key.Contains("height"))
                        {
                            tempWay.height = int.Parse(Regex.Replace(value, "[^-,.0-9]", "")); // Remove everything non-numeric
                        }
                        if(key.Contains("area"))
                        {
                            toAdd = false;
                        }
                        if(key.Contains ("natural"))
                        {
                            if (value.Contains("water"))
                                tempWay.type = WayType.RiverBank;
                        }
                    }

                }

                if(toAdd)
                ways.Add(tempWay);
            }
        }
    }
Example #17
0
 public BigInteger BlockNumber()
 {
     return(NodeManager.Post <BigInteger>("eth_blockNumber").Result);
 }
Example #18
0
 public string TraceBlock(string rlp)
 {
     return(NodeManager.Post("debug_traceBlock", rlp).Result);
 }
Example #19
0
 public string GetBalance(string address, string blockParameter)
 {
     return(NodeManager.Post <string>("eth_getBalance", address, blockParameter).Result);
 }
Example #20
0
 void Start()
 {
     manager = GetComponent <NetGameManager>();
     node    = manager.Node;
 }
Example #21
0
 public int ProtocolVersion()
 {
     return(NodeManager.Post <int>("eth_protocolVersion").Result);
 }
Example #22
0
        private static string GetAnalysisValue(PageInfo pageInfo, int channelId, int contentId, string templateType, string type, string scope, bool isAverage, string style, int addNum, string since, string referrer)
        {
            var publishmentSystemInfo = pageInfo.PublishmentSystemInfo;

            if (publishmentSystemInfo == null)
            {
                return(string.Empty);
            }

            var html = string.Empty;

            var eStyle = publishmentSystemInfo.Additional.TrackerStyle;

            if (!string.IsNullOrEmpty(style))
            {
                eStyle = ETrackerStyleUtils.GetEnumType(style);
            }
            if (string.IsNullOrEmpty(scope) || !StringUtils.EqualsIgnoreCase(scope, ScopeSite))
            {
                scope = ScopePage;
            }
            var eTemplateType = ETemplateTypeUtils.GetEnumType(templateType);

            var accessNum = 0;
            var sinceDate = DateUtils.SqlMinValue;

            if (!string.IsNullOrEmpty(since))
            {
                sinceDate = DateTime.Now.AddHours(-DateUtils.GetSinceHours(since));
            }

            if (StringUtils.EqualsIgnoreCase(type, TypePageView))
            {
                if (StringUtils.EqualsIgnoreCase(scope, ScopePage))
                {
                    if (eTemplateType != ETemplateType.FileTemplate)
                    {
                        accessNum = DataProvider.TrackingDao.GetTotalAccessNumByPageInfo(pageInfo.PublishmentSystemId, channelId, contentId, sinceDate);
                    }
                    else
                    {
                        accessNum = DataProvider.TrackingDao.GetTotalAccessNumByPageUrl(pageInfo.PublishmentSystemId, referrer, sinceDate);
                    }
                }
                else
                {
                    accessNum = DataProvider.TrackingDao.GetTotalAccessNum(pageInfo.PublishmentSystemId, sinceDate);
                    accessNum = accessNum + publishmentSystemInfo.Additional.TrackerPageView;
                }
                if (isAverage)
                {
                    var nodeInfo = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, pageInfo.PublishmentSystemId);
                    var timeSpan = new TimeSpan(DateTime.Now.Ticks - nodeInfo.AddDate.Ticks);
                    if (!string.IsNullOrEmpty(since))
                    {
                        timeSpan = new TimeSpan(DateTime.Now.Ticks - sinceDate.Ticks);
                    }
                    var trackerDays = (timeSpan.Days == 0) ? 1 : timeSpan.Days;//总统计天数
                    trackerDays = trackerDays + publishmentSystemInfo.Additional.TrackerDays;
                    accessNum   = Convert.ToInt32(Math.Round(Convert.ToDouble(accessNum / trackerDays)));
                }
            }
            else if (StringUtils.EqualsIgnoreCase(type, TypeUniqueVisitor))
            {
                if (StringUtils.EqualsIgnoreCase(scope, ScopePage))
                {
                    if (eTemplateType != ETemplateType.FileTemplate)
                    {
                        accessNum = DataProvider.TrackingDao.GetTotalUniqueAccessNumByPageInfo(pageInfo.PublishmentSystemId, channelId, contentId, sinceDate);
                    }
                    else
                    {
                        accessNum = DataProvider.TrackingDao.GetTotalUniqueAccessNumByPageUrl(pageInfo.PublishmentSystemId, referrer, sinceDate);
                    }
                }
                else
                {
                    accessNum = DataProvider.TrackingDao.GetTotalUniqueAccessNum(pageInfo.PublishmentSystemId, sinceDate);
                    accessNum = accessNum + publishmentSystemInfo.Additional.TrackerUniqueVisitor;
                }
                if (isAverage)
                {
                    var nodeInfo    = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, pageInfo.PublishmentSystemId);
                    var timeSpan    = new TimeSpan(DateTime.Now.Ticks - nodeInfo.AddDate.Ticks);
                    var trackerDays = (timeSpan.Days == 0) ? 1 : timeSpan.Days;//总统计天数
                    trackerDays = trackerDays + publishmentSystemInfo.Additional.TrackerDays;
                    accessNum   = Convert.ToInt32(Math.Round(Convert.ToDouble(accessNum / trackerDays)));
                }
            }
            else if (StringUtils.EqualsIgnoreCase(type, TypeCurrentVisitor))
            {
                accessNum = DataProvider.TrackingDao.GetCurrentVisitorNum(pageInfo.PublishmentSystemId, publishmentSystemInfo.Additional.TrackerCurrentMinute);
            }

            accessNum = accessNum + addNum;
            if (accessNum == 0)
            {
                accessNum = 1;
            }

            if (eStyle != ETrackerStyle.None)
            {
                if (eStyle == ETrackerStyle.Number)
                {
                    html = accessNum.ToString();
                }
                else
                {
                    var    numString   = accessNum.ToString();
                    var    htmlBuilder = new StringBuilder();
                    string imgFolder   = $"{SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.Tracker.DirectoryName)}/{ETrackerStyleUtils.GetValue(eStyle)}";
                    foreach (var t in numString)
                    {
                        string imgHtml = $"<img src='{imgFolder}/{t}.gif' align=absmiddle border=0>";
                        htmlBuilder.Append(imgHtml);
                    }
                    html = htmlBuilder.ToString();
                }
            }

            return(html);
        }
Example #23
0
        private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, HtmlSelect selectControl, bool isChannel, string channelIndex, string channelName, int upLevel, int topLevel, string scopeTypeString, string groupChannel, string groupChannelNot, string groupContent, string groupContentNot, string tags, string order, int totalNum, int titleWordNum, string where, string queryString, bool isTop, bool isTopExists, bool isRecommend, bool isRecommendExists, bool isHot, bool isHotExists, bool isColor, bool isColorExists, string displayTitle, bool openWin)
        {
            var parsedContent = string.Empty;

            EScopeType scopeType;

            if (!string.IsNullOrEmpty(scopeTypeString))
            {
                scopeType = EScopeTypeUtils.GetEnumType(scopeTypeString);
            }
            else
            {
                if (isChannel)
                {
                    scopeType = EScopeType.Children;
                }
                else
                {
                    scopeType = EScopeType.Self;
                }
            }

            string orderByString;

            if (isChannel)
            {
                orderByString = StlDataUtility.GetOrderByString(pageInfo.PublishmentSystemId, order, ETableStyle.Channel, ETaxisType.OrderByTaxis);
            }
            else
            {
                orderByString = StlDataUtility.GetOrderByString(pageInfo.PublishmentSystemId, order, ETableStyle.BackgroundContent, ETaxisType.OrderByTaxisDesc);
            }

            var channelID = StlDataUtility.GetNodeIdByLevel(pageInfo.PublishmentSystemId, contextInfo.ChannelID, upLevel, topLevel);

            channelID = StlCacheManager.NodeId.GetNodeIdByChannelIdOrChannelIndexOrChannelName(pageInfo.PublishmentSystemId, channelID, channelIndex, channelName);

            var channel = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, channelID);

            var uniqueID = "Select_" + pageInfo.UniqueId;

            selectControl.ID = uniqueID;

            string scriptHtml;

            if (openWin)
            {
                scriptHtml = $@"
<script language=""JavaScript"" type=""text/JavaScript"">
<!--
function {uniqueID}_jumpMenu(targ,selObj)
{"{"} //v3.0
window.open(selObj.options[selObj.selectedIndex].value);
selObj.selectedIndex=0;
{"}"}
//-->
</script>";
                selectControl.Attributes.Add("onChange", $"{uniqueID}_jumpMenu('parent',this)");
            }
            else
            {
                scriptHtml =
                    $"<script language=\"JavaScript\">function {uniqueID}_jumpMenu(targ,selObj,restore){"{"}eval(targ+\".location='\"+selObj.options[selObj.selectedIndex].value+\"'\");if (restore) selObj.selectedIndex=0;{"}"}</script>";
                selectControl.Attributes.Add("onChange", $"{uniqueID}_jumpMenu('self',this,0)");
            }
            if (!string.IsNullOrEmpty(displayTitle))
            {
                var listitem = new ListItem(displayTitle, PageUtils.UnclickedUrl);
                listitem.Selected = true;
                selectControl.Items.Add(listitem);
            }

            if (isChannel)
            {
                var nodeIdList = StlDataUtility.GetNodeIdList(pageInfo.PublishmentSystemId, channel.NodeId, groupContent, groupContentNot, orderByString, scopeType, groupChannel, groupChannelNot, false, false, totalNum, where);

                if (nodeIdList != null && nodeIdList.Count > 0)
                {
                    foreach (int nodeIDInSelect in nodeIdList)
                    {
                        var nodeInfo = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, nodeIDInSelect);

                        if (nodeInfo != null)
                        {
                            var title = StringUtils.MaxLengthText(nodeInfo.NodeName, titleWordNum);
                            var url   = PageUtility.GetChannelUrl(pageInfo.PublishmentSystemInfo, nodeInfo);
                            if (!string.IsNullOrEmpty(queryString))
                            {
                                url = PageUtils.AddQueryString(url, queryString);
                            }
                            var listitem = new ListItem(title, url);
                            selectControl.Items.Add(listitem);
                        }
                    }
                }
            }
            else
            {
                var dataSource = StlDataUtility.GetContentsDataSource(pageInfo.PublishmentSystemInfo, channelID, contextInfo.ContentID, groupContent, groupContentNot, tags, false, false, false, false, false, false, false, false, 1, totalNum, orderByString, isTopExists, isTop, isRecommendExists, isRecommend, isHotExists, isHot, isColorExists, isColor, where, scopeType, groupChannel, groupChannelNot, null);

                if (dataSource != null)
                {
                    foreach (var dataItem in dataSource)
                    {
                        var contentInfo = new BackgroundContentInfo(dataItem);
                        if (contentInfo != null)
                        {
                            var title = StringUtils.MaxLengthText(contentInfo.Title, titleWordNum);
                            var url   = PageUtility.GetContentUrl(pageInfo.PublishmentSystemInfo, contentInfo);
                            if (!string.IsNullOrEmpty(queryString))
                            {
                                url = PageUtils.AddQueryString(url, queryString);
                            }
                            var listitem = new ListItem(title, url);
                            selectControl.Items.Add(listitem);
                        }
                    }
                }
            }

            parsedContent = scriptHtml + ControlUtils.GetControlRenderHtml(selectControl);

            return(parsedContent);
        }
Example #24
0
        private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, bool isGetUrlFromAttribute, string channelIndex, string channelName, int upLevel, int topLevel, string type, string playUrl, string imageUrl, int width, int height, bool isAutoPlay, bool isControls, bool isPreLoad, bool isLoop)
        {
            var parsedContent = string.Empty;

            var contentId = 0;

            //判断是否地址由标签属性获得
            if (!isGetUrlFromAttribute)
            {
                contentId = contextInfo.ContentId;
            }

            var videoUrl = string.Empty;

            if (!string.IsNullOrEmpty(playUrl))
            {
                videoUrl = playUrl;
            }
            else
            {
                if (contextInfo.ContextType == EContextType.Content)
                {
                    if (contentId != 0)//获取内容视频
                    {
                        if (contextInfo.ContentInfo == null)
                        {
                            videoUrl = BaiRongDataProvider.ContentDao.GetValue(pageInfo.PublishmentSystemInfo.AuxiliaryTableForContent, contentId, type);
                            if (string.IsNullOrEmpty(videoUrl))
                            {
                                if (!StringUtils.EqualsIgnoreCase(type, BackgroundContentAttribute.VideoUrl))
                                {
                                    videoUrl = BaiRongDataProvider.ContentDao.GetValue(pageInfo.PublishmentSystemInfo.AuxiliaryTableForContent, contentId, BackgroundContentAttribute.VideoUrl);
                                }
                            }
                            if (string.IsNullOrEmpty(videoUrl))
                            {
                                if (!StringUtils.EqualsIgnoreCase(type, BackgroundContentAttribute.FileUrl))
                                {
                                    videoUrl = BaiRongDataProvider.ContentDao.GetValue(pageInfo.PublishmentSystemInfo.AuxiliaryTableForContent, contentId, BackgroundContentAttribute.FileUrl);
                                }
                            }
                        }
                        else
                        {
                            videoUrl = contextInfo.ContentInfo.GetExtendedAttribute(type);
                            if (string.IsNullOrEmpty(videoUrl))
                            {
                                videoUrl = contextInfo.ContentInfo.GetExtendedAttribute(BackgroundContentAttribute.VideoUrl);
                            }
                            if (string.IsNullOrEmpty(videoUrl))
                            {
                                videoUrl = contextInfo.ContentInfo.GetExtendedAttribute(BackgroundContentAttribute.FileUrl);
                            }
                        }
                    }
                }
                else if (contextInfo.ContextType == EContextType.Each)
                {
                    videoUrl = contextInfo.ItemContainer.EachItem.DataItem as string;
                }
            }

            if (string.IsNullOrEmpty(imageUrl))
            {
                if (contentId != 0)
                {
                    if (contextInfo.ContentInfo == null)
                    {
                        imageUrl = BaiRongDataProvider.ContentDao.GetValue(pageInfo.PublishmentSystemInfo.AuxiliaryTableForContent, contentId, BackgroundContentAttribute.ImageUrl);
                    }
                    else
                    {
                        imageUrl = contextInfo.ContentInfo.GetExtendedAttribute(BackgroundContentAttribute.ImageUrl);
                    }
                }
            }

            if (string.IsNullOrEmpty(imageUrl))
            {
                var channelId = StlDataUtility.GetNodeIdByLevel(pageInfo.PublishmentSystemId, contextInfo.ChannelId, upLevel, topLevel);
                channelId = StlCacheManager.NodeId.GetNodeIdByChannelIdOrChannelIndexOrChannelName(pageInfo.PublishmentSystemId, channelId, channelIndex, channelName);
                var channel = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, channelId);
                imageUrl = channel.ImageUrl;
            }

            if (!string.IsNullOrEmpty(videoUrl))
            {
                videoUrl = PageUtility.ParseNavigationUrl(pageInfo.PublishmentSystemInfo, videoUrl);
                imageUrl = PageUtility.ParseNavigationUrl(pageInfo.PublishmentSystemInfo, imageUrl);

                pageInfo.AddPageScriptsIfNotExists(PageInfo.JsAcVideoJs);

                parsedContent =
                    $@"<video class=""video-js vjs-default-skin"" src=""{videoUrl}"" width=""{width}"" height=""{height}"" {(isAutoPlay
                        ? "autoplay"
                        : string.Empty)} {(isControls ? "controls" : string.Empty)} {(isPreLoad
                        ? string.Empty
                        : @"preload=""none""")} {(isLoop ? "loop" : string.Empty)} {(string.IsNullOrEmpty(imageUrl)
                        ? string.Empty
                        : $@"poster=""{imageUrl}""")}></video>";
Example #25
0
        private static string ParseImpl(string stlElement, XmlNode node, PageInfo pageInfo, ContextInfo contextInfo, HtmlImage stlImage, bool isGetPicUrlFromAttribute, string channelIndex, string channelName, int no, int upLevel, int topLevel, string type, bool isOriginal, string src, string altSrc)
        {
            var parsedContent = string.Empty;

            var contentId = 0;

            //判断是否图片地址由标签属性获得
            if (!isGetPicUrlFromAttribute)
            {
                contentId = contextInfo.ContentId;
            }
            var contextType = contextInfo.ContextType;

            var picUrl = string.Empty;

            if (!string.IsNullOrEmpty(src))
            {
                picUrl = src;
            }
            else
            {
                if (contextType == EContextType.Undefined)
                {
                    contextType = contentId != 0 ? EContextType.Content : EContextType.Channel;
                }

                if (contextType == EContextType.Content)//获取内容图片
                {
                    var contentInfo = contextInfo.ContentInfo;

                    if (isOriginal)
                    {
                        if (contentInfo != null && contentInfo.ReferenceId > 0 && contentInfo.SourceId > 0)
                        {
                            var targetNodeId = contentInfo.SourceId;
                            var targetPublishmentSystemId   = DataProvider.NodeDao.GetPublishmentSystemId(targetNodeId);
                            var targetPublishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(targetPublishmentSystemId);
                            var targetNodeInfo = NodeManager.GetNodeInfo(targetPublishmentSystemId, targetNodeId);

                            var tableStyle        = NodeManager.GetTableStyle(targetPublishmentSystemInfo, targetNodeInfo);
                            var tableName         = NodeManager.GetTableName(targetPublishmentSystemInfo, targetNodeInfo);
                            var targetContentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, contentInfo.ReferenceId);
                            if (targetContentInfo != null && targetContentInfo.NodeId > 0)
                            {
                                contentInfo = targetContentInfo;
                            }
                        }
                    }

                    if (contentInfo == null)
                    {
                        contentInfo = DataProvider.ContentDao.GetContentInfo(ETableStyle.BackgroundContent, pageInfo.PublishmentSystemInfo.AuxiliaryTableForContent, contentId);
                    }

                    if (contentInfo != null)
                    {
                        if (no <= 1)
                        {
                            picUrl = contentInfo.GetExtendedAttribute(type);
                        }
                        else
                        {
                            var extendAttributeName = ContentAttribute.GetExtendAttributeName(type);
                            var extendValues        = contentInfo.GetExtendedAttribute(extendAttributeName);
                            if (!string.IsNullOrEmpty(extendValues))
                            {
                                var index = 2;
                                foreach (var extendValue in TranslateUtils.StringCollectionToStringList(extendValues))
                                {
                                    if (index == no)
                                    {
                                        picUrl = extendValue;
                                        break;
                                    }
                                    index++;
                                }
                            }
                        }
                    }
                }
                else if (contextType == EContextType.Channel)//获取栏目图片
                {
                    var channelId = StlDataUtility.GetNodeIdByLevel(pageInfo.PublishmentSystemId, contextInfo.ChannelId, upLevel, topLevel);

                    channelId = StlCacheManager.NodeId.GetNodeIdByChannelIdOrChannelIndexOrChannelName(pageInfo.PublishmentSystemId, channelId, channelIndex, channelName);

                    var channel = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, channelId);

                    picUrl = channel.ImageUrl;
                }
                else if (contextType == EContextType.Each)
                {
                    picUrl = contextInfo.ItemContainer.EachItem.DataItem as string;
                }
            }

            if (string.IsNullOrEmpty(picUrl))
            {
                picUrl = altSrc;
            }

            if (!string.IsNullOrEmpty(picUrl))
            {
                var extension = PathUtils.GetExtension(picUrl);
                if (EFileSystemTypeUtils.IsFlash(extension))
                {
                    parsedContent = StlFlash.Parse(stlElement, node, pageInfo, contextInfo);
                }
                else if (EFileSystemTypeUtils.IsPlayer(extension))
                {
                    parsedContent = StlPlayer.Parse(stlElement, node, pageInfo, contextInfo);
                }
                else
                {
                    stlImage.Src  = PageUtility.ParseNavigationUrl(pageInfo.PublishmentSystemInfo, picUrl);
                    parsedContent = ControlUtils.GetControlRenderHtml(stlImage);
                }
            }

            return(parsedContent);
        }
Example #26
0
        public void RegisterNodeProviders()
        {
            MockNodeProvider ProviderOneNode = new MockNodeProvider();

            ProviderOneNode.NodeDescriptions.Add(new MockNodeDescription("Provider One Node One"));

            MockNodeProvider ProviderThreeNodes = new MockNodeProvider();

            ProviderThreeNodes.NodeDescriptions.Add(new MockNodeDescription("Provider Two Node One"));
            ProviderThreeNodes.NodeDescriptions.Add(new MockNodeDescription("Provider Two Node Two"));
            ProviderThreeNodes.NodeDescriptions.Add(new MockNodeDescription("Provider Two Node Three"));

            MockNodeProvider ProviderNoNodes = new MockNodeProvider();

            // Register a node provider with only one node
            NodeManager nodeManager = new NodeManager(1, false, new Engine(@"c:\"));

            nodeManager.RegisterNodeProvider(ProviderOneNode);
            // One from node added by node provider, one for the default 0 local node (null as there is no description)
            Assert.IsTrue(nodeManager.GetNodeDescriptions().Length == 2, "Expected there to be two node Descriptions");
            Assert.AreEqual(2, nodeManager.MaxNodeCount);
            Assert.IsNull(nodeManager.GetNodeDescriptions()[0], "Expected first element to be null");
            Assert.IsTrue(string.Compare(((MockNodeDescription)nodeManager.GetNodeDescriptions()[1]).NodeDescription, "Provider One Node One", StringComparison.OrdinalIgnoreCase) == 0, "Expected node description to be Provider One  Node One");

            // Register a node provider with more than one node
            nodeManager = new NodeManager(1, false, new Engine(@"c:\"));
            nodeManager.RegisterNodeProvider(ProviderThreeNodes);
            // THree from node added by node provider, one for the default 0 local node (null as there is no description)
            Assert.IsTrue(nodeManager.GetNodeDescriptions().Length == 4, "Expected there to be four node Descriptions");
            Assert.AreEqual(4, nodeManager.MaxNodeCount);
            Assert.IsNull(nodeManager.GetNodeDescriptions()[0], "Expected first element to be null");
            Assert.IsTrue(string.Compare(((MockNodeDescription)nodeManager.GetNodeDescriptions()[1]).NodeDescription, "Provider Two Node One", StringComparison.OrdinalIgnoreCase) == 0, "Expected node description to be Provider Two Node One");
            Assert.IsTrue(string.Compare(((MockNodeDescription)nodeManager.GetNodeDescriptions()[2]).NodeDescription, "Provider Two Node Two", StringComparison.OrdinalIgnoreCase) == 0, "Expected node description to be Provider Two Node Two");
            Assert.IsTrue(string.Compare(((MockNodeDescription)nodeManager.GetNodeDescriptions()[3]).NodeDescription, "Provider Two Node Three", StringComparison.OrdinalIgnoreCase) == 0, "Expected node description to be Provider Two Node Three");


            // Register a node provider with more than one node
            nodeManager = new NodeManager(1, false, new Engine(@"c:\"));
            nodeManager.RegisterNodeProvider(ProviderOneNode);
            nodeManager.RegisterNodeProvider(ProviderThreeNodes);
            // THree from node added by node provider, one for the default 0 local node (null as there is no description)
            Assert.IsTrue(nodeManager.GetNodeDescriptions().Length == 5, "Expected there to be four node Descriptions");
            Assert.AreEqual(5, nodeManager.MaxNodeCount);
            Assert.IsNull(nodeManager.GetNodeDescriptions()[0], "Expected first element to be null");
            Assert.IsTrue(string.Compare(((MockNodeDescription)nodeManager.GetNodeDescriptions()[1]).NodeDescription, "Provider One Node One", StringComparison.OrdinalIgnoreCase) == 0, "Expected node description to be Provider One Node One");
            Assert.IsTrue(string.Compare(((MockNodeDescription)nodeManager.GetNodeDescriptions()[2]).NodeDescription, "Provider Two Node One", StringComparison.OrdinalIgnoreCase) == 0, "Expected node description to be Provider Two Node One");
            Assert.IsTrue(string.Compare(((MockNodeDescription)nodeManager.GetNodeDescriptions()[3]).NodeDescription, "Provider Two Node Two", StringComparison.OrdinalIgnoreCase) == 0, "Expected node description to be Provider Two Node Two");
            Assert.IsTrue(string.Compare(((MockNodeDescription)nodeManager.GetNodeDescriptions()[4]).NodeDescription, "Provider Two Node Three", StringComparison.OrdinalIgnoreCase) == 0, "Expected node description to be Provider Two Node Three");


            // Register a node provider with more than one node
            nodeManager = new NodeManager(1, false, new Engine(@"c:\"));
            nodeManager.RegisterNodeProvider(ProviderThreeNodes);
            nodeManager.RegisterNodeProvider(ProviderOneNode);
            nodeManager.UpdateSettings(true, false, true); // just need to test this once
            // THree from node added by node provider, one for the default 0 local node (null as there is no description)
            Assert.IsTrue(nodeManager.GetNodeDescriptions().Length == 5, "Expected there to be four node Descriptions");
            Assert.AreEqual(5, nodeManager.MaxNodeCount);
            Assert.IsNull(nodeManager.GetNodeDescriptions()[0], "Expected first element to be null");
            Assert.IsTrue(string.Compare(((MockNodeDescription)nodeManager.GetNodeDescriptions()[1]).NodeDescription, "Provider Two Node One", StringComparison.OrdinalIgnoreCase) == 0, "Expected node description to be Provider Two Node One");
            Assert.IsTrue(string.Compare(((MockNodeDescription)nodeManager.GetNodeDescriptions()[2]).NodeDescription, "Provider Two Node Two", StringComparison.OrdinalIgnoreCase) == 0, "Expected node description to be Provider Two Node Two");
            Assert.IsTrue(string.Compare(((MockNodeDescription)nodeManager.GetNodeDescriptions()[3]).NodeDescription, "Provider Two Node Three", StringComparison.OrdinalIgnoreCase) == 0, "Expected node description to be Provider Two Node Three");
            Assert.IsTrue(string.Compare(((MockNodeDescription)nodeManager.GetNodeDescriptions()[4]).NodeDescription, "Provider One Node One", StringComparison.OrdinalIgnoreCase) == 0, "Expected node description to be Provider One Node One");
        }
Example #27
0
        private static string ParseImpl(string stlElement, XmlNode node, PageInfo pageInfo, ContextInfo contextInfo, StringDictionary attributes, string leftText, string rightText, string channelIndex, string channelName, int upLevel, int topLevel, string type, string formatString, string separator, int startIndex, int length, int wordNum, string ellipsis, string replace, string to, bool isClearTags, bool isReturnToBr, bool isLower, bool isUpper)
        {
            var parsedContent = string.Empty;

            var channelId = StlDataUtility.GetNodeIdByLevel(pageInfo.PublishmentSystemId, contextInfo.ChannelID, upLevel, topLevel);

            channelId = StlCacheManager.NodeId.GetNodeIdByChannelIdOrChannelIndexOrChannelName(pageInfo.PublishmentSystemId, channelId, channelIndex, channelName);
            var channel = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, channelId);

            if (!string.IsNullOrEmpty(formatString))
            {
                formatString = formatString.Trim();
                if (!formatString.StartsWith("{0"))
                {
                    formatString = "{0:" + formatString;
                }
                if (!formatString.EndsWith("}"))
                {
                    formatString = formatString + "}";
                }
            }

            if (!string.IsNullOrEmpty(type))
            {
                if (type.ToLower().Equals(NodeAttribute.Title.ToLower()))
                {
                    parsedContent = channel.NodeName;

                    if (isClearTags)
                    {
                        parsedContent = StringUtils.StripTags(parsedContent);
                    }

                    if (!string.IsNullOrEmpty(replace))
                    {
                        parsedContent = StringUtils.Replace(replace, parsedContent, to);
                    }

                    if (wordNum == 0 && contextInfo.TitleWordNum > 0)
                    {
                        wordNum = contextInfo.TitleWordNum;
                    }

                    if (!string.IsNullOrEmpty(parsedContent) && wordNum > 0)
                    {
                        parsedContent = StringUtils.MaxLengthText(parsedContent, wordNum, ellipsis);
                    }
                }
                else if (type.ToLower().Equals(NodeAttribute.ChannelIndex.ToLower()))
                {
                    parsedContent = channel.NodeIndexName;

                    if (!string.IsNullOrEmpty(replace))
                    {
                        parsedContent = StringUtils.Replace(replace, parsedContent, to);
                    }

                    if (!string.IsNullOrEmpty(parsedContent) && wordNum > 0)
                    {
                        parsedContent = StringUtils.MaxLengthText(parsedContent, wordNum, ellipsis);
                    }
                }
                else if (type.ToLower().Equals(NodeAttribute.Content.ToLower()))
                {
                    parsedContent = StringUtility.TextEditorContentDecode(channel.Content, pageInfo.PublishmentSystemInfo);

                    if (isClearTags)
                    {
                        parsedContent = StringUtils.StripTags(parsedContent);
                    }

                    if (!string.IsNullOrEmpty(replace))
                    {
                        parsedContent = StringUtils.Replace(replace, parsedContent, to);
                    }

                    if (!string.IsNullOrEmpty(parsedContent) && wordNum > 0)
                    {
                        parsedContent = StringUtils.MaxLengthText(parsedContent, wordNum, ellipsis);
                    }
                }
                else if (type.ToLower().Equals(NodeAttribute.PageContent.ToLower()))
                {
                    if (contextInfo.IsInnerElement || pageInfo.TemplateInfo.TemplateType != ETemplateType.ChannelTemplate)
                    {
                        parsedContent = StringUtility.TextEditorContentDecode(channel.Content, pageInfo.PublishmentSystemInfo);

                        if (isClearTags)
                        {
                            parsedContent = StringUtils.StripTags(parsedContent);
                        }

                        if (!string.IsNullOrEmpty(replace))
                        {
                            parsedContent = StringUtils.Replace(replace, parsedContent, to);
                        }

                        if (!string.IsNullOrEmpty(parsedContent) && wordNum > 0)
                        {
                            parsedContent = StringUtils.MaxLengthText(parsedContent, wordNum, ellipsis);
                        }
                    }
                    else
                    {
                        return(stlElement);
                    }
                }
                else if (type.ToLower().Equals(NodeAttribute.AddDate.ToLower()))
                {
                    parsedContent = DateUtils.Format(channel.AddDate, formatString);
                }
                else if (type.ToLower().Equals(NodeAttribute.ImageUrl.ToLower()))
                {
                    parsedContent = InputParserUtility.GetImageOrFlashHtml(pageInfo.PublishmentSystemInfo, channel.ImageUrl, attributes, false);
                }
                else if (type.ToLower().Equals(NodeAttribute.Id.ToLower()))
                {
                    parsedContent = channelId.ToString();
                }
                else if (StringUtils.StartsWithIgnoreCase(type, StlParserUtility.ItemIndex) && contextInfo.ItemContainer?.ChannelItem != null)
                {
                    var itemIndex = StlParserUtility.ParseItemIndex(contextInfo.ItemContainer.ChannelItem.ItemIndex, type, contextInfo);
                    parsedContent = !string.IsNullOrEmpty(formatString) ? string.Format(formatString, itemIndex) : itemIndex.ToString();
                }
                else if (type.ToLower().Equals(NodeAttribute.CountOfChannels.ToLower()))
                {
                    parsedContent = channel.ChildrenCount.ToString();
                }
                else if (type.ToLower().Equals(NodeAttribute.CountOfContents.ToLower()))
                {
                    parsedContent = channel.ContentNum.ToString();
                }
                else if (type.ToLower().Equals(NodeAttribute.CountOfImageContents.ToLower()))
                {
                    var count = DataProvider.BackgroundContentDao.GetCountCheckedImage(pageInfo.PublishmentSystemId, channel.NodeId);
                    parsedContent = count.ToString();
                }
                else if (type.ToLower().Equals(NodeAttribute.Keywords.ToLower()))
                {
                    parsedContent = channel.Keywords;
                }
                else if (type.ToLower().Equals(NodeAttribute.Description.ToLower()))
                {
                    parsedContent = channel.Description;
                }
                else
                {
                    var attributeName = type;

                    var formCollection = channel.Additional.Attributes;
                    if (formCollection != null && formCollection.Count > 0)
                    {
                        var styleInfo = TableStyleManager.GetTableStyleInfo(ETableStyle.Channel, DataProvider.NodeDao.TableName, attributeName, RelatedIdentities.GetChannelRelatedIdentities(pageInfo.PublishmentSystemId, channel.NodeId));
                        parsedContent = GetValue(attributeName, formCollection, false, styleInfo.DefaultValue);
                        if (!string.IsNullOrEmpty(parsedContent))
                        {
                            parsedContent = InputParserUtility.GetContentByTableStyle(parsedContent, separator, pageInfo.PublishmentSystemInfo, ETableStyle.Channel, styleInfo, formatString, attributes, node.InnerXml, false);
                            parsedContent = StringUtils.ParseString(EInputTypeUtils.GetEnumType(styleInfo.InputType), parsedContent, replace, to, startIndex, length, wordNum, ellipsis, isClearTags, isReturnToBr, isLower, isUpper, formatString);
                        }
                    }
                }

                if (!string.IsNullOrEmpty(parsedContent))
                {
                    parsedContent = leftText + parsedContent + rightText;
                }
            }

            return(parsedContent);
        }
Example #28
0
        private static string ParseImpl(XmlNode node, PageInfo pageInfo, ContextInfo contextInfo, HtmlAnchor stlAnchor, string type, string emptyText, string tipText, int wordNum, bool isDisplayIfEmpty, bool isKeyboard)
        {
            var parsedContent = string.Empty;

            var successTemplateString = string.Empty;
            var failureTemplateString = string.Empty;

            StlParserUtility.GetYesOrNoTemplateString(node, pageInfo, out successTemplateString, out failureTemplateString);

            if (string.IsNullOrEmpty(successTemplateString))
            {
                var nodeInfo = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, contextInfo.ChannelID);

                if (type.ToLower().Equals(Type_PreviousChannel.ToLower()) || type.ToLower().Equals(Type_NextChannel.ToLower()))
                {
                    var taxis         = nodeInfo.Taxis;
                    var isNextChannel = true;
                    if (StringUtils.EqualsIgnoreCase(type, Type_PreviousChannel))
                    {
                        isNextChannel = false;
                    }
                    var siblingNodeID = DataProvider.NodeDao.GetNodeIdByParentIdAndTaxis(nodeInfo.ParentId, taxis, isNextChannel);
                    if (siblingNodeID != 0)
                    {
                        var siblingNodeInfo = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, siblingNodeID);
                        var url             = PageUtility.GetChannelUrl(pageInfo.PublishmentSystemInfo, siblingNodeInfo);
                        if (url.Equals(PageUtils.UnclickedUrl))
                        {
                            stlAnchor.Target = string.Empty;
                        }
                        stlAnchor.HRef = url;

                        if (string.IsNullOrEmpty(node.InnerXml))
                        {
                            stlAnchor.InnerHtml = NodeManager.GetNodeName(pageInfo.PublishmentSystemId, siblingNodeID);
                            if (wordNum > 0)
                            {
                                stlAnchor.InnerHtml = StringUtils.MaxLengthText(stlAnchor.InnerHtml, wordNum);
                            }
                        }
                        else
                        {
                            contextInfo.ChannelID = siblingNodeID;
                            var innerBuilder = new StringBuilder(node.InnerXml);
                            StlParserManager.ParseInnerContent(innerBuilder, pageInfo, contextInfo);
                            stlAnchor.InnerHtml = innerBuilder.ToString();
                        }
                    }
                }
                else if (type.ToLower().Equals(Type_PreviousContent.ToLower()) || type.ToLower().Equals(Type_NextContent.ToLower()))
                {
                    if (contextInfo.ContentID != 0)
                    {
                        var taxis         = contextInfo.ContentInfo.Taxis;
                        var isNextContent = true;
                        if (StringUtils.EqualsIgnoreCase(type, Type_PreviousContent))
                        {
                            isNextContent = false;
                        }
                        var tableStyle       = NodeManager.GetTableStyle(pageInfo.PublishmentSystemInfo, contextInfo.ChannelID);
                        var tableName        = NodeManager.GetTableName(pageInfo.PublishmentSystemInfo, contextInfo.ChannelID);
                        var siblingContentID = BaiRongDataProvider.ContentDao.GetContentId(tableName, contextInfo.ChannelID, taxis, isNextContent);
                        if (siblingContentID != 0)
                        {
                            var siblingContentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, siblingContentID);
                            var url = PageUtility.GetContentUrl(pageInfo.PublishmentSystemInfo, siblingContentInfo);
                            if (url.Equals(PageUtils.UnclickedUrl))
                            {
                                stlAnchor.Target = string.Empty;
                            }
                            stlAnchor.HRef = url;

                            if (isKeyboard)
                            {
                                var keyCode       = isNextContent ? 39 : 37;
                                var scriptContent = new StringBuilder();
                                pageInfo.AddPageScriptsIfNotExists(PageInfo.Components.Jquery);
                                scriptContent.Append($@"<script language=""javascript"" type=""text/javascript""> 
      $(document).keydown(function(event){{
        if(event.keyCode=={keyCode}){{location = '{url}';}}
      }});
</script> 
");
                                var nextOrPrevious = isNextContent ? "nextContent" : "previousContent";
                                pageInfo.SetPageScripts(nextOrPrevious, scriptContent.ToString(), true);
                            }

                            if (string.IsNullOrEmpty(node.InnerXml))
                            {
                                stlAnchor.InnerHtml = siblingContentInfo.Title;
                                if (wordNum > 0)
                                {
                                    stlAnchor.InnerHtml = StringUtils.MaxLengthText(stlAnchor.InnerHtml, wordNum);
                                }
                            }
                            else
                            {
                                var innerBuilder = new StringBuilder(node.InnerXml);
                                contextInfo.ContentID = siblingContentID;
                                StlParserManager.ParseInnerContent(innerBuilder, pageInfo, contextInfo);
                                stlAnchor.InnerHtml = innerBuilder.ToString();
                            }
                        }
                    }
                }

                if (string.IsNullOrEmpty(stlAnchor.HRef))
                {
                    if (isDisplayIfEmpty)
                    {
                        if (!string.IsNullOrEmpty(node.InnerXml))
                        {
                            var innerBuilder = new StringBuilder(node.InnerXml);
                            StlParserManager.ParseInnerContent(innerBuilder, pageInfo, contextInfo);
                            parsedContent = innerBuilder.ToString();
                        }
                        else
                        {
                            parsedContent = emptyText;
                        }
                    }
                    else
                    {
                        parsedContent = emptyText;
                    }
                }
                else
                {
                    parsedContent = ControlUtils.GetControlRenderHtml(stlAnchor);
                }
            }
            else
            {
                var nodeInfo = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, contextInfo.ChannelID);

                var isSuccess      = false;
                var theContextInfo = contextInfo.Clone();

                if (type.ToLower().Equals(Type_PreviousChannel.ToLower()) || type.ToLower().Equals(Type_NextChannel.ToLower()))
                {
                    var taxis         = nodeInfo.Taxis;
                    var isNextChannel = true;
                    if (StringUtils.EqualsIgnoreCase(type, Type_PreviousChannel))
                    {
                        isNextChannel = false;
                    }
                    var siblingNodeID = DataProvider.NodeDao.GetNodeIdByParentIdAndTaxis(nodeInfo.ParentId, taxis, isNextChannel);
                    if (siblingNodeID != 0)
                    {
                        isSuccess = true;
                        theContextInfo.ContextType = EContextType.Channel;
                        theContextInfo.ChannelID   = siblingNodeID;
                    }
                }
                else if (type.ToLower().Equals(Type_PreviousContent.ToLower()) || type.ToLower().Equals(Type_NextContent.ToLower()))
                {
                    if (contextInfo.ContentID != 0)
                    {
                        var taxis         = contextInfo.ContentInfo.Taxis;
                        var isNextContent = true;
                        if (StringUtils.EqualsIgnoreCase(type, Type_PreviousContent))
                        {
                            isNextContent = false;
                        }
                        var tableName        = NodeManager.GetTableName(pageInfo.PublishmentSystemInfo, contextInfo.ChannelID);
                        var siblingContentID = BaiRongDataProvider.ContentDao.GetContentId(tableName, contextInfo.ChannelID, taxis, isNextContent);
                        if (siblingContentID != 0)
                        {
                            isSuccess = true;
                            theContextInfo.ContextType = EContextType.Content;
                            theContextInfo.ContentID   = siblingContentID;
                            theContextInfo.ContentInfo = null;
                        }
                    }
                }

                if (isSuccess)
                {
                    parsedContent = successTemplateString;
                }
                else
                {
                    parsedContent = failureTemplateString;
                }

                if (!string.IsNullOrEmpty(parsedContent))
                {
                    var innerBuilder = new StringBuilder(parsedContent);
                    StlParserManager.ParseInnerContent(innerBuilder, pageInfo, theContextInfo);

                    parsedContent = innerBuilder.ToString();
                }
            }

            parsedContent = tipText + parsedContent;

            return(parsedContent);
        }
Example #29
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (Page.IsPostBack && Page.IsValid)
            {
                var isChanged = false;

                try
                {
                    var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _nodeId);

                    if (NodeIndexNameRow.Visible)
                    {
                        if (!nodeInfo.NodeIndexName.Equals(NodeIndexName.Text) && NodeIndexName.Text.Length != 0)
                        {
                            var nodeIndexNameList = DataProvider.NodeDao.GetNodeIndexNameList(PublishmentSystemId);
                            if (nodeIndexNameList.IndexOf(NodeIndexName.Text) != -1)
                            {
                                FailMessage("栏目修改失败,栏目索引已存在!");
                                return;
                            }
                        }
                    }

                    if (FilePathRow.Visible)
                    {
                        FilePath.Text = FilePath.Text.Trim();
                        if (!nodeInfo.FilePath.Equals(FilePath.Text) && FilePath.Text.Length != 0)
                        {
                            if (!DirectoryUtils.IsDirectoryNameCompliant(FilePath.Text))
                            {
                                FailMessage("栏目页面路径不符合系统要求!");
                                return;
                            }

                            if (PathUtils.IsDirectoryPath(FilePath.Text))
                            {
                                FilePath.Text = PageUtils.Combine(FilePath.Text, "index.html");
                            }

                            var filePathArrayList = DataProvider.NodeDao.GetAllFilePathByPublishmentSystemId(PublishmentSystemId);
                            if (filePathArrayList.IndexOf(FilePath.Text) != -1)
                            {
                                FailMessage("栏目修改失败,栏目页面路径已存在!");
                                return;
                            }
                        }
                    }

                    if (channelControl.Visible)
                    {
                        var extendedAttributes = new ExtendedAttributes();
                        var relatedIdentities  = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, _nodeId);
                        InputTypeParser.AddValuesToAttributes(ETableStyle.Channel, DataProvider.NodeDao.TableName, PublishmentSystemInfo, relatedIdentities, Request.Form, extendedAttributes.Attributes);
                        if (extendedAttributes.Attributes.Count > 0)
                        {
                            nodeInfo.Additional.SetExtendedAttribute(extendedAttributes.Attributes);
                        }
                    }

                    if (NodeNameRow.Visible)
                    {
                        nodeInfo.NodeName = NodeName.Text;
                    }
                    if (NodeIndexNameRow.Visible)
                    {
                        nodeInfo.NodeIndexName = NodeIndexName.Text;
                    }
                    if (FilePathRow.Visible)
                    {
                        nodeInfo.FilePath = FilePath.Text;
                    }

                    if (NodeGroupNameCollectionRow.Visible)
                    {
                        var list = new ArrayList();
                        foreach (ListItem item in NodeGroupNameCollection.Items)
                        {
                            if (item.Selected)
                            {
                                list.Add(item.Value);
                            }
                        }
                        nodeInfo.NodeGroupNameCollection = TranslateUtils.ObjectCollectionToString(list);
                    }
                    if (ImageUrlRow.Visible)
                    {
                        nodeInfo.ImageUrl = tbImageUrl.Text;
                    }
                    if (ContentRow.Visible)
                    {
                        nodeInfo.Content = StringUtility.TextEditorContentEncode(Request.Form[NodeAttribute.Content], PublishmentSystemInfo, PublishmentSystemInfo.Additional.IsSaveImageInTextEditor);
                    }
                    if (Keywords.Visible)
                    {
                        nodeInfo.Keywords = Keywords.Text;
                    }
                    if (Description.Visible)
                    {
                        nodeInfo.Description = Description.Text;
                    }



                    if (LinkUrlRow.Visible)
                    {
                        nodeInfo.LinkUrl = LinkUrl.Text;
                    }
                    if (LinkTypeRow.Visible)
                    {
                        nodeInfo.LinkType = ELinkTypeUtils.GetEnumType(LinkType.SelectedValue);
                    }
                    if (ChannelTemplateIDRow.Visible)
                    {
                        nodeInfo.ChannelTemplateId = (ChannelTemplateID.Items.Count > 0) ? int.Parse(ChannelTemplateID.SelectedValue) : 0;
                    }
                    if (ContentTemplateIDRow.Visible)
                    {
                        nodeInfo.ContentTemplateId = (ContentTemplateID.Items.Count > 0) ? int.Parse(ContentTemplateID.SelectedValue) : 0;
                    }

                    DataProvider.NodeDao.UpdateNodeInfo(nodeInfo);

                    Body.AddSiteLog(PublishmentSystemId, _nodeId, 0, "修改栏目", $"栏目:{nodeInfo.NodeName}");

                    isChanged = true;
                }
                catch (Exception ex)
                {
                    FailMessage(ex, $"栏目修改失败:{ex.Message}");
                    LogUtils.AddErrorLog(ex);
                }

                if (isChanged)
                {
                    CreateManager.CreateChannel(PublishmentSystemId, _nodeId);

                    if (string.IsNullOrEmpty(_returnUrl))
                    {
                        PageUtils.CloseModalPage(Page);
                    }
                    else
                    {
                        PageUtils.CloseModalPageAndRedirect(Page, _returnUrl);
                    }
                }
            }
        }
 public JsValue TraceBlock(string rlp, object options)
 {
     return(NodeManager.PostJint("debug_traceBlock", rlp, options).Result);
 }
Example #31
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID", "NodeID", "ReturnUrl");
            _nodeId    = Body.GetQueryInt("NodeID");
            _returnUrl = StringUtils.ValueFromUrl(Body.GetQueryString("ReturnUrl"));

            channelControl = (ChannelAuxiliaryControl)FindControl("ControlForAuxiliary");
            if (!IsPostBack)
            {
                if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ChannelEdit))
                {
                    PageUtils.RedirectToErrorPage("您没有修改栏目的权限!");
                    return;
                }

                var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _nodeId);
                if (nodeInfo != null)
                {
                    if (nodeInfo.NodeType == ENodeType.BackgroundPublishNode)
                    {
                        LinkUrlRow.Visible           = false;
                        LinkTypeRow.Visible          = false;
                        ChannelTemplateIDRow.Visible = false;
                        FilePathRow.Visible          = false;
                    }

                    btnSubmit.Attributes.Add("onclick", "if (UE && UE.getEditor('Content', {{allowDivTransToP: false}})){ UE.getEditor('Content', {{allowDivTransToP: false}}).sync(); }");

                    if (!string.IsNullOrEmpty(PublishmentSystemInfo.Additional.ChannelEditAttributes))
                    {
                        var channelEditAttributes = TranslateUtils.StringCollectionToStringList(PublishmentSystemInfo.Additional.ChannelEditAttributes);
                        if (channelEditAttributes.Count > 0)
                        {
                            NodeNameRow.Visible = NodeIndexNameRow.Visible = LinkUrlRow.Visible = NodeGroupNameCollectionRow.Visible = LinkTypeRow.Visible = ChannelTemplateIDRow.Visible = ContentTemplateIDRow.Visible = ImageUrlRow.Visible = FilePathRow.Visible = ContentRow.Visible = KeywordsRow.Visible = DescriptionRow.Visible = false;
                            foreach (string attribute in channelEditAttributes)
                            {
                                if (attribute == NodeAttribute.ChannelName)
                                {
                                    NodeNameRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.ChannelIndex)
                                {
                                    NodeIndexNameRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.LinkUrl)
                                {
                                    LinkUrlRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.ChannelGroupNameCollection)
                                {
                                    NodeGroupNameCollectionRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.LinkType)
                                {
                                    LinkTypeRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.ChannelTemplateId)
                                {
                                    ChannelTemplateIDRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.ContentTemplateId)
                                {
                                    ContentTemplateIDRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.ImageUrl)
                                {
                                    ImageUrlRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.FilePath)
                                {
                                    FilePathRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.Content)
                                {
                                    ContentRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.Keywords)
                                {
                                    KeywordsRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.Description)
                                {
                                    DescriptionRow.Visible = true;
                                }
                            }
                        }
                    }

                    if (channelControl.Visible)
                    {
                        //List<string> displayAttributes = null;
                        //if (!string.IsNullOrEmpty(PublishmentSystemInfo.Additional.ChannelEditAttributes))
                        //{
                        //    displayAttributes = TranslateUtils.StringCollectionToStringList(PublishmentSystemInfo.Additional.ChannelEditAttributes);
                        //}
                        channelControl.SetParameters(nodeInfo.Additional.Attributes, true, IsPostBack);
                    }

                    if (LinkTypeRow.Visible)
                    {
                        ELinkTypeUtils.AddListItems(LinkType);
                    }

                    if (NodeGroupNameCollectionRow.Visible)
                    {
                        NodeGroupNameCollection.DataSource = DataProvider.NodeGroupDao.GetDataSource(PublishmentSystemId);
                    }
                    if (ChannelTemplateIDRow.Visible)
                    {
                        ChannelTemplateID.DataSource = DataProvider.TemplateDao.GetDataSourceByType(PublishmentSystemId, ETemplateType.ChannelTemplate);
                    }
                    if (ContentTemplateIDRow.Visible)
                    {
                        ContentTemplateID.DataSource = DataProvider.TemplateDao.GetDataSourceByType(PublishmentSystemId, ETemplateType.ContentTemplate);
                    }

                    DataBind();

                    if (ChannelTemplateIDRow.Visible)
                    {
                        ChannelTemplateID.Items.Insert(0, new ListItem("<未设置>", "0"));
                        ControlUtils.SelectListItems(ChannelTemplateID, nodeInfo.ChannelTemplateId.ToString());
                    }

                    if (ContentTemplateIDRow.Visible)
                    {
                        ContentTemplateID.Items.Insert(0, new ListItem("<未设置>", "0"));
                        ControlUtils.SelectListItems(ContentTemplateID, nodeInfo.ContentTemplateId.ToString());
                    }

                    if (NodeNameRow.Visible)
                    {
                        NodeName.Text = nodeInfo.NodeName;
                    }
                    if (NodeIndexNameRow.Visible)
                    {
                        NodeIndexName.Text = nodeInfo.NodeIndexName;
                    }
                    if (LinkUrlRow.Visible)
                    {
                        LinkUrl.Text = nodeInfo.LinkUrl;
                    }

                    if (NodeGroupNameCollectionRow.Visible)
                    {
                        foreach (ListItem item in NodeGroupNameCollection.Items)
                        {
                            if (CompareUtils.Contains(nodeInfo.NodeGroupNameCollection, item.Value))
                            {
                                item.Selected = true;
                            }
                            else
                            {
                                item.Selected = false;
                            }
                        }
                    }
                    if (FilePathRow.Visible)
                    {
                        FilePath.Text = nodeInfo.FilePath;
                    }

                    if (LinkTypeRow.Visible)
                    {
                        ControlUtils.SelectListItems(LinkType, ELinkTypeUtils.GetValue(nodeInfo.LinkType));
                    }

                    if (ImageUrlRow.Visible)
                    {
                        tbImageUrl.Text             = nodeInfo.ImageUrl;
                        ltlImageUrlButtonGroup.Text = ControlUtility.GetImageUrlButtonGroupHtml(PublishmentSystemInfo, tbImageUrl.ClientID);
                    }
                    if (ContentRow.Visible)
                    {
                        var formCollection = new NameValueCollection();
                        formCollection[NodeAttribute.Content] = nodeInfo.Content;
                        Content.SetParameters(PublishmentSystemInfo, NodeAttribute.Content, formCollection, true, IsPostBack);

                        //this.Content.PublishmentSystemID = base.PublishmentSystemID;
                        //this.Content.Text = StringUtility.TextEditorContentDecode(nodeInfo.Content, ConfigUtils.Instance.ApplicationPath, base.PublishmentSystemInfo.PublishmentSystemUrl);
                    }
                    if (Keywords.Visible)
                    {
                        Keywords.Text = nodeInfo.Keywords;
                    }
                    if (Description.Visible)
                    {
                        Description.Text = nodeInfo.Description;
                    }
                }
            }
            else
            {
                if (channelControl.Visible)
                {
                    channelControl.SetParameters(Request.Form, true, IsPostBack);
                }
            }
        }
 void Start()
 {
     nodeMan = GameObject.Find ("UIManager").GetComponent<NodeManager> ();
 }
 private void Start()
 {
     nodeManager = FindObjectOfType <NodeManager>();
 }
Example #34
0
        public static void LoadSystemConfig()
        {
            Execution.initInstrumentation();
            DataFlow = new DataFlowManager();
            Elements = new ElementManager();
            Nodes = new NodeManager();
            OutputControllers = new OutputControllerManager(
                new ControllerLinkingManagement<OutputController>(),
                new OutputDeviceCollection<OutputController>(),
                new OutputDeviceExecution<OutputController>());
            SmartOutputControllers = new SmartOutputControllerManager(
                new ControllerLinkingManagement<SmartOutputController>(),
                new OutputDeviceCollection<SmartOutputController>(),
                new OutputDeviceExecution<SmartOutputController>());
            Previews = new PreviewManager(
                new OutputDeviceCollection<OutputPreview>(),
                new OutputDeviceExecution<OutputPreview>());
            Contexts = new ContextManager();
            Filters = new FilterManager(DataFlow);
            ControllerLinking = new ControllerLinker();
            ControllerManagement = new ControllerFacade();
            ControllerManagement.AddParticipant(OutputControllers);
            ControllerManagement.AddParticipant(SmartOutputControllers);
            OutputDeviceManagement = new OutputDeviceFacade();
            OutputDeviceManagement.AddParticipant(OutputControllers);
            OutputDeviceManagement.AddParticipant(SmartOutputControllers);
            OutputDeviceManagement.AddParticipant(Previews);

            // Load system data in order of dependency.
            // The system data generally resides in the data branch, but it
            // may not be in the case of an alternate context.
            string systemDataPath = _GetSystemDataPath();
            // Load module data before system config.
            // System config creates objects that use modules that have data in the store.
            ModuleStore = _LoadModuleStore(systemDataPath) ?? new ModuleStore();
            SystemConfig = _LoadSystemConfig(systemDataPath) ?? new SystemConfig();

            Elements.AddElements(SystemConfig.Elements);
            Nodes.AddNodes(SystemConfig.Nodes);
            OutputControllers.AddRange(SystemConfig.OutputControllers.Cast<OutputController>());
            SmartOutputControllers.AddRange(SystemConfig.SmartOutputControllers.Cast<SmartOutputController>());
            Previews.AddRange(SystemConfig.Previews.Cast<OutputPreview>());
            ControllerLinking.AddRange(SystemConfig.ControllerLinking);
            Filters.AddRange(SystemConfig.Filters);

            DataFlow.Initialize(SystemConfig.DataFlow);
        }
Example #35
0
 void Awake()
 {
     Instance = this;
 }