private static bool ConvertCsv(string inputFile, string outputFile) { if (Path.GetExtension(inputFile) != ".csv") { return(false); } bool bResult = true; try { CsvStreamReader csvReader = new CsvStreamReader(inputFile, Encoding.Default, true); bResult &= csvReader.LoadCsvFile(); string strTxtName = GetFileName(inputFile); string strOutputTxtName = m_strTxtPath + "/" + strTxtName + ".txt"; CTxtWriter txtWriter = new CTxtWriter(csvReader, strOutputTxtName, strTxtName); bResult &= txtWriter.WriteTxtFile(); if (bResult) { m_dictOutputTxt.Add(strTxtName, "Assets/MyResources/outputtxt/" + strTxtName + ".txt"); string strOutputScriptName = outputFile + "/Assets/Scripts/StaticData/ScriptObject/" + CScriptWriter.GetScriptName(strTxtName) + ".cs"; CScriptWriter scriptWriter = new CScriptWriter(csvReader, strOutputScriptName, strTxtName); bResult &= scriptWriter.WriteScriptFile(); } } catch (Exception ex) { Debug.LogError("导入表" + System.IO.Path.GetFileName(inputFile) + "失败:" + ex.Message); bResult = false; } return(bResult); }