-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathAlgoScrypt.cs
More file actions
60 lines (51 loc) · 1.68 KB
/
AlgoScrypt.cs
File metadata and controls
60 lines (51 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Serialization;
using Appwrite.Enums;
using Appwrite.Extensions;
namespace Appwrite.Models
{
public class AlgoScrypt
{
[JsonPropertyName("type")]
public string Type { get; private set; }
[JsonPropertyName("costCpu")]
public long CostCpu { get; private set; }
[JsonPropertyName("costMemory")]
public long CostMemory { get; private set; }
[JsonPropertyName("costParallel")]
public long CostParallel { get; private set; }
[JsonPropertyName("length")]
public long Length { get; private set; }
public AlgoScrypt(
string type,
long costCpu,
long costMemory,
long costParallel,
long length
) {
Type = type;
CostCpu = costCpu;
CostMemory = costMemory;
CostParallel = costParallel;
Length = length;
}
public static AlgoScrypt From(Dictionary<string, object> map) => new AlgoScrypt(
type: map["type"].ToString(),
costCpu: Convert.ToInt64(map["costCpu"]),
costMemory: Convert.ToInt64(map["costMemory"]),
costParallel: Convert.ToInt64(map["costParallel"]),
length: Convert.ToInt64(map["length"])
);
public Dictionary<string, object?> ToMap() => new Dictionary<string, object?>()
{
{ "type", Type },
{ "costCpu", CostCpu },
{ "costMemory", CostMemory },
{ "costParallel", CostParallel },
{ "length", Length }
};
}
}