-
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
1 parent
895d860
commit dc5ba94
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
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,9 @@ | ||
[package] | ||
name = "VTOLVRRecent" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
regex = "1.10.2" |
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,38 @@ | ||
extern crate regex; | ||
use regex::Regex; | ||
use std::fs; | ||
use std::collections::HashSet; | ||
|
||
|
||
fn main() { | ||
let app_data_path = std::env::var("APPDATA").expect("APPDATA not found"); | ||
let relative_path = "\\..\\LocalLow\\Boundless Dynamics, LLC\\VTOLVR\\Player.log"; | ||
let file_path = format!("{}{}", app_data_path, relative_path); | ||
|
||
// Read the file | ||
let text = fs::read_to_string(file_path) | ||
.expect("Something went wrong reading the file"); | ||
|
||
// Regular expression to strictly match player entries | ||
let re = Regex::new(r"(\d+),([\w\d]+),([\w\d]+),(?:[\w\d]+,){3}[\w\d]+;").unwrap(); | ||
|
||
// HashSet to store and check for duplicates (using a tuple of id, name, team) | ||
let mut seen = HashSet::new(); | ||
|
||
// Find all matches and process them | ||
let mut found_any = false; | ||
for cap in re.captures_iter(&text) { | ||
let id = cap[1].to_string(); | ||
let name = cap[2].to_string(); | ||
let team = cap[3].to_string(); | ||
|
||
if seen.insert((id.clone(), name.clone(), team.clone())) { | ||
found_any = true; | ||
println!("ID: {}, Name: {}, Team: {}", id, name, team); | ||
} | ||
} | ||
|
||
if !found_any { | ||
println!("No player data found in the log."); | ||
} | ||
} |