Пример #1
0
        ///// <summary>
        ///// 更新ClientSmokeDetector信息
        ///// </summary>
        //public static void UpdateClientSmokeDetector(ClientSmokeDetector entity)
        //{
        //    CheckClientSmokeDetector(entity,false);
        //    ClientSmokeDetectorDA.UpdateClientSmokeDetector(entity);
        //}

        ///// <summary>
        ///// 删除ClientSmokeDetector信息
        ///// </summary>
        //public static void DeleteClientSmokeDetector(int sysNo)
        //{
        //    ClientSmokeDetectorDA.DeleteClientSmokeDetector(sysNo);
        //}

        ///// <summary>
        ///// 分页查询ClientSmokeDetector信息
        ///// </summary>
        //public static QueryResult<ClientSmokeDetector> QueryClientSmokeDetectorList(QF_ClientSmokeDetector  filter)
        //{
        //    return ClientSmokeDetectorDA.QueryClientSmokeDetectorList(filter);
        //}

        /// <summary>
        /// 检查ClientSmokeDetector信息
        /// </summary>
        private static void CheckClientSmokeDetector(ClientSmokeDetector entity, bool isCreate)
        {
            if (!isCreate && entity.SysNo == 0)
            {
                throw new BusinessException(LangHelper.GetText("请传入数据主键!"));
            }
            if (string.IsNullOrWhiteSpace(entity.SmokeDetectorCode))
            {
                throw new BusinessException(LangHelper.GetText("烟感器编码不能为空!"));
            }
            if (entity.SmokeDetectorCode.Length > 32)
            {
                throw new BusinessException(LangHelper.GetText("烟感器编码长度不能超过32!"));
            }
            if (entity.CellPhone != null && entity.CellPhone.Length > 15)
            {
                throw new BusinessException(LangHelper.GetText("手机1长度不能超过15!"));
            }
            if (entity.CellPhone2 != null && entity.CellPhone2.Length > 15)
            {
                throw new BusinessException(LangHelper.GetText("手机2长度不能超过15!"));
            }
            if (entity.CellPhone3 != null && entity.CellPhone3.Length > 15)
            {
                throw new BusinessException(LangHelper.GetText("手机3长度不能超过15!"));
            }
        }
Пример #2
0
        /// <summary>
        /// 登录
        /// </summary>
        /// <typeparam name="T">登录信息类</typeparam>
        /// <param name="loginModel">登录信息</param>
        /// <returns></returns>
        public AuthUserModel LoginV2 <T>(T loginModel) where T : LoginModel
        {
            UserEntity userEntity = UserService.GetByLoginNameAndPassword(loginModel.Account, loginModel.Password);

            if (userEntity == null)
            {
                throw new BusinessException(LangHelper.GetText("用户或者密码错误!", "PortalBase.DBAuth"));
            }
            if (userEntity.CommonStatus == CommonStatus.DeActived)
            {
                throw new BusinessException("该登录用户已被禁用,请联系管理员");
            }
            AuthUserModel authUser = new AuthUserModel()
            {
                UserSysNo       = userEntity.Id,
                UserDisplayName = userEntity.UserFullName,
                UserID          = userEntity.LoginName,
                UsrCommonStatus = (AuthUserStatus)((int)userEntity.CommonStatus)
            };//todo 登陆实现

            if (authUser != null && authUser.UserSysNo > 0)
            {
                //清除本机缓存
                RsetUserLocalCache(authUser);
            }
            return(authUser);
        }
Пример #3
0
        public static string GetStatusLayout(int status)
        {
            switch (status)
            {
            case (int)DeliveryStatusEnum.New:
                return(LangHelper.Get("Delivery_Entity_Status_Enum_New"));             // 新建货运单

            case (int)DeliveryStatusEnum.Submit:
                return(LangHelper.Get("Delivery_Entity_Status_Enum_Submited"));        // 提交

            case (int)DeliveryStatusEnum.Processing:
                return(LangHelper.Get("Delivery_Entity_Status_Enum_Processing"));      // 处理中

            case (int)DeliveryStatusEnum.Delivering:
                return(LangHelper.Get("Delivery_Entity_Status_Enum_Delivering"));      // 运输中

            case (int)DeliveryStatusEnum.BadOrder:
                return(LangHelper.Get("Delivery_Entity_Status_Enum_BadOrder"));        // 坏单

            case (int)DeliveryStatusEnum.Cancel:
                return(LangHelper.Get("Delivery_Entity_Status_Enum_Cancel"));          // 取消

            case (int)DeliveryStatusEnum.Received:
                return(LangHelper.Get("Delivery_Entity_Status_Enum_Received"));        // 已收货

            case (int)DeliveryStatusEnum.Error:
                return(LangHelper.Get("Delivery_Entity_Status_Enum_Error"));           // 异常

            case (int)DeliveryStatusEnum.Success:
                return(LangHelper.Get("Delivery_Entity_Status_Enum_Success"));         // 成功

            default:
                return("undefined");
            }
        }
Пример #4
0
        /// <summary>
        /// Executes all the statements in the script.
        /// </summary>
        public override PhaseResult Execute(PhaseContext phaseCtx)
        {
            // 1. Check number of statements.
            var statements = _execAllNodes ? phaseCtx.Nodes : phaseCtx.NodesStack[phaseCtx.NodesStack.Count - 1];

            var now = DateTime.Now;

            // 2. No statements ? return
            if (statements == null || statements.Count == 0)
            {
                return(ToPhaseResult(now, now, true, "There are 0 nodes to execute"));
            }

            // 3. Execute the nodes and get the run-result which captures various data
            var runResult = LangHelper.Execute(() =>
            {
                var execution  = new Execution();
                execution.Ctx  = this.Ctx;
                EvalHelper.Ctx = this.Ctx;
                execution.VisitExprs(statements);
            });

            // 4. Simply wrap the run-result ( success, message, start/end times )
            // inside of a phase result.
            return(new PhaseResult(runResult));
        }
Пример #5
0
        public Login()
        {
            InitializeComponent();
            Application.Current.MainWindow = this;

            this.DataContext = new LoginViewModel();

            metroDialogSettings = new MetroDialogSettings
            {
                CustomResourceDictionary = DialogDictionary,
                AffirmativeButtonText    = LangHelper.GetValue("Message", "确定", "ok"),
                NegativeButtonText       = LangHelper.GetValue("Message", "取消", "cancel")
                                           //AffirmativeButtonText = LangHelper.GetValue("Message", "是", "yes"),
                                           //NegativeButtonText = LangHelper.GetValue("Message", "否", "no")
                                           //SuppressDefaultResources = true
            };

            Messager.Default.Register <NotificationMessage>(this, message =>
            {
                if (message.Key == LoginViewModel.MESSAGE_LOGINFAIL) //登陆失败
                {
                    this.ShowMessageAsync(LangHelper.GetValue("Message", "提示信息", "title"), message.Data.ToString(), MessageDialogStyle.Affirmative, metroDialogSettings);
                }
                else if (message.Key == LoginViewModel.MESSAGE_LOGINOK) //登陆成功
                {
                    new MainWindow().Show();                            //显示程序主窗口
                    this.Close();
                }
            });
        }
Пример #6
0
        /// <summary>
        /// 更改文章状态
        /// </summary>
        /// <param name="topic"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public static bool UpdateTopicStatus(TopicInfo topicInfo, CurrentUser user)
        {
            //AjaxResult ajaxResult = new AjaxResult() { Success = true, Message=string.Empty};
            bool result = true;

            #region check

            var topic = LoadTopicInfoBySysNo(topicInfo.SysNo.Value);
            if (topicInfo.TopicStatus == TopicStatus.Published && topic.TopicStatus != TopicStatus.Init && topic.TopicStatus != TopicStatus.Offline)
            {
                throw new BusinessException(LangHelper.GetText("只有草稿和撤下状态才能发布!"));
                //ajaxResult.Success = false;
                //ajaxResult.Message = "只有草稿和撤下状态才能发布!";
                //return ajaxResult;
            }

            #endregion

            topicInfo.EditUserSysNo = user.UserSysNo;
            topicInfo.EditUserName  = user.UserDisplayName;
            topicInfo.EditDate      = DateTime.Now;
            if (topicInfo.TopicStatus == TopicStatus.Published)
            {
                result = TopicDA.PublishTopic(topicInfo);
            }
            else
            {
                result = TopicDA.UpdateTopicStatus(topicInfo);
            }
            return(result);
        }
Пример #7
0
        /// <summary>
        /// 检查FileInfo信息
        /// </summary>
        private static void CheckFileInfo(FileInfo entity, bool isCreate)
        {
            if (entity == null)
            {
                throw new BusinessException(LangHelper.GetText("请传入实体!"));
            }
            if (!isCreate && entity.SysNo == 0)
            {
                throw new BusinessException(LangHelper.GetText("请传入数据主键!"));
            }
            if (!entity.MasterType.HasValue)
            {
                throw new BusinessException(LangHelper.GetText("主体类型不能为空!"));
            }

            if (entity.MasterID <= 0)
            {
                throw new BusinessException(LangHelper.GetText("主体ID不能为空!"));
            }
            if (entity.CategoryName != null && entity.CategoryName.Length > 64)
            {
                throw new BusinessException(LangHelper.GetText("文件分组编号长度不能超过64!"));
            }
            if (string.IsNullOrWhiteSpace(entity.FileRelativePath))
            {
                throw new BusinessException(LangHelper.GetText("文件相对路径不能为空!"));
            }
        }
Пример #8
0
        /// <summary>
        /// 批量修改文章状态
        /// </summary>
        /// <param name="?"></param>
        /// <param name="status"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public static bool BatchUpdateTopicStatus(List <int> topicSysNoList, TopicStatus status, CurrentUser user)
        {
            //AjaxResult ajaxResult = new AjaxResult() { Success = true, Message = string.Empty };
            List <TopicInfo> topicList = new List <TopicInfo>();

            #region check
            foreach (int topicSysNo in topicSysNoList)
            {
                var topic = LoadTopicInfoBySysNo(topicSysNo);
                if (status == TopicStatus.Published && topic.TopicStatus != TopicStatus.Init && topic.TopicStatus != TopicStatus.Offline)
                {
                    throw new BusinessException(LangHelper.GetText("只有草稿和撤下状态才能发布!"));
                    //ajaxResult.Success = false;
                    //ajaxResult.Message = "只有草稿和撤下状态才能发布!";
                    //return ajaxResult;
                }
                if (status == TopicStatus.Void && topic.TopicStatus != TopicStatus.Init && topic.TopicStatus != TopicStatus.Offline)
                {
                    throw new BusinessException(LangHelper.GetText("只有草稿和撤下状态才能作废!"));
                    //ajaxResult.Success = false;
                    //ajaxResult.Message = "只有草稿和撤下状态才能发布!";
                    //return ajaxResult;
                }
                if (status == TopicStatus.Delete && topic.TopicStatus != TopicStatus.Init && topic.TopicStatus != TopicStatus.Offline && topic.TopicStatus != TopicStatus.Void)
                {
                    throw new BusinessException(LangHelper.GetText("只有草稿,撤下以及作废状态才能删除!"));
                    //ajaxResult.Success = false;
                    //ajaxResult.Message = "只有草稿和撤下状态才能发布!";
                    //return ajaxResult;
                }
                topicList.Add(new TopicInfo()
                {
                    SysNo         = topicSysNo,
                    TopicStatus   = status,
                    EditUserSysNo = user.UserSysNo,
                    EditUserName  = user.UserDisplayName,
                    EditDate      = DateTime.Now
                });
            }

            #endregion

            using (ITransaction transaction = TransactionManager.Create())
            {
                foreach (var topic in topicList)
                {
                    if (status == TopicStatus.Published)
                    {
                        TopicDA.PublishTopic(topic);
                    }
                    else
                    {
                        TopicDA.UpdateTopicStatus(topic);
                    }
                }
                transaction.Complete();
            }

            return(true);
        }
Пример #9
0
    public void ExitMenuGUI()
    {
        GUI.skin = this.guiSkin;

        guiSkin.label.fontSize  = HUD.LabelSize;
        guiSkin.button.fontSize = HUD.ButtonSize;

        GUI.Box(new Rect(10, 10, Screen.width - 20, Screen.height - 20), LangHelper.GetInstance().GetString("ConfirmMessageExit"), GUI.skin.GetStyle("box"));

        if (GUI.Button(new Rect(HUD.Left + 20, HUD.GetPositionTop(2), HUD.Width / 2, HUD.Height), LangHelper.GetInstance().GetString("ConfirmExitButton"), GUI.skin.GetStyle("button")))
        {
            PlayerPrefs.Save();

            if (Application.isEditor)
            {
                UnityEditor.EditorApplication.isPlaying = false;
            }
            else
            {
                Application.Quit();
            }
        }

        if (GUI.Button(new Rect((HUD.Left + HUD.Left) - 20, HUD.GetPositionTop(2), HUD.Width / 2, HUD.Height), LangHelper.GetInstance().GetString("CancelExitButton"), GUI.skin.GetStyle("button")))
        {
            this.currentGUIMethod = MainMenuGUI;
        }
    }
Пример #10
0
 /// <summary>
 /// 检查Client信息
 /// </summary>
 private static void CheckClient(Client entity, bool isCreate)
 {
     if (!isCreate && entity.SysNo == 0)
     {
         throw new BusinessException(LangHelper.GetText("记录不存在,请刷新页面重试!"));
     }
     if (string.IsNullOrWhiteSpace(entity.Name))
     {
         throw new BusinessException(LangHelper.GetText("用户名称不能为空!"));
     }
     if (entity.Name.Length > 15)
     {
         throw new BusinessException(LangHelper.GetText("用户名称长度不能超过15!"));
     }
     if (entity.HeaderImage != null && entity.HeaderImage.Length > 500)
     {
         throw new BusinessException(LangHelper.GetText("头像地址长度不能超过500!"));
     }
     if (entity.CellPhone != null && entity.CellPhone.Length > 15)
     {
         throw new BusinessException(LangHelper.GetText("手机1长度不能超过15!"));
     }
     if (entity.CellPhone2 != null && entity.CellPhone2.Length > 15)
     {
         throw new BusinessException(LangHelper.GetText("手机2长度不能超过15!"));
     }
     if (entity.CellPhone3 != null && entity.CellPhone3.Length > 15)
     {
         throw new BusinessException(LangHelper.GetText("手机3长度不能超过15!"));
     }
 }
 /// <summary>
 /// 检查Address信息
 /// </summary>
 private static void CheckAddress(Address entity)
 {
     if (entity.Name != null && entity.Name.Length > 40)
     {
         throw new BusinessException(LangHelper.GetText("名称长度不能超过40个字符!"));
     }
 }
Пример #12
0
        /// <summary>
        /// Executes all the statements in the script.
        /// </summary>
        public override PhaseResult Execute(PhaseContext phaseCtx)
        {
            // 1. Check number of statements.
            var statements = phaseCtx.Nodes;

            var now = DateTime.Now;

            // 2. No statements ? return
            if (statements == null || statements.Count == 0)
            {
                return(ToPhaseResult(now, now, true, "There are 0 nodes to execute"));
            }

            // 3. Execute the nodes and get the run-result which captures various data
            var runResult = LangHelper.Execute(() =>
            {
                foreach (var stmt in statements)
                {
                }
            });

            // 4. Simply wrap the run-result ( success, message, start/end times )
            // inside of a phase result.
            return(new PhaseResult(runResult));
        }
Пример #13
0
    void PauseMenuGUI()
    {
        GUI.skin = guiSkin;

        guiSkin.label.fontSize  = HUD.LabelSize;
        guiSkin.button.fontSize = HUD.ButtonSize;

        GUI.Box(new Rect(10, 10, Screen.width - 20, Screen.height - 20), LangHelper.GetInstance().GetString("OptionLabel"), GUI.skin.GetStyle("box"));

        if (GUI.Button(new Rect(HUD.Left, HUD.GetPositionTop(), HUD.Width, HUD.Height), LangHelper.GetInstance().GetString("BackButton"), GUI.skin.GetStyle("button")))
        {
            IsExit = false;
        }

        if (GUI.Button(new Rect(HUD.Left, HUD.GetPositionTop(2), HUD.Width, HUD.Height), LangHelper.GetInstance().GetString("SoundButton") + (SoundEffectsHelper.Instance.HasSound ? "On" : "Off"), GUI.skin.GetStyle("button")))
        {
            SoundEffectsHelper.Instance.SetSound();
        }

        if (GUI.Button(new Rect(HUD.Left, HUD.GetPositionTop(3), HUD.Width, HUD.Height), LangHelper.GetInstance().GetString("MusicButton") + (SoundEffectsHelper.Instance.HasMusic ? "On" : "Off"), GUI.skin.GetStyle("button")))
        {
            SoundEffectsHelper.Instance.SetMusic();
        }

        if (GUI.Button(new Rect(HUD.Left, HUD.GetPositionTop(4), HUD.Width, HUD.Height), LangHelper.GetInstance().GetString("ExitButton"), GUI.skin.GetStyle("button")))
        {
            Application.LoadLevel("Menu");
        }
    }
Пример #14
0
        /// <summary>
        /// Executes all the statements in the script.
        /// </summary>
        public override PhaseResult Execute(PhaseContext phaseCtx)
        {
            var script = phaseCtx.ScriptText;
            var memory = phaseCtx.Ctx.Memory;

            var runResult = LangHelper.Execute(() =>
            {
                Ctx.Limits.CheckScriptLength(script);
                _parser.Parse(script, memory);

                if (phaseCtx.Nodes == null)
                {
                    phaseCtx.Nodes = new List <Expr>();
                }

                if (phaseCtx.NodesStack == null)
                {
                    phaseCtx.NodesStack = new List <List <Expr> >();
                }

                // 1. Keep track of all the statements.
                phaseCtx.Nodes.AddRange(_parser.Statements);

                // 2. Keep track of the each individual set of statements ( from multiple scripts )
                phaseCtx.NodesStack.Add(_parser.Statements);
            });

            return(new PhaseResult(runResult));
        }
Пример #15
0
        private static List <object> FindInternal(string path, string[] named, bool recursive)
        {
            var files         = new List <object>();
            var hasNameFilter = named != null && named.Length > 0;
            IDictionary <string, string> nameMap = hasNameFilter ? LangHelper.ToDictionary(named) : null;

            // Match the files.
            Dir.ForEachDir(path, recursive, (filepath) =>
            {
                var name = Path.GetFileNameWithoutExtension(filepath);
                bool matchesNameFilter = true;
                if (hasNameFilter && !nameMap.ContainsKey(name))
                {
                    matchesNameFilter = false;
                }

                // Add if both filters match or if both filter were not applicable.
                // or if 1 matches and the other one was not applicable.
                if (matchesNameFilter)
                {
                    files.Add(filepath);
                }
            });
            return(files);
        }
Пример #16
0
        /// <summary>
        /// 创建新闻类别
        /// </summary>
        /// <param name="topicCategory"></param>
        /// <returns></returns>
        public static int InsertTopicCategory(TopicCategory topicCategory, CurrentUser user)
        {
            int sysNo = 0;

            using (ITransaction transaction = TransactionManager.Create())
            {
                bool nameExist = TopicDA.CheckNameIsExist(topicCategory);
                if (nameExist)
                {
                    throw new BusinessException(LangHelper.GetText("类别名称已存在!"));
                }
                string pCategoryID = string.IsNullOrEmpty(topicCategory.ParentCategoryID) ? "" : topicCategory.ParentCategoryID;
                string categoryID  = pCategoryID + "01";

                List <TopicCategory> list = QueryAllTopicCategoryListByParentID(pCategoryID);

                if (list != null && list.Count > 0)
                {
                    TopicCategory tc    = list.OrderByDescending(p => p.SysNo).FirstOrDefault();
                    int           index = int.Parse(tc.CategoryID.Substring(tc.CategoryID.Length - 2, 2)) + 1;
                    categoryID = pCategoryID + (index < 10 ? "0" + index.ToString() : index.ToString());
                }

                topicCategory.ParentCategoryID = pCategoryID;
                topicCategory.CategoryID       = categoryID;
                sysNo = TopicDA.InsertTopicCategory(topicCategory);
                transaction.Complete();
            }
            return(sysNo);
        }
Пример #17
0
    public void OptionsMenuGUI()
    {
        GUI.skin = this.guiSkin;

        guiSkin.label.fontSize  = HUD.LabelSize;
        guiSkin.button.fontSize = HUD.ButtonSize;

        GUI.Box(new Rect(10, 10, Screen.width - 20, Screen.height - 20), LangHelper.GetInstance().GetString("OptionLabel"), GUI.skin.GetStyle("box"));

        if (GUI.Button(new Rect(HUD.Left, HUD.GetPositionTop(), HUD.Width, HUD.Height), LangHelper.GetInstance().GetString("SoundButton") + (SoundEffectsHelper.Instance.HasSound ? "On" : "Off"), GUI.skin.GetStyle("button")))
        {
            SoundEffectsHelper.Instance.SetSound();
        }

        if (GUI.Button(new Rect(HUD.Left, HUD.GetPositionTop(2), HUD.Width, HUD.Height), LangHelper.GetInstance().GetString("MusicButton") + (SoundEffectsHelper.Instance.HasMusic ? "On" : "Off"), GUI.skin.GetStyle("button")))
        {
            SoundEffectsHelper.Instance.SetMusic();
        }

        if (GUI.Button(new Rect(HUD.Left, HUD.GetPositionTop(4), HUD.Width, HUD.Height), LangHelper.GetInstance().GetString("BackButton"), GUI.skin.GetStyle("button")))
        {
            this.currentGUIMethod = MainMenuGUI;
        }

        if (GUI.Button(new Rect(HUD.Left, HUD.GetPositionTop(3), HUD.Width, HUD.Height), LangHelper.GetInstance().GetString("LanguageLabel")))
        {
            if (!showDropLanguages)
            {
                showDropLanguages = true;
            }
            else
            {
                showDropLanguages = false;
            }
        }

        if (showDropLanguages)
        {
            scrollViewVector =
                GUI.BeginScrollView(new Rect(HUD.Left + HUD.Width - 20, HUD.GetPositionTop(3), HUD.Width / 4, HUD.Height), scrollViewVector, new Rect(0, 0, HUD.Width / 5.5f, (HUD.Height * languages.Length)));

            for (index = 0; index < languages.Length; index++)
            {
                if (GUI.Button(new Rect(0, index * HUD.Height, HUD.Width / 5, HUD.Height), ""))
                {
                    showDropLanguages = false; wichLanguage = index;
                    PlayerPrefs.SetString("Language", languages[index]);
                    LangHelper.GetInstance().ChangeLanguage();
                }

                GUI.Label(new Rect(12, index * HUD.Height, HUD.Width / 5, HUD.Height), Resources.Load(languages[index]) as Texture);
            }
            GUI.EndScrollView();
        }
        else
        {
            GUI.Label(new Rect(HUD.Left + HUD.Width - 10, HUD.GetPositionTop(3), HUD.Width, HUD.Height), Resources.Load(languages[wichLanguage]) as Texture);
        }
    }
Пример #18
0
        public override void UpdateArmorSet(Player player)
        {
            ClickerPlayer clickerPlayer = player.GetModPlayer <ClickerPlayer>();

            player.setBonus      = LangHelper.GetText("SetBonus.RGB");
            clickerPlayer.setRGB = true;
            clickerPlayer.EnableClickEffect(ClickEffect.ChromaticBurst);
        }
Пример #19
0
 public List <SysFunction> LoadAllFunctions(string applicationID)
 {
     if (string.IsNullOrWhiteSpace(applicationID))
     {
         throw new BusinessException(LangHelper.GetText("请传入ApplicationID!"));
     }
     return(SysFunctionDA.LoadAllFunctions(applicationID));
 }
Пример #20
0
        /// <summary>
        /// Execute
        /// </summary>
        public object VisitTryCatch(TryCatchExpr expr)
        {
            var tryScopePopped   = false;
            var catchScopePopped = false;

            try
            {
                this.Ctx.Memory.Push();
                LangHelper.Evaluate(expr.Statements, expr, this);
                this.Ctx.Memory.Pop();
                tryScopePopped = true;
            }
            // Force the langlimit excpetion to propegate
            // do not allow to flow through to the catch all "Exception ex".
            catch (LangLimitException)
            {
                throw;
            }
            catch (LangFailException)
            {
                throw;
            }
            catch (Exception ex)
            {
                this.Ctx.Limits.CheckExceptions(expr);

                // Pop the try scope.
                if (!tryScopePopped)
                {
                    this.Ctx.Memory.Pop();
                }

                // Push the scope in the catch block
                this.Ctx.Memory.Push();
                var lException = LangTypeHelper.ConvertToLangClass(LError.FromException(ex));
                this.Ctx.Memory.SetValue(expr.ErrorName, lException);

                // Run statements in catch block.
                if (expr.Catch != null && expr.Catch.Statements.Count > 0)
                {
                    LangHelper.Evaluate(expr.Catch.Statements, expr.Catch, this);
                }

                // Pop the catch scope.
                this.Ctx.Memory.Pop();
                catchScopePopped = true;
            }
            finally
            {
                // Pop the catch scope in case there was an error.
                if (!catchScopePopped)
                {
                    this.Ctx.Memory.Remove(expr.ErrorName);
                }
            }
            return(LObjects.Null);
        }
Пример #21
0
    public static LangHelper GetInstance()
    {
        if (Instance == null)
        {
            Instance = new LangHelper();
        }

        return(Instance);
    }
Пример #22
0
        /// <summary>
        /// Execute
        /// </summary>
        public override object DoEvaluate()
        {
            bool tryScopePopped   = false;
            bool catchScopePopped = false;

            try
            {
                Ctx.Memory.Push();
                LangHelper.Evaluate(_statements, this);
                Ctx.Memory.Pop();
                tryScopePopped = true;
            }
            // Force the langlimit excpetion to propegate
            // do not allow to flow through to the catch all "Exception ex".
            catch (LangLimitException)
            {
                throw;
            }
            catch (LangFailException)
            {
                throw;
            }
            catch (Exception ex)
            {
                Ctx.Limits.CheckExceptions(this);

                // Pop the try scope.
                if (!tryScopePopped)
                {
                    Ctx.Memory.Pop();
                }

                // Push the scope in the catch block
                Ctx.Memory.Push();
                Ctx.Memory.SetValue(ErrorName, new LClass(LError.FromException(ex)));

                // Run statements in catch block.
                if (Catch != null && Catch.Statements.Count > 0)
                {
                    LangHelper.Evaluate(Catch.Statements, Catch);
                }

                // Pop the catch scope.
                Ctx.Memory.Pop();
                catchScopePopped = true;
            }
            finally
            {
                // Pop the catch scope in case there was an error.
                if (!catchScopePopped)
                {
                    Ctx.Memory.Remove(ErrorName);
                }
            }
            return(LObjects.Null);
        }
Пример #23
0
        private static void AddLangParameter(Dictionary <string, string> parameters)
        {
            string lang = LangHelper.GetLang();

            if (!(lang != ""))
            {
                return;
            }
            parameters["lang"] = lang;
        }
Пример #24
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{lang}/{controller}/{action}/{id}",
                defaults: new { lang = LangHelper.GetDefaultLang(), controller = "Home", action = "Index", id = UrlParameter.Optional }
                );
        }
Пример #25
0
        private void HyperlinkLicenseAgreement_OnClick(object sender, RoutedEventArgs e)
        {
            string uri  = "https://m.vk.com/licence?api_view=1";
            string lang = LangHelper.GetLang();

            if (!string.IsNullOrEmpty(lang))
            {
                uri += string.Format("&lang={0}", (object)lang);
            }
            Navigator.Current.NavigateToWebUri(uri, true, false);
        }
Пример #26
0
        private void HelpButton_OnClicked(object sender, System.Windows.Input.GestureEventArgs e)
        {
            string uri  = "https://m.vk.com/attachments?act=attach_money_about&from_client=1";
            string lang = LangHelper.GetLang();

            if (!string.IsNullOrEmpty(lang))
            {
                uri += string.Format("&lang={0}", lang);
            }
            Navigator.Current.NavigateToWebViewPage(uri, false);
        }
Пример #27
0
        public override void ModifyTooltips(List <TooltipLine> tooltips)
        {
            ClickerPlayer clickerPlayer = Main.LocalPlayer.GetModPlayer <ClickerPlayer>();

            bool enabled = clickerPlayer.accAimbotModule2Toggle;

            tooltips.Add(new TooltipLine(Mod, "AimbotEnabled", LangHelper.GetText("Tooltip.AimbotModule" + (enabled ? "Enabled" : "Disabled")))
            {
                OverrideColor = enabled ? Color.Lerp(Color.Red, Color.White, 0.6f) : Color.Gray
            });
        }
Пример #28
0
 private void ActionButton_OnClicked(object sender, System.Windows.Input.GestureEventArgs e)
 {
     if (this._link.money_transfer == null)
     {
         LinkButton button = this._link.button;
         string     url    = (button != null ? button.url :  null) ?? this._link.url;
         if (string.IsNullOrEmpty(url))
         {
             return;
         }
         e.Handled = true;
         LinkButtonAction action            = button.action;
         LinkButtonAction linkButtonAction1 = action;
         if ((linkButtonAction1 != null ? (linkButtonAction1.Type == LinkButtonActionType.JoinGroupAndOpenUrl ? 1 : 0) : 0) != 0)
         {
             GroupsService.Current.Join(action.group_id, false, (Action <BackendResult <OwnCounters, ResultCode> >)(result =>
             {
                 if (result.ResultCode != ResultCode.Succeeded)
                 {
                     return;
                 }
                 Execute.ExecuteOnUIThread((Action)(() => Navigator.Current.NavigateToWebUri(url, action.IsExternal, false)));
             }), null);
         }
         else
         {
             INavigator       current           = Navigator.Current;
             string           uri               = url;
             LinkButtonAction linkButtonAction2 = action;
             int num1 = linkButtonAction2 != null ? (linkButtonAction2.IsExternal ? 1 : 0) : 0;
             int num2 = 0;
             current.NavigateToWebUri(uri, num1 != 0, num2 != 0);
         }
     }
     else
     {
         e.Handled = true;
         if (this.CanShowCard)
         {
             MoneyTransfer moneyTransfer = this._link.money_transfer;
             TransferCardView.Show(moneyTransfer.id, moneyTransfer.from_id, moneyTransfer.to_id);
         }
         else
         {
             string uri  = "https://m.vk.com/landings/moneysend";
             string lang = LangHelper.GetLang();
             if (!string.IsNullOrEmpty(lang))
             {
                 uri += string.Format("?lang={0}", lang);
             }
             Navigator.Current.NavigateToWebViewPage(uri, true);
         }
     }
 }
Пример #29
0
 public ClickEffect(Mod mod, string internalName, string displayName, string description, int amount, Func <Color> colorFunc, Action <Player, EntitySource_ItemUse_WithAmmo, Vector2, int, int, float> action)
 {
     Mod                 = mod ?? throw new Exception("No mod specified");
     InternalName        = internalName ?? throw new Exception("No internal name specified");
     DisplayName         = displayName ?? LangHelper.GetText("Common.Unknown");
     Description         = description ?? LangHelper.GetText("Common.Unknown");
     TryUsingTranslation = displayName == null || description == null;
     Amount              = amount;
     ColorFunc           = colorFunc;
     Action              = action ?? (new Action <Player, EntitySource_ItemUse_WithAmmo, Vector2, int, int, float>((a, b, c, d, e, f) => { }));
 }
 /// <summary>
 /// 检查子节点
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="isCreate"></param>
 private static void CheckChildCategory(Category entity, bool isCreate)
 {
     if (string.IsNullOrEmpty(entity.ParentCategoryCode))
     {
         throw new BusinessException(LangHelper.GetText("父编码不能为空!"));
     }
     else if (entity.ParentCategoryCode.Trim().Length > 10)
     {
         throw new BusinessException(LangHelper.GetText("父编码长度不能超过10!"));
     }
     CheckRootCategory(entity, isCreate);
 }