当前位置: 首页>>代码示例>>C#>>正文


C# FilePath.SetLastModified方法代码示例

本文整理汇总了C#中Sharpen.FilePath.SetLastModified方法的典型用法代码示例。如果您正苦于以下问题:C# FilePath.SetLastModified方法的具体用法?C# FilePath.SetLastModified怎么用?C# FilePath.SetLastModified使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sharpen.FilePath的用法示例。


在下文中一共展示了FilePath.SetLastModified方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WaitNextSec

		private void WaitNextSec(FilePath f)
		{
			long initialLastModified = f.LastModified();
			do
			{
				f.SetLastModified(Runtime.CurrentTimeMillis());
			}
			while (f.LastModified() == initialLastModified);
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:9,代码来源:FileSnapshotTest.cs

示例2: BUG_WorkAroundRacyGitIssues

 /// <summary>Kick the timestamp of a local file.</summary>
 /// <remarks>
 /// Kick the timestamp of a local file.
 /// <p>
 /// We shouldn't have to make these method calls. The cache is using file
 /// system timestamps, and on many systems unit tests run faster than the
 /// modification clock. Dumping the cache after we make an edit behind
 /// RefDirectory's back allows the tests to pass.
 /// </remarks>
 /// <param name="name">the file in the repository to force a time change on.</param>
 private void BUG_WorkAroundRacyGitIssues(string name)
 {
     FilePath path = new FilePath(db.Directory, name);
     long old = path.LastModified();
     long set = 1250379778668L;
     // Sat Aug 15 20:12:58 GMT-03:30 2009
     path.SetLastModified(set);
     NUnit.Framework.Assert.IsTrue(old != path.LastModified(), "time changed");
 }
开发者ID:JamesChan,项目名称:ngit,代码行数:19,代码来源:T0003_BasicTest.cs

示例3: Touch

		private static void Touch(long begin, FilePath dir)
		{
			while (begin >= dir.LastModified())
			{
				try
				{
					Sharpen.Thread.Sleep(25);
				}
				catch (Exception)
				{
				}
				//
				dir.SetLastModified(Runtime.CurrentTimeMillis());
			}
		}
开发者ID:shoff,项目名称:ngit,代码行数:15,代码来源:ConcurrentRepackTest.cs

示例4: WritePackedRefs

 /// <exception cref="System.IO.IOException"></exception>
 private void WritePackedRefs(string content)
 {
     FilePath pr = new FilePath(diskRepo.Directory, "packed-refs");
     Write(pr, content);
     long now = Runtime.CurrentTimeMillis();
     int oneHourAgo = 3600 * 1000;
     pr.SetLastModified(now - oneHourAgo);
 }
开发者ID:JamesChan,项目名称:ngit,代码行数:9,代码来源:RefDirectoryTest.cs

示例5: TestUpdateSmudgedEntries

		public virtual void TestUpdateSmudgedEntries()
		{
			git.BranchCreate().SetName("test2").Call();
			RefUpdate rup = db.UpdateRef(Constants.HEAD);
			rup.Link("refs/heads/test2");
			FilePath file = new FilePath(db.WorkTree, "Test.txt");
			long size = file.Length();
			long mTime = file.LastModified() - 5000L;
			NUnit.Framework.Assert.IsTrue(file.SetLastModified(mTime));
			DirCache cache = DirCache.Lock(db.GetIndexFile(), db.FileSystem);
			DirCacheEntry entry = cache.GetEntry("Test.txt");
			NUnit.Framework.Assert.IsNotNull(entry);
			entry.SetLength(0);
			entry.LastModified = 0;
			cache.Write();
			NUnit.Framework.Assert.IsTrue(cache.Commit());
			cache = DirCache.Read(db.GetIndexFile(), db.FileSystem);
			entry = cache.GetEntry("Test.txt");
			NUnit.Framework.Assert.IsNotNull(entry);
			NUnit.Framework.Assert.AreEqual(0, entry.Length);
			NUnit.Framework.Assert.AreEqual(0, entry.LastModified);
			db.GetIndexFile().SetLastModified(db.GetIndexFile().LastModified() - 5000);
			NUnit.Framework.Assert.IsNotNull(git.Checkout().SetName("test").Call());
			cache = DirCache.Read(db.GetIndexFile(), db.FileSystem);
			entry = cache.GetEntry("Test.txt");
			NUnit.Framework.Assert.IsNotNull(entry);
			NUnit.Framework.Assert.AreEqual(size, entry.Length);
			NUnit.Framework.Assert.AreEqual(mTime, entry.LastModified);
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:29,代码来源:CheckoutCommandTest.cs


注:本文中的Sharpen.FilePath.SetLastModified方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。