4

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

I can read the date stamps using FileInfo, but these properties are read only. Using native code it looks like I can use the SetFileInformationByHandle api. My project does use native code so I can add a little helper function, but this seems like a lot of over kill.

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

noggin182
  • 627
  • 4
  • 14

1 Answers1

0

The SetFileInformationByHandle API is supported via DLL api-ms-win-core-file-l1-2-0.dll More info 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 machine to test but you could try the following: How to update the change time of a file from c#?

Community
  • 1
  • 1
Jasper
  • 660
  • 1
  • 7
  • 19