/// <summary> /// 初始化文件信息 /// </summary> protected FileInfo( string filePath, byte[] fileBytes, long? fileSize, string fileName ) { FilePath = filePath; FileName = GetFileName( filePath, fileName ); Extension = GetExtension( filePath ); Length = new FileSize( fileSize.SafeValue() ); if ( fileBytes == null ) return; FileBytes = fileBytes; Length = new FileSize( fileBytes.Length ); }
/// <summary> /// 初始化文件信息 /// </summary> protected FileInfo(string filePath, byte[] fileBytes, long?fileSize, string fileName) { FilePath = filePath; FileName = GetFileName(filePath, fileName); Extension = GetExtension(filePath); Length = new FileSize(fileSize.SafeValue()); if (fileBytes == null) { return; } FileBytes = fileBytes; Length = new FileSize(fileBytes.Length); }