Remove comments, simplify

This commit is contained in:
2022-08-29 19:17:47 -07:00
parent c9e9cbc66d
commit 9564c70a33

View File

@@ -202,6 +202,7 @@ async fn main() {
let among_us_version = let among_us_version =
determine_among_us_version(String::from(among_us_folder.to_str().unwrap())).unwrap(); determine_among_us_version(String::from(among_us_folder.to_str().unwrap())).unwrap();
println!("AmongUsVersion: {}", among_us_version);
let ver_url: (String, String, bool) = let ver_url: (String, String, bool) =
determine_town_of_us_url(among_us_version.to_string().clone()) determine_town_of_us_url(among_us_version.to_string().clone())
.await .await
@@ -394,23 +395,6 @@ async fn determine_town_of_us_url(among_us_version: String) -> Option<(String, S
println!("Sanctioned version cannot be determined, installing experimental latest..."); println!("Sanctioned version cannot be determined, installing experimental latest...");
line = markdown.find("[Download]"); line = markdown.find("[Download]");
line_offset = 15; line_offset = 15;
// println!("At this point, there are two options:");
// println!(" [1] Revert Among Us to public-previous in Steam THEN select this option.");
// println!(" [2] Attempt to use the latest version of Town of Us anyway");
// let mut input = String::new();
// io::stdin().read_line(&mut input).unwrap();
// match input.trim() {
// "1" => {
// println!("Re-attempting...");
// return None;
// }
// "2" => {
// println!("Continuing...");
// line = markdown.find("[Download]");
// line_offset = 15;
// }
// _ => return None,
// };
} }
// 100% scientific "-15" here to get the correct version since we find to [Download] above which is after the version number for that line // 100% scientific "-15" here to get the correct version since we find to [Download] above which is after the version number for that line
let splits = markdown.split_at(line.unwrap() - line_offset); let splits = markdown.split_at(line.unwrap() - line_offset);
@@ -461,27 +445,9 @@ fn determine_among_us_version(folder_root: String) -> Option<AmongUsVersion> {
let offset: usize = usize::from(file_bytes[file_index]); let offset: usize = usize::from(file_bytes[file_index]);
file_index += 4; file_index += 4;
// let mut offset = 10; Some(AmongUsVersion::from(
// if file_bytes[file_index + 9] == 0 {
// offset -= 1;
// }
// if file_bytes[file_index + 8] == 0 {
// offset -= 1;
// }
// println!(
// "|{}|",
// str::from_utf8(file_bytes.get(file_index..file_index + offset).unwrap()).unwrap()
// );
let ver = AmongUsVersion::from(
str::from_utf8(file_bytes.get(file_index..file_index + offset).unwrap()).unwrap(), str::from_utf8(file_bytes.get(file_index..file_index + offset).unwrap()).unwrap(),
); ))
println!("AmongUsVersion: {}", ver);
Some(ver)
// Some(String::from(
// str::from_utf8(file_bytes.get(file_index..file_index + offset).unwrap()).unwrap(),
// ))
} }
fn copy_folder_to_target<T: AsRef<Path>>(source: T, dest: T) { fn copy_folder_to_target<T: AsRef<Path>>(source: T, dest: T) {