/// <summary> /// 更新本地词库 /// </summary> /// <returns></returns> public static void UpdateLocalDict(string updateCmd) { WordSqlXml sql = new WordSqlXml(); sql.LoadXml(updateCmd); foreach (var item in sql) { WordSqlXmlAction word = (WordSqlXmlAction)item; word.Run(); } }
/// <summary> /// 返回更新字符串 /// </summary> public string GetUpdateCmd() { WordSqlXml sql = Service.WordSqlXml; foreach (var item in this.NewWords) { WordSqlXmlAction action = sql.CreatAction(DictAction.Add, item.Key, item.Value, ""); sql.Add(action); } foreach (var item in this.ExistWords) { WordSqlXmlAction action = sql.CreatAction(DictAction.UpdataFrequency, item.Key, item.Value, ""); sql.Add(action); } return(sql.ToString()); }
/// <summary> /// 更新服务器端词库 /// </summary> /// <param name="updateStr"></param> private void UpdateServerDict(string updateStr) { try { WordSqlXml sql = new WordSqlXml(); sql.LoadXml(updateStr); foreach (var item in sql) { WordSqlXmlAction word = (WordSqlXmlAction)item; word.Run(); } } catch (Exception ex) { ExceptionRecord.Record(ex.Message + ex.Source + ex.TargetSite + ex.StackTrace); } }