public static void WriteCSV(string filePathName, BaseItemInfo itemInfo) { try { string filePath = filePathName; CheckAndCreateFolder(filePath); if (!File.Exists(filePath)) { using (StreamWriter fileWriter = new StreamWriter(filePath, true, Encoding.Default)) { fileWriter.WriteLine(itemInfo.GetLogHeadLine()); fileWriter.Flush(); fileWriter.Close(); } } WriteCSV(filePath, true, itemInfo.GetLogStrArr()); } catch (Exception ex) { Console.WriteLine(ex); } }
public static bool WriteXLS(string fileName, BaseItemInfo item) { string filePath = fileName; CheckAndCreateFolder(filePath); if (!File.Exists(filePath)) { CreateXLS(filePath); InsertToXLS(fileName, "info", item.GetLogHeadLine().Split(',')); } InsertToXLS(fileName, "info", item.GetLogStrArr()); return(true); }