@@ -90,11 +90,11 @@ public async Task ValidateDataAsync(long offset, long length, IValidateDataOpera
9090 }
9191
9292 /// <inheritdoc/>
93- public async Task WriteAsync ( IFileMetadata fileMetadata , Stream content = null , IOperationContext operationContext = null , IInSyncResultContext inSyncResultContext = null , CancellationToken cancellationToken = default )
93+ public async Task < IFileMetadata > WriteAsync ( IFileSystemBasicInfo fileBasicInfo , Stream content = null , IOperationContext operationContext = null , IInSyncResultContext inSyncResultContext = null , CancellationToken cancellationToken = default )
9494 {
9595 Logger . LogMessage ( $ "{ nameof ( IFile ) } .{ nameof ( WriteAsync ) } ()", UserFileSystemPath , default , operationContext ) ;
9696
97- if ( ! Mapping . TryGetRemoteStoragePathById ( RemoteStorageItemId , out string remoteStoragePath ) ) return ;
97+ if ( ! Mapping . TryGetRemoteStoragePathById ( RemoteStorageItemId , out string remoteStoragePath ) ) return null ;
9898
9999 // Send the ETag to the server as part of the update to ensure
100100 // the file in the remote storge is not modified since last read.
@@ -129,15 +129,36 @@ public async Task WriteAsync(IFileMetadata fileMetadata, Stream content = null,
129129 }
130130
131131 // Update remote storage file metadata.
132- remoteStorageItem . Attributes = fileMetadata . Attributes & ~ FileAttributes . ReadOnly ;
133- remoteStorageItem . CreationTimeUtc = fileMetadata . CreationTime . UtcDateTime ;
134- remoteStorageItem . LastWriteTimeUtc = fileMetadata . LastWriteTime . UtcDateTime ;
135- remoteStorageItem . LastAccessTimeUtc = fileMetadata . LastAccessTime . UtcDateTime ;
136- remoteStorageItem . Attributes = fileMetadata . Attributes ;
132+ if ( fileBasicInfo . Attributes . HasValue )
133+ {
134+ remoteStorageItem . Attributes = fileBasicInfo . Attributes . Value & ~ FileAttributes . ReadOnly ;
135+ }
136+
137+ if ( fileBasicInfo . CreationTime . HasValue )
138+ {
139+ remoteStorageItem . CreationTimeUtc = fileBasicInfo . CreationTime . Value . UtcDateTime ;
140+ }
141+
142+ if ( fileBasicInfo . LastWriteTime . HasValue )
143+ {
144+ remoteStorageItem . LastWriteTimeUtc = fileBasicInfo . LastWriteTime . Value . UtcDateTime ;
145+ }
146+
147+ if ( fileBasicInfo . LastAccessTime . HasValue )
148+ {
149+ remoteStorageItem . LastAccessTimeUtc = fileBasicInfo . LastAccessTime . Value . UtcDateTime ;
150+ }
151+
152+ if ( fileBasicInfo . Attributes . HasValue )
153+ {
154+ remoteStorageItem . Attributes = fileBasicInfo . Attributes . Value ;
155+ }
137156
138157 // Save ETag received from your remote storage in persistent placeholder properties.
139158 // string newEtag = ...
140159 // placeholder.SetETag(newEtag);
160+
161+ return null ;
141162 }
142163 }
143164}
0 commit comments