root / trunk / Pithos.Network / AccountInfo.cs @ c92e02f3
History | View | Annotate | Download (1.4 kB)
1 |
using System; |
---|---|
2 |
using System.Collections.Generic; |
3 |
|
4 |
namespace Pithos.Network |
5 |
{ |
6 |
public class AccountInfo |
7 |
{ |
8 |
public string UserName { get; set; } |
9 |
public string Token { get; set; } |
10 |
public Uri StorageUri { get; set; } |
11 |
|
12 |
private string _accountPath; |
13 |
public string AccountPath |
14 |
{ |
15 |
get { return _accountPath; } |
16 |
set { _accountPath = value.ToLower(); } |
17 |
} |
18 |
|
19 |
public int BlockSize { get; set; } |
20 |
|
21 |
public string BlockHash { get; set; } |
22 |
|
23 |
public long Quota { get; set; } |
24 |
|
25 |
public long BytesUsed { get; set; } |
26 |
|
27 |
|
28 |
public string Usage |
29 |
{ |
30 |
get |
31 |
{ |
32 |
var gigabytes = Quota / 1073741824; |
33 |
var percentage = BytesUsed / (double)Quota; |
34 |
return String.Format("{0:P0} of {1} GB", percentage, gigabytes); |
35 |
} |
36 |
|
37 |
} |
38 |
|
39 |
public string SiteUri { get; set; } |
40 |
|
41 |
public List<Group> Groups { get; set; } |
42 |
} |
43 |
|
44 |
public class Group |
45 |
{ |
46 |
public string Name { get; set; } |
47 |
|
48 |
public List<string> Users { get; set; } |
49 |
|
50 |
public Group() |
51 |
{ |
52 |
|
53 |
} |
54 |
|
55 |
public Group(string name,string users) |
56 |
{ |
57 |
Name = name; |
58 |
|
59 |
if (String.IsNullOrWhiteSpace(users)) |
60 |
return; |
61 |
Users=new List<string>(users.Split(',')); |
62 |
} |
63 |
} |
64 |
} |