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


C# DirectoryEntry.Setup方法代码示例

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


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

示例1: AllocateRoot

 /// <summary>
 /// Allocates a vfs root directory entry.
 /// </summary>
 /// <param name="node">The vfs node, which corresponds to the root directory.</param>
 /// <returns>The created directory entry.</returns>
 /// <exception cref="System.ArgumentNullException">The specified node is invalid.</exception>
 /// <remarks>
 /// This method creates a directory entry, which has some special properties. The first one is, that
 /// its parent is itself. This provides for the ability to cd .. on the root to stay on the root.
 /// <para/>
 /// The next ability is to create specialized root directories to isolate processes from the remainder
 /// of the filesystem. Setting a root directory created using this method effectively limits the process
 /// to access inside of the newly created namespace.
 /// </remarks>
 public static DirectoryEntry AllocateRoot(IVfsNode node)
 {
     #if VFS_NO_EXCEPTIONS
     if (node == null)
         throw new ArgumentNullException(@"node");
     #endif // #if VFS_NO_EXCEPTIONS
     DirectoryEntry result = new DirectoryEntry();
     result.Setup(result, System.String.Empty, node);
     return result;
 }
开发者ID:hj1980,项目名称:Mosa,代码行数:24,代码来源:DirectoryEntry.cs

示例2: Allocate

        /// <summary>
        /// Allocates a new DirectoryEntry object for the given settings.
        /// </summary>
        /// <param name="parent">The parent directory entry.</param>
        /// <param name="name">The name of the entry to create.</param>
        /// <param name="node">The vfs node referenced by the directory entry.</param>
        /// <returns>The allocated directory entry.</returns>
        /// <exception cref="System.ArgumentNullException">If any one of the parameters is null.</exception>
        /// <exception cref="System.ArgumentException">If the name is zero-length.</exception>
        /// <remarks>
        /// This method is used to control the DirectoryEntry allocation and maintain a cache of them. Also used to
        /// prevent infinite name allocations.
        /// </remarks>
        public static DirectoryEntry Allocate(DirectoryEntry parent, string name, IVfsNode node)
        {
            //#if VFS_NO_EXCEPTIONS
            if (parent == null)
                throw new System.ArgumentNullException(@"parent");

            if (name == null)
                throw new System.ArgumentNullException(@"name");

            if (node == null)
                throw new System.ArgumentNullException(@"node");

            if (name.Length == 0)
                throw new System.ArgumentException(@"Invalid directory entry name."); // , @"name"
            // FIXME: Add precondition check for invalid characters
            // FIXME: Localize exception messages
            //#endif // #if VFS_NO_EXCEPTIONS

            DirectoryEntry directory = new DirectoryEntry();

            directory.Setup(parent, name, node);

            return directory;
        }
开发者ID:hj1980,项目名称:Mosa,代码行数:37,代码来源:DirectoryEntry.cs


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