public bool LoadLinksFromFileToList(string vsPath) { try { cFile oLogger = new cFile("Error.txt"); oLogger.Write("++++++++++++++++++++++++++"); oLogger.Write(vsPath); oLogger.Write("++++++++++++++++++++++++++"); cFile oFile = new cFile(vsPath); //oFile.FileName = ; string pattern = "\r\n|\n"; String sNewUrlList = oFile.Read(); string[] sTs = Regex.Split(sNewUrlList, pattern); foreach (string sT in sTs) { } for (int iCnt1 = 0; iCnt1 < sTs.Count(); iCnt1++) { oLogger.Write("-----" + iCnt1.ToString() + "-----"); string sUrl1 = sTs[iCnt1]; oLogger.Write(sUrl1); oLogger.Write("-----" + iCnt1.ToString() + "-----"); CheckLink(sUrl1); } return(true); } catch (Exception ex) { throw ex; } //throw new NotImplementedException(); }
public bool Load() { if (File.Exists(msFileName)) { string[] oLinkCatRecord = null; cFile oFile = new cFile(msFileName); try { string sInput = oFile.Read(); // oLinkCatRecord = sInput.Split(Convert.ToChar(Constants.vbCrLf)); oLinkCatRecord = sInput.Split(new String[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); foreach (string linkRow in oLinkCatRecord) { if (linkRow.Trim().Length > 3) { // Process a student record cLinkCategory oLinkCategory = new cLinkCategory(); string[] sLinkFields = null; sLinkFields = linkRow.Split('|'); var _with3 = oLinkCategory; _with3.Name = sLinkFields[0]; _with3.FileName = sLinkFields[1]; _with3.LinkDefine = sLinkFields[2]; oCatagories.Add(oLinkCategory); // Add(oLinkCategory); } } return(true); } catch (Exception ex) { //MessageBox.Show(ex.Message); cFile oLog = new cFile("error.log"); oLog.Write(ex.Message); } } else { File.Create("LinkCategories.txt"); Load(); } return(false); }