@@ -37,92 +37,145 @@ internal static Process Instance
37
37
private static readonly object _syncRoot = new ( ) ;
38
38
39
39
/// <summary>
40
- /// The process.execPath property returns the absolute pathname of the executable that started the Node.js process. Symbolic links, if any, are resolved.
41
- /// </summary>
42
- /// <example>
43
- /// <code>
44
- /// var path = await Electron.Process.ExecPathAsync;
45
- /// </code>
46
- /// </example>
40
+ /// The process.execPath property returns the absolute pathname of the executable that
41
+ /// started the Node.js process. Symbolic links, if any, are resolved.
42
+ /// </summary>
47
43
public Task < string > ExecPathAsync
48
44
{
49
45
get
50
46
{
51
- CancellationToken cancellationToken = new ( ) ;
52
- cancellationToken . ThrowIfCancellationRequested ( ) ;
53
-
54
- var taskCompletionSource = new TaskCompletionSource < string > ( ) ;
55
- using ( cancellationToken . Register ( ( ) => taskCompletionSource . TrySetCanceled ( ) ) )
56
- {
57
- BridgeConnector . Socket . On ( "process-execPathCompleted" , ( text ) =>
58
- {
59
- BridgeConnector . Socket . Off ( "process-execPathCompleted" ) ;
60
- taskCompletionSource . SetResult ( ( string ) text ) ;
61
- } ) ;
62
-
63
- BridgeConnector . Socket . Emit ( "process-execPath" ) ;
64
-
65
- return taskCompletionSource . Task ;
66
- }
47
+ return BridgeConnector . GetValueOverSocketAsync < string > (
48
+ "process-execPath" , "process-execPath-Completed" ) ;
67
49
}
68
50
}
69
51
70
52
/// <summary>
71
- /// TBD
53
+ /// The process.argv property returns an array containing the command-line arguments passed
54
+ /// when the Node.js process was launched. The first element will be process.execPath. See
55
+ /// process.argv0 if access to the original value of argv[0] is needed. The second element
56
+ /// will be the path to the JavaScript file being executed. The remaining elements will be
57
+ /// any additional command-line arguments
72
58
/// </summary>
73
- /// <value></value>
74
59
public Task < string [ ] > ArgvAsync
75
60
{
76
61
get
77
62
{
78
- CancellationToken cancellationToken = new ( ) ;
79
- cancellationToken . ThrowIfCancellationRequested ( ) ;
63
+ return BridgeConnector . GetArrayOverSocketAsync < string [ ] > (
64
+ "process-argv" , "process-argv-Completed" ) ;
65
+ }
66
+ }
80
67
81
- var taskCompletionSource = new TaskCompletionSource < string [ ] > ( ) ;
82
- using ( cancellationToken . Register ( ( ) => taskCompletionSource . TrySetCanceled ( ) ) )
83
- {
84
- BridgeConnector . Socket . On ( "process-argvCompleted" , ( value ) =>
85
- {
86
- BridgeConnector . Socket . Off ( "process-argvCompleted" ) ;
87
- taskCompletionSource . SetResult ( ( ( JArray ) value ) . ToObject < string [ ] > ( ) ) ;
88
- } ) ;
68
+ /// <summary>
69
+ /// The process.execPath property returns the absolute pathname of the executable that
70
+ /// started the Node.js process. Symbolic links, if any, are resolved.
71
+ /// </summary>
72
+ public Task < string > TypeAsync
73
+ {
74
+ get
75
+ {
76
+ return BridgeConnector . GetValueOverSocketAsync < string > (
77
+ "process-type" , "process-type-Completed" ) ;
78
+ }
79
+ }
80
+
81
+
82
+ /// <summary>
83
+ ///
84
+ /// </summary>
85
+ public Task < Versions > VersionsAsync
86
+ {
87
+ get
88
+ {
89
+ return BridgeConnector . GetValueOverSocketAsync < Versions > (
90
+ "process-versions" , "process-versions-Completed" ) ;
91
+ }
92
+ }
93
+
94
+
95
+ /// <summary>
96
+ ///
97
+ /// </summary>
98
+ public Task < bool > DefaultAppAsync
99
+ {
100
+ get
101
+ {
102
+ return BridgeConnector . GetValueOverSocketAsync < bool > (
103
+ "process-defaultApp" , "process-defaultApp-Completed" ) ;
104
+ }
105
+ }
89
106
90
- BridgeConnector . Socket . Emit ( "process-argv" ) ;
107
+ /// <summary>
108
+ ///
109
+ /// </summary>
110
+ public Task < bool > IsMainFrameAsync
111
+ {
112
+ get
113
+ {
114
+ return BridgeConnector . GetValueOverSocketAsync < bool > (
115
+ "process-isMainFrame" , "process-isMainFrame-Completed" ) ;
116
+ }
117
+ }
91
118
92
- return taskCompletionSource . Task ;
93
- }
119
+ /// <summary>
120
+ ///
121
+ /// </summary>
122
+ public Task < string > ResourcesPathAsync
123
+ {
124
+ get
125
+ {
126
+ return BridgeConnector . GetValueOverSocketAsync < string > (
127
+ "process-resourcesPath" , "process-resourcesPath-Completed" ) ;
94
128
}
95
129
}
96
130
97
131
/// <summary>
98
- /// The process.execPath property returns the absolute pathname of the executable that started the Node.js process. Symbolic links, if any, are resolved.
132
+ ///
99
133
/// </summary>
100
- /// <example>
101
- /// <code>
102
- /// var path = await Electron.Process.ExecPathAsync;
103
- /// </code>
104
- /// </example>
105
- public Task < string > TypeAsync
134
+ public Task < double > UpTimeAsync
106
135
{
107
136
get
108
137
{
109
- CancellationToken cancellationToken = new ( ) ;
110
- cancellationToken . ThrowIfCancellationRequested ( ) ;
138
+ return BridgeConnector . GetValueOverSocketAsync < double > (
139
+ "process-uptime" , "process-uptime-Completed" ) ;
140
+ }
141
+ }
111
142
112
- var taskCompletionSource = new TaskCompletionSource < string > ( ) ;
113
- using ( cancellationToken . Register ( ( ) => taskCompletionSource . TrySetCanceled ( ) ) )
114
- {
115
- BridgeConnector . Socket . On ( "process-typeCompleted" , ( text ) =>
116
- {
117
- BridgeConnector . Socket . Off ( "process-typeCompleted" ) ;
118
- taskCompletionSource . SetResult ( ( string ) text ) ;
119
- } ) ;
143
+ /// <summary>
144
+ ///
145
+ /// </summary>
146
+ public Task < int > PidAsync
147
+ {
148
+ get
149
+ {
150
+ return BridgeConnector . GetValueOverSocketAsync < int > (
151
+ "process-pid" , "process-pid-Completed" ) ;
152
+ }
153
+ }
120
154
121
- BridgeConnector . Socket . Emit ( "process-type" ) ;
122
155
123
- return taskCompletionSource . Task ;
124
- }
156
+ /// <summary>
157
+ ///
158
+ /// </summary>
159
+ public Task < string > ArchAsync
160
+ {
161
+ get
162
+ {
163
+ return BridgeConnector . GetValueOverSocketAsync < string > (
164
+ "process-arch" , "process-arch-Completed" ) ;
165
+ }
166
+ }
167
+
168
+ /// <summary>
169
+ ///
170
+ /// </summary>
171
+ public Task < string > PlatformAsync
172
+ {
173
+ get
174
+ {
175
+ return BridgeConnector . GetValueOverSocketAsync < string > (
176
+ "process-platform" , "process-platform-Completed" ) ;
125
177
}
126
178
}
179
+
127
180
}
128
181
}
0 commit comments