root / trunk / Pithos.Network / AccountInfo.cs @ 6aa29f4f
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 |
public string Usage |
28 |
{ |
29 |
get |
30 |
{ |
31 |
var gigabytes = Quota / 1073741824; |
32 |
var percentage = BytesUsed / (double)Quota; |
33 |
return String.Format("{0:P0} of {1} GB", percentage, gigabytes); |
34 |
} |
35 |
|
36 |
} |
37 |
|
38 |
public string SiteUri { get; set; } |
39 |
|
40 |
public List<Group> Groups { get; set; } |
41 |
} |
42 |
|
43 |
public class Group |
44 |
{ |
45 |
public string Name { get; set; } |
46 |
|
47 |
public List<string> Users { get; set; } |
48 |
|
49 |
public Group() |
50 |
{ |
51 |
|
52 |
} |
53 |
|
54 |
public Group(string name,string users) |
55 |
{ |
56 |
Name = name; |
57 |
|
58 |
if (String.IsNullOrWhiteSpace(users)) |
59 |
return; |
60 |
Users=new List<string>(users.Split(',')); |
61 |
} |
62 |
} |
63 |
} |