Merge branch 'main' into download-manager

This commit is contained in:
DecDuck
2024-12-09 21:20:44 +11:00
9 changed files with 1104 additions and 537 deletions

View File

@ -205,15 +205,15 @@ impl GameDownloadAgent {
let file = File::create(path.clone()).unwrap();
let mut running_offset = 0;
for (i, length) in chunk.lengths.iter().enumerate() {
for (index, length) in chunk.lengths.iter().enumerate() {
contexts.push(DropDownloadContext {
file_name: raw_path.to_string(),
version: chunk.version_name.to_string(),
offset: running_offset,
index: i,
index,
game_id: game_id.to_string(),
path: path.clone(),
checksum: chunk.checksums[i].clone(),
checksum: chunk.checksums[index].clone(),
length: *length,
});
running_offset += *length as u64;

View File

@ -8,14 +8,18 @@ pub enum DownloadThreadControlFlag {
Stop,
Go,
}
/// Go => true
/// Stop => false
impl From<DownloadThreadControlFlag> for bool {
fn from(value: DownloadThreadControlFlag) -> Self {
match value {
DownloadThreadControlFlag::Stop => false,
DownloadThreadControlFlag::Go => true,
DownloadThreadControlFlag::Stop => false,
}
}
}
/// true => Go
/// false => Stop
impl From<bool> for DownloadThreadControlFlag {
fn from(value: bool) -> Self {
match value {