Browse Source

Parsing date from list objects, list buckets and stat object. Fixes #1.

pull/19/head
Frederick F. Kautz IV 10 years ago
parent
commit
7649cb5a28
  1. 4
      Minio.Client/ObjectStat.cs
  2. 7
      Minio.Client/ObjectStorageClient.cs
  3. 6
      Minio.Client/xml/Bucket.cs
  4. 8
      Minio.Client/xml/Item.cs

4
Minio.Client/ObjectStat.cs

@ -23,14 +23,14 @@ namespace Minio.Client
{
public class ObjectStat
{
public ObjectStat(string key, UInt64 size, DateTime lastModified, string etag) {
public ObjectStat(string key, long size, DateTime lastModified, string etag) {
this.Key = key;
this.Size = size;
this.LastModified = lastModified;
this.ETag = etag;
}
public string Key { get; private set; }
public UInt64 Size { get; private set; }
public long Size { get; private set; }
public DateTime LastModified { get; private set; }
public string ETag { get; private set; }
}

7
Minio.Client/ObjectStorageClient.cs

@ -328,19 +328,18 @@ namespace Minio.Client
if (response.StatusCode == HttpStatusCode.OK)
{
UInt64 size = 0;
long size = 0;
DateTime lastModified = new DateTime();
string etag = "";
foreach (Parameter parameter in response.Headers)
{
if (parameter.Name == "Content-Length")
{
size = UInt64.Parse(parameter.Value.ToString());
size = long.Parse(parameter.Value.ToString());
}
if (parameter.Name == "Last-Modified")
{
// TODO parse datetime
lastModified = new DateTime();
DateTime.Parse(parameter.Value.ToString());
}
if (parameter.Name == "ETag")
{

6
Minio.Client/xml/Bucket.cs

@ -28,5 +28,11 @@ namespace Minio.Client.xml
{
public string Name { get; set; }
public string CreationDate { get; set; }
public DateTime CreationDateDateTime {
get {
return DateTime.Parse(this.CreationDate);
}
}
}
}

8
Minio.Client/xml/Item.cs

@ -15,5 +15,13 @@ namespace Minio.Client.xml
public UInt64 Size { get; set; }
public bool IsDir { get; set; }
public DateTime LastModifiedDateTime
{
get
{
return DateTime.Parse(this.LastModified);
}
}
}
}
Loading…
Cancel
Save