-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathTaskKey.cs
More file actions
55 lines (44 loc) · 1.28 KB
/
TaskKey.cs
File metadata and controls
55 lines (44 loc) · 1.28 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
using System;
namespace Gofer.NET
{
public class TaskKey
{
public string Value { get; set; }
public string RecurringTaskName { get; set; }
public static TaskKey CreateUnique()
{
return new TaskKey($"{DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()}::{Guid.NewGuid().ToString()}");
}
public static TaskKey CreateRecurring(string recurringTaskName)
{
return new TaskKey($"Recurring{nameof(TaskKey)}::{recurringTaskName}", recurringTaskName);
}
public TaskKey() {}
public TaskKey(string value)
{
Value = value;
RecurringTaskName = null;
}
public TaskKey(string value, string recurringTaskName)
{
Value = value;
RecurringTaskName = recurringTaskName;
}
public override bool Equals(object obj)
{
if (obj == null || GetType() != obj.GetType())
{
return false;
}
return string.Equals(Value, ((TaskKey) obj).Value);
}
public override int GetHashCode()
{
return Value.GetHashCode();
}
public override string ToString()
{
return Value;
}
}
}