📄 sharpzlib.build
字号:
<?xml version="1.0"?>
<project name="#ZLib" default="build" basedir=".">
<property name="debug" value="False"/>
<property name="optimize" value="True"/>
<target name="build">
<!-- compile SharpZipLib -->
<script language="C#">
<code><![CDATA[
static string revisionNumber = "0";
static Regex REVISION_NUMBER = new Regex(@"\$RevisionNumber\$");
static void Substitute(string templateFileName, string resultFileName)
{
string data;
StreamReader template = new StreamReader(templateFileName);
using (template) {
StringBuilder b = new StringBuilder();
string line;
while ((line = template.ReadLine()) != null) {
b.Append(ProcessLine(line));
b.Append("\r\n");
}
data = b.ToString();
}
// check if the file content has altered.
if (File.Exists(resultFileName)) {
StreamReader resultReader = new StreamReader(resultFileName);
using (resultReader) {
if (resultReader.ReadToEnd() == data) {
return;
}
}
}
StreamWriter result = new StreamWriter(resultFileName);
using (result) {
result.Write(data);
}
}
static string ProcessLine(string s)
{
return REVISION_NUMBER.Replace(s, revisionNumber);
}
static string ReadRevisionFromFile()
{
try {
StreamReader reader = new StreamReader(@"..\..\..\REVISION");
using (reader) {
return reader.ReadLine();
}
}
catch (Exception e) {
Console.WriteLine(e.Message);
throw new Exception("Cannot read revision number from file: " + e.Message);
}
}
public static void ScriptMain(Project project)
{
try {
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("svn", "info");
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
try {
System.Diagnostics.Process process = System.Diagnostics.Process.Start(psi);
process.WaitForExit();
string output = process.StandardOutput.ReadToEnd();
Regex r = new Regex(@"Revision:\s+(\d+)");
Match m = r.Match(output);
if (m != null && m.Success && m.Groups[1] != null) {
revisionNumber = m.Groups[1].Value;
}
if (revisionNumber == null || revisionNumber.Equals("") || revisionNumber.Equals("0")) {
throw new Exception("Could not find revision number in svn output");
}
}
catch (Exception e) {
Console.WriteLine(e.Message);
revisionNumber = ReadRevisionFromFile();
}
} catch {}
Substitute("Src/AssemblyInfo.tmpl", "Src/AssemblyInfo.cs");
}
]]></code>
</script>
<echo message="Building #ZLib"/>
<csc
target="library"
output="bin/ICSharpCode.SharpZipLib.dll"
optimize="${optimize}"
debug="${debug}">
<sources basedir="src">
<includes name="**/*.cs"/>
</sources>
</csc>
<nant buildfile = "samples/cs/samples.build" />
</target>
<target name="clean">
<delete verbose="true" >
<fileset basedir=".">
<includes name="bin/ICSharpCode.SharpZipLib.dll"/>
<includes name="bin/ICSharpCode.SharpZipLib.pdb"/>
</fileset>
</delete>
<nant buildfile = "samples/cs/samples.build" target="clean"/>
<nant buildfile = "samples/vb/samples.build" target="clean"/>
</target>
</project>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -