Ejemplo n.º 1
0
        public RSSFeedDesc RssFilterData(string RSSURL, string Title)
        {
            var rssFeed = XDocument.Load(RSSURL);

            var data       = rssFeed;
            var rssFeedOut = (from item in rssFeed.Descendants("item")
                              where
                              ((string)item.Element("title")).Trim() == Title.Trim()
                              select new RSSFeedDesc
            {
                Title = ((string)item.Element("title")),
                Description = ((string)item.Element("description")),
            }).FirstOrDefault();


            if (rssFeedOut != null)
            {
                QuizAppEntities entities     = new QuizAppEntities();
                FilterWord      filterWord   = new FilterWord();
                string          temp         = rssFeedOut.Description;
                string          findString   = "Download Dainik Bhaskar App to read Latest Hindi News Today";
                string          filteredData = "";
                if (temp.Contains(findString))
                {
                    filteredData = temp.Replace(findString, "");
                }
                rssFeedOut.Description = filteredData;
                return(rssFeedOut);
            }
            else
            {
                return(null);
            }
        }
 private void Filter()
 {
     PostedList.Clear();
     foreach (Auction a in actualPostedList)
     {
         if (a.Name.ToLower().Contains(FilterWord.ToLower()))
         {
             PostedList.Add(a);
         }
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 提交关键词
 /// </summary>
 /// <param name="word"></param>
 /// <returns></returns>
 public bool PutFilterWord(FilterWord word)
 {
     if (word.AutoID == 0)
     {
         return(Add(word));
     }
     else
     {
         return(Update(word));
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 检查词是否存在
        /// </summary>
        /// <param name="filterType"></param>
        /// <param name="word"></param>
        /// <param name="websiteOwner"></param>
        /// <returns></returns>
        public bool ExistsFilterWord(string filterType, string word, string websiteOwner, string autoId = "")
        {
            string     whereParams = GetParams(filterType, word, websiteOwner);
            FilterWord old         = Get <FilterWord>(whereParams);

            if (old == null || old.AutoID.ToString() == autoId)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 添加敏感词
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string AddFilterWord(HttpContext context)
        {
            string filterWord = context.Request["FilterWord"],
                   filterType = context.Request["FilterType"];

            if (string.IsNullOrEmpty(filterWord))
            {
                resp.Status = 0;
                resp.Msg    = "请输入敏感词";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            if (string.IsNullOrEmpty(filterType))
            {
                resp.Status = 0;
                resp.Msg    = "类型错误";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            FilterWord word = new FilterWord();

            word.FilterType   = int.Parse(filterType);
            word.WebsiteOwner = bllFilterWord.WebsiteOwner;
            word.Word         = filterWord;
            word.AutoID       = 0;
            if (bllFilterWord.ExistsFilterWord(filterType, filterWord, bllFilterWord.WebsiteOwner))
            {
                resp.Status = 0;
                resp.Msg    = "敏感词重复不能添加";
                return(Common.JSONHelper.ObjectToJson(resp));
            }

            if (bllFilterWord.PutFilterWord(word))
            {
                resp.Status = 1;
                resp.Msg    = "添加成功";
            }
            else
            {
                resp.Status = 0;
                resp.Msg    = "添加失败";
            }

            return(Common.JSONHelper.ObjectToJson(resp));
        }
Ejemplo n.º 6
0
    void Awake()
    {
        //DontDestroyOnLoad(gameObject);

        /*string txtPath = string.Empty;
         #if UNITY_EDITOR
         * txtPath = Application.dataPath + "/StreamingAssets/sensitive.txt";
         #elif UNITY_IPHONE
         * txtPath = Application.dataPath +"/Raw/sensitive.txt";
         #elif UNITY_ANDROID
         * txtPath = "jar:file://" + Application.dataPath + "!/assets/"+"/sensitive.txt";
         #else
         * txtPath = Application.dataPath + "/StreamingAssets/sensitive.txt";
         #endif*/

        TextAsset SensitiveTextFile = (TextAsset)Resources.Load("Config/TextConfigs/Sensitive");

        fw = new FilterWord(SensitiveTextFile);
    }
Ejemplo n.º 7
0
    /// <summary>
    ///     初始化导入数据
    /// </summary>
    /// <returns></returns>
    public void InitData()
    {
        var gameText = AssetManager.getInstance().loadAsset("Config/GameText.xml"); //同步加载XML

        if (gameText == null)
        {
            return;
        }
        var doc = XDocument.Parse(gameText.ToString());

        if (doc.Root == null)
        {
            return;
        }
        //TODO:得到每一个text节点,获取text的节点的下 t, value 节点的值,加入 textData 中
        foreach (XElement item in doc.Root.Descendants("text"))
        {
            AddOrOverlay(item.Attribute("t").Value, item.Attribute("value").Value);
        }

        var replaceFile = AssetManager.getInstance().loadAsset("Config/sensitivewords.txt");//同步加载XML

        if (replaceFile == null)
        {
            return;
        }
        _badwords = replaceFile.ToString();

        string[] listBadWords = _badwords.Split(new char[] { ',', '\n', '\r' });
        //foreach(var str in listBadWords)
        //{
        //    if (!str.Equals(""))
        //        UnityEngine.Debug.Log(str);
        //}

        _filterWord = new FilterWord(ref listBadWords);

        //_base = new Regex(_badwords, Options);
    }
Ejemplo n.º 8
0
        /// <summary>
        /// 修改敏感词
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string UpdateFilterWord(HttpContext context)
        {
            string     autoId     = context.Request["AutoID"];
            string     filterWord = context.Request["FilterWord"];
            FilterWord word       = bllFilterWord.GetFilterWord(int.Parse(autoId));

            if (bllFilterWord.ExistsFilterWord(word.FilterType.ToString(), filterWord, word.WebsiteOwner, word.AutoID.ToString()))
            {
                resp.Status = 0;
                resp.Msg    = "敏感词重复";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            word.Word = filterWord;
            if (bllFilterWord.PutFilterWord(word))
            {
                resp.Status = 1;
                resp.Msg    = "修改成功";
            }
            else
            {
                resp.Msg = "修改失败";
            }
            return(Common.JSONHelper.ObjectToJson(resp));
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 添加留言信息
        /// </summary>
        /// <returns></returns>
        public ActionResult AddCommentInfo()
        {
            var resultMode = new ResponseBaseModel <dynamic>
            {
                ResultCode = ResponceCodeEnum.Fail,
                Message    = "响应成功"
            };
            var checkcode = System.Web.HttpContext.Current.GetStringFromParameters("checkcode");

            if (string.IsNullOrEmpty(checkcode) || string.IsNullOrEmpty(Session["ValidateCode"]?.ToString()))
            {
                resultMode.Message = "验证码必填";
                return(Json(resultMode, JsonRequestBehavior.AllowGet));
            }

            var oldCode = Session["ValidateCode"];

            Session["ValidateCode"] = null;
            if (!oldCode.Equals(checkcode))
            {
                resultMode.Message = "验证码必填";
                return(Json(resultMode, JsonRequestBehavior.AllowGet));
            }
            var content       = System.Web.HttpContext.Current.GetStringFromParameters("content");
            var createTime    = DateTime.Now;
            var customerEmail = System.Web.HttpContext.Current.GetStringFromParameters("email");
            var customerName  = System.Web.HttpContext.Current.GetStringFromParameters("username");
            var customerPhone = System.Web.HttpContext.Current.GetStringFromParameters("tel");

            var    fw       = new FilterWord();
            string str      = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
            var    filePath = AppConfigurationHelper.GetString("SensitiveFilePath");

            fw.DictionaryPath = str + filePath;
            fw.SourctText     = content;
            content           = fw.Filter('*');
            if (string.IsNullOrEmpty(content))
            {
                resultMode.Message = "留言内容不能为空";
                return(Json(resultMode, JsonRequestBehavior.AllowGet));
            }
            fw.SourctText = customerEmail;
            customerEmail = fw.Filter('*');
            if (string.IsNullOrEmpty(customerEmail) || !RegExp.IsEmail(customerEmail))
            {
                resultMode.Message = "邮箱内容错误";
                return(Json(resultMode, JsonRequestBehavior.AllowGet));
            }
            fw.SourctText = customerName;
            customerName  = fw.Filter('*');
            if (string.IsNullOrEmpty(customerName))
            {
                resultMode.Message = "姓名内容错误";
                return(Json(resultMode, JsonRequestBehavior.AllowGet));
            }
            fw.SourctText = customerPhone;
            customerPhone = fw.Filter('*');
            if (string.IsNullOrEmpty(customerPhone) || !RegExp.IsMobileNo(customerPhone))
            {
                resultMode.Message = "电话内容错误";
                return(Json(resultMode, JsonRequestBehavior.AllowGet));
            }
            var commentModel = new CustomercommentModel {
                Content = content, CreateTime = createTime, CustomerName = customerName, CustomerEmail = customerEmail, CustomerPhone = customerPhone, IsDel = FlagEnum.HadZore.GetHashCode(), HasDeal = FlagEnum.HadZore
            };
            var server = new CustomerCommentService();

            try
            {
                server.SaveModel(commentModel);
                resultMode.Message    = "处理成功";
                resultMode.ResultCode = ResponceCodeEnum.Success;
            }
            catch (Exception e)
            {
                Trace.WriteLine(e);
                resultMode.Message = "系统异常";
            }
            return(Json(resultMode, JsonRequestBehavior.AllowGet));
        }