DXperience demo编译工具
2007-10-21 02:58
316 查看
编译了源码后可以使用,但是demo看不起来。为了解决大家后顾之忧,我写了生成编译编译demo命令的程序,放在demo目录后可以自动生成编译的命令,手工调整参数后直接运行能编译所有demo(不出意外的情况,哈哈)。
程序可以在我的网络硬盘上下载,
说明,只支持编译C#工程,可以自己改。
附源码,请引用system.windows.form.dll:
void main()
{
CreateCSCmd();
}
StringCollection FileSearch(string sDir, string sFile)
{
try
{
foreach (string d in Directory.GetDirectories(sDir))
{
foreach (string f in Directory.GetFiles(d, sFile))
{
lstFilesFound.Add(f);
}
FileSearch(d, sFile);
}
}
catch (System.Exception excpt)
{
Console.WriteLine(excpt.Message);
}
return lstFilesFound;
}
void WriteS(System.IO.FileStream f, string str)
{
byte[] ar = System.Text.Encoding.ASCII.GetBytes(str);
f.Write(ar, 0, ar.Length);
}
private void CreateCSCmd()
{
lstFilesFound.Clear();
string dir = AppDomain.CurrentDomain.BaseDirectory;
StringCollection p = FileSearch(dir, "*.csproj");
System.IO.FileStream bproj = new FileStream("buildproject.cmd", FileMode.OpenOrCreate);
WriteS(bproj, "if not exist %1 goto end");
WriteS(bproj, "/r/necho Building %1...");
WriteS(bproj, "/r/n%msbuild% /nologo /t:Rebuild /verbosity:quiet /p:Configuration=%configuration% %1");
WriteS(bproj, "/r/necho Done %1");
WriteS(bproj, "/r/n:end");
bproj.Close();
System.IO.FileStream pp = new FileStream("buildall.cmd", FileMode.OpenOrCreate);
WriteS(pp, "@echo off");
WriteS(pp, "/r/nSET sn=/"d://Program Files//Microsoft Visual Studio 8//SDK//v2.0//Bin//sn.exe/"");
WriteS(pp, "/r/nset gacutil=/"d://Program Files//Microsoft Visual Studio 8//SDK//v2.0//Bin//gacutil.exe/"");
WriteS(pp, "/r/nset msbuild=c://windows//Microsoft.NET//Framework//v2.0.50727//MSBuild.exe");
WriteS(pp, "/r/nset dxver=v7.1");
WriteS(pp, "/r/nset configuration=Release");
for (int i = 0; i < p.Count; i++)
{
string cmd = "/r/ncall buildproject.cmd " + "/".//" + p[i].Substring(dir.Length) + "/"";
WriteS(pp, cmd);
//try{
System.IO.FileInfo finfo = new FileInfo(p[i]);
if(finfo.Exists)
{
string demoname = finfo.Name.Replace(".csproj", ".exe");
string sfile = "/r/ncopy /"" + finfo.DirectoryName + @"/obj/%configuration%/" +demoname + "/"";
string tfile = "/"" + finfo.DirectoryName + @"/../../bin/"+demoname + "/"";
WriteS(pp, sfile+" " +tfile);
}
}
pp.Close();
MessageBox.Show("生成Demo编译命令完成。");
}
}
程序可以在我的网络硬盘上下载,
说明,只支持编译C#工程,可以自己改。
附源码,请引用system.windows.form.dll:
void main()
{
CreateCSCmd();
}
StringCollection FileSearch(string sDir, string sFile)
{
try
{
foreach (string d in Directory.GetDirectories(sDir))
{
foreach (string f in Directory.GetFiles(d, sFile))
{
lstFilesFound.Add(f);
}
FileSearch(d, sFile);
}
}
catch (System.Exception excpt)
{
Console.WriteLine(excpt.Message);
}
return lstFilesFound;
}
void WriteS(System.IO.FileStream f, string str)
{
byte[] ar = System.Text.Encoding.ASCII.GetBytes(str);
f.Write(ar, 0, ar.Length);
}
private void CreateCSCmd()
{
lstFilesFound.Clear();
string dir = AppDomain.CurrentDomain.BaseDirectory;
StringCollection p = FileSearch(dir, "*.csproj");
System.IO.FileStream bproj = new FileStream("buildproject.cmd", FileMode.OpenOrCreate);
WriteS(bproj, "if not exist %1 goto end");
WriteS(bproj, "/r/necho Building %1...");
WriteS(bproj, "/r/n%msbuild% /nologo /t:Rebuild /verbosity:quiet /p:Configuration=%configuration% %1");
WriteS(bproj, "/r/necho Done %1");
WriteS(bproj, "/r/n:end");
bproj.Close();
System.IO.FileStream pp = new FileStream("buildall.cmd", FileMode.OpenOrCreate);
WriteS(pp, "@echo off");
WriteS(pp, "/r/nSET sn=/"d://Program Files//Microsoft Visual Studio 8//SDK//v2.0//Bin//sn.exe/"");
WriteS(pp, "/r/nset gacutil=/"d://Program Files//Microsoft Visual Studio 8//SDK//v2.0//Bin//gacutil.exe/"");
WriteS(pp, "/r/nset msbuild=c://windows//Microsoft.NET//Framework//v2.0.50727//MSBuild.exe");
WriteS(pp, "/r/nset dxver=v7.1");
WriteS(pp, "/r/nset configuration=Release");
for (int i = 0; i < p.Count; i++)
{
string cmd = "/r/ncall buildproject.cmd " + "/".//" + p[i].Substring(dir.Length) + "/"";
WriteS(pp, cmd);
//try{
System.IO.FileInfo finfo = new FileInfo(p[i]);
if(finfo.Exists)
{
string demoname = finfo.Name.Replace(".csproj", ".exe");
string sfile = "/r/ncopy /"" + finfo.DirectoryName + @"/obj/%configuration%/" +demoname + "/"";
string tfile = "/"" + finfo.DirectoryName + @"/../../bin/"+demoname + "/"";
WriteS(pp, sfile+" " +tfile);
}
}
pp.Close();
MessageBox.Show("生成Demo编译命令完成。");
}
}
相关文章推荐
- 虚拟机下载 FBreader源码 demo资源 编译rk依赖的工具
- 【安装工具】【ARM-DS-5】成功破解ARM DS-5 v5.26.0 + 配置高通MDM9026芯片的demo==》成功编译得到demo.bin文件
- 反编译工具源代码
- Flash反编译工具(Sonne Flash Decompiler)
- android反编译工具学习
- YACC、LEX、JAVACC-------常用的编译工具
- 在Android系统中修改Android.mk使其同时编译rgb2565和rgb2888(向out/host/linux-x86/bin/下新增加一个工具命令)
- tpcc-mysql数据库绘图工具编译安装
- 自动化编译工具(autotools系列工具)使用实例
- java编译器API——使用编译工具
- 可以在线C++编译的工具站点
- 三款常用的Java字节码反编译工具
- 强大的.net反编译工具
- android apk反编译工具汇总(2017年10月)
- 反编译工具jad的使用
- 管理工具---Maven系列(一)编译问题Could not resolve dependencies for project
- win7环境下,golang thrift demo代码编译不通过
- Ubuntu12.04安装交叉编译工具链arm-linux-gcc
- Eclipse反编译工具Jad及插件JadClipse配置
- Eclipse反编译工具Jad及插件JadClipse配置