Set file date using managed code in WP8

Is it possible to change the file creation date or the date the file was last written from managed code in WP8?

I can read date stamps using FileInfo, but these properties are read-only. Using native code, it seems like I can use the SetFileInformationByHandle api. My project uses native code, so I can add a little helper function, but that seems like a lot of killing.

Reason: I have a multiplayer online game (4sFear) that allows people to upload their own avatars. Currently, I just set the image source to the avatar http address, but I would like to be a little smart and cache images locally. I can return the last time an avatar was updated before it needs to be displayed. I know that I can store dates when avatars were updated separately, but it makes sense that I just need to set the last date the file was recorded after it was created.

+4
source share
1 answer

The SetFileInformationByHandle API is supported through the api-ms-win-core-file-l1-2-0.dll DLL. More here: https://msdn.microsoft.com/library/windows/apps/jj662956%28v=vs.105%29 .aspx # BKMK_ListofsupportedWin32APIs , which can be called using DLLImports.

I don’t have a testing machine, but you can try the following: How to update file modification time from C #?

0
source

Source: https://habr.com/ru/post/1492611/


All Articles