Added support for 1.1.0 core library

This commit is contained in:
Observer KRypt0n_ 2022-09-18 15:24:31 +02:00
parent 7af63ae7f2
commit 6fd220e633
No known key found for this signature in database
GPG key ID: 844DA47BA25FE1E2
6 changed files with 16 additions and 12 deletions

2
Cargo.lock generated
View file

@ -31,7 +31,7 @@ dependencies = [
[[package]] [[package]]
name = "anime-game-core" name = "anime-game-core"
version = "1.0.3" version = "1.1.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bzip2", "bzip2",

@ -1 +1 @@
Subproject commit a32856db7dcb66f5d61ceab20e3bf3716b9ed6fa Subproject commit 6adbca88936bcb16d10063fe58688cc7b10813b2

View file

@ -1,6 +1,8 @@
use gtk4::{self as gtk, prelude::*}; use gtk4::{self as gtk, prelude::*};
use libadwaita::{self as adw, prelude::*}; use libadwaita::{self as adw, prelude::*};
use std::path::PathBuf;
use anime_game_core::genshin::voice_data::package::VoicePackage; use anime_game_core::genshin::voice_data::package::VoicePackage;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
@ -31,7 +33,7 @@ impl VoiceoverRow {
} }
} }
pub fn update_state<T: ToString>(&self, game_path: T) { pub fn update_state<T: Into<PathBuf>>(&self, game_path: T) {
if self.is_downloaded(game_path) { if self.is_downloaded(game_path) {
self.button.set_icon_name("user-trash-symbolic"); self.button.set_icon_name("user-trash-symbolic");
} }
@ -41,7 +43,7 @@ impl VoiceoverRow {
} }
} }
pub fn is_downloaded<T: ToString>(&self, game_path: T) -> bool { pub fn is_downloaded<T: Into<PathBuf>>(&self, game_path: T) -> bool {
self.package.is_installed_in(game_path) self.package.is_installed_in(game_path)
} }
} }

View file

@ -7,6 +7,7 @@ use gtk::glib::clone;
use std::rc::Rc; use std::rc::Rc;
use std::cell::Cell; use std::cell::Cell;
use std::process::Command; use std::process::Command;
use std::path::PathBuf;
use anime_game_core::prelude::*; use anime_game_core::prelude::*;
@ -261,7 +262,7 @@ impl App {
match Installer::new(&wine_version_copy.uri) { match Installer::new(&wine_version_copy.uri) {
Ok(mut installer) => { Ok(mut installer) => {
if let Some(temp_folder) = config.launcher.temp { if let Some(temp_folder) = config.launcher.temp {
installer.temp_folder = temp_folder; installer.temp_folder = PathBuf::from(temp_folder);
} }
installer.downloader installer.downloader
@ -326,7 +327,7 @@ impl App {
match Installer::new(&dxvk_version.uri) { match Installer::new(&dxvk_version.uri) {
Ok(mut installer) => { Ok(mut installer) => {
if let Some(temp_folder) = config.launcher.temp { if let Some(temp_folder) = config.launcher.temp {
installer.temp_folder = temp_folder; installer.temp_folder = PathBuf::from(temp_folder);
} }
installer.downloader installer.downloader

View file

@ -8,6 +8,7 @@ use std::rc::Rc;
use std::cell::Cell; use std::cell::Cell;
use std::io::Error; use std::io::Error;
use std::process::{Command, Stdio}; use std::process::{Command, Stdio};
use std::path::PathBuf;
use wait_not_await::Await; use wait_not_await::Await;
@ -435,7 +436,7 @@ impl App {
match Installer::new(wine.uri) { match Installer::new(wine.uri) {
Ok(mut installer) => { Ok(mut installer) => {
if let Some(temp_folder) = config.launcher.temp { if let Some(temp_folder) = config.launcher.temp {
installer.temp_folder = temp_folder; installer.temp_folder = PathBuf::from(temp_folder);
} }
installer.downloader installer.downloader
@ -694,7 +695,7 @@ impl App {
println!("Found broken files:"); println!("Found broken files:");
for file in &broken { for file in &broken {
println!(" - {}", file.path); println!(" - {:?}", file.path);
} }
let total = broken.len() as f64; let total = broken.len() as f64;
@ -706,9 +707,9 @@ impl App {
println!("Patch status: {}", is_patch_applied); println!("Patch status: {}", is_patch_applied);
fn should_ignore(path: &str) -> bool { fn should_ignore(path: &PathBuf) -> bool {
for part in ["UnityPlayer.dll", "xlua.dll", "crashreport.exe", "upload_crash.exe", "vulkan-1.dll"] { for part in ["UnityPlayer.dll", "xlua.dll", "crashreport.exe", "upload_crash.exe", "vulkan-1.dll"] {
if path.contains(part) { if path.to_string_lossy().contains(part) {
return true; return true;
} }
} }

View file

@ -2,7 +2,7 @@ use gtk4::{self as gtk, prelude::*};
use gtk::glib; use gtk::glib;
use std::path::Path; use std::path::{Path, PathBuf};
use anime_game_core::prelude::*; use anime_game_core::prelude::*;
use wait_not_await::Await; use wait_not_await::Await;
@ -83,7 +83,7 @@ pub trait DownloadComponent {
let mut installer = Installer::new(self.get_download_uri())?; let mut installer = Installer::new(self.get_download_uri())?;
if let Some(temp_folder) = config.launcher.temp { if let Some(temp_folder) = config.launcher.temp {
installer.temp_folder = temp_folder; installer.temp_folder = PathBuf::from(temp_folder);
} }
installer.downloader installer.downloader