把做工程过程比较好的一些内容片段做个备份,下面的资料是关于C# 修改指定文件的最后修改时间的时间戳的内容。
using System;
using System.IO;
using System.Linq;
namespace RobvanderWoude
{
class CloneDate
{
static int Main( string[] args )
{
bool debug = false;
switch ( args.Length )
{
case 0:
return WriteError( string.Empty );
case 2:
break;
case 3:
if ( args[2].Substring( 0, 2 ).ToUpper( ) == "/D" )
{
debug = true;
}
else
{
return WriteError( "Invalid command line argument(s)" );
}
break;
default:
return WriteError( "Invalid number of command line arguments" );
}
try
{
string sourcefile = args[0];
if ( string.IsNullOrWhiteSpace( sourcefile ) )
{
return WriteError( "Invalid source file specification" );
}
try
{
sourcefile = Path.GetFullPath( sourcefile ).Trim( '"' );
}
catch ( ArgumentException )
{
return WriteError( "No wildcards allowed in source file" );
}
if ( !File.Exists( sourcefile ) )
{
return WriteError( "File not found: "" + sourcefile + """ );
}
string targetspec = args[1];
if ( string.IsNullOrWhiteSpace( targetspec ) )
{
return WriteError( "Invalid target file sp