-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
78 additions
and
36 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
mod dat; | ||
mod files; | ||
|
||
pub use dat::{Datafile, Game, Rom}; | ||
pub use files::File; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use std::collections::HashMap; | ||
|
||
use crate::lib::{ | ||
input::{File, Game, Rom}, | ||
verify::VerifiedStatus, | ||
}; | ||
|
||
#[derive(Debug)] | ||
pub struct GameResult<'a> { | ||
roms: HashMap<&'a str, VerifiedStatus<'a>>, | ||
} | ||
|
||
impl<'a> GameResult<'a> { | ||
/// Build a new game result from the specified string. | ||
pub fn new(game: &'a Game) -> GameResult<'a> { | ||
let mut roms = HashMap::with_capacity(game.roms().len()); | ||
for rom in game.roms() { | ||
roms.insert(rom.name(), VerifiedStatus::Missing); | ||
} | ||
|
||
GameResult { roms } | ||
} | ||
|
||
/// Add a file to the given | ||
pub fn add_file(&mut self, file: &'a File, rom: &'a Rom) { | ||
let status = if file.name().unwrap() == rom.name() { | ||
VerifiedStatus::Verified { file } | ||
} else { | ||
VerifiedStatus::MatchNotName { | ||
file: file, | ||
correct_name: rom.name(), | ||
} | ||
}; | ||
|
||
self.roms.insert(rom.name(), status); | ||
} | ||
|
||
pub fn roms(&self) -> &HashMap<&'a str, VerifiedStatus<'a>> { | ||
&self.roms | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
mod game; | ||
mod set; | ||
|
||
pub use game::GameResult; | ||
pub use set::ResultSet; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
use super::files::File; | ||
use crate::lib::input::File; | ||
pub mod hash; | ||
|
||
#[derive(Debug, PartialEq)] | ||
|