This commit is contained in:
2024-09-04 17:18:13 +08:00
parent 3da318ec71
commit 74fe0457f0
276 changed files with 901 additions and 14439 deletions

View File

@ -1,47 +0,0 @@
import 'dart:io';
import 'package:archive/archive.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:starcitizen_doctor/common/utils/log.dart';
class BinaryModuleConf {
static const _modules = {
"aria2c": "0",
"unp4kc": "1",
};
static Future extractModule(List<String> modules, String workingDir) async {
for (var m in _modules.entries) {
if (!modules.contains(m.key)) continue;
final name = m.key;
final version = m.value;
final dir = "$workingDir\\$name";
final versionFile = File("$dir\\version");
if (kReleaseMode &&
await versionFile.exists() &&
(await versionFile.readAsString()).trim() == version) {
dPrint(
"BinaryModuleConf.extractModule skip $name version == $version");
continue;
}
// write model file
final zipBuffer = await rootBundle.load("assets/binary/$name.zip");
final decoder = ZipDecoder().decodeBytes(zipBuffer.buffer.asUint8List());
for (var value in decoder.files) {
final filename = value.name;
if (value.isFile) {
final data = value.content as List<int>;
final file = File('$dir\\$filename');
await file.create(recursive: true);
await file.writeAsBytes(data);
} else {
await Directory('$dir\\$filename').create(recursive: true);
}
}
// write version file
await versionFile.writeAsString(version);
dPrint("BinaryModuleConf.extractModule $name $dir");
}
}
}

View File

@ -1,8 +1,7 @@
class ConstConf {
static const String appVersion = "2.12.0";
static const int appVersionCode = 54;
static const String appVersionDate = "2024-6-28";
static const String appVersion = "Lite";
static const int appVersionCode = 0;
static const String appVersionDate = "2024-09-04";
static const gameChannels = ["LIVE", "PTU", "EPTU", "TECH-PREVIEW"];
static const isMSE =
String.fromEnvironment("MSE", defaultValue: "false") == "true";
static const isMSE = true;
}

View File

@ -37,24 +37,7 @@ class URLConf {
static String get devReleaseUrl => "$gitApiHome/SCToolBox/Release/releases";
static Future<bool> checkHost() async {
// 使用 DNS 获取可用列表
final gitApiList =
_genFinalList(await RSHttp.dnsLookupTxt("git.dns.scbox.org"));
dPrint("DNS gitApiList ==== $gitApiList");
final fasterGit = await getFasterUrl(gitApiList);
dPrint("gitApiList.Faster ==== $fasterGit");
if (fasterGit != null) {
gitApiHome = fasterGit;
}
final rssApiList =
_genFinalList(await RSHttp.dnsLookupTxt("rss.dns.scbox.org"));
final fasterRss = await getFasterUrl(rssApiList);
dPrint("DNS rssApiList ==== $rssApiList");
dPrint("rssApiList.Faster ==== $fasterRss");
if (fasterRss != null) {
rssApiHome = fasterRss;
}
isUrlCheckPass = fasterGit != null && fasterRss != null;
isUrlCheckPass = true;
return isUrlCheckPass;
}
@ -87,14 +70,4 @@ class URLConf {
}
}
static List<String> _genFinalList(List<String> sList) {
List<String> list = [];
for (var ll in sList) {
final ssList = ll.split(",");
for (var value in ssList) {
list.add(value);
}
}
return list;
}
}

View File

@ -1,209 +0,0 @@
import 'dart:convert';
import 'dart:io';
import 'package:hive/hive.dart';
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
import 'package:starcitizen_doctor/common/utils/log.dart';
class SCLoggerHelper {
static Future<String?> getLogFilePath() async {
if (!Platform.isWindows) return null;
Map<String, String> envVars = Platform.environment;
final appDataPath = envVars["appdata"];
if (appDataPath == null) {
return null;
}
final rsiLauncherPath = "$appDataPath\\rsilauncher";
dPrint("rsiLauncherPath:$rsiLauncherPath");
final jsonLogPath = "$rsiLauncherPath\\logs\\log.log";
return jsonLogPath;
}
static Future<String?> getShaderCachePath() async {
Map<String, String> envVars = Platform.environment;
final appDataPath = envVars["LOCALAPPDATA"];
if (appDataPath == null) {
return null;
}
final scCachePath = "$appDataPath\\Star Citizen";
dPrint("getShaderCachePath === $scCachePath");
return scCachePath;
}
static Future<List?> getLauncherLogList() async {
if (!Platform.isWindows) return [];
try {
final jsonLogPath = await getLogFilePath();
if (jsonLogPath == null) throw "no file path";
var jsonString = utf8.decode(await File(jsonLogPath).readAsBytes());
if (jsonString.endsWith("\n")) {
jsonString = jsonString.substring(0, jsonString.length - 3);
}
if (jsonString.endsWith(" ")) {
jsonString = jsonString.substring(0, jsonString.length - 3);
}
if (jsonString.endsWith(",")) {
jsonString = jsonString.substring(0, jsonString.length - 3);
}
return json.decode("[$jsonString]");
} catch (e) {
dPrint(e);
return [];
}
}
static Future<List<String>> getGameInstallPath(List listData,
{bool checkExists = true,
List<String> withVersion = const ["LIVE"]}) async {
List<String> scInstallPaths = [];
checkAndAddPath(String path, bool checkExists) async {
if (path.isNotEmpty && !scInstallPaths.contains(path)) {
if (!checkExists) {
dPrint("find installPath == $path");
scInstallPaths.add(path);
} else if (await File("$path/Bin64/StarCitizen.exe").exists() &&
await File("$path/Data.p4k").exists()) {
dPrint("find installPath == $path");
scInstallPaths.add(path);
}
}
}
final confBox = await Hive.openBox("app_conf");
final path = confBox.get("custom_game_path");
if (path != null && path != "") {
for (var v in withVersion) {
await checkAndAddPath("$path\\$v", checkExists);
}
}
try {
for (var v in withVersion) {
for (var i = listData.length - 1; i > 0; i--) {
final m = listData[i];
final info = m["[browser][info] "];
if (info is String) {
String installPath = "";
if (info.contains("Installing Star Citizen $v")) {
installPath = "${info.split(" at ")[1]}\\$v";
}
if (info.contains("Verifying Star Citizen $v")) {
installPath = "${info.split(" at ")[1]}\\$v";
}
if (info.contains("Launching Star Citizen $v from")) {
installPath = info
.replaceAll("Launching Star Citizen $v from (", "")
.replaceAll(")", "");
}
await checkAndAddPath(installPath, checkExists);
}
}
if (scInstallPaths.isNotEmpty) {
// 动态检测更多位置
for (var v in withVersion) {
for (var fileName in List.from(scInstallPaths)) {
if (fileName.toString().endsWith(v)) {
for (var nv in withVersion) {
final nextName =
"${fileName.toString().replaceAll("\\$v", "")}\\$nv";
await checkAndAddPath(nextName, true);
}
}
}
}
}
}
} catch (e) {
dPrint(e);
if (scInstallPaths.isEmpty) rethrow;
}
return scInstallPaths;
}
static String getGameChannelID(String installPath) {
for (var value in ConstConf.gameChannels) {
if (installPath.endsWith("\\$value")) {
return value;
}
}
return "UNKNOWN";
}
static Future<List<String>?> getGameRunningLogs(String gameDir) async {
final logFile = File("$gameDir/Game.log");
if (!await logFile.exists()) {
return null;
}
return await logFile.readAsLines(
encoding: const Utf8Codec(allowMalformed: true));
}
static MapEntry<String, String>? getGameRunningLogInfo(List<String> logs) {
for (var i = logs.length - 1; i > 0; i--) {
final line = logs[i];
final r = _checkRunningLine(line);
if (r != null) {
return r;
}
}
return null;
}
static MapEntry<String, String>? _checkRunningLine(String line) {
if (line.contains("STATUS_CRYENGINE_OUT_OF_SYSMEM")) {
return MapEntry(S.current.doctor_game_error_low_memory,
S.current.doctor_game_error_low_memory_info);
}
if (line.contains("EXCEPTION_ACCESS_VIOLATION")) {
return MapEntry(S.current.doctor_game_error_generic_info,
"https://docs.qq.com/doc/DUURxUVhzTmZoY09Z");
}
if (line.contains("DXGI_ERROR_DEVICE_REMOVED")) {
return MapEntry(S.current.doctor_game_error_gpu_crash,
"https://www.bilibili.com/read/cv19335199");
}
if (line.contains("Wakeup socket sendto error")) {
return MapEntry(S.current.doctor_game_error_socket_error,
S.current.doctor_game_error_socket_error_info);
}
if (line.contains("The requested operation requires elevated")) {
return MapEntry(S.current.doctor_game_error_permissions_error,
S.current.doctor_game_error_permissions_error_info);
}
if (line.contains(
"The process cannot access the file because is is being used by another process")) {
return MapEntry(S.current.doctor_game_error_game_process_error,
S.current.doctor_game_error_game_process_error_info);
}
if (line.contains("0xc0000043")) {
return MapEntry(S.current.doctor_game_error_game_damaged_file,
S.current.doctor_game_error_game_damaged_file_info);
}
if (line.contains("option to verify the content of the Data.p4k file")) {
return MapEntry(S.current.doctor_game_error_game_damaged_p4k_file,
S.current.doctor_game_error_game_damaged_p4k_file_info);
}
if (line.contains("OUTOFMEMORY Direct3D could not allocate")) {
return MapEntry(S.current.doctor_game_error_low_gpu_memory,
S.current.doctor_game_error_low_gpu_memory_info);
}
if (line.contains(
"try disabling with r_vulkanDisableLayers = 1 in your user.cfg")) {
return MapEntry(S.current.doctor_game_error_gpu_vulkan_crash,
S.current.doctor_game_error_gpu_vulkan_crash_info);
}
/// Unknown
if (line.contains("network.replicatedEntityHandle")) {
return const MapEntry("_", "network.replicatedEntityHandle");
}
if (line.contains("Exception Unknown")) {
return const MapEntry("_", "Exception Unknown");
}
return null;
}
}

View File

@ -1,280 +0,0 @@
import 'dart:io';
import 'package:hive/hive.dart';
import 'package:starcitizen_doctor/common/utils/log.dart';
class SystemHelper {
static String powershellPath = "powershell.exe";
static initPowershellPath() async {
try {
var result = await Process.run(powershellPath, ["echo", "ping"]);
if (!result.stdout.toString().startsWith("ping") &&
powershellPath == "powershell.exe") {
throw "powershell check failed";
}
} catch (e) {
Map<String, String> envVars = Platform.environment;
final systemRoot = envVars["SYSTEMROOT"];
if (systemRoot != null) {
final autoSearchPath =
"$systemRoot\\System32\\WindowsPowerShell\\v1.0\\powershell.exe";
dPrint("auto search powershell path === $autoSearchPath");
powershellPath = autoSearchPath;
}
}
}
static Future<bool> checkNvmePatchStatus() async {
try {
var result = await Process.run(SystemHelper.powershellPath, [
"Get-ItemProperty",
"-Path",
"\"HKLM:\\SYSTEM\\CurrentControlSet\\Services\\stornvme\\Parameters\\Device\"",
"-Name",
"\"ForcedPhysicalSectorSizeInBytes\""
]);
dPrint("checkNvmePatchStatus result ==== ${result.stdout}");
if (result.stderr == "" &&
result.stdout.toString().contains("{* 4095}")) {
return true;
} else {
return false;
}
} catch (e) {
return false;
}
}
static Future<String> addNvmePatch() async {
var result = await Process.run(powershellPath, [
'New-ItemProperty',
"-Path",
"\"HKLM:\\SYSTEM\\CurrentControlSet\\Services\\stornvme\\Parameters\\Device\"",
"-Name",
"ForcedPhysicalSectorSizeInBytes",
"-PropertyType MultiString",
"-Force -Value",
"\"* 4095\""
]);
dPrint("nvme_PhysicalBytes result == ${result.stdout}");
return result.stderr;
}
static doRemoveNvmePath() async {
try {
var result = await Process.run(powershellPath, [
"Clear-ItemProperty",
"-Path",
"\"HKLM:\\SYSTEM\\CurrentControlSet\\Services\\stornvme\\Parameters\\Device\"",
"-Name",
"\"ForcedPhysicalSectorSizeInBytes\""
]);
dPrint("doRemoveNvmePath result ==== ${result.stdout}");
if (result.stderr == "") {
return true;
} else {
return false;
}
} catch (e) {
return false;
}
}
/// 获取 RSI 启动器 目录
static Future<String> getRSILauncherPath({bool skipEXE = false}) async {
final confBox = await Hive.openBox("app_conf");
final path = confBox.get("custom_launcher_path");
if (path != null && path != "") {
if (await File(path).exists()) {
if (skipEXE) {
return "${path.toString().replaceAll("\\RSI Launcher.exe", "")}\\";
}
return path;
}
}
Map<String, String> envVars = Platform.environment;
final programDataPath = envVars["programdata"];
final rsiFilePath =
"$programDataPath\\Microsoft\\Windows\\Start Menu\\Programs\\Roberts Space Industries\\RSI Launcher.lnk";
final rsiLinkFile = File(rsiFilePath);
if (await rsiLinkFile.exists()) {
final r = await Process.run(SystemHelper.powershellPath, [
"(New-Object -ComObject WScript.Shell).CreateShortcut(\"$rsiFilePath\").targetpath"
]);
if (r.stdout.toString().contains("RSI Launcher.exe")) {
final start = r.stdout.toString().split("RSI Launcher.exe");
if (skipEXE) {
return start[0];
}
return "${start[0]}RSI Launcher.exe";
}
}
return "";
}
static killRSILauncher() async {
var psr = await Process.run(
powershellPath, ["ps", "\"RSI Launcher\"", "|select -expand id"]);
if (psr.stderr == "") {
for (var value in (psr.stdout ?? "").toString().split("\n")) {
dPrint(value);
if (value != "") {
Process.killPid(int.parse(value));
}
}
}
}
static Future<List<String>> getPID(String name) async {
final r = await Process.run(powershellPath, ["(ps $name).Id"]);
final str = r.stdout.toString().trim();
dPrint(str);
if (str.isEmpty) return [];
return str.split("\n");
}
static checkAndLaunchRSILauncher(String path) async {
// check running and kill
await killRSILauncher();
// launch
final processorAffinity = await SystemHelper.getCpuAffinity();
if (processorAffinity == null) {
Process.run(path, []);
} else {
Process.run("cmd.exe", [
'/C',
'Start',
'""',
'/High',
'/Affinity',
processorAffinity,
path,
]);
}
dPrint(path);
}
static Future<int> getSystemMemorySizeGB() async {
final r = await Process.run(powershellPath, [
"(Get-CimInstance Win32_PhysicalMemory | Measure-Object -Property capacity -Sum).sum /1gb"
]);
return int.tryParse(r.stdout.toString().trim()) ?? 0;
}
static Future<String> getSystemCimInstance(String win32InstanceName,
{pathName = "Name"}) async {
final r = await Process.run(
powershellPath, ["(Get-CimInstance $win32InstanceName).$pathName"]);
return r.stdout.toString().trim();
}
static Future<String> getSystemName() async {
final r = await Process.run(
powershellPath, ["(Get-ComputerInfo | Select-Object -expand OsName)"]);
return r.stdout.toString().trim();
}
static Future<String> getCpuName() async {
final r = await Process.run(
powershellPath, ["(Get-WmiObject -Class Win32_Processor).Name"]);
return r.stdout.toString().trim();
}
static Future<String> getGpuInfo() async {
const cmd = r"""
$adapterMemory = (Get-ItemProperty -Path "HKLM:\SYSTEM\ControlSet001\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\0*" -Name "HardwareInformation.AdapterString", "HardwareInformation.qwMemorySize" -Exclude PSPath -ErrorAction SilentlyContinue)
foreach ($adapter in $adapterMemory) {
[PSCustomObject] @{
Model=$adapter."HardwareInformation.AdapterString"
"VRAM (GB)"=[math]::round($adapter."HardwareInformation.qwMemorySize"/1GB)
}
}
""";
final r = await Process.run(powershellPath, [cmd]);
return r.stdout.toString().trim();
}
static Future<String> getDiskInfo() async {
return (await Process.run(powershellPath,
["Get-PhysicalDisk | format-table BusType,FriendlyName,Size"]))
.stdout
.toString()
.trim();
}
static Future<int> getDirLen(String path, {List<String>? skipPath}) async {
if (path == "") return 0;
int totalSize = 0;
try {
final l = await Directory(path).list(recursive: true).toList();
for (var element in l) {
if (element is File) {
bool skip = false;
if (skipPath != null) {
for (var value in skipPath) {
if (element.absolute.path.startsWith(value)) {
skip = true;
break;
}
}
}
if (!skip) totalSize += await element.length();
}
}
} catch (_) {}
return totalSize;
}
static Future<int> getNumberOfLogicalProcessors() async {
final cpuNumberResult = await Process.run(powershellPath,
["(Get-WmiObject -Class Win32_Processor).NumberOfLogicalProcessors"]);
if (cpuNumberResult.exitCode != 0) return 0;
return int.tryParse(cpuNumberResult.stdout.toString().trim()) ?? 0;
}
static Future<String?> getCpuAffinity() async {
final confBox = await Hive.openBox("app_conf");
final eCoreCount = int.tryParse(
confBox.get("gameLaunch_eCore_count", defaultValue: "0")) ??
0;
final cpuNumber = await getNumberOfLogicalProcessors();
if (cpuNumber == 0 || eCoreCount == 0 || eCoreCount > cpuNumber) {
return null;
}
StringBuffer sb = StringBuffer();
for (var i = 0; i < cpuNumber; i++) {
if (i < eCoreCount) {
sb.write("0");
} else {
sb.write("1");
}
}
final binaryString = sb.toString();
int hexDigits = (binaryString.length / 4).ceil();
dPrint("Affinity sb ==== $sb");
return int.parse(binaryString, radix: 2)
.toRadixString(16)
.padLeft(hexDigits, '0')
.toUpperCase();
}
static Future openDir(path, {bool isFile = false}) async {
dPrint("SystemHelper.openDir path === $path");
if (Platform.isWindows) {
await Process.run(SystemHelper.powershellPath,
["explorer.exe", isFile ? "/select,$path" : "\"/select,\"$path\"\""]);
}
}
static String getHostsFilePath() {
if (Platform.isWindows) {
final envVars = Platform.environment;
final systemRoot = envVars["SYSTEMROOT"];
return "$systemRoot\\System32\\drivers\\etc\\hosts";
}
return "/etc/hosts";
}
}

View File

@ -17,10 +17,7 @@ class RSHttp {
static Future<RustHttpResponse> get(String url,
{Map<String, String>? headers, String? withIpAddress}) async {
final r = await rust_http.fetch(
method: MyMethod.gets,
url: url,
headers: headers,
withIpAddress: withIpAddress);
method: MyMethod.gets, url: url, headers: headers);
return r;
}
@ -42,29 +39,14 @@ class RSHttp {
headers["Content-Type"] = contentType;
}
final r = await rust_http.fetch(
method: MyMethod.post,
url: url,
headers: headers,
inputData: data,
withIpAddress: withIpAddress);
method: MyMethod.post, url: url, headers: headers, inputData: data);
return r;
}
static Future<RustHttpResponse> head(String url,
{Map<String, String>? headers, String? withIpAddress}) async {
final r = await rust_http.fetch(
method: MyMethod.head,
url: url,
headers: headers,
withIpAddress: withIpAddress);
method: MyMethod.head, url: url, headers: headers);
return r;
}
static Future<List<String>> dnsLookupTxt(String host) async {
return await rust_http.dnsLookupTxt(host: host);
}
static Future<List<String>> dnsLookupIps(String host) async {
return await rust_http.dnsLookupIps(host: host);
}
}

View File

@ -1,41 +0,0 @@
// This file is automatically generated, so please do not edit it.
// Generated by `flutter_rust_bridge`@ 2.3.0.
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import
import '../frb_generated.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
Future<RsiLauncherAsarData> getRsiLauncherAsarData(
{required String asarPath}) =>
RustLib.instance.api
.crateApiAsarApiGetRsiLauncherAsarData(asarPath: asarPath);
class RsiLauncherAsarData {
final String asarPath;
final String mainJsPath;
final Uint8List mainJsContent;
const RsiLauncherAsarData({
required this.asarPath,
required this.mainJsPath,
required this.mainJsContent,
});
Future<void> writeMainJs({required List<int> content}) =>
RustLib.instance.api.crateApiAsarApiRsiLauncherAsarDataWriteMainJs(
that: this, content: content);
@override
int get hashCode =>
asarPath.hashCode ^ mainJsPath.hashCode ^ mainJsContent.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is RsiLauncherAsarData &&
runtimeType == other.runtimeType &&
asarPath == other.asarPath &&
mainJsPath == other.mainJsPath &&
mainJsContent == other.mainJsContent;
}

View File

@ -16,20 +16,9 @@ Future<RustHttpResponse> fetch(
{required MyMethod method,
required String url,
Map<String, String>? headers,
Uint8List? inputData,
String? withIpAddress}) =>
Uint8List? inputData}) =>
RustLib.instance.api.crateApiHttpApiFetch(
method: method,
url: url,
headers: headers,
inputData: inputData,
withIpAddress: withIpAddress);
Future<List<String>> dnsLookupTxt({required String host}) =>
RustLib.instance.api.crateApiHttpApiDnsLookupTxt(host: host);
Future<List<String>> dnsLookupIps({required String host}) =>
RustLib.instance.api.crateApiHttpApiDnsLookupIps(host: host);
method: method, url: url, headers: headers, inputData: inputData);
enum MyMethod {
options,

View File

@ -1,54 +0,0 @@
// This file is automatically generated, so please do not edit it.
// Generated by `flutter_rust_bridge`@ 2.3.0.
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import
import '../frb_generated.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
// These functions are ignored because they are not marked as `pub`: `_process_output`
// These types are ignored because they are not used by any `pub` functions: `RsProcess`
// These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `clone`
Stream<RsProcessStreamData> start(
{required String executable,
required List<String> arguments,
required String workingDirectory}) =>
RustLib.instance.api.crateApiRsProcessStart(
executable: executable,
arguments: arguments,
workingDirectory: workingDirectory);
Future<void> write({required int rsPid, required String data}) =>
RustLib.instance.api.crateApiRsProcessWrite(rsPid: rsPid, data: data);
class RsProcessStreamData {
final RsProcessStreamDataType dataType;
final String data;
final int rsPid;
const RsProcessStreamData({
required this.dataType,
required this.data,
required this.rsPid,
});
@override
int get hashCode => dataType.hashCode ^ data.hashCode ^ rsPid.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is RsProcessStreamData &&
runtimeType == other.runtimeType &&
dataType == other.dataType &&
data == other.data &&
rsPid == other.rsPid;
}
enum RsProcessStreamDataType {
output,
error,
exit,
;
}

View File

@ -1,16 +0,0 @@
// This file is automatically generated, so please do not edit it.
// Generated by `flutter_rust_bridge`@ 2.3.0.
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import
import '../frb_generated.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
Future<void> sendNotify(
{String? summary, String? body, String? appName, String? appId}) =>
RustLib.instance.api.crateApiWin32ApiSendNotify(
summary: summary, body: body, appName: appName, appId: appId);
Future<bool> setForegroundWindow({required String windowName}) =>
RustLib.instance.api
.crateApiWin32ApiSetForegroundWindow(windowName: windowName);

View File

@ -3,10 +3,7 @@
// 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/asar_api.dart';
import 'api/http_api.dart';
import 'api/rs_process.dart';
import 'api/win32_api.dart';
import 'dart:async';
import 'dart:convert';
import 'frb_generated.dart';
@ -70,7 +67,7 @@ class RustLib extends BaseEntrypoint<RustLibApi, RustLibApiImpl, RustLibWire> {
String get codegenVersion => '2.3.0';
@override
int get rustContentHash => 1832496273;
int get rustContentHash => -669496402;
static const kDefaultExternalLibraryLoaderConfig =
ExternalLibraryLoaderConfig(
@ -81,39 +78,14 @@ class RustLib extends BaseEntrypoint<RustLibApi, RustLibApiImpl, RustLibWire> {
}
abstract class RustLibApi extends BaseApi {
Future<RsiLauncherAsarData> crateApiAsarApiGetRsiLauncherAsarData(
{required String asarPath});
Future<void> crateApiAsarApiRsiLauncherAsarDataWriteMainJs(
{required RsiLauncherAsarData that, required List<int> content});
Future<List<String>> crateApiHttpApiDnsLookupIps({required String host});
Future<List<String>> crateApiHttpApiDnsLookupTxt({required String host});
Future<RustHttpResponse> crateApiHttpApiFetch(
{required MyMethod method,
required String url,
Map<String, String>? headers,
Uint8List? inputData,
String? withIpAddress});
Uint8List? inputData});
Future<void> crateApiHttpApiSetDefaultHeader(
{required Map<String, String> headers});
Stream<RsProcessStreamData> crateApiRsProcessStart(
{required String executable,
required List<String> arguments,
required String workingDirectory});
Future<void> crateApiRsProcessWrite(
{required int rsPid, required String data});
Future<void> crateApiWin32ApiSendNotify(
{String? summary, String? body, String? appName, String? appId});
Future<bool> crateApiWin32ApiSetForegroundWindow(
{required String windowName});
}
class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
@ -124,134 +96,34 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
required super.portManager,
});
@override
Future<RsiLauncherAsarData> crateApiAsarApiGetRsiLauncherAsarData(
{required String asarPath}) {
return handler.executeNormal(NormalTask(
callFfi: (port_) {
var arg0 = cst_encode_String(asarPath);
return wire.wire__crate__api__asar_api__get_rsi_launcher_asar_data(
port_, arg0);
},
codec: DcoCodec(
decodeSuccessData: dco_decode_rsi_launcher_asar_data,
decodeErrorData: dco_decode_AnyhowException,
),
constMeta: kCrateApiAsarApiGetRsiLauncherAsarDataConstMeta,
argValues: [asarPath],
apiImpl: this,
));
}
TaskConstMeta get kCrateApiAsarApiGetRsiLauncherAsarDataConstMeta =>
const TaskConstMeta(
debugName: "get_rsi_launcher_asar_data",
argNames: ["asarPath"],
);
@override
Future<void> crateApiAsarApiRsiLauncherAsarDataWriteMainJs(
{required RsiLauncherAsarData that, required List<int> content}) {
return handler.executeNormal(NormalTask(
callFfi: (port_) {
var arg0 = cst_encode_box_autoadd_rsi_launcher_asar_data(that);
var arg1 = cst_encode_list_prim_u_8_loose(content);
return wire
.wire__crate__api__asar_api__rsi_launcher_asar_data_write_main_js(
port_, arg0, arg1);
},
codec: DcoCodec(
decodeSuccessData: dco_decode_unit,
decodeErrorData: dco_decode_AnyhowException,
),
constMeta: kCrateApiAsarApiRsiLauncherAsarDataWriteMainJsConstMeta,
argValues: [that, content],
apiImpl: this,
));
}
TaskConstMeta get kCrateApiAsarApiRsiLauncherAsarDataWriteMainJsConstMeta =>
const TaskConstMeta(
debugName: "rsi_launcher_asar_data_write_main_js",
argNames: ["that", "content"],
);
@override
Future<List<String>> crateApiHttpApiDnsLookupIps({required String host}) {
return handler.executeNormal(NormalTask(
callFfi: (port_) {
var arg0 = cst_encode_String(host);
return wire.wire__crate__api__http_api__dns_lookup_ips(port_, arg0);
},
codec: DcoCodec(
decodeSuccessData: dco_decode_list_String,
decodeErrorData: dco_decode_AnyhowException,
),
constMeta: kCrateApiHttpApiDnsLookupIpsConstMeta,
argValues: [host],
apiImpl: this,
));
}
TaskConstMeta get kCrateApiHttpApiDnsLookupIpsConstMeta =>
const TaskConstMeta(
debugName: "dns_lookup_ips",
argNames: ["host"],
);
@override
Future<List<String>> crateApiHttpApiDnsLookupTxt({required String host}) {
return handler.executeNormal(NormalTask(
callFfi: (port_) {
var arg0 = cst_encode_String(host);
return wire.wire__crate__api__http_api__dns_lookup_txt(port_, arg0);
},
codec: DcoCodec(
decodeSuccessData: dco_decode_list_String,
decodeErrorData: dco_decode_AnyhowException,
),
constMeta: kCrateApiHttpApiDnsLookupTxtConstMeta,
argValues: [host],
apiImpl: this,
));
}
TaskConstMeta get kCrateApiHttpApiDnsLookupTxtConstMeta =>
const TaskConstMeta(
debugName: "dns_lookup_txt",
argNames: ["host"],
);
@override
Future<RustHttpResponse> crateApiHttpApiFetch(
{required MyMethod method,
required String url,
Map<String, String>? headers,
Uint8List? inputData,
String? withIpAddress}) {
Uint8List? inputData}) {
return handler.executeNormal(NormalTask(
callFfi: (port_) {
var arg0 = cst_encode_my_method(method);
var arg1 = cst_encode_String(url);
var arg2 = cst_encode_opt_Map_String_String(headers);
var arg3 = cst_encode_opt_list_prim_u_8_strict(inputData);
var arg4 = cst_encode_opt_String(withIpAddress);
return wire.wire__crate__api__http_api__fetch(
port_, arg0, arg1, arg2, arg3, arg4);
port_, arg0, arg1, arg2, arg3);
},
codec: DcoCodec(
decodeSuccessData: dco_decode_rust_http_response,
decodeErrorData: dco_decode_AnyhowException,
),
constMeta: kCrateApiHttpApiFetchConstMeta,
argValues: [method, url, headers, inputData, withIpAddress],
argValues: [method, url, headers, inputData],
apiImpl: this,
));
}
TaskConstMeta get kCrateApiHttpApiFetchConstMeta => const TaskConstMeta(
debugName: "fetch",
argNames: ["method", "url", "headers", "inputData", "withIpAddress"],
argNames: ["method", "url", "headers", "inputData"],
);
@override
@ -278,113 +150,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
argNames: ["headers"],
);
@override
Stream<RsProcessStreamData> crateApiRsProcessStart(
{required String executable,
required List<String> arguments,
required String workingDirectory}) {
final streamSink = RustStreamSink<RsProcessStreamData>();
unawaited(handler.executeNormal(NormalTask(
callFfi: (port_) {
var arg0 = cst_encode_String(executable);
var arg1 = cst_encode_list_String(arguments);
var arg2 = cst_encode_String(workingDirectory);
var arg3 = cst_encode_StreamSink_rs_process_stream_data_Dco(streamSink);
return wire.wire__crate__api__rs_process__start(
port_, arg0, arg1, arg2, arg3);
},
codec: DcoCodec(
decodeSuccessData: dco_decode_unit,
decodeErrorData: null,
),
constMeta: kCrateApiRsProcessStartConstMeta,
argValues: [executable, arguments, workingDirectory, streamSink],
apiImpl: this,
)));
return streamSink.stream;
}
TaskConstMeta get kCrateApiRsProcessStartConstMeta => const TaskConstMeta(
debugName: "start",
argNames: ["executable", "arguments", "workingDirectory", "streamSink"],
);
@override
Future<void> crateApiRsProcessWrite(
{required int rsPid, required String data}) {
return handler.executeNormal(NormalTask(
callFfi: (port_) {
var arg0 = cst_encode_u_32(rsPid);
var arg1 = cst_encode_String(data);
return wire.wire__crate__api__rs_process__write(port_, arg0, arg1);
},
codec: DcoCodec(
decodeSuccessData: dco_decode_unit,
decodeErrorData: null,
),
constMeta: kCrateApiRsProcessWriteConstMeta,
argValues: [rsPid, data],
apiImpl: this,
));
}
TaskConstMeta get kCrateApiRsProcessWriteConstMeta => const TaskConstMeta(
debugName: "write",
argNames: ["rsPid", "data"],
);
@override
Future<void> crateApiWin32ApiSendNotify(
{String? summary, String? body, String? appName, String? appId}) {
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__crate__api__win32_api__send_notify(
port_, arg0, arg1, arg2, arg3);
},
codec: DcoCodec(
decodeSuccessData: dco_decode_unit,
decodeErrorData: dco_decode_AnyhowException,
),
constMeta: kCrateApiWin32ApiSendNotifyConstMeta,
argValues: [summary, body, appName, appId],
apiImpl: this,
));
}
TaskConstMeta get kCrateApiWin32ApiSendNotifyConstMeta => const TaskConstMeta(
debugName: "send_notify",
argNames: ["summary", "body", "appName", "appId"],
);
@override
Future<bool> crateApiWin32ApiSetForegroundWindow(
{required String windowName}) {
return handler.executeNormal(NormalTask(
callFfi: (port_) {
var arg0 = cst_encode_String(windowName);
return wire.wire__crate__api__win32_api__set_foreground_window(
port_, arg0);
},
codec: DcoCodec(
decodeSuccessData: dco_decode_bool,
decodeErrorData: dco_decode_AnyhowException,
),
constMeta: kCrateApiWin32ApiSetForegroundWindowConstMeta,
argValues: [windowName],
apiImpl: this,
));
}
TaskConstMeta get kCrateApiWin32ApiSetForegroundWindowConstMeta =>
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
@ -398,32 +163,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
.map((e) => MapEntry(e.$1, e.$2)));
}
@protected
RustStreamSink<RsProcessStreamData>
dco_decode_StreamSink_rs_process_stream_data_Dco(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
throw UnimplementedError();
}
@protected
String dco_decode_String(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
return raw as String;
}
@protected
bool dco_decode_bool(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
return raw as bool;
}
@protected
RsiLauncherAsarData dco_decode_box_autoadd_rsi_launcher_asar_data(
dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
return dco_decode_rsi_launcher_asar_data(raw);
}
@protected
BigInt dco_decode_box_autoadd_u_64(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
@ -436,18 +181,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return raw as int;
}
@protected
List<String> dco_decode_list_String(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
return (raw as List<dynamic>).map(dco_decode_String).toList();
}
@protected
List<int> dco_decode_list_prim_u_8_loose(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
return raw as List<int>;
}
@protected
Uint8List dco_decode_list_prim_u_8_strict(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
@ -460,12 +193,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return (raw as List<dynamic>).map(dco_decode_record_string_string).toList();
}
@protected
MyHttpVersion dco_decode_my_http_version(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
return MyHttpVersion.values[raw as int];
}
@protected
MyMethod dco_decode_my_method(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
@ -478,12 +205,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return raw == null ? null : dco_decode_Map_String_String(raw);
}
@protected
String? dco_decode_opt_String(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
return raw == null ? null : dco_decode_String(raw);
}
@protected
BigInt? dco_decode_opt_box_autoadd_u_64(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
@ -509,52 +230,18 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
);
}
@protected
RsProcessStreamData dco_decode_rs_process_stream_data(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
final arr = raw as List<dynamic>;
if (arr.length != 3)
throw Exception('unexpected arr length: expect 3 but see ${arr.length}');
return RsProcessStreamData(
dataType: dco_decode_rs_process_stream_data_type(arr[0]),
data: dco_decode_String(arr[1]),
rsPid: dco_decode_u_32(arr[2]),
);
}
@protected
RsProcessStreamDataType dco_decode_rs_process_stream_data_type(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
return RsProcessStreamDataType.values[raw as int];
}
@protected
RsiLauncherAsarData dco_decode_rsi_launcher_asar_data(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
final arr = raw as List<dynamic>;
if (arr.length != 3)
throw Exception('unexpected arr length: expect 3 but see ${arr.length}');
return RsiLauncherAsarData(
asarPath: dco_decode_String(arr[0]),
mainJsPath: dco_decode_String(arr[1]),
mainJsContent: dco_decode_list_prim_u_8_strict(arr[2]),
);
}
@protected
RustHttpResponse dco_decode_rust_http_response(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
final arr = raw as List<dynamic>;
if (arr.length != 7)
throw Exception('unexpected arr length: expect 7 but see ${arr.length}');
if (arr.length != 5)
throw Exception('unexpected arr length: expect 5 but see ${arr.length}');
return RustHttpResponse(
statusCode: dco_decode_u_16(arr[0]),
headers: dco_decode_Map_String_String(arr[1]),
url: dco_decode_String(arr[2]),
contentLength: dco_decode_opt_box_autoadd_u_64(arr[3]),
version: dco_decode_my_http_version(arr[4]),
remoteAddr: dco_decode_String(arr[5]),
data: dco_decode_opt_list_prim_u_8_strict(arr[6]),
data: dco_decode_opt_list_prim_u_8_strict(arr[4]),
);
}
@ -564,12 +251,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return raw as int;
}
@protected
int dco_decode_u_32(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
return raw as int;
}
@protected
BigInt dco_decode_u_64(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
@ -603,14 +284,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return Map.fromEntries(inner.map((e) => MapEntry(e.$1, e.$2)));
}
@protected
RustStreamSink<RsProcessStreamData>
sse_decode_StreamSink_rs_process_stream_data_Dco(
SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
throw UnimplementedError('Unreachable ()');
}
@protected
String sse_decode_String(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@ -618,19 +291,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return utf8.decoder.convert(inner);
}
@protected
bool sse_decode_bool(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
return deserializer.buffer.getUint8() != 0;
}
@protected
RsiLauncherAsarData sse_decode_box_autoadd_rsi_launcher_asar_data(
SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
return (sse_decode_rsi_launcher_asar_data(deserializer));
}
@protected
BigInt sse_decode_box_autoadd_u_64(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@ -643,25 +303,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return deserializer.buffer.getInt32();
}
@protected
List<String> sse_decode_list_String(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
var len_ = sse_decode_i_32(deserializer);
var ans_ = <String>[];
for (var idx_ = 0; idx_ < len_; ++idx_) {
ans_.add(sse_decode_String(deserializer));
}
return ans_;
}
@protected
List<int> sse_decode_list_prim_u_8_loose(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
var len_ = sse_decode_i_32(deserializer);
return deserializer.buffer.getUint8List(len_);
}
@protected
Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@ -682,13 +323,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return ans_;
}
@protected
MyHttpVersion sse_decode_my_http_version(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
var inner = sse_decode_i_32(deserializer);
return MyHttpVersion.values[inner];
}
@protected
MyMethod sse_decode_my_method(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@ -708,17 +342,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
}
}
@protected
String? sse_decode_opt_String(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
if (sse_decode_bool(deserializer)) {
return (sse_decode_String(deserializer));
} else {
return null;
}
}
@protected
BigInt? sse_decode_opt_box_autoadd_u_64(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@ -750,38 +373,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return (var_field0, var_field1);
}
@protected
RsProcessStreamData sse_decode_rs_process_stream_data(
SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
var var_dataType = sse_decode_rs_process_stream_data_type(deserializer);
var var_data = sse_decode_String(deserializer);
var var_rsPid = sse_decode_u_32(deserializer);
return RsProcessStreamData(
dataType: var_dataType, data: var_data, rsPid: var_rsPid);
}
@protected
RsProcessStreamDataType sse_decode_rs_process_stream_data_type(
SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
var inner = sse_decode_i_32(deserializer);
return RsProcessStreamDataType.values[inner];
}
@protected
RsiLauncherAsarData sse_decode_rsi_launcher_asar_data(
SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
var var_asarPath = sse_decode_String(deserializer);
var var_mainJsPath = sse_decode_String(deserializer);
var var_mainJsContent = sse_decode_list_prim_u_8_strict(deserializer);
return RsiLauncherAsarData(
asarPath: var_asarPath,
mainJsPath: var_mainJsPath,
mainJsContent: var_mainJsContent);
}
@protected
RustHttpResponse sse_decode_rust_http_response(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@ -789,16 +380,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
var var_headers = sse_decode_Map_String_String(deserializer);
var var_url = sse_decode_String(deserializer);
var var_contentLength = sse_decode_opt_box_autoadd_u_64(deserializer);
var var_version = sse_decode_my_http_version(deserializer);
var var_remoteAddr = sse_decode_String(deserializer);
var var_data = sse_decode_opt_list_prim_u_8_strict(deserializer);
return RustHttpResponse(
statusCode: var_statusCode,
headers: var_headers,
url: var_url,
contentLength: var_contentLength,
version: var_version,
remoteAddr: var_remoteAddr,
data: var_data);
}
@ -808,12 +395,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return deserializer.buffer.getUint16();
}
@protected
int sse_decode_u_32(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
return deserializer.buffer.getUint32();
}
@protected
BigInt sse_decode_u_64(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@ -832,9 +413,9 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
}
@protected
bool cst_encode_bool(bool raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
return raw;
bool sse_decode_bool(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
return deserializer.buffer.getUint8() != 0;
}
@protected
@ -843,36 +424,18 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return raw;
}
@protected
int cst_encode_my_http_version(MyHttpVersion raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
return cst_encode_i_32(raw.index);
}
@protected
int cst_encode_my_method(MyMethod raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
return cst_encode_i_32(raw.index);
}
@protected
int cst_encode_rs_process_stream_data_type(RsProcessStreamDataType raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
return cst_encode_i_32(raw.index);
}
@protected
int cst_encode_u_16(int raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
return raw;
}
@protected
int cst_encode_u_32(int raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
return raw;
}
@protected
int cst_encode_u_8(int raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
@ -900,38 +463,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
self.entries.map((e) => (e.key, e.value)).toList(), serializer);
}
@protected
void sse_encode_StreamSink_rs_process_stream_data_Dco(
RustStreamSink<RsProcessStreamData> self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
sse_encode_String(
self.setupAndSerialize(
codec: DcoCodec(
decodeSuccessData: dco_decode_rs_process_stream_data,
decodeErrorData: dco_decode_AnyhowException,
)),
serializer);
}
@protected
void sse_encode_String(String self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
sse_encode_list_prim_u_8_strict(utf8.encoder.convert(self), serializer);
}
@protected
void sse_encode_bool(bool self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
serializer.buffer.putUint8(self ? 1 : 0);
}
@protected
void sse_encode_box_autoadd_rsi_launcher_asar_data(
RsiLauncherAsarData self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
sse_encode_rsi_launcher_asar_data(self, serializer);
}
@protected
void sse_encode_box_autoadd_u_64(BigInt self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@ -944,24 +481,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
serializer.buffer.putInt32(self);
}
@protected
void sse_encode_list_String(List<String> self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
sse_encode_i_32(self.length, serializer);
for (final item in self) {
sse_encode_String(item, serializer);
}
}
@protected
void sse_encode_list_prim_u_8_loose(
List<int> self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
sse_encode_i_32(self.length, serializer);
serializer.buffer
.putUint8List(self is Uint8List ? self : Uint8List.fromList(self));
}
@protected
void sse_encode_list_prim_u_8_strict(
Uint8List self, SseSerializer serializer) {
@ -980,13 +499,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
}
}
@protected
void sse_encode_my_http_version(
MyHttpVersion self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
sse_encode_i_32(self.index, serializer);
}
@protected
void sse_encode_my_method(MyMethod self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@ -1004,16 +516,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
}
}
@protected
void sse_encode_opt_String(String? self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
sse_encode_bool(self != null, serializer);
if (self != null) {
sse_encode_String(self, serializer);
}
}
@protected
void sse_encode_opt_box_autoadd_u_64(BigInt? self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@ -1043,31 +545,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
sse_encode_String(self.$2, serializer);
}
@protected
void sse_encode_rs_process_stream_data(
RsProcessStreamData self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
sse_encode_rs_process_stream_data_type(self.dataType, serializer);
sse_encode_String(self.data, serializer);
sse_encode_u_32(self.rsPid, serializer);
}
@protected
void sse_encode_rs_process_stream_data_type(
RsProcessStreamDataType self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
sse_encode_i_32(self.index, serializer);
}
@protected
void sse_encode_rsi_launcher_asar_data(
RsiLauncherAsarData self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
sse_encode_String(self.asarPath, serializer);
sse_encode_String(self.mainJsPath, serializer);
sse_encode_list_prim_u_8_strict(self.mainJsContent, serializer);
}
@protected
void sse_encode_rust_http_response(
RustHttpResponse self, SseSerializer serializer) {
@ -1076,8 +553,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
sse_encode_Map_String_String(self.headers, serializer);
sse_encode_String(self.url, serializer);
sse_encode_opt_box_autoadd_u_64(self.contentLength, serializer);
sse_encode_my_http_version(self.version, serializer);
sse_encode_String(self.remoteAddr, serializer);
sse_encode_opt_list_prim_u_8_strict(self.data, serializer);
}
@ -1087,12 +562,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
serializer.buffer.putUint16(self);
}
@protected
void sse_encode_u_32(int self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
serializer.buffer.putUint32(self);
}
@protected
void sse_encode_u_64(BigInt self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@ -1109,4 +578,10 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
void sse_encode_unit(void self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
}
@protected
void sse_encode_bool(bool self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
serializer.buffer.putUint8(self ? 1 : 0);
}
}

View File

@ -3,10 +3,7 @@
// 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/asar_api.dart';
import 'api/http_api.dart';
import 'api/rs_process.dart';
import 'api/win32_api.dart';
import 'dart:async';
import 'dart:convert';
import 'dart:ffi' as ffi;
@ -28,50 +25,27 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
Map<String, String> dco_decode_Map_String_String(dynamic raw);
@protected
RustStreamSink<RsProcessStreamData>
dco_decode_StreamSink_rs_process_stream_data_Dco(dynamic raw);
@protected
String dco_decode_String(dynamic raw);
@protected
bool dco_decode_bool(dynamic raw);
@protected
RsiLauncherAsarData dco_decode_box_autoadd_rsi_launcher_asar_data(
dynamic raw);
@protected
BigInt dco_decode_box_autoadd_u_64(dynamic raw);
@protected
int dco_decode_i_32(dynamic raw);
@protected
List<String> dco_decode_list_String(dynamic raw);
@protected
List<int> dco_decode_list_prim_u_8_loose(dynamic raw);
@protected
Uint8List dco_decode_list_prim_u_8_strict(dynamic raw);
@protected
List<(String, String)> dco_decode_list_record_string_string(dynamic raw);
@protected
MyHttpVersion dco_decode_my_http_version(dynamic raw);
@protected
MyMethod dco_decode_my_method(dynamic raw);
@protected
Map<String, String>? dco_decode_opt_Map_String_String(dynamic raw);
@protected
String? dco_decode_opt_String(dynamic raw);
@protected
BigInt? dco_decode_opt_box_autoadd_u_64(dynamic raw);
@ -81,24 +55,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
(String, String) dco_decode_record_string_string(dynamic raw);
@protected
RsProcessStreamData dco_decode_rs_process_stream_data(dynamic raw);
@protected
RsProcessStreamDataType dco_decode_rs_process_stream_data_type(dynamic raw);
@protected
RsiLauncherAsarData dco_decode_rsi_launcher_asar_data(dynamic raw);
@protected
RustHttpResponse dco_decode_rust_http_response(dynamic raw);
@protected
int dco_decode_u_16(dynamic raw);
@protected
int dco_decode_u_32(dynamic raw);
@protected
BigInt dco_decode_u_64(dynamic raw);
@ -115,33 +77,15 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
Map<String, String> sse_decode_Map_String_String(
SseDeserializer deserializer);
@protected
RustStreamSink<RsProcessStreamData>
sse_decode_StreamSink_rs_process_stream_data_Dco(
SseDeserializer deserializer);
@protected
String sse_decode_String(SseDeserializer deserializer);
@protected
bool sse_decode_bool(SseDeserializer deserializer);
@protected
RsiLauncherAsarData sse_decode_box_autoadd_rsi_launcher_asar_data(
SseDeserializer deserializer);
@protected
BigInt sse_decode_box_autoadd_u_64(SseDeserializer deserializer);
@protected
int sse_decode_i_32(SseDeserializer deserializer);
@protected
List<String> sse_decode_list_String(SseDeserializer deserializer);
@protected
List<int> sse_decode_list_prim_u_8_loose(SseDeserializer deserializer);
@protected
Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer);
@ -149,9 +93,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
List<(String, String)> sse_decode_list_record_string_string(
SseDeserializer deserializer);
@protected
MyHttpVersion sse_decode_my_http_version(SseDeserializer deserializer);
@protected
MyMethod sse_decode_my_method(SseDeserializer deserializer);
@ -159,9 +100,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
Map<String, String>? sse_decode_opt_Map_String_String(
SseDeserializer deserializer);
@protected
String? sse_decode_opt_String(SseDeserializer deserializer);
@protected
BigInt? sse_decode_opt_box_autoadd_u_64(SseDeserializer deserializer);
@ -172,27 +110,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
(String, String) sse_decode_record_string_string(
SseDeserializer deserializer);
@protected
RsProcessStreamData sse_decode_rs_process_stream_data(
SseDeserializer deserializer);
@protected
RsProcessStreamDataType sse_decode_rs_process_stream_data_type(
SseDeserializer deserializer);
@protected
RsiLauncherAsarData sse_decode_rsi_launcher_asar_data(
SseDeserializer deserializer);
@protected
RustHttpResponse sse_decode_rust_http_response(SseDeserializer deserializer);
@protected
int sse_decode_u_16(SseDeserializer deserializer);
@protected
int sse_decode_u_32(SseDeserializer deserializer);
@protected
BigInt sse_decode_u_64(SseDeserializer deserializer);
@ -202,6 +125,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
void sse_decode_unit(SseDeserializer deserializer);
@protected
bool sse_decode_bool(SseDeserializer deserializer);
@protected
ffi.Pointer<wire_cst_list_prim_u_8_strict> cst_encode_AnyhowException(
AnyhowException raw) {
@ -217,58 +143,18 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
raw.entries.map((e) => (e.key, e.value)).toList());
}
@protected
ffi.Pointer<wire_cst_list_prim_u_8_strict>
cst_encode_StreamSink_rs_process_stream_data_Dco(
RustStreamSink<RsProcessStreamData> raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
return cst_encode_String(raw.setupAndSerialize(
codec: DcoCodec(
decodeSuccessData: dco_decode_rs_process_stream_data,
decodeErrorData: dco_decode_AnyhowException,
)));
}
@protected
ffi.Pointer<wire_cst_list_prim_u_8_strict> cst_encode_String(String raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
return cst_encode_list_prim_u_8_strict(utf8.encoder.convert(raw));
}
@protected
ffi.Pointer<wire_cst_rsi_launcher_asar_data>
cst_encode_box_autoadd_rsi_launcher_asar_data(RsiLauncherAsarData raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
final ptr = wire.cst_new_box_autoadd_rsi_launcher_asar_data();
cst_api_fill_to_wire_rsi_launcher_asar_data(raw, ptr.ref);
return ptr;
}
@protected
ffi.Pointer<ffi.Uint64> cst_encode_box_autoadd_u_64(BigInt raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
return wire.cst_new_box_autoadd_u_64(cst_encode_u_64(raw));
}
@protected
ffi.Pointer<wire_cst_list_String> cst_encode_list_String(List<String> raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
final ans = wire.cst_new_list_String(raw.length);
for (var i = 0; i < raw.length; ++i) {
ans.ref.ptr[i] = cst_encode_String(raw[i]);
}
return ans;
}
@protected
ffi.Pointer<wire_cst_list_prim_u_8_loose> cst_encode_list_prim_u_8_loose(
List<int> raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
final ans = wire.cst_new_list_prim_u_8_loose(raw.length);
ans.ref.ptr.asTypedList(raw.length).setAll(0, raw);
return ans;
}
@protected
ffi.Pointer<wire_cst_list_prim_u_8_strict> cst_encode_list_prim_u_8_strict(
Uint8List raw) {
@ -296,13 +182,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
return raw == null ? ffi.nullptr : cst_encode_Map_String_String(raw);
}
@protected
ffi.Pointer<wire_cst_list_prim_u_8_strict> cst_encode_opt_String(
String? raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
return raw == null ? ffi.nullptr : cst_encode_String(raw);
}
@protected
ffi.Pointer<ffi.Uint64> cst_encode_opt_box_autoadd_u_64(BigInt? raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
@ -322,13 +201,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
return raw.toSigned(64).toInt();
}
@protected
void cst_api_fill_to_wire_box_autoadd_rsi_launcher_asar_data(
RsiLauncherAsarData apiObj,
ffi.Pointer<wire_cst_rsi_launcher_asar_data> wireObj) {
cst_api_fill_to_wire_rsi_launcher_asar_data(apiObj, wireObj.ref);
}
@protected
void cst_api_fill_to_wire_record_string_string(
(String, String) apiObj, wire_cst_record_string_string wireObj) {
@ -336,23 +208,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
wireObj.field1 = cst_encode_String(apiObj.$2);
}
@protected
void cst_api_fill_to_wire_rs_process_stream_data(
RsProcessStreamData apiObj, wire_cst_rs_process_stream_data wireObj) {
wireObj.data_type = cst_encode_rs_process_stream_data_type(apiObj.dataType);
wireObj.data = cst_encode_String(apiObj.data);
wireObj.rs_pid = cst_encode_u_32(apiObj.rsPid);
}
@protected
void cst_api_fill_to_wire_rsi_launcher_asar_data(
RsiLauncherAsarData apiObj, wire_cst_rsi_launcher_asar_data wireObj) {
wireObj.asar_path = cst_encode_String(apiObj.asarPath);
wireObj.main_js_path = cst_encode_String(apiObj.mainJsPath);
wireObj.main_js_content =
cst_encode_list_prim_u_8_strict(apiObj.mainJsContent);
}
@protected
void cst_api_fill_to_wire_rust_http_response(
RustHttpResponse apiObj, wire_cst_rust_http_response wireObj) {
@ -361,32 +216,18 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
wireObj.url = cst_encode_String(apiObj.url);
wireObj.content_length =
cst_encode_opt_box_autoadd_u_64(apiObj.contentLength);
wireObj.version = cst_encode_my_http_version(apiObj.version);
wireObj.remote_addr = cst_encode_String(apiObj.remoteAddr);
wireObj.data = cst_encode_opt_list_prim_u_8_strict(apiObj.data);
}
@protected
bool cst_encode_bool(bool raw);
@protected
int cst_encode_i_32(int raw);
@protected
int cst_encode_my_http_version(MyHttpVersion raw);
@protected
int cst_encode_my_method(MyMethod raw);
@protected
int cst_encode_rs_process_stream_data_type(RsProcessStreamDataType raw);
@protected
int cst_encode_u_16(int raw);
@protected
int cst_encode_u_32(int raw);
@protected
int cst_encode_u_8(int raw);
@ -401,32 +242,15 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
void sse_encode_Map_String_String(
Map<String, String> self, SseSerializer serializer);
@protected
void sse_encode_StreamSink_rs_process_stream_data_Dco(
RustStreamSink<RsProcessStreamData> self, SseSerializer serializer);
@protected
void sse_encode_String(String self, SseSerializer serializer);
@protected
void sse_encode_bool(bool self, SseSerializer serializer);
@protected
void sse_encode_box_autoadd_rsi_launcher_asar_data(
RsiLauncherAsarData self, SseSerializer serializer);
@protected
void sse_encode_box_autoadd_u_64(BigInt self, SseSerializer serializer);
@protected
void sse_encode_i_32(int self, SseSerializer serializer);
@protected
void sse_encode_list_String(List<String> self, SseSerializer serializer);
@protected
void sse_encode_list_prim_u_8_loose(List<int> self, SseSerializer serializer);
@protected
void sse_encode_list_prim_u_8_strict(
Uint8List self, SseSerializer serializer);
@ -435,9 +259,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
void sse_encode_list_record_string_string(
List<(String, String)> self, SseSerializer serializer);
@protected
void sse_encode_my_http_version(MyHttpVersion self, SseSerializer serializer);
@protected
void sse_encode_my_method(MyMethod self, SseSerializer serializer);
@ -445,9 +266,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
void sse_encode_opt_Map_String_String(
Map<String, String>? self, SseSerializer serializer);
@protected
void sse_encode_opt_String(String? self, SseSerializer serializer);
@protected
void sse_encode_opt_box_autoadd_u_64(BigInt? self, SseSerializer serializer);
@ -459,18 +277,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
void sse_encode_record_string_string(
(String, String) self, SseSerializer serializer);
@protected
void sse_encode_rs_process_stream_data(
RsProcessStreamData self, SseSerializer serializer);
@protected
void sse_encode_rs_process_stream_data_type(
RsProcessStreamDataType self, SseSerializer serializer);
@protected
void sse_encode_rsi_launcher_asar_data(
RsiLauncherAsarData self, SseSerializer serializer);
@protected
void sse_encode_rust_http_response(
RustHttpResponse self, SseSerializer serializer);
@ -478,9 +284,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
void sse_encode_u_16(int self, SseSerializer serializer);
@protected
void sse_encode_u_32(int self, SseSerializer serializer);
@protected
void sse_encode_u_64(BigInt self, SseSerializer serializer);
@ -489,6 +292,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
void sse_encode_unit(void self, SseSerializer serializer);
@protected
void sse_encode_bool(bool self, SseSerializer serializer);
}
// Section: wire_class
@ -532,96 +338,12 @@ class RustLibWire implements BaseWire {
late final _store_dart_post_cobject = _store_dart_post_cobjectPtr
.asFunction<void Function(DartPostCObjectFnType)>();
void wire__crate__api__asar_api__get_rsi_launcher_asar_data(
int port_,
ffi.Pointer<wire_cst_list_prim_u_8_strict> asar_path,
) {
return _wire__crate__api__asar_api__get_rsi_launcher_asar_data(
port_,
asar_path,
);
}
late final _wire__crate__api__asar_api__get_rsi_launcher_asar_dataPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(
ffi.Int64, ffi.Pointer<wire_cst_list_prim_u_8_strict>)>>(
'frbgen_starcitizen_doctor_wire__crate__api__asar_api__get_rsi_launcher_asar_data');
late final _wire__crate__api__asar_api__get_rsi_launcher_asar_data =
_wire__crate__api__asar_api__get_rsi_launcher_asar_dataPtr.asFunction<
void Function(int, ffi.Pointer<wire_cst_list_prim_u_8_strict>)>();
void wire__crate__api__asar_api__rsi_launcher_asar_data_write_main_js(
int port_,
ffi.Pointer<wire_cst_rsi_launcher_asar_data> that,
ffi.Pointer<wire_cst_list_prim_u_8_loose> content,
) {
return _wire__crate__api__asar_api__rsi_launcher_asar_data_write_main_js(
port_,
that,
content,
);
}
late final _wire__crate__api__asar_api__rsi_launcher_asar_data_write_main_jsPtr =
_lookup<
ffi.NativeFunction<
ffi.Void Function(
ffi.Int64,
ffi.Pointer<wire_cst_rsi_launcher_asar_data>,
ffi.Pointer<wire_cst_list_prim_u_8_loose>)>>(
'frbgen_starcitizen_doctor_wire__crate__api__asar_api__rsi_launcher_asar_data_write_main_js');
late final _wire__crate__api__asar_api__rsi_launcher_asar_data_write_main_js =
_wire__crate__api__asar_api__rsi_launcher_asar_data_write_main_jsPtr
.asFunction<
void Function(int, ffi.Pointer<wire_cst_rsi_launcher_asar_data>,
ffi.Pointer<wire_cst_list_prim_u_8_loose>)>();
void wire__crate__api__http_api__dns_lookup_ips(
int port_,
ffi.Pointer<wire_cst_list_prim_u_8_strict> host,
) {
return _wire__crate__api__http_api__dns_lookup_ips(
port_,
host,
);
}
late final _wire__crate__api__http_api__dns_lookup_ipsPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(
ffi.Int64, ffi.Pointer<wire_cst_list_prim_u_8_strict>)>>(
'frbgen_starcitizen_doctor_wire__crate__api__http_api__dns_lookup_ips');
late final _wire__crate__api__http_api__dns_lookup_ips =
_wire__crate__api__http_api__dns_lookup_ipsPtr.asFunction<
void Function(int, ffi.Pointer<wire_cst_list_prim_u_8_strict>)>();
void wire__crate__api__http_api__dns_lookup_txt(
int port_,
ffi.Pointer<wire_cst_list_prim_u_8_strict> host,
) {
return _wire__crate__api__http_api__dns_lookup_txt(
port_,
host,
);
}
late final _wire__crate__api__http_api__dns_lookup_txtPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(
ffi.Int64, ffi.Pointer<wire_cst_list_prim_u_8_strict>)>>(
'frbgen_starcitizen_doctor_wire__crate__api__http_api__dns_lookup_txt');
late final _wire__crate__api__http_api__dns_lookup_txt =
_wire__crate__api__http_api__dns_lookup_txtPtr.asFunction<
void Function(int, ffi.Pointer<wire_cst_list_prim_u_8_strict>)>();
void wire__crate__api__http_api__fetch(
int port_,
int method,
ffi.Pointer<wire_cst_list_prim_u_8_strict> url,
ffi.Pointer<wire_cst_list_record_string_string> headers,
ffi.Pointer<wire_cst_list_prim_u_8_strict> input_data,
ffi.Pointer<wire_cst_list_prim_u_8_strict> with_ip_address,
) {
return _wire__crate__api__http_api__fetch(
port_,
@ -629,7 +351,6 @@ class RustLibWire implements BaseWire {
url,
headers,
input_data,
with_ip_address,
);
}
@ -640,7 +361,6 @@ class RustLibWire implements BaseWire {
ffi.Int32,
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
ffi.Pointer<wire_cst_list_record_string_string>,
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
ffi.Pointer<wire_cst_list_prim_u_8_strict>)>>(
'frbgen_starcitizen_doctor_wire__crate__api__http_api__fetch');
late final _wire__crate__api__http_api__fetch =
@ -650,7 +370,6 @@ class RustLibWire implements BaseWire {
int,
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
ffi.Pointer<wire_cst_list_record_string_string>,
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
ffi.Pointer<wire_cst_list_prim_u_8_strict>)>();
void wire__crate__api__http_api__set_default_header(
@ -673,128 +392,6 @@ class RustLibWire implements BaseWire {
void Function(
int, ffi.Pointer<wire_cst_list_record_string_string>)>();
void wire__crate__api__rs_process__start(
int port_,
ffi.Pointer<wire_cst_list_prim_u_8_strict> executable,
ffi.Pointer<wire_cst_list_String> arguments,
ffi.Pointer<wire_cst_list_prim_u_8_strict> working_directory,
ffi.Pointer<wire_cst_list_prim_u_8_strict> stream_sink,
) {
return _wire__crate__api__rs_process__start(
port_,
executable,
arguments,
working_directory,
stream_sink,
);
}
late final _wire__crate__api__rs_process__startPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(
ffi.Int64,
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
ffi.Pointer<wire_cst_list_String>,
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
ffi.Pointer<wire_cst_list_prim_u_8_strict>)>>(
'frbgen_starcitizen_doctor_wire__crate__api__rs_process__start');
late final _wire__crate__api__rs_process__start =
_wire__crate__api__rs_process__startPtr.asFunction<
void Function(
int,
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
ffi.Pointer<wire_cst_list_String>,
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
ffi.Pointer<wire_cst_list_prim_u_8_strict>)>();
void wire__crate__api__rs_process__write(
int port_,
int rs_pid,
ffi.Pointer<wire_cst_list_prim_u_8_strict> data,
) {
return _wire__crate__api__rs_process__write(
port_,
rs_pid,
data,
);
}
late final _wire__crate__api__rs_process__writePtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(ffi.Int64, ffi.Uint32,
ffi.Pointer<wire_cst_list_prim_u_8_strict>)>>(
'frbgen_starcitizen_doctor_wire__crate__api__rs_process__write');
late final _wire__crate__api__rs_process__write =
_wire__crate__api__rs_process__writePtr.asFunction<
void Function(
int, int, ffi.Pointer<wire_cst_list_prim_u_8_strict>)>();
void wire__crate__api__win32_api__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__crate__api__win32_api__send_notify(
port_,
summary,
body,
app_name,
app_id,
);
}
late final _wire__crate__api__win32_api__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__crate__api__win32_api__send_notify');
late final _wire__crate__api__win32_api__send_notify =
_wire__crate__api__win32_api__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__crate__api__win32_api__set_foreground_window(
int port_,
ffi.Pointer<wire_cst_list_prim_u_8_strict> window_name,
) {
return _wire__crate__api__win32_api__set_foreground_window(
port_,
window_name,
);
}
late final _wire__crate__api__win32_api__set_foreground_windowPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(
ffi.Int64, ffi.Pointer<wire_cst_list_prim_u_8_strict>)>>(
'frbgen_starcitizen_doctor_wire__crate__api__win32_api__set_foreground_window');
late final _wire__crate__api__win32_api__set_foreground_window =
_wire__crate__api__win32_api__set_foreground_windowPtr.asFunction<
void Function(int, ffi.Pointer<wire_cst_list_prim_u_8_strict>)>();
ffi.Pointer<wire_cst_rsi_launcher_asar_data>
cst_new_box_autoadd_rsi_launcher_asar_data() {
return _cst_new_box_autoadd_rsi_launcher_asar_data();
}
late final _cst_new_box_autoadd_rsi_launcher_asar_dataPtr = _lookup<
ffi.NativeFunction<
ffi.Pointer<wire_cst_rsi_launcher_asar_data> Function()>>(
'frbgen_starcitizen_doctor_cst_new_box_autoadd_rsi_launcher_asar_data');
late final _cst_new_box_autoadd_rsi_launcher_asar_data =
_cst_new_box_autoadd_rsi_launcher_asar_dataPtr.asFunction<
ffi.Pointer<wire_cst_rsi_launcher_asar_data> Function()>();
ffi.Pointer<ffi.Uint64> cst_new_box_autoadd_u_64(
int value,
) {
@ -809,36 +406,6 @@ class RustLibWire implements BaseWire {
late final _cst_new_box_autoadd_u_64 = _cst_new_box_autoadd_u_64Ptr
.asFunction<ffi.Pointer<ffi.Uint64> Function(int)>();
ffi.Pointer<wire_cst_list_String> cst_new_list_String(
int len,
) {
return _cst_new_list_String(
len,
);
}
late final _cst_new_list_StringPtr = _lookup<
ffi.NativeFunction<
ffi.Pointer<wire_cst_list_String> Function(
ffi.Int32)>>('frbgen_starcitizen_doctor_cst_new_list_String');
late final _cst_new_list_String = _cst_new_list_StringPtr
.asFunction<ffi.Pointer<wire_cst_list_String> Function(int)>();
ffi.Pointer<wire_cst_list_prim_u_8_loose> cst_new_list_prim_u_8_loose(
int len,
) {
return _cst_new_list_prim_u_8_loose(
len,
);
}
late final _cst_new_list_prim_u_8_loosePtr = _lookup<
ffi.NativeFunction<
ffi.Pointer<wire_cst_list_prim_u_8_loose> Function(ffi.Int32)>>(
'frbgen_starcitizen_doctor_cst_new_list_prim_u_8_loose');
late final _cst_new_list_prim_u_8_loose = _cst_new_list_prim_u_8_loosePtr
.asFunction<ffi.Pointer<wire_cst_list_prim_u_8_loose> Function(int)>();
ffi.Pointer<wire_cst_list_prim_u_8_strict> cst_new_list_prim_u_8_strict(
int len,
) {
@ -899,21 +466,6 @@ final class wire_cst_list_prim_u_8_strict extends ffi.Struct {
external int len;
}
final class wire_cst_rsi_launcher_asar_data extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> asar_path;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> main_js_path;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> main_js_content;
}
final class wire_cst_list_prim_u_8_loose extends ffi.Struct {
external ffi.Pointer<ffi.Uint8> ptr;
@ffi.Int32()
external int len;
}
final class wire_cst_record_string_string extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> field0;
@ -927,23 +479,6 @@ final class wire_cst_list_record_string_string extends ffi.Struct {
external int len;
}
final class wire_cst_list_String extends ffi.Struct {
external ffi.Pointer<ffi.Pointer<wire_cst_list_prim_u_8_strict>> ptr;
@ffi.Int32()
external int len;
}
final class wire_cst_rs_process_stream_data extends ffi.Struct {
@ffi.Int32()
external int data_type;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> data;
@ffi.Uint32()
external int rs_pid;
}
final class wire_cst_rust_http_response extends ffi.Struct {
@ffi.Uint16()
external int status_code;
@ -954,10 +489,5 @@ final class wire_cst_rust_http_response extends ffi.Struct {
external ffi.Pointer<ffi.Uint64> content_length;
@ffi.Int32()
external int version;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> remote_addr;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> data;
}

View File

@ -0,0 +1,316 @@
// This file is automatically generated, so please do not edit it.
// Generated by `flutter_rust_bridge`@ 2.3.0.
// 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
// Static analysis wrongly picks the IO variant, thus ignore this
// ignore_for_file: argument_type_not_assignable
import 'api/http_api.dart';
import 'dart:async';
import 'dart:convert';
import 'frb_generated.dart';
import 'http_package.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated_web.dart';
abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
RustLibApiImplPlatform({
required super.handler,
required super.wire,
required super.generalizedFrbRustBinding,
required super.portManager,
});
@protected
AnyhowException dco_decode_AnyhowException(dynamic raw);
@protected
Map<String, String> dco_decode_Map_String_String(dynamic raw);
@protected
String dco_decode_String(dynamic raw);
@protected
BigInt dco_decode_box_autoadd_u_64(dynamic raw);
@protected
int dco_decode_i_32(dynamic raw);
@protected
Uint8List dco_decode_list_prim_u_8_strict(dynamic raw);
@protected
List<(String, String)> dco_decode_list_record_string_string(dynamic raw);
@protected
MyMethod dco_decode_my_method(dynamic raw);
@protected
Map<String, String>? dco_decode_opt_Map_String_String(dynamic raw);
@protected
BigInt? dco_decode_opt_box_autoadd_u_64(dynamic raw);
@protected
Uint8List? dco_decode_opt_list_prim_u_8_strict(dynamic raw);
@protected
(String, String) dco_decode_record_string_string(dynamic raw);
@protected
RustHttpResponse dco_decode_rust_http_response(dynamic raw);
@protected
int dco_decode_u_16(dynamic raw);
@protected
BigInt dco_decode_u_64(dynamic raw);
@protected
int dco_decode_u_8(dynamic raw);
@protected
void dco_decode_unit(dynamic raw);
@protected
AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer);
@protected
Map<String, String> sse_decode_Map_String_String(
SseDeserializer deserializer);
@protected
String sse_decode_String(SseDeserializer deserializer);
@protected
BigInt sse_decode_box_autoadd_u_64(SseDeserializer deserializer);
@protected
int sse_decode_i_32(SseDeserializer deserializer);
@protected
Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer);
@protected
List<(String, String)> sse_decode_list_record_string_string(
SseDeserializer deserializer);
@protected
MyMethod sse_decode_my_method(SseDeserializer deserializer);
@protected
Map<String, String>? sse_decode_opt_Map_String_String(
SseDeserializer deserializer);
@protected
BigInt? sse_decode_opt_box_autoadd_u_64(SseDeserializer deserializer);
@protected
Uint8List? sse_decode_opt_list_prim_u_8_strict(SseDeserializer deserializer);
@protected
(String, String) sse_decode_record_string_string(
SseDeserializer deserializer);
@protected
RustHttpResponse sse_decode_rust_http_response(SseDeserializer deserializer);
@protected
int sse_decode_u_16(SseDeserializer deserializer);
@protected
BigInt sse_decode_u_64(SseDeserializer deserializer);
@protected
int sse_decode_u_8(SseDeserializer deserializer);
@protected
void sse_decode_unit(SseDeserializer deserializer);
@protected
bool sse_decode_bool(SseDeserializer deserializer);
@protected
String cst_encode_AnyhowException(AnyhowException raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
throw UnimplementedError();
}
@protected
JSAny cst_encode_Map_String_String(Map<String, String> raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
return cst_encode_list_record_string_string(
raw.entries.map((e) => (e.key, e.value)).toList());
}
@protected
String cst_encode_String(String raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
return raw;
}
@protected
JSAny cst_encode_box_autoadd_u_64(BigInt raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
return cst_encode_u_64(raw);
}
@protected
JSAny cst_encode_list_prim_u_8_strict(Uint8List raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
return raw.jsify()!;
}
@protected
JSAny cst_encode_list_record_string_string(List<(String, String)> raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
return raw.map(cst_encode_record_string_string).toList().jsify()!;
}
@protected
JSAny? cst_encode_opt_Map_String_String(Map<String, String>? raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
return raw == null ? null : cst_encode_Map_String_String(raw);
}
@protected
JSAny? cst_encode_opt_box_autoadd_u_64(BigInt? raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
return raw == null ? null : cst_encode_box_autoadd_u_64(raw);
}
@protected
JSAny? cst_encode_opt_list_prim_u_8_strict(Uint8List? raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
return raw == null ? null : cst_encode_list_prim_u_8_strict(raw);
}
@protected
JSAny cst_encode_record_string_string((String, String) raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
return [cst_encode_String(raw.$1), cst_encode_String(raw.$2)].jsify()!;
}
@protected
JSAny cst_encode_rust_http_response(RustHttpResponse raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
return [
cst_encode_u_16(raw.statusCode),
cst_encode_Map_String_String(raw.headers),
cst_encode_String(raw.url),
cst_encode_opt_box_autoadd_u_64(raw.contentLength),
cst_encode_opt_list_prim_u_8_strict(raw.data)
].jsify()!;
}
@protected
JSAny cst_encode_u_64(BigInt raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
return castNativeBigInt(raw);
}
@protected
int cst_encode_i_32(int raw);
@protected
int cst_encode_my_method(MyMethod raw);
@protected
int cst_encode_u_16(int raw);
@protected
int cst_encode_u_8(int raw);
@protected
void cst_encode_unit(void raw);
@protected
void sse_encode_AnyhowException(
AnyhowException self, SseSerializer serializer);
@protected
void sse_encode_Map_String_String(
Map<String, String> self, SseSerializer serializer);
@protected
void sse_encode_String(String self, SseSerializer serializer);
@protected
void sse_encode_box_autoadd_u_64(BigInt self, SseSerializer serializer);
@protected
void sse_encode_i_32(int self, SseSerializer serializer);
@protected
void sse_encode_list_prim_u_8_strict(
Uint8List self, SseSerializer serializer);
@protected
void sse_encode_list_record_string_string(
List<(String, String)> self, SseSerializer serializer);
@protected
void sse_encode_my_method(MyMethod self, SseSerializer serializer);
@protected
void sse_encode_opt_Map_String_String(
Map<String, String>? self, SseSerializer serializer);
@protected
void sse_encode_opt_box_autoadd_u_64(BigInt? self, SseSerializer serializer);
@protected
void sse_encode_opt_list_prim_u_8_strict(
Uint8List? self, SseSerializer serializer);
@protected
void sse_encode_record_string_string(
(String, String) self, SseSerializer serializer);
@protected
void sse_encode_rust_http_response(
RustHttpResponse self, SseSerializer serializer);
@protected
void sse_encode_u_16(int self, SseSerializer serializer);
@protected
void sse_encode_u_64(BigInt self, SseSerializer serializer);
@protected
void sse_encode_u_8(int self, SseSerializer serializer);
@protected
void sse_encode_unit(void self, SseSerializer serializer);
@protected
void sse_encode_bool(bool self, SseSerializer serializer);
}
// Section: wire_class
class RustLibWire implements BaseWire {
RustLibWire.fromExternalLibrary(ExternalLibrary lib);
void wire__crate__api__http_api__fetch(NativePortType port_, int method,
String url, JSAny? headers, JSAny? input_data) =>
wasmModule.wire__crate__api__http_api__fetch(
port_, method, url, headers, input_data);
void wire__crate__api__http_api__set_default_header(
NativePortType port_, JSAny headers) =>
wasmModule.wire__crate__api__http_api__set_default_header(port_, headers);
}
@JS('wasm_bindgen')
external RustLibWasmModule get wasmModule;
@JS()
@anonymous
extension type RustLibWasmModule._(JSObject _) implements JSObject {
external void wire__crate__api__http_api__fetch(NativePortType port_,
int method, String url, JSAny? headers, JSAny? input_data);
external void wire__crate__api__http_api__set_default_header(
NativePortType port_, JSAny headers);
}

View File

@ -6,23 +6,11 @@
import 'frb_generated.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
enum MyHttpVersion {
http09,
http10,
http11,
http2,
http3,
httpUnknown,
;
}
class RustHttpResponse {
final int statusCode;
final Map<String, String> headers;
final String url;
final BigInt? contentLength;
final MyHttpVersion version;
final String remoteAddr;
final Uint8List? data;
const RustHttpResponse({
@ -30,8 +18,6 @@ class RustHttpResponse {
required this.headers,
required this.url,
this.contentLength,
required this.version,
required this.remoteAddr,
this.data,
});
@ -41,8 +27,6 @@ class RustHttpResponse {
headers.hashCode ^
url.hashCode ^
contentLength.hashCode ^
version.hashCode ^
remoteAddr.hashCode ^
data.hashCode;
@override
@ -54,7 +38,5 @@ class RustHttpResponse {
headers == other.headers &&
url == other.url &&
contentLength == other.contentLength &&
version == other.version &&
remoteAddr == other.remoteAddr &&
data == other.data;
}