/// <summary> /// read json file to list /// </summary> /// <param name="url"></param> /// <returns></returns> public List <BarNameEntity> getJsonContent(string filepath) { List <BarNameEntity> listkeyWorldEntity = new List <BarNameEntity>(); try { if (string.IsNullOrEmpty(filepath)) { return(null); } IOFileHelper iOFileHelper = new IOFileHelper(); var strContext = iOFileHelper.ReadTxtFile(filepath); var byteData = strContext.Split('-'); UrlCodeConvert urlCodeConvert = new UrlCodeConvert(); foreach (var item in byteData) { BarNameEntity barNameEntity = new BarNameEntity(); barNameEntity.BarName = item.Trim(); barNameEntity.Url = urlCodeConvert.EncodeUrl(item.Trim()); listkeyWorldEntity.Add(barNameEntity); } return(listkeyWorldEntity); } catch { Debug.WriteLine("KeyWorldService"); } return(listkeyWorldEntity); }
/// <summary> /// get keyworld content from text file /// </summary> /// <param name="url"></param> /// <returns></returns> public List <KeyWorldEntity> getTextContent(string url) { List <KeyWorldEntity> listkeyWorldEntity = new List <KeyWorldEntity>(); try { if (string.IsNullOrEmpty(url)) { return(null); } IOFileHelper iOFileHelper = new IOFileHelper(); var strContext = iOFileHelper.ReadTxtFile(url); var byteData = strContext.Split('-'); foreach (var item in byteData) { KeyWorldEntity keyWorldEntity = new KeyWorldEntity(); keyWorldEntity.KeyWorld = item.Trim(); listkeyWorldEntity.Add(keyWorldEntity); } return(listkeyWorldEntity); } catch { Debug.WriteLine("KeyWorldService"); } return(listkeyWorldEntity); }