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


C# FileLocator.GetDirectoryFromPath方法代码示例

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


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

示例1: DiskImageFile

        /// <summary>
        /// Initializes a new instance of the DiskImageFile class.
        /// </summary>
        /// <param name="fileLocator">An object to open the file and any extents</param>
        /// <param name="file">The file name</param>
        /// <param name="access">The type of access desired</param>
        internal DiskImageFile(FileLocator fileLocator, string file, FileAccess access)
        {
            _access = access;

            FileAccess fileAccess = FileAccess.Read;
            FileShare fileShare = FileShare.Read;
            if (_access != FileAccess.Read)
            {
                fileAccess = FileAccess.ReadWrite;
                fileShare = FileShare.None;
            }

            Stream fileStream = null;
            try
            {
                fileStream = fileLocator.Open(file, FileMode.Open, fileAccess, fileShare);
                LoadDescriptor(fileStream);

                // For monolithic disks, keep hold of the stream - we won't try to use the file name
                // from the embedded descriptor because the file may have been renamed, making the 
                // descriptor out of date.
                if (_descriptor.CreateType == DiskCreateType.StreamOptimized || _descriptor.CreateType == DiskCreateType.MonolithicSparse)
                {
                    _monolithicStream = fileStream;
                    _ownsMonolithicStream = Ownership.Dispose;
                    fileStream = null;
                }
            }
            finally
            {
                if (fileStream != null)
                {
                    fileStream.Dispose();
                }
            }

            _fileLocator = fileLocator.GetRelativeLocator(fileLocator.GetDirectoryFromPath(file));
        }
开发者ID:AnotherAltr,项目名称:Rc.Core,代码行数:44,代码来源:DiskImageFile.cs

示例2: DiskImageFile

 internal DiskImageFile(FileLocator locator, string path, Stream stream, Ownership ownsStream)
     : this(stream, ownsStream)
 {
     _fileLocator = locator.GetRelativeLocator(locator.GetDirectoryFromPath(path));
     _fileName = locator.GetFileFromPath(path);
 }
开发者ID:alexcmd,项目名称:DiscUtils,代码行数:6,代码来源:DiskImageFile.cs

示例3: DiskImageFile

        internal DiskImageFile(FileLocator locator, string path, FileAccess access)
        {
            FileShare share = access == FileAccess.Read ? FileShare.Read : FileShare.None;
            _fileStream = locator.Open(path, FileMode.Open, access, share);
            _ownsStream = Ownership.Dispose;

            _fileLocator = locator.GetRelativeLocator(locator.GetDirectoryFromPath(path));
            _fileName = locator.GetFileFromPath(path);

            Initialize();
        }
开发者ID:easymetadata,项目名称:discutils_Ewf-POC,代码行数:11,代码来源:DiskImageFile.cs


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