diff --git a/Facepunch.Steamworks.Test/Client/RemoteStorageTest.cs b/Facepunch.Steamworks.Test/Client/RemoteStorageTest.cs
index 15c31c3..fee10be 100644
--- a/Facepunch.Steamworks.Test/Client/RemoteStorageTest.cs
+++ b/Facepunch.Steamworks.Test/Client/RemoteStorageTest.cs
@@ -77,7 +77,8 @@ public void WriteFiles()
foreach ( var file in client.RemoteStorage.Files )
{
- Console.WriteLine( $"- {file.FileName} ({file.SizeInBytes} bytes)" );
+ DateTime t = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddSeconds(file.FileTimestamp);
+ Console.WriteLine( $"- {file.FileName} ({file.SizeInBytes} bytes), modified {t:O}" );
}
}
}
diff --git a/Facepunch.Steamworks/Client/RemoteStorage.File.cs b/Facepunch.Steamworks/Client/RemoteStorage.File.cs
index 58b93ae..80851d5 100644
--- a/Facepunch.Steamworks/Client/RemoteStorage.File.cs
+++ b/Facepunch.Steamworks/Client/RemoteStorage.File.cs
@@ -19,6 +19,7 @@ public class RemoteFile
private readonly bool _isUgc;
private string _fileName;
private int _sizeInBytes = -1;
+ private long _timestamp = 0;
private UGCHandle_t _handle;
private ulong _ownerId;
@@ -84,6 +85,21 @@ public int SizeInBytes
internal set { _sizeInBytes = value; }
}
+ ///
+ /// Date modified timestamp in epoch format.
+ ///
+ public long FileTimestamp
+ {
+ get
+ {
+ if ( _timestamp != 0 ) return _timestamp;
+ if (_isUgc) throw new NotImplementedException();
+ _timestamp = remoteStorage.native.GetFileTimestamp(FileName);
+ return _timestamp;
+ }
+ internal set { _timestamp = value; }
+ }
+
internal RemoteFile( RemoteStorage r, UGCHandle_t handle )
{
Exists = true;
@@ -94,7 +110,7 @@ internal RemoteFile( RemoteStorage r, UGCHandle_t handle )
_handle = handle;
}
- internal RemoteFile( RemoteStorage r, string name, ulong ownerId, int sizeInBytes = -1 )
+ internal RemoteFile( RemoteStorage r, string name, ulong ownerId, int sizeInBytes = -1, long timestamp = 0 )
{
remoteStorage = r;
@@ -102,6 +118,7 @@ internal RemoteFile( RemoteStorage r, string name, ulong ownerId, int sizeInByte
_fileName = name;
_ownerId = ownerId;
_sizeInBytes = sizeInBytes;
+ _timestamp = timestamp;
}
///
diff --git a/Facepunch.Steamworks/Client/RemoteStorage.cs b/Facepunch.Steamworks/Client/RemoteStorage.cs
index 7110d31..0330afa 100644
--- a/Facepunch.Steamworks/Client/RemoteStorage.cs
+++ b/Facepunch.Steamworks/Client/RemoteStorage.cs
@@ -177,16 +177,18 @@ private void UpdateFiles()
{
int size;
var name = NormalizePath( native.GetFileNameAndSize( i, out size ) );
+ var timestamp = native.GetFileTimestamp(name);
var existing = _files.FirstOrDefault( x => x.FileName == name );
if ( existing == null )
{
- existing = new RemoteFile( this, name, client.SteamId, size );
+ existing = new RemoteFile( this, name, client.SteamId, size, timestamp );
_files.Add( existing );
}
else
{
existing.SizeInBytes = size;
+ existing.FileTimestamp = timestamp;
}
existing.Exists = true;