Exemplo n.º 1
0
        public void GenerateAll(XCForm f)
        {
            form = f;

            Console.WriteLine("dest: " + destdir + " origin: " + originDir);
            if (string.IsNullOrEmpty(temp_h_content))
            {
                temp_h_content = File.ReadAllText(tempdir + "Template.h");
            }
            if (string.IsNullOrEmpty(temp_c_content))
            {
                temp_c_content = File.ReadAllText(tempdir + "Template.cpp");
            }

            DirectoryInfo dinfo = new DirectoryInfo(originDir);

            FileInfo[] files = dinfo.GetFiles("*.csv");
            for (int i = 0, max = files.Length; i < max; i++)
            {
                CSVTable tb   = CSVUtil.sington.UtilCsv(files[i]);
                string   name = tb.name.Replace(".csv", "");
                GenerateHead(tb, name);
                GenerateCpp(tb, name);
                f.PCB(files[i].FullName);
            }
            f.PCB("generate cpp finish");
        }
Exemplo n.º 2
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());
        }
Exemplo n.º 3
0
        public void GenerateAll(XCForm f)
        {
            form = f;
            Console.WriteLine("dest: " + destdir + " origin: " + originDir);
            DirectoryInfo dinfo = new DirectoryInfo(originDir);

            FileInfo[] files = dinfo.GetFiles("*.csv");
            for (int i = 0, max = files.Length; i < max; i++)
            {
                GenerateTable(files[i]);
                f.PCB(files[i].FullName);
            }
            f.PCB("finish");
        }
Exemplo n.º 4
0
        public static void Build(XCForm form)
        {
            mForm = form;
            CSharpCodeProvider provider   = new CSharpCodeProvider();
            CompilerParameters parameters = MakeParamters(false);

            string[]        sourceFile = ScanFiles(project);
            CompilerResults cr         = provider.CompileAssemblyFromFile(parameters, sourceFile);

            if (cr.Errors.Count > 0)
            {
                form.PCB("Errors building into " + cr.PathToAssembly);
                foreach (CompilerError ce in cr.Errors)
                {
                    form.PCB(ce.ToString());
                }
            }
            else
            {
                form.PCB("编译成功");
            }
        }
Exemplo n.º 5
0
        public void GenerateXFormBytes(XCForm f)
        {
            DirectoryInfo dir = new DirectoryInfo(XCForm.unity_table_path);

            FileInfo[] files = dir.GetFiles("*.csv");
            for (int i = 0, max = files.Length; i < max; i++)
            {
                FileInfo file     = files[i];
                int      indx     = file.Name.LastIndexOf('.');
                string   destname = XCForm.xform_bytes_path + file.Name.Substring(0, indx) + ".bytes";
                WriteBytes(file, destname, System.Text.Encoding.Default);
                f.PCB(file.FullName);
            }
        }