-
Notifications
You must be signed in to change notification settings - Fork 2
/
constants.go
85 lines (72 loc) · 1.86 KB
/
constants.go
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package main
import "errors"
// LimitKinds represents various limits applied to the current ticket.
type LimitKinds int
const (
// PR is presumably "purchased".
PR LimitKinds = 0
TR = 1
DR = 2
SR = 3
LR = 4
AT = 10000
)
// LicenceKinds represents the various rights a user has to a title.
type LicenceKinds string
const (
PERMANENT LicenceKinds = "PERMANENT"
DEMO LicenceKinds = "DEMO"
TRIAL LicenceKinds = "TRIAL"
RENTAL LicenceKinds = "RENTAL"
SUBSCRIPT LicenceKinds = "SUBSCRIPT"
SERVICE LicenceKinds = "SERVICE"
)
func GetLicenceKind(kind string) (*LicenceKinds, error) {
names := map[string]LicenceKinds{
"PERMANENT": PERMANENT,
"DEMO": DEMO,
"TRIAL": TRIAL,
"RENTAL": RENTAL,
"SUBSCRIPT": SUBSCRIPT,
"SERVICE": SERVICE,
}
if value, exists := names[kind]; exists {
return &value, nil
} else {
return nil, errors.New("invalid LicenceKind")
}
}
// LimitStruct returns a Limits struct filled for the given kind.
func LimitStruct(kind LimitKinds) Limits {
names := map[LimitKinds]string{
PR: "PR",
TR: "TR",
DR: "DR",
SR: "SR",
LR: "LR",
AT: "AT",
}
return Limits{
Limits: kind,
LimitKind: names[kind],
}
}
// DeviceStatus represents the various statuses a device may have.
//
// These values do not appear to be directly checked by the client within the
// Wii Shop Channel, and are a generic string. We could utilize any value we wish.
// However, titles utilizing DLCs appear to check the raw values.
// For this reason, we mirror values from Nintendo.
type DeviceStatus string
const (
DeviceStatusRegistered = "R"
DeviceStatusUnregistered = "U"
)
// TokenType represents a way to distinguish between ST- (unhashed)
// and WT- (hashed) device tokens.
type TokenType int
const (
TokenTypeUnhashed = iota
TokenTypeHashed
TokenTypeInvalid
)