Example #1
0
        public void GenerateTCode(string path)
        {
            XDebug.Log("gene code: " + path);
            FileInfo file = new FileInfo(path);

            GenerateTable(file);
        }
Example #2
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);
 }
Example #3
0
        private static string[] ScanFiles(string path)
        {
            DirectoryInfo dir = new DirectoryInfo(path);

            FileInfo[]    files = dir.GetFiles("*.cs", SearchOption.AllDirectories);
            List <string> slist = new List <string>();

            if (mForm != null)
            {
                mForm.PCB("scan files cnt: " + files.Length + ". as list:");
            }
            XDebug.Log("scan files cnt: " + files.Length);
            for (int i = 0, max = files.Length; i < max; i++)
            {
                string str = files[i].FullName;
                if (!str.Contains("TemporaryGeneratedFile"))
                {
                    slist.Add(str);
                    if (mForm != null)
                    {
                        mForm.PCB(str);
                    }
                    XDebug.Log(str);
                }
            }
            return(slist.ToArray());
        }
Example #4
0
 static void Main(String[] args)
 {
     XDebug.Begin();
     if (ProcessArgs(args))
     {
         Application.EnableVisualStyles();
         Application.SetCompatibleTextRenderingDefault(false);
         Application.Run(new XCForm());
     }
 }
Example #5
0
        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("编译成功");
            }
        }
Example #6
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);
            }
        }