public static void Build(bool isIphone) { CSharpCodeProvider provider = new CSharpCodeProvider(); CompilerParameters parameters = MakeParamters(isIphone); string[] sourceFile = ScanFiles(project); CompilerResults cr = provider.CompileAssemblyFromFile(parameters, sourceFile); if (cr.Errors.Count > 0) { XDebug.Log("Errors building into " + cr.PathToAssembly); foreach (var item in cr.Errors) { XDebug.Log(item.ToString()); } } else { XDebug.Log("编译成功"); } }
private void WriteBytes(FileInfo src, string dest, System.Text.Encoding coding) { CSVTable table = CSVUtil.sington.UtilCsv(src); try { using (FileStream fs = new FileStream(dest, FileMode.Create)) { BinaryWriter write = new BinaryWriter(fs, coding); //先预留一个long记录文件大小 write.Seek(8, SeekOrigin.Begin); write.Write(table.rowCnt); for (int i = 0, max = table.sortlist.Count; i < max; i++) { for (int j = 0, len = table.sortlist[i].row.Length; j < len; j++) { CSVStruct st = table.sortlist[i].row[j]; st.parse.Write(write, st.content); st.parse.title = st.title; } } fs.Seek(0, SeekOrigin.Begin); write.Write(fs.Length); fs.Seek(0, SeekOrigin.End); write.Seek(0, SeekOrigin.Begin); write.Write(fs.Length); write.Flush(); write.Close(); XDebug.Log(dest); } } catch (Exception ex) { XDebug.LogError("解析表格" + table.name + "失败," + ex.Message + " \n" + ex.StackTrace); MessageBox.Show("解析表格" + table.name + "失败," + ex.Message + " \n" + ex.StackTrace, "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }