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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
class API_Boolean {
constructor(value) {
this.value = value;
}
encode() {
return {
optionalValue: {
subclasses: {
variantType: "API::Boolean",
variant: {
value: this.value
}
}
}
}
}
}
class API_String {
constructor(str) {
this.str = str;
}
encode() {
return {
optionalValue: {
subclasses: {
variantType: "API::String",
variant: {
string: this.str
}
}
}
}
}
}
class API_Array {
constructor(elements) {
this.elements = elements;
}
encode() {
return {
optionalValue: {
subclasses: {
variantType: "API::Array",
variant: {
elements: this.elements
}
}
}
}
}
}
class API_Dictionary {
constructor(values) {
this.values = values;
}
encode() {
return {
optionalValue: {
subclasses: {
variantType: "API::Dictionary",
variant: {
map: this.values
}
}
}
}
}
}
class API_UInt64 {
constructor(value) {
this.value = value;
}
encode() {
return {
optionalValue: {
subclasses: {
variantType: "API::UInt64",
variant: {
value: this.value
}
}
}
}
}
}
class NSString {
constructor(str) {
this.str = str;
}
encode() {
return new API_Dictionary([
{ key: '$class', value: new API_String("NSString").encode() },
{ key: '$string', value: new API_String(this.str).encode() }
]).encode();
}
}
class NSNumber {
constructor(value) {
this.value = value;
}
encode() {
return new API_Dictionary([
{ key: '$class', value: new API_String("NSNumber").encode() },
// see frame #0: 0x0000000184f8fc04 Foundation`-[NSPlaceholderNumber initWithCoder:](self=0x00000001ea154ca0, _cmd=<unavailable>, decoder=0x00006000027c8040) at NSValue.m:2158:13 [opt]
{ key: 'NS.intval', value: new API_UInt64(this.value).encode() }
]).encode();
}
}
class NSInvocation {
constructor(selector, typeString, isReplyBlock=false) {
this.selector = selector;
this.typeString = typeString;
this.isReplyBlock = isReplyBlock;
}
encode() {
return new API_Dictionary([
{ key: '$class', value: new API_String("NSInvocation").encode() },
{ key: 'selector', value: new NSString(this.selector).encode() },
{ key: 'typeString', value: new NSString(this.typeString).encode() },
{ key: 'isReplyBlock', value: new API_Boolean(this.isReplyBlock).encode() }
]).encode()
}
}
|