• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# QuickIO.QuickIOPathInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中SchwabenCode.QuickIO.QuickIOPathInfo的典型用法代码示例。如果您正苦于以下问题:C# QuickIOPathInfo类的具体用法?C# QuickIOPathInfo怎么用?C# QuickIOPathInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



QuickIOPathInfo类属于SchwabenCode.QuickIO命名空间,在下文中一共展示了QuickIOPathInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: EnumerateDirectoryMetadata

        /// <summary>
        /// Receives <see cref="QuickIODirectoryMetadata"/> of current directory
        /// </summary>
        /// <returns><see cref="QuickIODirectoryMetadata"/></returns>
        public static QuickIODirectoryMetadata EnumerateDirectoryMetadata( QuickIOPathInfo pathInfo, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None )
        {
            Contract.Requires( pathInfo != null );
            Contract.Ensures( Contract.Result<QuickIODirectoryMetadata>() != null );

            return EnumerateDirectoryMetadata( pathInfo.FullNameUnc, enumerateOptions );
        }
开发者ID:Invisibility,项目名称:QuickIO,代码行数:11,代码来源:QuickIODirectory.Metadata.cs


示例2: WriteAllBytes

        /// <summary>
        /// Writes the specified byte array.
        /// If the file already exists, it is overwritten.
        /// </summary>
        /// <param name="pathInfo">The file. </param>
        /// <param name="bytes">The bytes to write. </param>
        /// <remarks>http://msdn.microsoft.com/en-us/library/system.io.file.writeallbytes(v=vs.110).aspx</remarks>
        public static void WriteAllBytes( QuickIOPathInfo pathInfo, IEnumerable<byte> bytes )
        {
            Contract.Requires( pathInfo != null );
            Contract.Requires( bytes != null );

            WriteAllBytes( pathInfo.FullNameUnc, bytes.ToArray() );
        }
开发者ID:Invisibility,项目名称:QuickIO,代码行数:14,代码来源:QuickIOFile.Write.cs


示例3: OpenRead

        /// <summary>
        /// Opens an existing file for reading.
        /// </summary>
        /// <param name="pathInfo">The file to be opened for reading. </param>
        /// <returns>A read-only <see cref="FileStream"/> on the specified path.</returns>
        /// <remarks>http://msdn.microsoft.com/en-us/library/system.io.file.openread(v=vs.110).aspx</remarks>
        public static FileStream OpenRead( QuickIOPathInfo pathInfo )
        {
            Contract.Requires( pathInfo != null );
            Contract.Ensures( Contract.Result<StreamReader>() != null );

            return OpenRead( pathInfo.FullNameUnc );
        }
开发者ID:Invisibility,项目名称:QuickIO,代码行数:13,代码来源:QuickIOFile.Open.cs


示例4: AppendAllLines

        /// <summary>
        /// Appends lines by using the specified encoding.
        /// If the file does not exist, it creates the file.
        /// </summary>
        /// <param name="pathInfo">The file to append the lines to. The file is created if it doesn't exist.</param>
        /// <param name="contents">The lines to append.</param>
        /// <param name="encoding">The character encoding.</param>
        /// <remarks>http://msdn.microsoft.com/en-us/library/dd383356(v=vs.110).aspx</remarks>
        public static void AppendAllLines( QuickIOPathInfo pathInfo, IEnumerable<string> contents, Encoding encoding = null )
        {
            Contract.Requires( pathInfo != null );
            Contract.Requires( contents != null );

            AppendAllLines( pathInfo.FullNameUnc, contents, encoding );
        }
开发者ID:Invisibility,项目名称:QuickIO,代码行数:15,代码来源:QuickIOFile.Append.cs


示例5: Copy

        /// <summary>
        /// Copies a directory and all contents
        /// </summary>
        /// <param name="source">Source directory</param>
        /// <param name="target">Target directory</param>
        /// <param name="overwrite">true to overwrite existing files</param>
        /// <param name="cancellationToken">Cancallation Token</param>
        public static void Copy( QuickIODirectoryInfo source, QuickIOPathInfo target, bool overwrite = false, CancellationToken cancellationToken = default( CancellationToken ) )
        {
            Contract.Requires( source != null );
            Contract.Requires( target != null );

            throw new NotImplementedException();
        }
开发者ID:Invisibility,项目名称:QuickIO,代码行数:14,代码来源:QuickIODirectory.Copy.cs


示例6: AppendAllText

        /// <summary>
        /// Appends the specified string.
        /// If the file does not exist, it creates the file.
        /// </summary>
        /// <param name="pathInfo">The file to append the specified string to.</param>
        /// <param name="contents">The string to append to the file.</param>
        /// <param name="encoding">The character encoding.</param>
        /// <remarks>http://msdn.microsoft.com/en-us/library/ms143356(v=vs.110).aspx</remarks>
        public static void AppendAllText( QuickIOPathInfo pathInfo, string contents, Encoding encoding )
        {
            Contract.Requires( pathInfo != null );
            Contract.Requires( contents != null );

            AppendAllText( pathInfo.FullNameUnc, contents, encoding );
        }
开发者ID:Invisibility,项目名称:QuickIO,代码行数:15,代码来源:QuickIOFile.Append.cs


示例7: Exists

        /// <summary>
        /// Checks whether the path with the expected system entry type exists
        /// </summary>
        /// <param name="pathInfo">A file or a directory</param>
        /// <param name="systemEntryType"><see cref="QuickIOFileSystemEntryType"/> you are searching for</param>
        /// <returns></returns>
        /// <exception cref="UnmatchedFileSystemEntryTypeException">Path exists but it's not the type you're searching for.</exception>
        public static Boolean Exists( QuickIOPathInfo pathInfo, QuickIOFileSystemEntryType systemEntryType )
        {
            switch ( systemEntryType )
            {
                case QuickIOFileSystemEntryType.Directory:
                    try
                    {
                        InternalQuickIO.LoadDirectoryFromPathInfo( pathInfo );
                        return true;
                    }
                    catch ( PathNotFoundException )
                    {
                        return false;
                    }

                case QuickIOFileSystemEntryType.File:
                    try
                    {
                        InternalQuickIO.LoadFileFromPathInfo( pathInfo );
                        return true;
                    }
                    catch ( PathNotFoundException )
                    {
                        return false;
                    }

                default:
                    throw new ArgumentException( "Unknown QuickIOFileSystemEntryType passed." );
            }
        }
开发者ID:Kudach,项目名称:QuickIO,代码行数:37,代码来源:QuickIOCommon.cs


示例8: Copy

        /// <summary>
        /// Copies a directory and all contents
        /// </summary>
        /// <param name="source">Source directory</param>
        /// <param name="target">Target directory</param>
        /// <param name="overwrite">true to overwrite existing files</param>
        public static void Copy( QuickIODirectoryInfo source, QuickIOPathInfo target, bool overwrite = false )
        {
            Invariant.NotNull( source );
            Invariant.NotNull( target );

            var allContentUncPaths = EnumerateFileSystemEntryPaths( source, QuickIOPatternConstants.All, SearchOption.AllDirectories, QuickIOPathType.UNC );
            foreach ( var entry in allContentUncPaths )
            {
                string sourcePathUnc = entry.Key;
                var targetFullnameUnc = target.FullNameUnc + sourcePathUnc.Substring( source.FullNameUnc.Length );

                switch ( entry.Value )
                {
                    case QuickIOFileSystemEntryType.Directory:
                        {
                            QuickIODirectory.Create( targetFullnameUnc, true );
                        }
                        break;

                    case QuickIOFileSystemEntryType.File:
                        {
                            QuickIOFile.Copy( sourcePathUnc, targetFullnameUnc, overwrite );
                        }
                        break;
                }
            }
        }
开发者ID:Kudach,项目名称:QuickIO,代码行数:33,代码来源:QuickIODirectory_Copy.cs


示例9: CalculateHash

        /// <summary>
        /// File content hash calculation
        /// </summary>
        public static QuickIOHashResult CalculateHash( QuickIOPathInfo pathInfo, QuickIOHashImplementationType hashImplementationType )
        {
            Contract.Requires( pathInfo != null );

            switch( hashImplementationType )
            {
                case QuickIOHashImplementationType.SHA1:
                    return CalculateSha1Hash( pathInfo );

                case QuickIOHashImplementationType.SHA256:
                    return CalculateSha256Hash( pathInfo );

                case QuickIOHashImplementationType.SHA384:
                    return CalculateSha384Hash( pathInfo );

                case QuickIOHashImplementationType.SHA512:
                    return CalculateSha512Hash( pathInfo );

                case QuickIOHashImplementationType.MD5:
                    return CalculateMD5Hash( pathInfo );

                default:
                    throw new NotImplementedException( "Type " + hashImplementationType + " not implemented." );
            }
        }
开发者ID:Invisibility,项目名称:QuickIO,代码行数:28,代码来源:QuickIOFile.Hash.cs


示例10: Open

        /// <summary>
        /// Opens a <see cref="FileStream"/>
        /// </summary>
        /// <param name="pathInfo">The file to open. </param>
        /// <param name="mode"><see cref="FileMode"/> </param>
        /// <param name="access"><see cref="FileAccess"/></param>
        /// <param name="share"><see cref="FileShare"/></param>
        /// <returns><see cref="FileStream"/></returns>
        /// <remarks>http://msdn.microsoft.com/en-us/library/y973b725(v=vs.110).aspx</remarks>
        public static FileStream Open( QuickIOPathInfo pathInfo, FileMode mode, FileAccess access, FileShare share )
        {
            Contract.Requires( pathInfo != null );
            Contract.Ensures( Contract.Result<FileStream>() != null );

            return OpenFileStream( pathInfo.FullNameUnc, access, mode, share );
        }
开发者ID:Invisibility,项目名称:QuickIO,代码行数:16,代码来源:QuickIOFile.Open.cs


示例11: QuickIODirectoryInfo

 /// <summary>
 /// Creates the folder information on the basis of the path and the handles
 /// </summary>
 /// <param name="pathInfo"><see cref="QuickIOPathInfo"/></param>
 /// <param name="win32FindData"><see cref="Win32FindData"/></param>
 internal QuickIODirectoryInfo( QuickIOPathInfo pathInfo, Win32FindData win32FindData )
     : base(pathInfo, win32FindData)
 {
     if ( win32FindData != null )
     {
         RetriveDateTimeInformation( win32FindData );
     }
 }
开发者ID:Kudach,项目名称:QuickIO,代码行数:13,代码来源:QuickIODirectoryInfo.cs


示例12: CalculateMD5Hash

 /// <summary>
 /// File content hash calculation using MD5
 /// </summary>
 /// <returns><see cref="QuickIOHashResult"/></returns>
 /// <example>
 /// <code>
 /// // Show human readable hash
 /// QuickIOHashResult hashResult = QuickIOFile.CalculateMD5Hash( "C:\temp\image.bin" );
 /// Console.WriteLine("Hash: {0}", hashResult.Format( Encoding.UTF8, "x2" );
 /// </code>
 /// </example>
 public static QuickIOHashResult CalculateMD5Hash( QuickIOPathInfo pathInfo )
 {
     using ( var fs = OpenRead( pathInfo ) )
     using ( var hashAlgorithm = new MD5CryptoServiceProvider( ) )
     {
         return CalculateHash( hashAlgorithm, fs );
     }
 }
开发者ID:Kudach,项目名称:QuickIO,代码行数:19,代码来源:QuickIOFile_Hash.cs


示例13: WriteAllBytes

 /// <summary>
 /// Writes the specified byte array.
 /// If the file already exists, it is overwritten.
 /// </summary>
 /// <param name="pathInfo">The file. </param>
 /// <param name="bytes">The bytes to write. </param>
 /// <remarks>http://msdn.microsoft.com/en-us/library/system.io.file.writeallbytes(v=vs.110).aspx</remarks>
 public static void WriteAllBytes( QuickIOPathInfo pathInfo, byte[ ] bytes )
 {
     using ( var fileStream = OpenFileStream( pathInfo, FileAccess.ReadWrite, FileMode.Create, FileShare.None ) )
     {
         fileStream.Seek( 0, SeekOrigin.Begin );
         fileStream.Write( bytes, 0, bytes.Length );
     }
 }
开发者ID:Kudach,项目名称:QuickIO,代码行数:15,代码来源:QuickIOFile_Write.cs


示例14: QuickIOFileSystemEntryBase

 /// <summary>
 /// Initializes a new instance of the QuickIOAbstractBase class, which acts as a wrapper for a file path.
 /// </summary>
 /// <param name="pathInfo"><see cref="QuickIOPathInfo"/></param>
 /// <param name="findData"><see cref="Win32FindData"/></param>
 internal QuickIOFileSystemEntryBase( QuickIOPathInfo pathInfo, Win32FindData findData )
 {
     this.FindData = findData;
     this.PathInfo = pathInfo;
     if ( findData != null )
     {
         this.Attributes = findData.dwFileAttributes;
     }
 }
开发者ID:Kudach,项目名称:QuickIO,代码行数:14,代码来源:QuickIOFileSystemEntryBase.cs


示例15: CalculateSha1Hash

        /// <summary>
        /// File content hash calculation using SHA1
        /// </summary>
        /// <returns><see cref="QuickIOHashResult"/></returns>
        /// <example>
        /// <code>
        /// // Show human readable hash
        /// QuickIOHashResult hashResult = QuickIOFile.CalculateSha1Hash( "C:\temp\image.bin" );
        /// Console.WriteLine("Hash: {0}", hashResult.Format( Encoding.UTF8, "x2" );
        /// </code>
        /// </example>
        public static QuickIOHashResult CalculateSha1Hash( QuickIOPathInfo pathInfo )
        {
            Contract.Requires( pathInfo != null );

            using( var fs = OpenRead( pathInfo ) )
            using( var hashAlgorithm = new SHA1Managed() )
            {
                return CalculateHash( hashAlgorithm, fs );
            }
        }
开发者ID:Invisibility,项目名称:QuickIO,代码行数:21,代码来源:QuickIOFile.Hash.cs


示例16: AppendAllLines

 /// <summary>
 /// Appends lines by using the specified encoding.
 /// If the file does not exist, it creates the file.
 /// </summary>
 /// <param name="pathInfo">The file to append the lines to. The file is created if it doesn't exist.</param>
 /// <param name="contents">The lines to append.</param>
 /// <param name="encoding">The character encoding.</param>
 /// <remarks>http://msdn.microsoft.com/en-us/library/dd383356(v=vs.110).aspx</remarks>
 public static void AppendAllLines( QuickIOPathInfo pathInfo, IEnumerable<string> contents, Encoding encoding )
 {
     var fileStream = OpenAppendFileStream( pathInfo, FileAccess.Write, FileMode.OpenOrCreate, FileShare.Write );
     using ( var streamWriter = new StreamWriter( fileStream, encoding ) )
     {
         foreach ( var line in contents )
         {
             streamWriter.WriteLine( line );
         }
     }
 }
开发者ID:Kudach,项目名称:QuickIO,代码行数:19,代码来源:QuickIOFile_Append.cs


示例17: QuickIOFileSystemEntryBase

        /// <summary>
        /// Initializes a new instance of the QuickIOAbstractBase class, which acts as a wrapper for a file path.
        /// </summary>
        /// <param name="pathInfo"><see cref="QuickIOPathInfo"/></param>
        /// <param name="findData"><see cref="Win32FindData"/></param>
        internal QuickIOFileSystemEntryBase( QuickIOPathInfo pathInfo, Win32FindData findData )
        {
            this.PathInfo = pathInfo;
            this.FindData = findData;
            if( findData != null )
            {
                this.Attributes = findData.dwFileAttributes;
            }

            _lastWriteTimeUtc = FindData.GetLastWriteTimeUtc();
            _lastAccessTimeUtc = findData.GetLastAccessTimeUtc();
            _creationTimeUtc = findData.GetCreationTimeUtc();
        }
开发者ID:Invisibility,项目名称:QuickIO,代码行数:18,代码来源:QuickIOFileSystemEntryBase.cs


示例18: ReadAllBytes

 /// <summary>
 /// Reads the contents of the file into a byte collection.
 /// </summary>
 /// <param name="pathInfo">The file. </param>
 /// <returns>A byte collection containing the contents.</returns>
 /// <remarks>http://msdn.microsoft.com/en-us/library/system.io.file.readallbytes(v=vs.110).aspx</remarks>
 public static byte[] ReadAllBytes( QuickIOPathInfo pathInfo )
 {
     using ( var readStream = OpenRead( pathInfo ) )
     {
         var buffer = new byte[ 16 * 1024 ];
         using ( var ms = new MemoryStream( ) )
         {
             int read;
             while ( ( read = readStream.Read( buffer, 0, buffer.Length ) ) > 0 )
             {
                 ms.Write( buffer, 0, read );
             }
             return ms.ToArray( );
         }
     }
 }
开发者ID:Kudach,项目名称:QuickIO,代码行数:22,代码来源:QuickIOFile_Read.cs


示例19: QuickIOFileSystemSecurity

        /// <summary>
        /// Supply the path to the file or directory and a user or group. 
        /// Access checks are done
        /// during instantiation to ensure we always have a valid object
        /// </summary>
        /// <param name="pathInfo"></param>
        /// <param name="principal"></param>
        public QuickIOFileSystemSecurity( QuickIOPathInfo pathInfo, WindowsIdentity principal )
        {
            if ( pathInfo == null )
            {
                throw new ArgumentNullException( "pathInfo" );
            }
            if ( principal == null )
            {
                throw new ArgumentNullException( "principal" );
            }

            this.PathInfo = pathInfo;
            this.WindowsIdentity = principal;

            Refresh( );
        }
开发者ID:Kudach,项目名称:QuickIO,代码行数:23,代码来源:QuickIOFileSystemSecurity.cs


示例20: QuickIOFileSystemSecurity

        /// <summary>
        /// Supply the path to the file or directory and a user or group. 
        /// Access checks are done
        /// during instantiation to ensure we always have a valid object
        /// </summary>
        /// <param name="pathInfo"></param>
        /// <param name="principal"></param>
        public QuickIOFileSystemSecurity( QuickIOPathInfo pathInfo, WindowsIdentity principal )
        {
            #region Input Validation
            Contract.Requires( pathInfo != null );
            Contract.Requires( principal != null );

            if( pathInfo == null )
            {
                throw new ArgumentNullException( nameof( pathInfo ) );
            }
            if( principal == null )
            {
                throw new ArgumentNullException( nameof( principal ) );
            }
            #endregion Input Validation

            this._pathInfo = pathInfo;
            this._windowsIdentity = principal;

            Refresh();
        }
开发者ID:Invisibility,项目名称:QuickIO,代码行数:28,代码来源:QuickIOFileSystemSecurity.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ScintillaNET.Scintilla类代码示例发布时间:2022-05-26
下一篇:
C# QuickIO.QuickIODirectoryInfo类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap