Пример #1
0
        //http://www.itokit.com/2012/0721/74607.html
        public static string Post(string url, string data, string Referer = "http://d1.web2.qq.com/proxy.html?v=20151105001&callback=1&id=2", int timeout = 100000, Encoding encode = null)
        {
            string         dat = "";
            HttpWebRequest req;

            try
            {
                req = WebRequest.Create(url) as HttpWebRequest;
                req.CookieContainer = cookies;
                req.ContentType     = "application/x-www-form-urlencoded";
                req.Method          = "POST";
                req.Proxy           = null;
                req.Timeout         = timeout;
                req.UserAgent       = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.104 Safari/537.36 Core/1.53.2372.400 QQBrowser/9.5.10548.400";
                req.Accept          = "*/*";

                //req.UserAgent = "Mozilla/5.0 (Windows NT 10.0;%20WOW64; rv:47.0) Gecko/20100101 Firefox/47.0";
                req.ProtocolVersion = HttpVersion.Version11;
                req.Referer         = Referer;
                req.Headers.Add("Origin", "");
                byte[] mybyte = Encoding.Default.GetBytes(data);
                req.ContentLength = mybyte.Length;

                Stream stream = req.GetRequestStream();
                stream.Write(mybyte, 0, mybyte.Length);


                HttpWebResponse res = req.GetResponse() as HttpWebResponse;
                cookies.Add(res.Cookies);
                stream.Close();

                StreamReader SR = new StreamReader(res.GetResponseStream(), encode == null ? Encoding.UTF8 : encode);
                dat = SR.ReadToEnd();
                res.Close();
                req.Abort();
            }
            catch (HttpException e)
            {
                OrmManager.Insert(new SystemLogData {
                    OriginData = e.Message, Message = "网络故障"
                });
                return("");
            }
            catch (WebException e)
            {
                OrmManager.Insert(new SystemLogData {
                    OriginData = e.Message, Message = "网络故障"
                });
                return("");
            }
            if (!dat.Equals(""))
            {
                // OrmManager.Insert(new SystemLogData { OriginData = dat.Replace(';',' '), Message = "System" });
            }
            return(dat);
        }
Пример #2
0
        public void Answer(AnswerContext context)
        {
            if (!context.CanAnswer)
            {
                return;
            }
            var anwer = "";

            if (CommandKey.Any(x => context.Message.StartsWith(x)))
            {
                //  bool EnableFlag = false;
                //  if (context.State != null && context.GetState<bool>(SettingKey))
                //  {
                //      EnableFlag = true;
                //  }
                //  else if(context.MessageType=="message"){
                //      EnableFlag = true;
                // }
                // if (EnableFlag)
                //  {

                string[] tmp = context.Message.Split(' ');

                if (tmp.Length == 2)
                {
                    anwer = GetStock(tmp[1], "");
                }
                else if (tmp.Length == 3)
                {
                    anwer = GetStock(tmp[1], tmp[2]);
                }
                else
                {
                    context.Alerts.AddRange(Example());
                }
                if (!string.IsNullOrEmpty(anwer))
                {
                    context.Answers.Add(anwer);
                    var newlog = new AutoAnswerMessageLog();
                    newlog.FromUin     = context.SendToId;
                    newlog.ToUin       = context.FromUin;
                    newlog.MessageType = "stock";
                    newlog.P1          = tmp[tmp.Length - 1];
                    newlog.Data        = anwer;
                    OrmManager.Insert(newlog);

                    // }
                }
            }
        }
Пример #3
0
        public static string PostJsonData(string url, string data, int timeout = 100000, Encoding encode = null)
        {
            string         dat = "";
            HttpWebRequest req;

            try
            {
                req                 = WebRequest.Create(url) as HttpWebRequest;
                req.ContentType     = "application/json;charset=utf-8";
                req.Method          = "POST";
                req.Proxy           = null;
                req.Timeout         = timeout;
                req.UserAgent       = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.104 Safari/537.36 Core/1.53.2372.400 QQBrowser/9.5.10548.400";
                req.ProtocolVersion = HttpVersion.Version11;

                byte[] mybyte = Encoding.Default.GetBytes(data);
                req.ContentLength = mybyte.Length;

                Stream stream = req.GetRequestStream();
                stream.Write(mybyte, 0, mybyte.Length);


                HttpWebResponse res = req.GetResponse() as HttpWebResponse;

                stream.Close();

                StreamReader SR = new StreamReader(res.GetResponseStream(), encode == null ? Encoding.UTF8 : encode);
                dat = SR.ReadToEnd();
                res.Close();
                req.Abort();
            }
            catch (HttpException)
            {
                return("");
            }
            catch (WebException)
            {
                return("");
            }
            if (!dat.Equals(""))
            {
                OrmManager.Insert(new SystemLogData {
                    OriginData = dat.Replace(';', ' '), Message = "System"
                });
            }
            return(dat);
        }
Пример #4
0
        public void Answer(AnswerContext context)
        {
            if (!context.CanAnswer)
            {
                return;
            }

            //var message = context.Message.ToLower();
            if (CommandKey.Any(x => context.Message.IndexOf(x, StringComparison.InvariantCultureIgnoreCase) >= 0))
            {
                bool EnableFlag = false;
                if (context.State != null && context.GetState <bool>(SettingKey))
                {
                    EnableFlag = true;
                }
                else if (context.MessageType == "message")
                {
                    EnableFlag = true;
                }
                if (EnableFlag)
                {
                    var result = GetResult(context.Message);
                    if (result.Count() == 1 && string.IsNullOrEmpty(result[0]))
                    {
                        return;
                    }
                    else
                    {
                        context.Answers.AddRange(result);
                        try
                        {
                            var newlog = new AutoAnswerMessageLog();
                            newlog.FromUin     = context.SendToId;
                            newlog.ToUin       = context.FromUin;
                            newlog.MessageType = "orchard";
                            newlog.P1          = context.Message;
                            newlog.Data        = string.Join("回复了:", result);
                            OrmManager.Insert(newlog);
                        }
                        catch
                        { }
                    }
                }
            }
        }
Пример #5
0
        public void Answer(AnswerContext context)
        {
            if (!context.CanAnswer)
            {
                return;
            }
            List <string> anwer = null;

            if (CommandKey.Any(x => context.Message.StartsWith(x)))
            {
                bool EnableFlag = false;
                if (context.State != null && context.GetState <bool>(SettingKey))
                {
                    EnableFlag = true;
                }
                else if (context.MessageType == "message")
                {
                    EnableFlag = true;
                }
                if (EnableFlag)
                {
                    string[] tmp = context.Message.Trim().Split(' ');
                    if (tmp.Length == 2)
                    {
                        anwer = GetWeather(tmp[1]);
                    }
                    else
                    {
                        context.Alerts.AddRange(Example());
                    }

                    if (anwer != null && anwer.Count > 0)
                    {
                        context.Answers.AddRange(anwer);
                        var newlog = new AutoAnswerMessageLog();
                        newlog.FromUin     = context.SendToId;
                        newlog.ToUin       = context.FromUin;
                        newlog.MessageType = "weather";
                        newlog.P1          = tmp[1];
                        newlog.Data        = string.Join(",", anwer);
                        OrmManager.Insert(newlog);
                    }
                }
            }
        }
        public void Answer(AnswerContext context)
        {
            bool EnableFlag = false;

            if (context.State != null && context.GetState <bool>(SettingKey))
            {
                EnableFlag = true;
            }
            else if (context.MessageType == "message")
            {
                EnableFlag = true;
            }
            if (EnableFlag)
            {
                var words = OrmManager.Fetch <BadWords>(x => x.QQNum == context.CurrentQQ).Select(x => x.Word);
                if (words == null || words.Count() == 0)
                {
                    return;
                }
                else
                {
                    context.Answers.RemoveAll(x => string.IsNullOrEmpty(x));
                    for (int i = 0; i < context.Answers.Count; i++)
                    {
                        foreach (var word in words)
                        {
                            if (context.Answers[i].Contains(word))
                            {
                                var newlog = new AutoAnswerMessageLog();
                                newlog.FromUin     = context.SendToId;
                                newlog.ToUin       = context.FromUin;
                                newlog.MessageType = "badword";
                                newlog.P1          = word;
                                newlog.Data        = context.Answers[i];
                                OrmManager.Insert(newlog);
                                context.Answers[i] = context.Answers[i].Replace(word, "***");
                            }
                        }
                    }
                }
            }
        }
        public void Answer(AnswerContext context)
        {
            bool EnableFlag = false;

            if (context.State != null && context.GetState <bool>(SettingKey))
            {
                EnableFlag = true;
            }
            else if (context.MessageType == "message")
            {
                EnableFlag = true;
            }
            if (EnableFlag)
            {
                var words = OrmManager.Fetch <BadWords>(x => x.QQNum == context.CurrentQQ && context.Message.Contains(x.Word)).Select(x => x.Word);
                if (words == null || words.Count() == 0)
                {
                    return;
                }
                else
                {
                    var template = "{0} 含有禁用词 {1},提出警告";
                    foreach (var word in words)
                    {
                        context.Alerts.Add(string.Format(template, context.FromUin, word));
                    }

                    var newlog = new AutoAnswerMessageLog();

                    newlog.FromUin     = context.SendToId;
                    newlog.ToUin       = context.FromUin;
                    newlog.MessageType = "badword";
                    newlog.P1          = string.Join(",", words);
                    newlog.Data        = context.Message;
                    OrmManager.Insert(newlog);
                    context.CanAnswer = false;
                }
            }
        }
Пример #8
0
        /// <summary>
        /// 向服务器提交AI学习请求
        /// </summary>
        /// <param name="source">源语句</param>
        /// <param name="aim">目标语句</param>
        /// <param name="QQNum">发起学习用户的QQ</param>
        /// <param name="QunNum">发起学习的群</param>
        /// <param name="superstudy">是否为特权学习</param>
        /// <returns>用户友好的提示语</returns>
        public string AIStudy(string source, string aim, long QQNum, long QunNum = 0, bool superstudy = false)
        {
            var study = new StudyWords();

            study.SourceQQNum = QQNum;
            study.QQNum       = WorkContext.GetState <long>(Constract.CurrentQQ);
            study.GroupId     = QunNum;
            study.Source      = source;
            study.Aim         = aim;
            if (superstudy)
            {
                study.Pass  = true;
                study.Reson = "特权学习";
            }
            else
            {
            }
            if (OrmManager.Count <BadWords>(x => string.Equals(x.Word, source, StringComparison.InvariantCultureIgnoreCase)) > 0 || OrmManager.Count <BadWords>(x => string.Equals(x.Word, aim, StringComparison.InvariantCultureIgnoreCase)) > 0)
            {
                return("ForbiddenWord");
            }
            if (OrmManager.Count <StudyWords>(x => x.SourceQQNum == QQNum && x.GroupId == QunNum && x.Source == source && x.Pass) > 0)
            {
                return("Forbidden");
            }
            else if (OrmManager.Count <StudyWords>(x => x.SourceQQNum == QQNum && x.GroupId == QunNum && x.Source == source && !x.Pass) > 0)
            {
                return("Waitting");
            }
            OrmManager.Insert(study);
            if (!study.Pass)
            {
                return("pending");
            }
            else
            {
                return("Success");
            }
        }
        public SettingsAppearanceViewModel()//:base(container)IUnityContainer container
        {
            Setting = OrmManager.GetDefault <SettingModel>();
            if (Setting == null)
            {
                OrmManager.Insert(new SettingModel());
                Setting = OrmManager.GetDefault <SettingModel>();
            }
            foreach (var theme in Theme.GetThemes())
            {
                this.themes.Add(new Link {
                    DisplayName = theme.Name, Source = new Uri(theme.Path, UriKind.Relative)
                });
            }
            colors                   = Theme.GetThemeColors();
            FontSizes                = Theme.GetThemeFrontSizes().Select(x => x.Name);
            this.SelectedFontSize    = Setting.FontSize;
            this.SelectedTheme       = this.themes.FirstOrDefault(l => l.DisplayName.Equals(Setting.Theme, StringComparison.InvariantCultureIgnoreCase));
            this.SelectedAccentColor = this.colors.FirstOrDefault(x => x.Name.Equals(Setting.Color, StringComparison.InvariantCultureIgnoreCase));
            SyncThemeAndColor();

            AppearanceManager.Current.PropertyChanged += OnAppearanceManagerPropertyChanged;
        }
Пример #10
0
        private void Client_Logined(object sender, LoginSucessedEventArgs e)
        {
            // OrmManager.Update(state);
            var state = OrmManager.Get <Models.QQState>(x => x.QQNum == e.Session.QQNum);

            var clientManager = ClientManager.GetClientManagerUser(Container, new Models.QQState());

            clientManager.QQ.QQNum   = e.Session.QQNum;
            clientManager.QQ.Logined = true;
            clientManager.QQ.SetCookies(Constract.LoginCookies, e.JsonResult);
            //clientManager.QQ.SetCookies(Constract.QQSession, e.Session);
            if (state != null)
            {
                clientManager.QQ.Id = state.Id;
                OrmManager.Update(clientManager.QQ);
            }
            else
            {
                OrmManager.Insert(clientManager.QQ);
            }
            WorkContext.SetState(Constract.CurrentQQState, clientManager.QQ);
            WorkContext.SetState(Constract.CurrentQQ, clientManager.QQ.QQNum);
            clientManager.Client.DefaultState = clientManager.QQ.State;
            ClientManager.ResetKey();
            //throw new NotImplementedException();
            if (e.ShowMainWindow)
            {
                App.Current.Dispatcher.Invoke(() =>
                {
                    new MainWindow(Container).Show();
                    Logger.Debug("MainWindow has been created and displayed.");
                    // 3.Closes the SignIn window.
                    (Application.Current.Resources[LoginWindow.Key] as LoginWindow)?.Close();
                    Logger.Debug("LoginWindow has been closed.");
                });
            }
        }
Пример #11
0
        public void Answer(AnswerContext context)
        {
            if (!context.CanAnswer)
            {
                return;
            }
            var anwer = new SearchResult();

            if (CommandKey.Any(x => context.Message.StartsWith(x)))
            {
                bool EnableFlag = false;
                if (context.State != null && context.GetState <bool>(SettingKey))
                {
                    EnableFlag = true;
                }
                else if (context.MessageType == "message")
                {
                    EnableFlag = true;
                }
                if (EnableFlag)
                {
                    string[] tmp = context.Message.Trim().Split(' ');

                    if (tmp.Length == 2)
                    {
                        var keyword = tmp[1];
                        // anwer = GetWiki(tmp[1], "");
                        switch (tmp[0])
                        {
                        case "互动百科":
                        case "互动":
                        {
                            string url  = "http://www.baike.com/wiki/" + keyword;
                            string temp = QQClient.Get(url);
                            if (temp.Contains("尚未收录"))
                            {
                                anwer.Answer = "没有找到这个词条哦~";
                                break;
                            }
                            temp = temp.Replace("<meta content=\"", "&");
                            temp = temp.Replace("\" name=\"description\">", "&");
                            string[] result = temp.Split('&');
                            if (!result[1].Equals(""))
                            {
                                anwer.Answer = result[1];
                                anwer.Url    = "http://www.baike.com/wiki/" + HttpUtility.UrlEncode(keyword);
                            }
                            break;
                        }

                        case "维基百科":
                        case "维基":
                        {
                            string                 url    = "https://zh.wikipedia.org/w/api.php?action=query&prop=extracts&format=json&exsentences=2&exintro=&explaintext=&exsectionformat=plain&exvariant=zh&titles=" + keyword;
                            string                 temp   = QQClient.Get(url);
                            JsonWikipediaModel     temp1  = (JsonWikipediaModel)JsonConvert.DeserializeObject(temp, typeof(JsonWikipediaModel));
                            string[]               result = temp1.query.pages.ToString().Split("{}".ToCharArray());
                            JsonWikipediaPageModel pages  = (JsonWikipediaPageModel)JsonConvert.DeserializeObject("{" + tmp[2] + "}", typeof(JsonWikipediaPageModel));

                            if (pages.extract != null)
                            {
                                anwer.Answer = pages.extract;
                                anwer.Url    = "https://zh.wikipedia.org/wiki/" + HttpUtility.UrlEncode(keyword);
                            }
                            else
                            {
                                anwer.Answer = "没有找到这个Wiki哦~";
                            }

                            break;
                        }

                        case "百度百科":
                        case "百科":
                        default:
                        {
                            string url  = "http://wapbaike.baidu.com/item/" + keyword;
                            string temp = QQClient.Get(url);

                            if (temp.Contains("您所访问的页面不存在"))
                            {
                                anwer.Answer = "没有找到这个词条哦~";
                            }
                            if (temp.Contains("百科名片"))
                            {
                                temp = temp.Replace("&quot;", "");
                                temp = temp.Replace("&", "");
                                temp = temp.Replace("百科名片", "&");
                                string[] result = temp.Split('&');

                                temp   = result[1];
                                temp   = temp.Replace("<p>", "&");
                                temp   = temp.Replace("</p>", "&");
                                result = temp.Split('&');

                                temp = result[1].Replace("</a>", "");
                                temp = temp.Replace("<b>", "");
                                temp = temp.Replace("</b>", "");
                                temp = temp.Replace("<i>", "");
                                temp = temp.Replace("</i>", "");

                                temp   = temp.Replace("<a", "&");
                                temp   = temp.Replace("\">", "&");
                                result = temp.Split('&');

                                temp = "";
                                for (int i = 0; i < tmp.Length; i += 2)
                                {
                                    if ((!tmp[i].Contains("card-info")) && (!tmp[i].Contains("div class")))
                                    {
                                        temp += tmp[i];
                                    }
                                }
                                if (!temp.Equals(""))
                                {
                                    anwer.Answer = temp;
                                    anwer.Url    = "http://wapbaike.baidu.com/item/" + HttpUtility.UrlEncode(keyword);
                                }
                                else
                                {
                                    anwer.Answer = "词条 " + keyword + " 请查看http://wapbaike.baidu.com/item/" + HttpUtility.UrlEncode(keyword);
                                }
                            }
                            else
                            {
                                anwer.Answer = "没有找到这个词条哦~";
                            }
                            break;
                        }
                        }
                    }
                    else
                    {
                        context.Alerts.AddRange(Example());
                    }
                    if (!string.IsNullOrEmpty(anwer.Answer))
                    {
                        if (anwer.Answer.Length + anwer.Url.Length >= 400)
                        {
                            context.Answers.Add(anwer.Answer.Substring(0, 400 - anwer.Url.Length - 6) + "..." + anwer.Url);
                        }
                        else
                        {
                            context.Answers.Add(anwer.Answer + anwer.Url);
                        }
                        // context.Answers.Add(anwer);
                        var newlog = new AutoAnswerMessageLog();
                        newlog.FromUin     = context.SendToId;
                        newlog.ToUin       = context.FromUin;
                        newlog.MessageType = "wiki";
                        newlog.P1          = tmp[1];
                        newlog.Data        = anwer.Answer + anwer.Url;
                        OrmManager.Insert(newlog);
                    }
                }
            }
        }
Пример #12
0
        public void Update(string feature)
        {
            if (_processedFeatures.Contains(feature))
            {
                return;
            }

            _processedFeatures.Add(feature);


            var migrations = GetDataMigrations(feature);

            // apply update methods to each migration class for the module
            foreach (var migration in migrations)
            {
                var tempMigration = migration;

                // get current version for this migration
                var dataMigrationRecord = GetDataMigrationRecord(tempMigration);

                var current = 0;
                if (dataMigrationRecord != null)
                {
                    current = dataMigrationRecord.Version;
                }

                try {
                    // do we need to call Create() ?
                    if (current == 0)
                    {
                        // try to resolve a Create method

                        var createMethod = GetCreateMethod(migration);
                        if (createMethod != null)
                        {
                            current = (int)createMethod.Invoke(migration, new object[0]);
                        }
                    }

                    var lookupTable = CreateUpgradeLookupTable(migration);

                    while (lookupTable.ContainsKey(current))
                    {
                        try {
                            // Logger.Information("Applying migration for {0} from version {1}.", feature, current);
                            current = (int)lookupTable[current].Invoke(migration, new object[0]);
                        }
                        catch  {
                            throw;
                        }
                    }

                    // if current is 0, it means no upgrade/create method was found or succeeded
                    if (current == 0)
                    {
                        continue;
                    }
                    if (dataMigrationRecord == null)
                    {
                        OrmManager.Insert(new Tables.OrmTablesInfo {
                            Version = current, DataMigrationClass = migration.GetType().FullName
                        });
                    }
                    else
                    {
                        dataMigrationRecord.Version = current;
                        OrmManager.Update(dataMigrationRecord);
                    }
                }
                catch (Exception ex) {
                    Logger.Log(ex.Message, Category.Exception, Priority.High);
                    //throw new Exception(string.Format("Error while running migration version {0} for {1}.", current, feature), ex);
                }
            }
        }
Пример #13
0
 public void Insert(object Entity)
 {
     _OrmManager.Insert(Entity);
 }
Пример #14
0
        public void Answer(AnswerContext context)
        {
            if (!context.CanAnswer)
            {
                return;
            }
            var anwer = "";

            if (CommandKey.Any(x => context.Message.StartsWith(x)))
            {
                bool EnableFlag = false;
                if (context.State != null && context.GetState <bool>(SettingKey))
                {
                    EnableFlag = true;
                }
                else if (context.MessageType == "message")
                {
                    EnableFlag = true;
                }

                if (EnableFlag)
                {
                    bool     StudyFlag  = true;
                    bool     SuperStudy = false;
                    string[] tmp        = context.Message.Split('^');
                    if (tmp.Length == 3)
                    {
                        SuperStudy = true;
                    }
                    if (tmp.Length != 3 || string.IsNullOrWhiteSpace(tmp[1]) || string.IsNullOrWhiteSpace(tmp[2]))
                    {
                        StudyFlag  = false;
                        SuperStudy = false;
                        context.Alerts.AddRange(Example());
                    }
                    if (SuperStudy)
                    {
                        string result = "";
                        result = AIStudy(tmp[1], tmp[2], context.FromUin, context.SendToId, true);
                        anwer  = GetStudyFlagInfo(result, "@" + context.FromNick, tmp[1], tmp[2]);

                        if (!string.IsNullOrWhiteSpace(anwer))
                        {
                            context.Answers.Add(anwer);
                            var newlog = new AutoAnswerMessageLog();
                            newlog.FromUin     = context.SendToId;
                            newlog.ToUin       = context.FromUin;
                            newlog.MessageType = "study";
                            newlog.P1          = tmp[1];
                            newlog.P2          = tmp[2];
                            newlog.Data        = anwer;
                            OrmManager.Insert(newlog);
                        }
                        return;
                    }
                    if (StudyFlag)
                    {
                        string result   = "";
                        var    Badwords = OrmManager.Fetch <BadWords>(x => x.QQNum == context.CurrentQQ).Select(x => x.Word).ToList();
                        if (Badwords.Count(x => tmp[1].Contains(x) || tmp[2].Contains(x)) > 0)
                        {
                            result = "ForbiddenWord";
                            anwer  = "包含禁用词";
                            context.Answers.Add(anwer);
                            return;
                        }

                        if (result.Equals(""))
                        {
                            result = AIStudy(tmp[1], tmp[2], context.FromUin, context.FromUin, false);
                        }
                        anwer = GetStudyFlagInfo(result, "@" + context.FromNick, tmp[1], tmp[2]);

                        if (!string.IsNullOrWhiteSpace(anwer))
                        {
                            context.Answers.Add(anwer);
                            var newlog = new AutoAnswerMessageLog();
                            newlog.FromUin     = context.SendToId;
                            newlog.ToUin       = context.FromUin;
                            newlog.MessageType = "study";
                            newlog.P1          = tmp[1];
                            newlog.P2          = tmp[2];
                            newlog.Data        = anwer;
                            OrmManager.Insert(newlog);
                        }
                    }
                }
            }
        }
Пример #15
0
        public void Answer(AnswerContext context)
        {
            if (!context.CanAnswer)
            {
                return;
            }
            var anwer = "";

            bool EnableTalkFlag = false;

            if (context.State != null && context.GetState <bool>(SettingKey))
            {
                EnableTalkFlag = true;
            }
            else if (context.MessageType == "message")
            {
                EnableTalkFlag = true;
            }
            bool MsgAdapterFlag = false;

            if (EnableTalkFlag)
            {
                anwer = AIGet(context.Message);
                if (!anwer.Equals(""))
                {
                    var newlog = new AutoAnswerMessageLog();
                    newlog.FromUin     = context.FromUin;
                    newlog.ToUin       = context.SendToId;
                    newlog.MessageType = "talk";
                    newlog.P1          = context.Message;
                    newlog.Data        = anwer;
                    OrmManager.Insert(newlog);
                    context.Answers.Add(anwer);
                    return;
                }
                string[] tmp1       = context.Message.Split("@#$(),,.。::;^&;“”~~!!#()%??》《、· \r\n\"".ToCharArray());
                bool     RepeatFlag = false;
                for (int i = 0; i < tmp1.Length && i < 10; i++)
                {
                    if (tmp1[i].Equals(context.Message))
                    {
                        continue;
                    }
                    for (int k = 0; k < i; k++)
                    {
                        if (tmp1[k].Equals(tmp1[i]))
                        {
                            RepeatFlag = true;
                        }
                    }
                    if (RepeatFlag)
                    {
                        RepeatFlag = false;
                        continue;
                    }
                    if (!tmp1[i].Equals(""))
                    {
                        context.Answers.Add(AIGet(tmp1[i]));
                        MsgAdapterFlag = true;
                    }
                }
                if (!MsgAdapterFlag)
                {
                    string[] tmp2 = context.Message.Split("@#$(),,.。::;^&;“”~~!!#()%??》《、· \r\n\"啊喔是的么吧呀恩嗯了呢很吗".ToCharArray());
                    RepeatFlag = false;
                    for (int i = 0; i < tmp2.Length && i < 10; i++)
                    {
                        if (tmp2[i].Equals(context.Message))
                        {
                            continue;
                        }
                        for (int k = 0; k < i; k++)
                        {
                            if (tmp2[k].Equals(tmp2[i]))
                            {
                                RepeatFlag = true;
                            }
                        }
                        for (int k = 0; k < tmp1.Length; k++)
                        {
                            if (tmp1[k].Equals(tmp2[i]))
                            {
                                RepeatFlag = true;
                            }
                        }

                        if (RepeatFlag)
                        {
                            RepeatFlag = false;
                            continue;
                        }
                        if (!tmp2[i].Equals(""))
                        {
                            context.Answers.Add(AIGet(tmp2[i]));
                            MsgAdapterFlag = true;
                        }
                    }
                }
            }
        }