Skip to content

Commit

Permalink
Inital
Browse files Browse the repository at this point in the history
  • Loading branch information
RealMrCactus committed Nov 16, 2023
1 parent 895d860 commit dc5ba94
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ Cargo.lock

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb


# Added by cargo

/target
9 changes: 9 additions & 0 deletions Cargo.toml
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"
38 changes: 38 additions & 0 deletions src/main.rs
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.");
}
}

0 comments on commit dc5ba94

Please sign in to comment.