mirror of
https://ghfast.top/https://github.com/StarCitizenToolBox/app.git
synced 2025-06-28 12:34:45 +08:00
update: rust/ rename to win32_api.rs
fix: setForegroundWindow
This commit is contained in:
@ -23,10 +23,6 @@ Stream<RsProcessStreamData> start(
|
||||
Future<void> write({required int rsPid, required String data, dynamic hint}) =>
|
||||
RustLib.instance.api.write(rsPid: rsPid, data: data, hint: hint);
|
||||
|
||||
Future<bool> setForegroundWindow({required String windowName, dynamic hint}) =>
|
||||
RustLib.instance.api
|
||||
.setForegroundWindow(windowName: windowName, hint: hint);
|
||||
|
||||
class RsProcessStreamData {
|
||||
final RsProcessStreamDataType dataType;
|
||||
final String data;
|
||||
|
@ -18,3 +18,7 @@ Future<void> sendNotify(
|
||||
appName: appName,
|
||||
appId: appId,
|
||||
hint: hint);
|
||||
|
||||
Future<bool> setForegroundWindow({required String windowName, dynamic hint}) =>
|
||||
RustLib.instance.api
|
||||
.setForegroundWindow(windowName: windowName, hint: hint);
|
@ -4,8 +4,8 @@
|
||||
// ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field
|
||||
|
||||
import 'api/http_api.dart';
|
||||
import 'api/notify_api.dart';
|
||||
import 'api/rs_process.dart';
|
||||
import 'api/win32_api.dart';
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'frb_generated.io.dart' if (dart.library.html) 'frb_generated.web.dart';
|
||||
@ -57,7 +57,7 @@ class RustLib extends BaseEntrypoint<RustLibApi, RustLibApiImpl, RustLibWire> {
|
||||
String get codegenVersion => '2.0.0-dev.32';
|
||||
|
||||
@override
|
||||
int get rustContentHash => -1186168522;
|
||||
int get rustContentHash => 1453545208;
|
||||
|
||||
static const kDefaultExternalLibraryLoaderConfig =
|
||||
ExternalLibraryLoaderConfig(
|
||||
@ -83,6 +83,14 @@ abstract class RustLibApi extends BaseApi {
|
||||
Future<void> setDefaultHeader(
|
||||
{required Map<String, String> headers, dynamic hint});
|
||||
|
||||
Stream<RsProcessStreamData> start(
|
||||
{required String executable,
|
||||
required List<String> arguments,
|
||||
required String workingDirectory,
|
||||
dynamic hint});
|
||||
|
||||
Future<void> write({required int rsPid, required String data, dynamic hint});
|
||||
|
||||
Future<void> sendNotify(
|
||||
{String? summary,
|
||||
String? body,
|
||||
@ -91,14 +99,6 @@ abstract class RustLibApi extends BaseApi {
|
||||
dynamic hint});
|
||||
|
||||
Future<bool> setForegroundWindow({required String windowName, dynamic hint});
|
||||
|
||||
Stream<RsProcessStreamData> start(
|
||||
{required String executable,
|
||||
required List<String> arguments,
|
||||
required String workingDirectory,
|
||||
dynamic hint});
|
||||
|
||||
Future<void> write({required int rsPid, required String data, dynamic hint});
|
||||
}
|
||||
|
||||
class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
@ -212,60 +212,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
argNames: ["headers"],
|
||||
);
|
||||
|
||||
@override
|
||||
Future<void> sendNotify(
|
||||
{String? summary,
|
||||
String? body,
|
||||
String? appName,
|
||||
String? appId,
|
||||
dynamic hint}) {
|
||||
return handler.executeNormal(NormalTask(
|
||||
callFfi: (port_) {
|
||||
var arg0 = cst_encode_opt_String(summary);
|
||||
var arg1 = cst_encode_opt_String(body);
|
||||
var arg2 = cst_encode_opt_String(appName);
|
||||
var arg3 = cst_encode_opt_String(appId);
|
||||
return wire.wire_send_notify(port_, arg0, arg1, arg2, arg3);
|
||||
},
|
||||
codec: DcoCodec(
|
||||
decodeSuccessData: dco_decode_unit,
|
||||
decodeErrorData: dco_decode_AnyhowException,
|
||||
),
|
||||
constMeta: kSendNotifyConstMeta,
|
||||
argValues: [summary, body, appName, appId],
|
||||
apiImpl: this,
|
||||
hint: hint,
|
||||
));
|
||||
}
|
||||
|
||||
TaskConstMeta get kSendNotifyConstMeta => const TaskConstMeta(
|
||||
debugName: "send_notify",
|
||||
argNames: ["summary", "body", "appName", "appId"],
|
||||
);
|
||||
|
||||
@override
|
||||
Future<bool> setForegroundWindow({required String windowName, dynamic hint}) {
|
||||
return handler.executeNormal(NormalTask(
|
||||
callFfi: (port_) {
|
||||
var arg0 = cst_encode_String(windowName);
|
||||
return wire.wire_set_foreground_window(port_, arg0);
|
||||
},
|
||||
codec: DcoCodec(
|
||||
decodeSuccessData: dco_decode_bool,
|
||||
decodeErrorData: dco_decode_AnyhowException,
|
||||
),
|
||||
constMeta: kSetForegroundWindowConstMeta,
|
||||
argValues: [windowName],
|
||||
apiImpl: this,
|
||||
hint: hint,
|
||||
));
|
||||
}
|
||||
|
||||
TaskConstMeta get kSetForegroundWindowConstMeta => const TaskConstMeta(
|
||||
debugName: "set_foreground_window",
|
||||
argNames: ["windowName"],
|
||||
);
|
||||
|
||||
@override
|
||||
Stream<RsProcessStreamData> start(
|
||||
{required String executable,
|
||||
@ -322,6 +268,60 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
argNames: ["rsPid", "data"],
|
||||
);
|
||||
|
||||
@override
|
||||
Future<void> sendNotify(
|
||||
{String? summary,
|
||||
String? body,
|
||||
String? appName,
|
||||
String? appId,
|
||||
dynamic hint}) {
|
||||
return handler.executeNormal(NormalTask(
|
||||
callFfi: (port_) {
|
||||
var arg0 = cst_encode_opt_String(summary);
|
||||
var arg1 = cst_encode_opt_String(body);
|
||||
var arg2 = cst_encode_opt_String(appName);
|
||||
var arg3 = cst_encode_opt_String(appId);
|
||||
return wire.wire_send_notify(port_, arg0, arg1, arg2, arg3);
|
||||
},
|
||||
codec: DcoCodec(
|
||||
decodeSuccessData: dco_decode_unit,
|
||||
decodeErrorData: dco_decode_AnyhowException,
|
||||
),
|
||||
constMeta: kSendNotifyConstMeta,
|
||||
argValues: [summary, body, appName, appId],
|
||||
apiImpl: this,
|
||||
hint: hint,
|
||||
));
|
||||
}
|
||||
|
||||
TaskConstMeta get kSendNotifyConstMeta => const TaskConstMeta(
|
||||
debugName: "send_notify",
|
||||
argNames: ["summary", "body", "appName", "appId"],
|
||||
);
|
||||
|
||||
@override
|
||||
Future<bool> setForegroundWindow({required String windowName, dynamic hint}) {
|
||||
return handler.executeNormal(NormalTask(
|
||||
callFfi: (port_) {
|
||||
var arg0 = cst_encode_String(windowName);
|
||||
return wire.wire_set_foreground_window(port_, arg0);
|
||||
},
|
||||
codec: DcoCodec(
|
||||
decodeSuccessData: dco_decode_bool,
|
||||
decodeErrorData: dco_decode_AnyhowException,
|
||||
),
|
||||
constMeta: kSetForegroundWindowConstMeta,
|
||||
argValues: [windowName],
|
||||
apiImpl: this,
|
||||
hint: hint,
|
||||
));
|
||||
}
|
||||
|
||||
TaskConstMeta get kSetForegroundWindowConstMeta => const TaskConstMeta(
|
||||
debugName: "set_foreground_window",
|
||||
argNames: ["windowName"],
|
||||
);
|
||||
|
||||
@protected
|
||||
AnyhowException dco_decode_AnyhowException(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
|
@ -4,8 +4,8 @@
|
||||
// ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field
|
||||
|
||||
import 'api/http_api.dart';
|
||||
import 'api/notify_api.dart';
|
||||
import 'api/rs_process.dart';
|
||||
import 'api/win32_api.dart';
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:ffi' as ffi;
|
||||
@ -555,58 +555,6 @@ class RustLibWire implements BaseWire {
|
||||
late final _wire_set_default_header = _wire_set_default_headerPtr.asFunction<
|
||||
void Function(int, ffi.Pointer<wire_cst_list_record_string_string>)>();
|
||||
|
||||
void wire_send_notify(
|
||||
int port_,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict> summary,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict> body,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict> app_name,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict> app_id,
|
||||
) {
|
||||
return _wire_send_notify(
|
||||
port_,
|
||||
summary,
|
||||
body,
|
||||
app_name,
|
||||
app_id,
|
||||
);
|
||||
}
|
||||
|
||||
late final _wire_send_notifyPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Void Function(
|
||||
ffi.Int64,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict>)>>(
|
||||
'frbgen_starcitizen_doctor_wire_send_notify');
|
||||
late final _wire_send_notify = _wire_send_notifyPtr.asFunction<
|
||||
void Function(
|
||||
int,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict>)>();
|
||||
|
||||
void wire_set_foreground_window(
|
||||
int port_,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict> window_name,
|
||||
) {
|
||||
return _wire_set_foreground_window(
|
||||
port_,
|
||||
window_name,
|
||||
);
|
||||
}
|
||||
|
||||
late final _wire_set_foreground_windowPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Void Function(
|
||||
ffi.Int64, ffi.Pointer<wire_cst_list_prim_u_8_strict>)>>(
|
||||
'frbgen_starcitizen_doctor_wire_set_foreground_window');
|
||||
late final _wire_set_foreground_window =
|
||||
_wire_set_foreground_windowPtr.asFunction<
|
||||
void Function(int, ffi.Pointer<wire_cst_list_prim_u_8_strict>)>();
|
||||
|
||||
void wire_start(
|
||||
int port_,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict> executable,
|
||||
@ -660,6 +608,58 @@ class RustLibWire implements BaseWire {
|
||||
late final _wire_write = _wire_writePtr.asFunction<
|
||||
void Function(int, int, ffi.Pointer<wire_cst_list_prim_u_8_strict>)>();
|
||||
|
||||
void wire_send_notify(
|
||||
int port_,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict> summary,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict> body,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict> app_name,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict> app_id,
|
||||
) {
|
||||
return _wire_send_notify(
|
||||
port_,
|
||||
summary,
|
||||
body,
|
||||
app_name,
|
||||
app_id,
|
||||
);
|
||||
}
|
||||
|
||||
late final _wire_send_notifyPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Void Function(
|
||||
ffi.Int64,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict>)>>(
|
||||
'frbgen_starcitizen_doctor_wire_send_notify');
|
||||
late final _wire_send_notify = _wire_send_notifyPtr.asFunction<
|
||||
void Function(
|
||||
int,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict>)>();
|
||||
|
||||
void wire_set_foreground_window(
|
||||
int port_,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict> window_name,
|
||||
) {
|
||||
return _wire_set_foreground_window(
|
||||
port_,
|
||||
window_name,
|
||||
);
|
||||
}
|
||||
|
||||
late final _wire_set_foreground_windowPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Void Function(
|
||||
ffi.Int64, ffi.Pointer<wire_cst_list_prim_u_8_strict>)>>(
|
||||
'frbgen_starcitizen_doctor_wire_set_foreground_window');
|
||||
late final _wire_set_foreground_window =
|
||||
_wire_set_foreground_windowPtr.asFunction<
|
||||
void Function(int, ffi.Pointer<wire_cst_list_prim_u_8_strict>)>();
|
||||
|
||||
ffi.Pointer<ffi.Uint64> cst_new_box_autoadd_u_64(
|
||||
int value,
|
||||
) {
|
||||
|
Reference in New Issue
Block a user