Ejemplo n.º 1
0
        protected void Application_Start(object sender, EventArgs e)
        {
            AreaRegistration.RegisterAllAreas();

            // Тестировщик запросов к БД
            HibernatingRhinos.Profiler.Appender.EntityFramework.EntityFrameworkProfiler.Initialize();

            GlobalConfiguration.Configure(WebApiConfig.Register);

            // регистрация глобальных фильтров
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);

            // регистратор маршрутов
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            // хранилище ролей
            RoleConfig.RepositoryRoles();

            OpcPoller   = new OpcPoller();
            AlarmServer = new AlarmServer();
            Trends      = new Trend();
            OpcPoller.Init();
            if (AlarmServer.Init())
            {
                AlarmServer.Run();
            }
        }
Ejemplo n.º 2
0
        private void SetTalkInfo(LogInfo logInfo)
        {
            m_pl_oneLine.gameObject.SetActive(false);
            m_pl_talk.gameObject.SetActive(true);

            m_img_name_Image.enabled = true;
            m_lbl_name_TextMeshProUGUI.gameObject.SetActive(false);
            string artNameKey = RoleConfig.GetConfigByKey(logInfo.Name)?.artNameKey;

            if (artNameKey == null)
            {
                artNameKey = logInfo.Name;
            }
            PrefabManager.Instance.SetImage(m_img_name_Image, artNameKey, () =>
            {
                m_img_name_Image.enabled = false;
//                m_lbl_name_TextMeshProUGUI.gameObject.SetActive(true);
//                m_lbl_name_TextMeshProUGUI.text = artNameKey;
            });

            m_lbl_name_TextMeshProUGUI.text    = logInfo.Name;
            m_lbl_content_TextMeshProUGUI.text = logInfo.Content;

            LayoutRebuilder.ForceRebuildLayoutImmediate(m_pl_talk);
            m_itemSize = m_pl_talk.rect.height;
        }
        private void SetTalkInfo(LogInfo logInfo)
        {
            m_pl_oneLine.gameObject.SetActive(false);
            m_pl_talk.gameObject.SetActive(true);

            m_img_name_Image.enabled = true;
            m_lbl_name_TextMeshProUGUI.gameObject.SetActive(false);
            string artNameKey = RoleConfig.GetConfigByKey(logInfo.Name)?.artNameKey;

            if (!string.IsNullOrEmpty(artNameKey))
            {
                PrefabManager.Instance.SetImage(m_img_name_Image, artNameKey, () =>
                {
                    m_img_name_Image.enabled = false;
                    m_lbl_name_TextMeshProUGUI.gameObject.SetActive(true);
                    m_lbl_name_TextMeshProUGUI.text = logInfo.Name;
                });
            }
            else
            {
                m_img_name_Image.enabled = false;
                m_lbl_name_TextMeshProUGUI.gameObject.SetActive(true);
                m_lbl_name_TextMeshProUGUI.text = logInfo.Name;
            }

            m_lbl_name_TextMeshProUGUI.text    = logInfo.Name;
            m_lbl_content_TextMeshProUGUI.text = logInfo.Content;
            LayoutRebuilder.ForceRebuildLayoutImmediate(m_pl_talk);

            m_itemSize = m_lbl_content_TextMeshProUGUI.preferredHeight + m_img_name_Image.rectTransform.rect.height;
        }
Ejemplo n.º 4
0
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            bool authorized = base.AuthorizeCore(httpContext);

            // если не аутентифицирован
            if (!authorized)
            {
                return(false);
            }

            // логин
            var username = httpContext.User.Identity.Name;

            // данные маршрута
            var routeData = httpContext.Request.RequestContext.RouteData;

            // контроллер
            var controller = routeData.GetRequiredString("controller");

            // метод
            var action = routeData.GetRequiredString("action");

            // список всех ролей (загружен при старте приложения)
            var roles = RoleConfig.GetAllRoles();

            // проверяем права доступа
            return(account.HasAccess(controller, action, username, roles));
        }
Ejemplo n.º 5
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     RoleConfig.RegisterRoles();
     BundleConfig.RegisterBundles(BundleTable.Bundles);
 }
Ejemplo n.º 6
0
    //protected virtual void Awake()
    //{

    //}

    //protected virtual void Start()
    public void Init(uint RoleID)
    {
        tp = gameObject.GetComponentInChildren <TweenPosition>(true);
        MyTools.DestroyChildNodes(tp.transform);

        RoleID = Math.Max(RoleID, 1);
        RoleConfig rc = null;

        if (CsvConfigTables.Instance.RoleCsvDic.TryGetValue((int)RoleID, out rc))
        {
            GameObject model = Resources.Load <GameObject>("Prefabs/Actor/" + rc.ModelName);
            if (model != null)
            {
                GameObject obj = GameObject.Instantiate(model);
                obj.transform.parent           = tp.transform;
                obj.transform.localPosition    = Vector3.zero;
                obj.transform.localEulerAngles = Vector3.zero;
                obj.transform.localScale       = Vector3.one * 2;
            }
        }
        else
        {
            Debug.LogError("ChessPieces::Start 角色ID未设置!");
        }
    }
Ejemplo n.º 7
0
        private void SetNameContent(string name)
        {
            m_nameTxt.gameObject.SetActive(false);
            m_curRoleInfo = RoleConfig.GetConfigByKey(name);
            string artNameKey = "";

            if (m_curRoleInfo != null)
            {
                artNameKey = m_curRoleInfo.artNameKey;
            }
            if (!string.IsNullOrEmpty(artNameKey))
            {
                m_name.enabled = true;
                PrefabManager.Instance.SetImage(m_name, artNameKey, () =>
                {
                    m_name.enabled = false;
//                    m_nameTxt.gameObject.SetActive(true);
//                    m_nameTxt.text = name;
                });
            }
            else
            {
                m_name.enabled = false;
            }

            ResetContentText();
            SetActionState(ActionState.End);
        }
        public ActionResult Delete(DeleteContentTypeViewModel model)
        {
            // валидация модели
            if (ModelState.IsValid)
            {
                // удаление
                if (contenttype.DeleteContentType(model.contenttypes))
                {
                    // обновляем хранилище ролей
                    RoleConfig.RepositoryRoles();

                    // лог
                    logging.Logged(
                        "Info"
                        , "Пользователь " + User.Identity.Name + " удалил тип(ы) контента: '" + string.Join(", ", model.contenttypes.Select(x => x.Name.ToString()).ToArray())
                        , this.GetType().Namespace
                        , this.GetType().Name
                        );

                    return(Json(new { result = "Redirect", url = Url.Action("Index", "ContentType") }));
                }
            }

            ModelState.AddModelError("", "Ошибка, пожалуйста проверьте данные");

            return(PartialView(model));
        }
Ejemplo n.º 9
0
    public void Set(FriendInfo fi)
    {
        CurFI = fi;

        Name.text = CurFI.Name;

        int        RoleID = Math.Max(fi.RoleID, 1);
        RoleConfig rc     = null;

        if (CsvConfigTables.Instance.RoleCsvDic.TryGetValue(RoleID, out rc))
        {
            HeadPortrait.spriteName = rc.Portrait;
        }

        StageConfig sc = null;

        CsvConfigTables.Instance.StageCsvDic.TryGetValue(CurFI.StageProgress, out sc);
        if (sc != null)
        {
            ChapterConfig cc = null;
            CsvConfigTables.Instance.ChapterCsvDic.TryGetValue(sc.ChapterID, out cc);

            GroupConfig gc = null;
            CsvConfigTables.Instance.GroupCsvDic.TryGetValue(sc.GroupID, out gc);
            if (cc != null && gc != null)
            {
                Stage.text = StringBuilderTool.ToInfoString(cc.Name, "-", gc.Name, "-", sc.Name);
            }
        }
    }
Ejemplo n.º 10
0
        public ActionResult Delete(DeleteRoleViewModel model)
        {
            if (ModelState.IsValid)
            {
                // удаление роли
                if (account.DeleteRole(model.roles))
                {
                    // обновляем хранилище ролей
                    RoleConfig.RepositoryRoles();

                    // лог
                    logging.Logged(
                        "Info"
                        , "Пользователь '" + User.Identity.Name + "' удалил роль(и): " + string.Join(", ", model.roles.Select(x => x.Name.ToString()).ToArray())
                        , this.GetType().Namespace
                        , this.GetType().Name
                        );

                    return(Json(new { result = "Redirect", url = Url.Action("Group", "System") }));
                }
                else
                {
                    ModelState.AddModelError("", "Не удалось удалить объекты");
                }
            }
            else
            {
                ModelState.AddModelError("", "Ошибка, пожалуйста проверьте данные");
            }

            return(PartialView(model));
        }
Ejemplo n.º 11
0
        private void SetNameContent(string name)
        {
            m_lbl_name_TextMeshProUGUI.gameObject.SetActive(false);
            m_curRoleInfo = RoleConfig.GetConfigByKey(name);
            string artNameKey = null;

            if (m_curRoleInfo != null)
            {
                artNameKey = m_curRoleInfo.artNameKey;
            }
            //TODO:注释艺术字监狱岛记得改回来
            if (false)
            {
                m_img_artName_Image.enabled = true;
                PrefabManager.Instance.SetImage(m_img_artName_Image, artNameKey, () =>
                {
                    m_img_artName_Image.enabled = false;
                    m_lbl_name_TextMeshProUGUI.gameObject.SetActive(true);
                    m_lbl_name_TextMeshProUGUI.text = name;
                });
            }
            else
            {
                m_img_artName_Image.enabled = false;
                m_lbl_name_TextMeshProUGUI.gameObject.SetActive(true);
                m_lbl_name_TextMeshProUGUI.text = name;
            }
            ActiveTalkerTachie(name);
            ResetContentText();
            SetActionState(ActionState.End);
        }
Ejemplo n.º 12
0
        public override void PreInitialize()
        {
#if !WITHOUTLDAP
            Configuration.Modules.ZeroLdap().Enable(typeof(LdapAuthenticationSource));
#endif
            Configuration.Auditing.IsEnabledForAnonymousUsers = false;

            //Declare entity types
            Configuration.Modules.Zero().EntityTypes.Tenant = typeof(Tenant);
            Configuration.Modules.Zero().EntityTypes.Role = typeof(Role);
            Configuration.Modules.Zero().EntityTypes.User = typeof(User);

            //Add/remove localization sources here
            Configuration.Localization.Sources.Add(
                new DictionaryBasedLocalizationSource(
                    CoreConsts.LocalizationSourceName,
                    new XmlEmbeddedFileLocalizationDictionaryProvider(
                        Assembly.GetExecutingAssembly(),
                        "Portal.Core.Localization.Source"
                        )
                    )
                );

            RoleConfig.Configure(Configuration.Modules.Zero().RoleManagement);
            Configuration.Authorization.Providers.Add <AppAuthorizationProvider>();
            Configuration.Settings.Providers.Add <AppSettingProvider>();
        }
Ejemplo n.º 13
0
 public virtual void Awake()
 {
     cc        = this.gameObject.GetComponent <CharacterController>();
     actorBuff = this.gameObject.AddComponent <ActorBuff>();
     roleData  = new RoleData(RoleConfig.GetRoleDataById(this.roleId));
     roleData.SetCtrl(this);
     anim = GetComponent <Animator>();
 }
Ejemplo n.º 14
0
        public RoleConfigTests()
        {
            _pockyUserRepository = Substitute.For <IPockyUserRepository>();
            _chatHelper          = Substitute.For <IChatHelper>();
            _chatHelper.People.Returns(Substitute.For <IPersonHandler>());

            _subject = new RoleConfig(_pockyUserRepository, _chatHelper);
        }
Ejemplo n.º 15
0
        public void RefreshRole(string petName)
        {
            base.PetName = !string.IsNullOrEmpty(petName) ? petName : LocalPetInfoAgent.getCurrentPet();
            string newPath = RoleConfig.GetGuestPath(base.PetName);

            this.LoadPrefab(newPath);
            this.RemoveLight();//小宠物的主人fbx和客人fbx合并后,交友时,需要把客人身上的灯光关掉
        }
Ejemplo n.º 16
0
    public override bool init()
    {
        _engine        = SolaEngine.getInstance();
        _roleCfg       = ((List <RoleConfig>)_engine.getCfg(RoleConfigData.NAME)) [0];
        _createRoleCfg = ((List <CreateRoleConfig>)_engine.getCfg(CreateRoleConfigData.NAME)) [0];

        return(true);
    }
        public static bool IsAccess(string username, string controller, string action)
        {
            // список всех ролей (загружен при старте приложения)
            var roles = RoleConfig.GetAllRoles();

            // проверяем, есть ли доступ к контенту
            return(account.HasAccess(controller, action, username, roles));
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 查询角色
        /// </summary>
        /// <param name="request"></param>
        /// <param name="response"></param>
        public void QueryRoleInfo(RoleConfig request, RoleConfigResponse response)
        {
            var list = _roleRepository.QueryRoleInfo(request.RoleNo);

            response.QueryData = new Report {
                total = list.Count, rows = list
            };
            response.ResponseStatus.ErrorCode = "OK";
        }
Ejemplo n.º 19
0
    public void UpdateUI_ChangeRoleID(uint roleID)
    {
        RoleConfig rc = null;

        if (CsvConfigTables.Instance.RoleCsvDic.TryGetValue((int)RecordPD.RoleID, out rc))
        {
            HeadPortrait.spriteName = (useBigHeadPortrait ? rc.PortraitEx : rc.Portrait);
        }
    }
Ejemplo n.º 20
0
        public ActionResult Register()
        {
            RegisterViewModel model = new RegisterViewModel();

            // добавляем в модель
            model.Roles = RoleConfig.GetAllRoles();

            return(PartialView(model));
        }
Ejemplo n.º 21
0
 public void AddBuildingConf(RoleConfig conf)
 {
     //	Debug.LogError ("conf.id" + conf.id);
     if (Confs.ContainsKey(conf.Id))
     {
         return;
     }
     Confs.Add(conf.Id, conf);
 }
Ejemplo n.º 22
0
        public ActionResult QueryPrRoleConfig(string searchRoleId)
        {
            RoleConfig request = new RoleConfig
            {
                RequestType = 0,
                RoleNo      = searchRoleId
            };
            string response = WeChatHelper.PostService("RoleConfig", request);

            return(JavaScript(response));
        }
Ejemplo n.º 23
0
 public override Task <TypeReaderResult> ReadAsync(ICommandContext context, string input, IServiceProvider services)
 {
     if (RoleConfig.FromString(input, out RoleConfig config))
     {
         return(Task.FromResult(TypeReaderResult.FromSuccess(config)));
     }
     else
     {
         return(Task.FromResult(TypeReaderResult.FromError(CommandError.ParseFailed, $"`{input}` is not a valid role configuration")));
     }
 }
Ejemplo n.º 24
0
    private static void Add_Item(ReadStream rs)
    {
        int
            id =

            rs.ReadInt();



        string
            name =

            rs.ReadString();



        string
            res =

            rs.ReadString();



        string
            path =

            rs.ReadString();



        int
            version =

            rs.ReadInt();



        int
            mtype =

            rs.ReadInt();


        RoleConfig new_obj_RoleConfig = new RoleConfig(id, name, res, path, version, mtype);

        if (dic.ContainsKey(id))
        {
            LogWarning("duplicate key: " + id);
            return;
        }

        dic.Add(id, new_obj_RoleConfig);
        array.Add(new_obj_RoleConfig);
    }
Ejemplo n.º 25
0
        public ActionResult DeletePrRoleConfig(IEnumerable <string> ids)
        {
            RoleConfig request = new RoleConfig
            {
                RequestType = 3,
                RoleNo      = ids.First()
            };
            RoleConfigResponse response = WeChatHelper.PostService <RoleConfig, RoleConfigResponse>("RoleConfig", request);

            return(Json(response, JsonRequestBehavior.DenyGet));
        }
Ejemplo n.º 26
0
        public void AddRole(RoleConfig request, RoleConfigResponse response)
        {
            ValidRequest(request, new RoleConfigVaildator(), ruleSet: "Add");
            //验证角色编号是否重复
            var rolsConfigs = _roleRepository.QueryRoleInfo();

            if (rolsConfigs.Any(i => i.ROLENO == request.RoleNo))
            {
                throw new Utility.WeChatException("ROLE_ADD_ERROR", "角色编号已存在");
            }
            _roleRepository.InsertRole(request.RoleNo, request.RoleName, request.CurrOper, request.Remark);
            response.ResponseStatus.ErrorCode = "OK";
        }
Ejemplo n.º 27
0
        public void ModifyRole(RoleConfig request, RoleConfigResponse response)
        {
            ValidRequest(request, new RoleConfigVaildator(), ruleSet: "Edit");
            //验证部门编号是否存在
            var rolsConfigs = _roleRepository.QueryRoleInfo();

            if (!(rolsConfigs.Any(i => i.ROLENO == request.RoleNo)))
            {
                throw new Utility.WeChatException("ROLE_EDIT_ERROR", "当前角色编号不存在");
            }
            _roleRepository.UpdateRoleInfo(request.RoleNo, request.RoleName, request.CurrOper, request.Remark);
            response.ResponseStatus.ErrorCode = "OK";
        }
Ejemplo n.º 28
0
        public void DeleteRole(RoleConfig request, RoleConfigResponse response)
        {
            ValidRequest(request, new RoleConfigVaildator(), ruleSet: "Delete");
            //验证角色编号是否存在
            var rolsConfigs = _roleRepository.QueryRoleInfo();

            if (!(rolsConfigs.Any(i => i.ROLENO == request.RoleNo)))
            {
                throw new Utility.WeChatException("ROLE_DELETE_ERROR", "当前角色编号不存在");
            }
            _roleRepository.DeleteRole(request.RoleNo);
            response.ResponseStatus.ErrorCode = "OK";
        }
Ejemplo n.º 29
0
        public RoleConfig GetOrCreateConfig(ulong guildId)
        {
            var config = GetConfig(guildId);

            if (config == null)
            {
                config         = new RoleConfig();
                config.GuildId = guildId;
                SaveConfig(config);
            }

            return(config);
        }
Ejemplo n.º 30
0
        public ActionResult ModifyPrRoleConfig(IEnumerable <string> ids, string roleName, string remark)
        {
            RoleConfig request = new RoleConfig
            {
                RequestType = 2,
                RoleNo      = ids.First(),
                RoleName    = roleName,
                Remark      = remark,
                CurrOper    = Session["StaffNo"].CastTo(""),
            };
            RoleConfigResponse response = WeChatHelper.PostService <RoleConfig, RoleConfigResponse>("RoleConfig", request);

            return(Json(response, JsonRequestBehavior.DenyGet));
        }