Ejemplo n.º 1
0
 static bool ProcessArgs(string[] args)
 {
     if (args != null && args.Length > 0)
     {
         XDebug.Log("arg len:" + args.Length.ToString() + " arg0: " + args[0]);
         if (args[0].Equals(make_win_code))
         {
             XDebug.Log("build win code");
             CompileCode.Build(false);
         }
         else if (args[0].Equals(make_ios_code))
         {
             XDebug.Log("build ios code");
             CompileCode.Build(true);
         }
         else if (args[0].Equals(make_byte))
         {
             for (int i = 1; i < args.Length; i++)
             {
                 CheckException(args[i]);
                 XDebug.Log("gennerate bytes: " + args[i]);
                 GenerateBytes.sington.WriteByte(args[i]);
             }
         }
         else
         {
             XDebug.LogError("exception " + make_win_code.Length + " args:" + args[0].Length);
         }
         return(false);
     }
     return(true);
 }
Ejemplo n.º 2
0
        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);
            }
        }