99 * Authors:
1010 * 钟峰(Popeye Zhong) <zongsoft@qq.com>
1111 *
12- * Copyright (C) 2010-2020 Zongsoft Studio <http://www.zongsoft.com>
12+ * Copyright (C) 2010-2025 Zongsoft Studio <http://www.zongsoft.com>
1313 *
1414 * This file is part of Zongsoft.Core library.
1515 *
2828 */
2929
3030using System ;
31+ using System . Threading ;
32+ using System . Threading . Tasks ;
3133using System . Collections . Generic ;
3234
3335namespace Zongsoft . IO ;
3436
3537[ Serializable ]
36- public class FileInfo : PathInfo , IEquatable < FileInfo >
38+ public partial class FileInfo : PathInfo , IEquatable < FileInfo >
3739{
3840 #region 成员字段
3941 private long _size ;
@@ -99,3 +101,30 @@ public string Type
99101 public override int GetHashCode ( ) => HashCode . Combine ( base . GetHashCode ( ) , _size ) ;
100102 #endregion
101103}
104+
105+ partial class FileInfo
106+ {
107+ public bool Delete ( ) => FileSystem . File . Delete ( this . Url ) ;
108+ public ValueTask < bool > DeleteAsync ( CancellationToken cancellation = default ) => FileSystem . File . DeleteAsync ( this . Url , cancellation ) ;
109+
110+ public bool Exists ( ) => FileSystem . File . Exists ( this . Url ) ;
111+ public ValueTask < bool > ExistsAsync ( CancellationToken cancellation = default ) => FileSystem . File . ExistsAsync ( this . Url , cancellation ) ;
112+
113+ public void Copy ( string destination , bool overwrite = true ) => FileSystem . File . Copy ( this . Url , destination , overwrite ) ;
114+ public ValueTask CopyAsync ( string destination , CancellationToken cancellation = default ) => FileSystem . File . CopyAsync ( this . Url , destination , cancellation ) ;
115+ public ValueTask CopyAsync ( string destination , bool overwrite , CancellationToken cancellation = default ) => FileSystem . File . CopyAsync ( this . Url , destination , overwrite , cancellation ) ;
116+
117+ public void Move ( string destination ) => FileSystem . File . Move ( this . Url , destination ) ;
118+ public ValueTask MoveAsync ( string destination , CancellationToken cancellation = default ) => FileSystem . File . MoveAsync ( this . Url , destination , cancellation ) ;
119+
120+ public System . IO . Stream Open ( System . IO . FileMode mode , IEnumerable < KeyValuePair < string , string > > properties = null ) => FileSystem . File . Open ( this . Url , mode , properties ) ;
121+ public System . IO . Stream Open ( System . IO . FileMode mode , System . IO . FileAccess access , IEnumerable < KeyValuePair < string , string > > properties = null ) => FileSystem . File . Open ( this . Url , mode , access , properties ) ;
122+ public System . IO . Stream Open ( System . IO . FileMode mode , System . IO . FileAccess access , System . IO . FileShare share , IEnumerable < KeyValuePair < string , string > > properties = null ) => FileSystem . File . Open ( this . Url , mode , access , share , properties ) ;
123+
124+ public ValueTask < System . IO . Stream > OpenAsync ( System . IO . FileMode mode , CancellationToken cancellation = default ) => FileSystem . File . OpenAsync ( this . Url , mode , cancellation ) ;
125+ public ValueTask < System . IO . Stream > OpenAsync ( System . IO . FileMode mode , IEnumerable < KeyValuePair < string , string > > properties , CancellationToken cancellation = default ) => FileSystem . File . OpenAsync ( this . Url , mode , properties , cancellation ) ;
126+ public ValueTask < System . IO . Stream > OpenAsync ( System . IO . FileMode mode , System . IO . FileAccess access , CancellationToken cancellation = default ) => FileSystem . File . OpenAsync ( this . Url , mode , access , cancellation ) ;
127+ public ValueTask < System . IO . Stream > OpenAsync ( System . IO . FileMode mode , System . IO . FileAccess access , IEnumerable < KeyValuePair < string , string > > properties , CancellationToken cancellation = default ) => FileSystem . File . OpenAsync ( this . Url , mode , access , properties , cancellation ) ;
128+ public ValueTask < System . IO . Stream > OpenAsync ( System . IO . FileMode mode , System . IO . FileAccess access , System . IO . FileShare share , CancellationToken cancellation = default ) => FileSystem . File . OpenAsync ( this . Url , mode , access , share , cancellation ) ;
129+ public ValueTask < System . IO . Stream > OpenAsync ( System . IO . FileMode mode , System . IO . FileAccess access , System . IO . FileShare share , IEnumerable < KeyValuePair < string , string > > properties , CancellationToken cancellation = default ) => FileSystem . File . OpenAsync ( this . Url , mode , access , share , properties , cancellation ) ;
130+ }
0 commit comments