當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。