@nativescript/windows-v8 0.1.0-alpha.0 → 0.1.0-alpha.138
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -55
- package/framework/__PROJECT_NAME__/App.xaml +13 -13
- package/framework/__PROJECT_NAME__/Package.appxmanifest +35 -35
- package/framework/__PROJECT_NAME__/Program.cs +34 -34
- package/framework/__PROJECT_NAME__/Properties/Default.rd.xml +9 -9
- package/framework/__PROJECT_NAME__/RuntimeHost.cs +54 -11
- package/framework/__PROJECT_NAME__/__PROJECT_NAME__.csproj +6 -1
- package/framework/dotnet-bridge/BinaryProtocol.cs +161 -161
- package/framework/dotnet-bridge/Bridge.JsDelegate.cs +244 -244
- package/framework/dotnet-bridge/Bridge.TaskHelper.cs +207 -207
- package/framework/dotnet-bridge/DispatchTypes.cs +333 -333
- package/framework/dotnet-bridge/DotNetBridge.csproj +30 -30
- package/framework/libs/x64/nativescript.dll +0 -0
- package/framework/tools/ManifestMerger/ManifestMerger.dll +0 -0
- package/framework/tools/ManifestMerger/ManifestMerger.pdb +0 -0
- package/framework/tools/dotnet-tool-arm64.exe +0 -0
- package/framework/tools/dotnet-tool-x64.exe +0 -0
- package/framework/tools/dotnet-tool.exe +0 -0
- package/framework/tools/dotnet-typings-gen/dotnet-typings-gen.dll +0 -0
- package/framework/tools/dotnet-typings-gen/dotnet-typings-gen.exe +0 -0
- package/framework/tools/dotnet-typings-gen/dotnet-typings-gen.pdb +0 -0
- package/framework/tools/nsbundle_pack-x64.exe +0 -0
- package/framework/tools/nsbundle_pack.exe +0 -0
- package/framework/tools/sbg-arm64.exe +0 -0
- package/framework/tools/sbg-x64.exe +0 -0
- package/framework/tools/sbg.exe +0 -0
- package/framework/tools/typings-generator-arm64.exe +0 -0
- package/framework/tools/typings-generator-x64.exe +0 -0
- package/framework/tools/typings-generator.exe +0 -0
- package/package.json +43 -43
|
@@ -1,161 +1,161 @@
|
|
|
1
|
-
using System;
|
|
2
|
-
using System.Buffers;
|
|
3
|
-
using System.Buffers.Binary;
|
|
4
|
-
using System.Text;
|
|
5
|
-
|
|
6
|
-
namespace NativeScriptBridge;
|
|
7
|
-
|
|
8
|
-
internal readonly struct HandleRef(int id)
|
|
9
|
-
{
|
|
10
|
-
public readonly int Id = id;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// Carries a raw IUnknown/IInspectable pointer from a WinRT proxy (tag 0x0A).
|
|
14
|
-
// CoerceBin calls Marshal.GetObjectForIUnknown to create a managed RCW.
|
|
15
|
-
internal readonly struct WinRtRef(long ptr)
|
|
16
|
-
{
|
|
17
|
-
public readonly long Ptr = ptr;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
internal ref struct BinReader(ReadOnlySpan<byte> buf)
|
|
21
|
-
{
|
|
22
|
-
private readonly ReadOnlySpan<byte> _buf = buf;
|
|
23
|
-
private int _pos = 0;
|
|
24
|
-
|
|
25
|
-
public byte ReadByte() => _buf[_pos++];
|
|
26
|
-
|
|
27
|
-
public int ReadI32()
|
|
28
|
-
{
|
|
29
|
-
var v = BinaryPrimitives.ReadInt32LittleEndian(_buf[_pos..]);
|
|
30
|
-
_pos += 4;
|
|
31
|
-
return v;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
public long ReadI64()
|
|
35
|
-
{
|
|
36
|
-
var v = BinaryPrimitives.ReadInt64LittleEndian(_buf[_pos..]);
|
|
37
|
-
_pos += 8;
|
|
38
|
-
return v;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public ushort ReadU16()
|
|
42
|
-
{
|
|
43
|
-
var v = BinaryPrimitives.ReadUInt16LittleEndian(_buf[_pos..]);
|
|
44
|
-
_pos += 2;
|
|
45
|
-
return v;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
public double ReadF64()
|
|
49
|
-
{
|
|
50
|
-
var v = BinaryPrimitives.ReadDoubleLittleEndian(_buf[_pos..]);
|
|
51
|
-
_pos += 8;
|
|
52
|
-
return v;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
public string ReadString16()
|
|
56
|
-
{
|
|
57
|
-
var len = ReadU16();
|
|
58
|
-
var s = Encoding.UTF8.GetString(_buf.Slice(_pos, len));
|
|
59
|
-
_pos += len;
|
|
60
|
-
// Intern so repeated method/type names reuse the same heap string.
|
|
61
|
-
// Eliminates the allocation on every subsequent warm-path call.
|
|
62
|
-
return string.Intern(s);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
public string ReadString32()
|
|
66
|
-
{
|
|
67
|
-
var len = BinaryPrimitives.ReadUInt32LittleEndian(_buf.Slice(_pos, 4));
|
|
68
|
-
_pos += 4;
|
|
69
|
-
var s = Encoding.UTF8.GetString(_buf.Slice(_pos, (int)len));
|
|
70
|
-
_pos += (int)len;
|
|
71
|
-
return string.Intern(s);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
public uint ReadU32()
|
|
75
|
-
{
|
|
76
|
-
var v = BinaryPrimitives.ReadUInt32LittleEndian(_buf.Slice(_pos, 4));
|
|
77
|
-
_pos += 4;
|
|
78
|
-
return v;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
public object?[] ReadArgs()
|
|
82
|
-
{
|
|
83
|
-
var count = ReadByte();
|
|
84
|
-
if (count == 0) return [];
|
|
85
|
-
var args = new object?[count];
|
|
86
|
-
for (int i = 0; i < count; i++)
|
|
87
|
-
{
|
|
88
|
-
var tag = ReadByte();
|
|
89
|
-
args[i] = tag switch
|
|
90
|
-
{
|
|
91
|
-
0x00 => null,
|
|
92
|
-
0x01 => (object)false,
|
|
93
|
-
0x02 => (object)true,
|
|
94
|
-
0x03 => (object)ReadI32(),
|
|
95
|
-
0x04 => (object)ReadF64(),
|
|
96
|
-
0x05 => (object)ReadString16(),
|
|
97
|
-
0x06 => (object)new HandleRef(ReadI32()),
|
|
98
|
-
0x0A => (object)new WinRtRef(ReadI64()),
|
|
99
|
-
_ => null,
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
return args;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
internal ref struct BinWriter(ArrayBufferWriter<byte> buf)
|
|
107
|
-
{
|
|
108
|
-
private readonly ArrayBufferWriter<byte> _buf = buf;
|
|
109
|
-
|
|
110
|
-
public void WriteByte(byte b)
|
|
111
|
-
{
|
|
112
|
-
_buf.GetSpan(1)[0] = b;
|
|
113
|
-
_buf.Advance(1);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
public void WriteI32(int v)
|
|
117
|
-
{
|
|
118
|
-
BinaryPrimitives.WriteInt32LittleEndian(_buf.GetSpan(4), v);
|
|
119
|
-
_buf.Advance(4);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
public void WriteU16(ushort v)
|
|
123
|
-
{
|
|
124
|
-
BinaryPrimitives.WriteUInt16LittleEndian(_buf.GetSpan(2), v);
|
|
125
|
-
_buf.Advance(2);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
public void WriteU32(uint v)
|
|
129
|
-
{
|
|
130
|
-
BinaryPrimitives.WriteUInt32LittleEndian(_buf.GetSpan(4), v);
|
|
131
|
-
_buf.Advance(4);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
public void WriteI64(long v)
|
|
135
|
-
{
|
|
136
|
-
BinaryPrimitives.WriteInt64LittleEndian(_buf.GetSpan(8), v);
|
|
137
|
-
_buf.Advance(8);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
public void WriteF64(double v)
|
|
141
|
-
{
|
|
142
|
-
BinaryPrimitives.WriteDoubleLittleEndian(_buf.GetSpan(8), v);
|
|
143
|
-
_buf.Advance(8);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
public void WriteString32(ReadOnlySpan<char> s)
|
|
147
|
-
{
|
|
148
|
-
var byteCount = Encoding.UTF8.GetByteCount(s);
|
|
149
|
-
WriteU32((uint)byteCount);
|
|
150
|
-
Encoding.UTF8.GetBytes(s, _buf.GetSpan(byteCount));
|
|
151
|
-
_buf.Advance(byteCount);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
public void WriteString16(ReadOnlySpan<char> s)
|
|
155
|
-
{
|
|
156
|
-
var byteCount = Encoding.UTF8.GetByteCount(s);
|
|
157
|
-
WriteU16((ushort)byteCount);
|
|
158
|
-
Encoding.UTF8.GetBytes(s, _buf.GetSpan(byteCount));
|
|
159
|
-
_buf.Advance(byteCount);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
1
|
+
using System;
|
|
2
|
+
using System.Buffers;
|
|
3
|
+
using System.Buffers.Binary;
|
|
4
|
+
using System.Text;
|
|
5
|
+
|
|
6
|
+
namespace NativeScriptBridge;
|
|
7
|
+
|
|
8
|
+
internal readonly struct HandleRef(int id)
|
|
9
|
+
{
|
|
10
|
+
public readonly int Id = id;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Carries a raw IUnknown/IInspectable pointer from a WinRT proxy (tag 0x0A).
|
|
14
|
+
// CoerceBin calls Marshal.GetObjectForIUnknown to create a managed RCW.
|
|
15
|
+
internal readonly struct WinRtRef(long ptr)
|
|
16
|
+
{
|
|
17
|
+
public readonly long Ptr = ptr;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
internal ref struct BinReader(ReadOnlySpan<byte> buf)
|
|
21
|
+
{
|
|
22
|
+
private readonly ReadOnlySpan<byte> _buf = buf;
|
|
23
|
+
private int _pos = 0;
|
|
24
|
+
|
|
25
|
+
public byte ReadByte() => _buf[_pos++];
|
|
26
|
+
|
|
27
|
+
public int ReadI32()
|
|
28
|
+
{
|
|
29
|
+
var v = BinaryPrimitives.ReadInt32LittleEndian(_buf[_pos..]);
|
|
30
|
+
_pos += 4;
|
|
31
|
+
return v;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public long ReadI64()
|
|
35
|
+
{
|
|
36
|
+
var v = BinaryPrimitives.ReadInt64LittleEndian(_buf[_pos..]);
|
|
37
|
+
_pos += 8;
|
|
38
|
+
return v;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public ushort ReadU16()
|
|
42
|
+
{
|
|
43
|
+
var v = BinaryPrimitives.ReadUInt16LittleEndian(_buf[_pos..]);
|
|
44
|
+
_pos += 2;
|
|
45
|
+
return v;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public double ReadF64()
|
|
49
|
+
{
|
|
50
|
+
var v = BinaryPrimitives.ReadDoubleLittleEndian(_buf[_pos..]);
|
|
51
|
+
_pos += 8;
|
|
52
|
+
return v;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public string ReadString16()
|
|
56
|
+
{
|
|
57
|
+
var len = ReadU16();
|
|
58
|
+
var s = Encoding.UTF8.GetString(_buf.Slice(_pos, len));
|
|
59
|
+
_pos += len;
|
|
60
|
+
// Intern so repeated method/type names reuse the same heap string.
|
|
61
|
+
// Eliminates the allocation on every subsequent warm-path call.
|
|
62
|
+
return string.Intern(s);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public string ReadString32()
|
|
66
|
+
{
|
|
67
|
+
var len = BinaryPrimitives.ReadUInt32LittleEndian(_buf.Slice(_pos, 4));
|
|
68
|
+
_pos += 4;
|
|
69
|
+
var s = Encoding.UTF8.GetString(_buf.Slice(_pos, (int)len));
|
|
70
|
+
_pos += (int)len;
|
|
71
|
+
return string.Intern(s);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public uint ReadU32()
|
|
75
|
+
{
|
|
76
|
+
var v = BinaryPrimitives.ReadUInt32LittleEndian(_buf.Slice(_pos, 4));
|
|
77
|
+
_pos += 4;
|
|
78
|
+
return v;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public object?[] ReadArgs()
|
|
82
|
+
{
|
|
83
|
+
var count = ReadByte();
|
|
84
|
+
if (count == 0) return [];
|
|
85
|
+
var args = new object?[count];
|
|
86
|
+
for (int i = 0; i < count; i++)
|
|
87
|
+
{
|
|
88
|
+
var tag = ReadByte();
|
|
89
|
+
args[i] = tag switch
|
|
90
|
+
{
|
|
91
|
+
0x00 => null,
|
|
92
|
+
0x01 => (object)false,
|
|
93
|
+
0x02 => (object)true,
|
|
94
|
+
0x03 => (object)ReadI32(),
|
|
95
|
+
0x04 => (object)ReadF64(),
|
|
96
|
+
0x05 => (object)ReadString16(),
|
|
97
|
+
0x06 => (object)new HandleRef(ReadI32()),
|
|
98
|
+
0x0A => (object)new WinRtRef(ReadI64()),
|
|
99
|
+
_ => null,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
return args;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
internal ref struct BinWriter(ArrayBufferWriter<byte> buf)
|
|
107
|
+
{
|
|
108
|
+
private readonly ArrayBufferWriter<byte> _buf = buf;
|
|
109
|
+
|
|
110
|
+
public void WriteByte(byte b)
|
|
111
|
+
{
|
|
112
|
+
_buf.GetSpan(1)[0] = b;
|
|
113
|
+
_buf.Advance(1);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
public void WriteI32(int v)
|
|
117
|
+
{
|
|
118
|
+
BinaryPrimitives.WriteInt32LittleEndian(_buf.GetSpan(4), v);
|
|
119
|
+
_buf.Advance(4);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
public void WriteU16(ushort v)
|
|
123
|
+
{
|
|
124
|
+
BinaryPrimitives.WriteUInt16LittleEndian(_buf.GetSpan(2), v);
|
|
125
|
+
_buf.Advance(2);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
public void WriteU32(uint v)
|
|
129
|
+
{
|
|
130
|
+
BinaryPrimitives.WriteUInt32LittleEndian(_buf.GetSpan(4), v);
|
|
131
|
+
_buf.Advance(4);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
public void WriteI64(long v)
|
|
135
|
+
{
|
|
136
|
+
BinaryPrimitives.WriteInt64LittleEndian(_buf.GetSpan(8), v);
|
|
137
|
+
_buf.Advance(8);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
public void WriteF64(double v)
|
|
141
|
+
{
|
|
142
|
+
BinaryPrimitives.WriteDoubleLittleEndian(_buf.GetSpan(8), v);
|
|
143
|
+
_buf.Advance(8);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
public void WriteString32(ReadOnlySpan<char> s)
|
|
147
|
+
{
|
|
148
|
+
var byteCount = Encoding.UTF8.GetByteCount(s);
|
|
149
|
+
WriteU32((uint)byteCount);
|
|
150
|
+
Encoding.UTF8.GetBytes(s, _buf.GetSpan(byteCount));
|
|
151
|
+
_buf.Advance(byteCount);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
public void WriteString16(ReadOnlySpan<char> s)
|
|
155
|
+
{
|
|
156
|
+
var byteCount = Encoding.UTF8.GetByteCount(s);
|
|
157
|
+
WriteU16((ushort)byteCount);
|
|
158
|
+
Encoding.UTF8.GetBytes(s, _buf.GetSpan(byteCount));
|
|
159
|
+
_buf.Advance(byteCount);
|
|
160
|
+
}
|
|
161
|
+
}
|