Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3bd05ba8dd | |||
| ff311475dc | |||
| 8e61c8a2f2 | |||
| 97cdf4829a | |||
| 7244c24fe4 | |||
| fbc4c747a5 | |||
| 7f1a6c6bc1 | |||
| 856cffd740 | |||
| 9468194718 | |||
| 69f67d303e | |||
| 6d05440d98 | |||
| 686d24f7b5 | |||
| 972c310673 | |||
| 90b703ee30 | |||
| 38c975b44c | |||
| 762d96baee | |||
| 81e8eaad0f | |||
| 84d206a87b | |||
| e59c25af25 | |||
| cf75410860 | |||
| 35828e4b5b | |||
| bac49bc766 | |||
| 9564c70a33 | |||
| c9e9cbc66d | |||
| 88f8ca7031 | |||
| 721e08cfc6 | |||
| d6e3a7133b | |||
| 9e90a18c6a |
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "town-of-us-updater"
|
name = "town-of-us-updater"
|
||||||
version = "1.0.0"
|
version = "4.0.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
build = "src/build.rs"
|
build = "src/build.rs"
|
||||||
|
|
||||||
@@ -12,10 +12,13 @@ regex = "1.5"
|
|||||||
fs_extra = "1.2.0"
|
fs_extra = "1.2.0"
|
||||||
dirs = "4.0.0"
|
dirs = "4.0.0"
|
||||||
reqwest = {version = "0.11.11", features = ["blocking"]}
|
reqwest = {version = "0.11.11", features = ["blocking"]}
|
||||||
iui = "0.3.0"
|
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
md-5 = "0.10.5"
|
||||||
tokio = {version="1", features=["full"]}
|
tokio = {version="1", features=["full"]}
|
||||||
druid = "0.7.0"
|
registry = "1"
|
||||||
|
egui = "0.20.1"
|
||||||
|
eframe = "0.20.1"
|
||||||
|
rfd = "0.10"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
embed-resource = "1.6"
|
embed-resource = "1.6"
|
||||||
|
|||||||
21
README.md
21
README.md
@@ -1,2 +1,21 @@
|
|||||||
# town-of-us-updater
|
# Town of Us Updater
|
||||||
|
|
||||||
|
A tool to automatically install the **Town of Us R** mod for **Among Us**.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Caches old builds to allow you to continue playing the mod in case of a breaking Among Us update
|
||||||
|
- GUI to select which build to play
|
||||||
|
- Auto-detection of Among Us install directory
|
||||||
|
- Auto-launch of BetterCrewLink if installed
|
||||||
|
|
||||||
|
# Contributing
|
||||||
|
|
||||||
|
Help. I have no standards. Just look at the code.
|
||||||
|
|
||||||
|
## How to Build
|
||||||
|
|
||||||
|
- [Install Rust](https://www.rust-lang.org/learn/get-started)
|
||||||
|
- Download repository
|
||||||
|
- Navigate to repository
|
||||||
|
- `cargo build`
|
||||||
91
src/among_us_version.rs
Normal file
91
src/among_us_version.rs
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
use std::fmt;
|
||||||
|
|
||||||
|
#[derive(Ord, PartialOrd, Eq, PartialEq, Clone, Debug)]
|
||||||
|
pub struct AmongUsVersion {
|
||||||
|
year: i32,
|
||||||
|
month: i32,
|
||||||
|
day: i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AmongUsVersion {
|
||||||
|
pub fn as_american_string(&self) -> String {
|
||||||
|
format!("{}-{}-{}", self.month, self.day, self.year)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for AmongUsVersion {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
write!(f, "{}.{}.{}", self.year, self.month, self.day)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for AmongUsVersion {
|
||||||
|
fn default() -> Self {
|
||||||
|
AmongUsVersion {
|
||||||
|
year: 0,
|
||||||
|
month: 0,
|
||||||
|
day: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<&str> for AmongUsVersion {
|
||||||
|
fn from(s: &str) -> AmongUsVersion {
|
||||||
|
// Ignore a prepending "v"
|
||||||
|
let tmp_str = s.replace("v", "");
|
||||||
|
|
||||||
|
let v: Vec<&str> = tmp_str.split('.').collect();
|
||||||
|
|
||||||
|
AmongUsVersion {
|
||||||
|
year: v[0].parse().unwrap(),
|
||||||
|
month: v[1].parse().unwrap(),
|
||||||
|
day: v[2].parse().unwrap(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<(i32, i32, i32)> for AmongUsVersion {
|
||||||
|
fn from(s: (i32, i32, i32)) -> AmongUsVersion {
|
||||||
|
AmongUsVersion {
|
||||||
|
year: s.0,
|
||||||
|
month: s.1,
|
||||||
|
day: s.2,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn ordering_test() {
|
||||||
|
let mut vec = Vec::new();
|
||||||
|
vec.push(AmongUsVersion {
|
||||||
|
year: 2019,
|
||||||
|
month: 1,
|
||||||
|
day: 25,
|
||||||
|
});
|
||||||
|
|
||||||
|
vec.push(AmongUsVersion {
|
||||||
|
year: 2022,
|
||||||
|
month: 12,
|
||||||
|
day: 25,
|
||||||
|
});
|
||||||
|
|
||||||
|
vec.push(AmongUsVersion {
|
||||||
|
year: 2022,
|
||||||
|
month: 12,
|
||||||
|
day: 14,
|
||||||
|
});
|
||||||
|
|
||||||
|
vec.push(AmongUsVersion {
|
||||||
|
year: 2022,
|
||||||
|
month: 12,
|
||||||
|
day: 8,
|
||||||
|
});
|
||||||
|
vec.sort();
|
||||||
|
assert_eq!(vec[0].year, 2019);
|
||||||
|
assert_eq!(vec[1].year, 2022);
|
||||||
|
assert_eq!(vec[1].day, 8);
|
||||||
|
assert_eq!(vec[2].year, 2022);
|
||||||
|
assert_eq!(vec[2].day, 14);
|
||||||
|
assert_eq!(vec[3].year, 2022);
|
||||||
|
assert_eq!(vec[3].day, 25);
|
||||||
|
}
|
||||||
955
src/main.rs
955
src/main.rs
File diff suppressed because it is too large
Load Diff
31
src/semver.rs
Normal file
31
src/semver.rs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
//! # SemVer
|
||||||
|
|
||||||
|
//! A simple Semantic Versioning struct to handle comparisons and ordering
|
||||||
|
|
||||||
|
// Uses
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
|
#[derive(Clone, Ord, PartialOrd, Eq, PartialEq, Debug)]
|
||||||
|
pub struct SemVer {
|
||||||
|
pub major: i32,
|
||||||
|
pub minor: i32,
|
||||||
|
pub patch: i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for SemVer {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
write!(f, "{}.{}.{}", self.major, self.minor, self.patch)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<&str> for SemVer {
|
||||||
|
fn from(s: &str) -> SemVer {
|
||||||
|
let v: Vec<&str> = s.split('.').collect();
|
||||||
|
|
||||||
|
SemVer {
|
||||||
|
major: v[0].parse().unwrap(),
|
||||||
|
minor: v[1].parse().unwrap(),
|
||||||
|
patch: v[2].parse().unwrap(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user