mirror of
https://github.com/StarCitizenToolBox/app.git
synced 2026-02-06 15:10:20 +00:00
feat: downloader update
This commit is contained in:
@@ -86,6 +86,7 @@ Future<void> downloaderResume({required BigInt taskId}) =>
|
||||
RustLib.instance.api.crateApiDownloaderApiDownloaderResume(taskId: taskId);
|
||||
|
||||
/// Remove a download task
|
||||
/// Handles both active tasks (task_id < 10000) and cached completed tasks (task_id >= 10000)
|
||||
Future<void> downloaderRemove({
|
||||
required BigInt taskId,
|
||||
required bool deleteFiles,
|
||||
@@ -100,7 +101,7 @@ Future<DownloadTaskInfo> downloaderGetTaskInfo({required BigInt taskId}) =>
|
||||
taskId: taskId,
|
||||
);
|
||||
|
||||
/// Get all tasks
|
||||
/// Get all tasks (includes both active and completed tasks from cache)
|
||||
Future<List<DownloadTaskInfo>> downloaderGetAllTasks() =>
|
||||
RustLib.instance.api.crateApiDownloaderApiDownloaderGetAllTasks();
|
||||
|
||||
@@ -109,10 +110,17 @@ Future<DownloadGlobalStat> downloaderGetGlobalStats() =>
|
||||
RustLib.instance.api.crateApiDownloaderApiDownloaderGetGlobalStats();
|
||||
|
||||
/// Check if a task with given name exists
|
||||
Future<bool> downloaderIsNameInTask({required String name}) => RustLib
|
||||
.instance
|
||||
.api
|
||||
.crateApiDownloaderApiDownloaderIsNameInTask(name: name);
|
||||
///
|
||||
/// Parameters:
|
||||
/// - name: Task name to search for
|
||||
/// - downloading_only: If true, only search in active/waiting tasks. If false, include completed tasks (default: true)
|
||||
Future<bool> downloaderIsNameInTask({
|
||||
required String name,
|
||||
bool? downloadingOnly,
|
||||
}) => RustLib.instance.api.crateApiDownloaderApiDownloaderIsNameInTask(
|
||||
name: name,
|
||||
downloadingOnly: downloadingOnly,
|
||||
);
|
||||
|
||||
/// Pause all tasks
|
||||
Future<void> downloaderPauseAll() =>
|
||||
|
||||
@@ -148,6 +148,7 @@ abstract class RustLibApi extends BaseApi {
|
||||
|
||||
Future<bool> crateApiDownloaderApiDownloaderIsNameInTask({
|
||||
required String name,
|
||||
bool? downloadingOnly,
|
||||
});
|
||||
|
||||
Future<void> crateApiDownloaderApiDownloaderPause({required BigInt taskId});
|
||||
@@ -912,15 +913,18 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
@override
|
||||
Future<bool> crateApiDownloaderApiDownloaderIsNameInTask({
|
||||
required String name,
|
||||
bool? downloadingOnly,
|
||||
}) {
|
||||
return handler.executeNormal(
|
||||
NormalTask(
|
||||
callFfi: (port_) {
|
||||
var arg0 = cst_encode_String(name);
|
||||
var arg1 = cst_encode_opt_box_autoadd_bool(downloadingOnly);
|
||||
return wire
|
||||
.wire__crate__api__downloader_api__downloader_is_name_in_task(
|
||||
port_,
|
||||
arg0,
|
||||
arg1,
|
||||
);
|
||||
},
|
||||
codec: DcoCodec(
|
||||
@@ -928,7 +932,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
decodeErrorData: null,
|
||||
),
|
||||
constMeta: kCrateApiDownloaderApiDownloaderIsNameInTaskConstMeta,
|
||||
argValues: [name],
|
||||
argValues: [name, downloadingOnly],
|
||||
apiImpl: this,
|
||||
),
|
||||
);
|
||||
@@ -937,7 +941,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
TaskConstMeta get kCrateApiDownloaderApiDownloaderIsNameInTaskConstMeta =>
|
||||
const TaskConstMeta(
|
||||
debugName: "downloader_is_name_in_task",
|
||||
argNames: ["name"],
|
||||
argNames: ["name", "downloadingOnly"],
|
||||
);
|
||||
|
||||
@override
|
||||
|
||||
@@ -1494,10 +1494,12 @@ class RustLibWire implements BaseWire {
|
||||
void wire__crate__api__downloader_api__downloader_is_name_in_task(
|
||||
int port_,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict> name,
|
||||
ffi.Pointer<ffi.Bool> downloading_only,
|
||||
) {
|
||||
return _wire__crate__api__downloader_api__downloader_is_name_in_task(
|
||||
port_,
|
||||
name,
|
||||
downloading_only,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1507,6 +1509,7 @@ class RustLibWire implements BaseWire {
|
||||
ffi.Void Function(
|
||||
ffi.Int64,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
|
||||
ffi.Pointer<ffi.Bool>,
|
||||
)
|
||||
>
|
||||
>(
|
||||
@@ -1515,7 +1518,11 @@ class RustLibWire implements BaseWire {
|
||||
late final _wire__crate__api__downloader_api__downloader_is_name_in_task =
|
||||
_wire__crate__api__downloader_api__downloader_is_name_in_taskPtr
|
||||
.asFunction<
|
||||
void Function(int, ffi.Pointer<wire_cst_list_prim_u_8_strict>)
|
||||
void Function(
|
||||
int,
|
||||
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
|
||||
ffi.Pointer<ffi.Bool>,
|
||||
)
|
||||
>();
|
||||
|
||||
void wire__crate__api__downloader_api__downloader_pause(
|
||||
|
||||
Reference in New Issue
Block a user