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


C# FilePath.IsDirectory方法代码示例

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


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

示例1: Test001_Initalize

		public virtual void Test001_Initalize()
		{
			FilePath gitdir = new FilePath(trash, Constants.DOT_GIT);
			FilePath hooks = new FilePath(gitdir, "hooks");
			FilePath objects = new FilePath(gitdir, "objects");
			FilePath objects_pack = new FilePath(objects, "pack");
			FilePath objects_info = new FilePath(objects, "info");
			FilePath refs = new FilePath(gitdir, "refs");
			FilePath refs_heads = new FilePath(refs, "heads");
			FilePath refs_tags = new FilePath(refs, "tags");
			FilePath HEAD = new FilePath(gitdir, "HEAD");
			NUnit.Framework.Assert.IsTrue(trash.IsDirectory(), "Exists " + trash);
			NUnit.Framework.Assert.IsTrue(hooks.IsDirectory(), "Exists " + hooks);
			NUnit.Framework.Assert.IsTrue(objects.IsDirectory(), "Exists " + objects);
			NUnit.Framework.Assert.IsTrue(objects_pack.IsDirectory(), "Exists " + objects_pack
				);
			NUnit.Framework.Assert.IsTrue(objects_info.IsDirectory(), "Exists " + objects_info
				);
			NUnit.Framework.Assert.AreEqual(2L, objects.ListFiles().Length);
			NUnit.Framework.Assert.IsTrue(refs.IsDirectory(), "Exists " + refs);
			NUnit.Framework.Assert.IsTrue(refs_heads.IsDirectory(), "Exists " + refs_heads);
			NUnit.Framework.Assert.IsTrue(refs_tags.IsDirectory(), "Exists " + refs_tags);
			NUnit.Framework.Assert.IsTrue(HEAD.IsFile(), "Exists " + HEAD);
			NUnit.Framework.Assert.AreEqual(23, HEAD.Length());
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:25,代码来源:T0003_BasicTest.cs

示例2: BlobStore

 public BlobStore(string path)
 {
     this.path = path;
     FilePath directory = new FilePath(path);
     directory.Mkdirs();
     if (!directory.IsDirectory()) {
         throw new InvalidOperationException(string.Format("Unable to create directory for: {0}", directory));
     }
 }
开发者ID:DotNetEra,项目名称:couchbase-lite-net,代码行数:9,代码来源:BlobStore.cs

示例3: RecursiveListFiles

		public static FilePath[] RecursiveListFiles(FilePath dir, FileFilter filter)
		{
			if (!dir.IsDirectory())
			{
				throw new ArgumentException(dir + " is not a directory");
			}
			IList<FilePath> fileList = new List<FilePath>();
			RecursiveListFilesHelper(dir, filter, fileList);
			return Sharpen.Collections.ToArray(fileList, new FilePath[fileList.Count]);
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:10,代码来源:TestUtils.cs

示例4: DeleteRecursive

		public static bool DeleteRecursive(FilePath fileOrDirectory)
		{
			if (fileOrDirectory.IsDirectory())
			{
				foreach (FilePath child in fileOrDirectory.ListFiles())
				{
					DeleteRecursive(child);
				}
			}
			bool result = fileOrDirectory.Delete() || !fileOrDirectory.Exists();
			return result;
		}
开发者ID:Redth,项目名称:couchbase-lite-net,代码行数:12,代码来源:FileDirUtils.cs

示例5: Accept

			public override bool Accept(FilePath f)
			{
				if (f.IsDirectory())
				{
					return true;
				}
				string name = f.GetName();
				int i = name.LastIndexOf('.');
				if (i > 0 && i < name.Length - 1)
				{
					string ext = Sharpen.Runtime.Substring(name, i + 1).ToLower();
					if (ext.Equals("js"))
					{
						return true;
					}
				}
				return false;
			}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:18,代码来源:JSConsole.cs

示例6: BlobStore

        public BlobStore(string path, SymmetricKey encryptionKey)
        {
            if (path == null) {
                throw new ArgumentNullException("path");
            }

            _path = path;
            EncryptionKey = encryptionKey;
            FilePath directory = new FilePath(path);
            if (directory.Exists() && directory.IsDirectory()) {
                // Existing blob-store.
                VerifyExistingStore();
            } else {
                // New blob store; create directory:
                directory.Mkdirs();
                if (!directory.IsDirectory()) {
                    throw new InvalidOperationException(string.Format("Unable to create directory for: {0}", directory));
                }

                if (encryptionKey != null) {
                    MarkEncrypted(true);
                }
            }
        }
开发者ID:transformersprimeabcxyz,项目名称:_TO-DO-couchbase-lite-net-couchbase,代码行数:24,代码来源:BlobStore.cs

示例7: PrescanTwoTrees

		/// <exception cref="System.IO.IOException"></exception>
		internal virtual void PrescanTwoTrees()
		{
			new IndexTreeWalker(index, head, merge, root, new _AbstractIndexTreeVisitor_267(this
				)).Walk();
			// if there's a conflict, don't list it under
			// to-be-removed, since that messed up our next
			// section
			removed.RemoveAll(conflicts);
			foreach (string path in updated.Keys)
			{
				if (index.GetEntry(path) == null)
				{
					FilePath file = new FilePath(root, path);
					if (file.IsFile())
					{
						conflicts.AddItem(path);
					}
					else
					{
						if (file.IsDirectory())
						{
							CheckConflictsWithFile(file);
						}
					}
				}
			}
			conflicts.RemoveAll(removed);
		}
开发者ID:stewartwhaley,项目名称:monodevelop,代码行数:29,代码来源:WorkDirCheckout.cs

示例8: TempDir

 public FileInfo TempDir()
 {
     FilePath directory = new FilePath(path);
     FilePath tempDirectory = new FilePath(directory, "temp_attachments");
     tempDirectory.Mkdirs();
     if (!tempDirectory.IsDirectory())
     {
         throw new InvalidOperationException(string.Format("Unable to create directory for: {0}"
             , tempDirectory));
     }
     return tempDirectory;
 }
开发者ID:FireflyLogic,项目名称:couchbase-lite-net,代码行数:12,代码来源:BlobStore.cs

示例9: GetSubmoduleRepository

		/// <summary>Get submodule repository at path</summary>
		/// <param name="parent"></param>
		/// <param name="path"></param>
		/// <returns>repository or null if repository doesn't exist</returns>
		/// <exception cref="System.IO.IOException">System.IO.IOException</exception>
		public static Repository GetSubmoduleRepository(FilePath parent, string path)
		{
			FilePath subWorkTree = new FilePath(parent, path);
			if (!subWorkTree.IsDirectory())
			{
				return null;
			}
			FilePath workTree = new FilePath(parent, path);
			try
			{
				return new RepositoryBuilder().SetMustExist(true).SetFS(FS.DETECTED).SetWorkTree(
					workTree).Build();
			}
			catch (RepositoryNotFoundException)
			{
				//
				//
				//
				//
				return null;
			}
		}
开发者ID:nocache,项目名称:monodevelop,代码行数:27,代码来源:SubmoduleWalk.cs

示例10: Manager

 public Manager(Context context, ManagerOptions options)
 {
     Log.I(Database.Tag, "Starting Manager version: %s", Couchbase.Lite.Manager.Version
         );
     this.context = context;
     this.directoryFile = context.GetFilesDir();
     this.options = (options != null) ? options : DefaultOptions;
     this.databases = new Dictionary<string, Database>();
     this.replications = new AList<Replication>();
     directoryFile.Mkdirs();
     if (!directoryFile.IsDirectory())
     {
         throw new IOException(string.Format("Unable to create directory for: %s", directoryFile
             ));
     }
     UpgradeOldDatabaseFiles(directoryFile);
     workExecutor = Executors.NewSingleThreadScheduledExecutor();
 }
开发者ID:jonlipsky,项目名称:couchbase-lite-net,代码行数:18,代码来源:Manager.cs

示例11: TestMergeNonVersionedPaths

 public virtual void TestMergeNonVersionedPaths()
 {
     Git git = new Git(db);
     WriteTrashFile("a", "1\na\n3\n");
     WriteTrashFile("b", "1\nb\n3\n");
     WriteTrashFile("c/c/c", "1\nc\n3\n");
     git.Add().AddFilepattern("a").AddFilepattern("b").AddFilepattern("c/c/c").Call();
     RevCommit initialCommit = git.Commit().SetMessage("initial").Call();
     CreateBranch(initialCommit, "refs/heads/side");
     CheckoutBranch("refs/heads/side");
     WriteTrashFile("a", "1\na(side)\n3\n");
     WriteTrashFile("b", "1\nb(side)\n3\n");
     git.Add().AddFilepattern("a").AddFilepattern("b").Call();
     RevCommit secondCommit = git.Commit().SetMessage("side").Call();
     NUnit.Framework.Assert.AreEqual("1\nb(side)\n3\n", Read(new FilePath(db.WorkTree,
         "b")));
     CheckoutBranch("refs/heads/master");
     NUnit.Framework.Assert.AreEqual("1\nb\n3\n", Read(new FilePath(db.WorkTree, "b"))
         );
     WriteTrashFile("a", "1\na(main)\n3\n");
     WriteTrashFile("c/c/c", "1\nc(main)\n3\n");
     git.Add().AddFilepattern("a").AddFilepattern("c/c/c").Call();
     git.Commit().SetMessage("main").Call();
     WriteTrashFile("d", "1\nd\n3\n");
     NUnit.Framework.Assert.IsTrue(new FilePath(db.WorkTree, "e").Mkdir());
     MergeCommandResult result = git.Merge().Include(secondCommit.Id).SetStrategy(MergeStrategy
         .RESOLVE).Call();
     NUnit.Framework.Assert.AreEqual(MergeStatus.CONFLICTING, result.GetMergeStatus());
     NUnit.Framework.Assert.AreEqual("1\n<<<<<<< HEAD\na(main)\n=======\na(side)\n>>>>>>> 86503e7e397465588cc267b65d778538bffccb83\n3\n"
         , Read(new FilePath(db.WorkTree, "a")));
     NUnit.Framework.Assert.AreEqual("1\nb(side)\n3\n", Read(new FilePath(db.WorkTree,
         "b")));
     NUnit.Framework.Assert.AreEqual("1\nc(main)\n3\n", Read(new FilePath(db.WorkTree,
         "c/c/c")));
     NUnit.Framework.Assert.AreEqual("1\nd\n3\n", Read(new FilePath(db.WorkTree, "d"))
         );
     FilePath dir = new FilePath(db.WorkTree, "e");
     NUnit.Framework.Assert.IsTrue(dir.IsDirectory());
     NUnit.Framework.Assert.AreEqual(1, result.GetConflicts().Count);
     NUnit.Framework.Assert.AreEqual(3, result.GetConflicts().Get("a")[0].Length);
     NUnit.Framework.Assert.AreEqual(RepositoryState.MERGING, db.GetRepositoryState());
 }
开发者ID:OrangeCloudNetworks,项目名称:ngit,代码行数:42,代码来源:MergeCommandTest.cs

示例12: DoCheckout

 /// <exception cref="NGit.Errors.CorruptObjectException"></exception>
 /// <exception cref="System.IO.IOException"></exception>
 /// <exception cref="NGit.Errors.MissingObjectException"></exception>
 /// <exception cref="NGit.Errors.IncorrectObjectTypeException"></exception>
 /// <exception cref="NGit.Errors.CheckoutConflictException"></exception>
 /// <exception cref="NGit.Errors.IndexWriteException"></exception>
 private bool DoCheckout()
 {
     toBeDeleted.Clear();
     ObjectReader objectReader = repo.ObjectDatabase.NewReader();
     try
     {
         if (headCommitTree != null)
         {
             PreScanTwoTrees();
         }
         else
         {
             PrescanOneTree();
         }
         if (!conflicts.IsEmpty())
         {
             if (failOnConflict)
             {
                 throw new NGit.Errors.CheckoutConflictException(Sharpen.Collections.ToArray(conflicts
                     , new string[conflicts.Count]));
             }
             else
             {
                 CleanUpConflicts();
             }
         }
         // update our index
         builder.Finish();
         FilePath file = null;
         string last = string.Empty;
         // when deleting files process them in the opposite order as they have
         // been reported. This ensures the files are deleted before we delete
         // their parent folders
         for (int i = removed.Count - 1; i >= 0; i--)
         {
             string r = removed[i];
             file = new FilePath(repo.WorkTree, r);
             if (!file.Delete() && file.Exists())
             {
                 // The list of stuff to delete comes from the index
                 // which will only contain a directory if it is
                 // a submodule, in which case we shall not attempt
                 // to delete it. A submodule is not empty, so it
                 // is safe to check this after a failed delete.
                 if (!file.IsDirectory())
                 {
                     toBeDeleted.AddItem(r);
                 }
             }
             else
             {
                 if (!IsSamePrefix(r, last))
                 {
                     RemoveEmptyParents(new FilePath(repo.WorkTree, last));
                 }
                 last = r;
             }
         }
         if (file != null)
         {
             RemoveEmptyParents(file);
         }
         foreach (string path in updated.Keys)
         {
             // ... create/overwrite this file ...
             file = new FilePath(repo.WorkTree, path);
             if (!file.GetParentFile().Mkdirs())
             {
             }
             // ignore
             DirCacheEntry entry = dc.GetEntry(path);
             // submodules are handled with separate operations
             if (FileMode.GITLINK.Equals(entry.RawMode))
             {
                 continue;
             }
             CheckoutEntry(repo, file, entry, objectReader);
         }
         // commit the index builder - a new index is persisted
         if (!builder.Commit())
         {
             throw new IndexWriteException();
         }
     }
     finally
     {
         objectReader.Release();
     }
     return toBeDeleted.Count == 0;
 }
开发者ID:stinos,项目名称:ngit,代码行数:96,代码来源:DirCacheCheckout.cs

示例13: Identities

 // Oh well. They don't have a known hosts in home.
 // Oh well. They don't have a known hosts in home.
 private static void Identities(JSch sch, FS fs)
 {
     FilePath home = fs.UserHome();
     if (home == null)
     {
         return;
     }
     FilePath sshdir = new FilePath(home, ".ssh");
     if (sshdir.IsDirectory())
     {
         LoadIdentity(sch, new FilePath(sshdir, "identity"));
         LoadIdentity(sch, new FilePath(sshdir, "id_rsa"));
         LoadIdentity(sch, new FilePath(sshdir, "id_dsa"));
     }
 }
开发者ID:kenji-tan,项目名称:ngit,代码行数:17,代码来源:JschConfigSessionFactory.cs

示例14: Accept

			public bool Accept(FilePath pathname)
			{
				return pathname.IsDirectory() && !pathname.GetName().Equals("CVS");
			}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:4,代码来源:ShellTest.cs

示例15: Mkdirs

 /// <summary>
 /// Creates the directory named by this abstract pathname, including any
 /// necessary but nonexistent parent directories.
 /// </summary>
 /// <remarks>
 /// Creates the directory named by this abstract pathname, including any
 /// necessary but nonexistent parent directories. Note that if this operation
 /// fails it may have succeeded in creating some of the necessary parent
 /// directories.
 /// </remarks>
 /// <param name="d">directory to be created</param>
 /// <param name="skipExisting">
 /// if
 /// <code>true</code>
 /// skip creation of the given directory if it
 /// already exists in the file system
 /// </param>
 /// <exception cref="System.IO.IOException">
 /// if creation of
 /// <code>d</code>
 /// fails. This may occur if
 /// <code>d</code>
 /// did exist when the method was called. This can therefore
 /// cause IOExceptions during race conditions when multiple
 /// concurrent threads all try to create the same directory.
 /// </exception>
 public static void Mkdirs(FilePath d, bool skipExisting)
 {
     if (!d.Mkdirs())
     {
         if (skipExisting && d.IsDirectory())
         {
             return;
         }
         throw new IOException(MessageFormat.Format(JGitText.Get().mkDirsFailed, d.GetAbsolutePath
             ()));
     }
 }
开发者ID:kenji-tan,项目名称:ngit,代码行数:38,代码来源:FileUtils.cs


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