20 releases
new 0.3.9 | Nov 17, 2024 |
---|---|
0.3.8 | Oct 17, 2024 |
0.3.3 | Sep 29, 2024 |
0.2.6 | Sep 15, 2024 |
0.1.1 | Aug 20, 2024 |
#177 in Games
85 downloads per month
75KB
1K
SLoC
Rocket League Hours Tracker
This was made specifically for the Epic Games version of Rocket League as the Epic Games launcher has no way of showing the past two hours played in the same way that steam is able to.
However, this program can and should still work with the steam version of the game.
It is HIGHLY
recommended to not manually alter the files that are created by this program
otherwise it could lead to unwanted behaviour by the program
println!("You got it Oneil :)");
Installing the program
- You can find the latest installer for the program in Releases section.
- After downloading the installer, run the installer
- You may get a windows popup warning after opening the installer, but you can press 'more info' and select 'Run anyway' in order to run the installer.
- After the program is installed, you should be able to run the program via the desktop shortcut.
lib.rs
:
Rocket League Hours Tracker
This was made specifically for the Epic Games version of Rocket League as the Epic Games launcher has no way of showing the past two hours played in the same way that steam is able to.
However, this program can and should still work with the steam version of the game.
It is HIGHLY
recommended to not manually alter the files that are created by this program
otherwise it could lead to unwanted behaviour by the program
println!("You got it Oneil :)");
Library
The Rocket League Hours Tracker library contains modules which provide additional
functionality to the Rocket League Hours Tracker binary. This library currently
implements the website_files
module, which provides the functionality to generate
the Html, CSS, and JavaScript for the Rocket League Hours Tracker website, and the update
module, which is the built in updater for the binary which retrieves the update from the GitHub
repository.
The website functionality takes adavantage of the build_html
library, which allows us
to generate the Html for the website, alongside the webbrowser
library, which allows us
to open the website in a browser.
The update module only operates when using the installed version of the program which can be found in the
releases section on the GitHub repository. This
module uses the reqwest
crate to make HTTP requests to the rl-hours-tracker repository in order to retrieve
the new update from the releases section. This module has the functionality to check for any new updates, update
the program, and clean up any additional files made during the update.
Use Case
Within the website_files
module, there is a public function website_files::generate_website_files
,
which writes the files for the website in the website directory in RlHoursFolder
. This function accepts a
bool
value, which determines whether the option to open the website in a browser should appear when this
function is called.
use rl_hours_tracker::website_files;
// This will generate the website files and prompt you with the option to open the
// webstie in a browser.
website_files::generate_website_files(true);
// This will also generate the website but will not prompt the user to open the website
// in a browser.
website_files::generate_website_files(false);
The update
module has two public asynchronous functions available: update::check_for_update
and update::update
.
The update::check_for_update
function is responsible for sending a HTTP request to the repository and checking the version
number of the latest release, and comparing it to the current version of the program. The update::update
function is responsible
updating the program by sending a HTTP request to the repository to retrieve the update zip from the latest release, and unzipping the
zip files contents to replace the old program files with the newest version.
use rl_hours_tracker::update;
use tokio::runtime::Runtime;
// This creates a tokio runtime instance for running our function
let rt = Runtime::new().unwrap();
// This runs our asynchronous function which checks for an update
rt.block_on(update::check_for_update())?;
The update::check_for_update
function does use the update::update
function when it finds that there is a new release on the GitHub, however
the update function can be used by itself in a different context if needed.
use rl_hours_tracker::update;
use tokio::runtime::Runtime;
// This creates a tokio runtime instance for running our function
let rt = Runtime::new().unwrap();
// This runs our asynchronous function which updates the program
rt.block_on(update::update())?;
Dependencies
~13–27MB
~371K SLoC