Skip to content

Commit

Permalink
Add support for RedAlt SteamUp Creator
Browse files Browse the repository at this point in the history
  • Loading branch information
Reddiepoint committed Feb 22, 2024
1 parent 8901c60 commit 4f7bd29
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 10 deletions.
34 changes: 32 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#![windows_subsystem = "windows"]

mod modules;

use std::path::PathBuf;
use eframe::egui::ViewportBuilder;
use crate::modules::app::MultiUpDirect;
use crate::modules::app::{DOCUMENTATION, MultiUpDirect, TabBar};
use crate::modules::upload::UploadType;


fn main() -> Result<(), eframe::Error> {
Expand All @@ -15,9 +18,36 @@ fn main() -> Result<(), eframe::Error> {
..Default::default()
};

let mut app = MultiUpDirect::default();
let args = std::env::args().collect::<Vec<String>>();
if args.len() > 1 {
if args[1] == "--help" {
println!("See {} for help.", DOCUMENTATION);
} else if args[1] == "--upload" {
app.tab_bar = TabBar::Upload;
if args[2] == "disk_upload" {
app.upload_ui.upload_type = UploadType::Disk;
}
for arg in args.into_iter().skip(3) {
let path = PathBuf::from(arg);
if path.is_dir() {
for file in path.read_dir().unwrap().flatten() {
if file.path().is_file() {
app.upload_ui.disk_upload_settings.file_paths.push(file.path());
app.upload_ui.disk_upload_settings.file_names.push(String::new());
}
}
} else if path.is_file() {
app.upload_ui.disk_upload_settings.file_paths.push(path);
app.upload_ui.disk_upload_settings.file_names.push(String::new());
}
}
}
}

eframe::run_native(
"MultiUp Direct",
options,
Box::new(|_cc| Box::<MultiUpDirect>::default()),
Box::new(|_cc| Box::<MultiUpDirect>::new(app)),
)
}
13 changes: 10 additions & 3 deletions src/modules/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ use crate::modules::debrid::DebridUI;
use crate::modules::upload::UploadUI;
use crate::modules::help::HelpUI;


pub const HOMEPAGE: &str = "https://cs.rin.ru/forum/viewtopic.php?f=14&p=2822500#p2822500";

pub const DOCUMENTATION: &str = "https://reddiepoint.github.io/RedAlt-SteamUp-Documentation/using-the-creator.html";



/// Represents a bar containing tabs for each function.
#[derive(Default, PartialEq)]
enum TabBar {
pub enum TabBar {
#[default]
Extract,
Debrid,
Expand All @@ -19,10 +26,10 @@ enum TabBar {
/// Stores the state of each tab.
#[derive(Default)]
pub struct MultiUpDirect {
tab_bar: TabBar,
pub tab_bar: TabBar,
extract_ui: ExtractUI,
debrid_ui: DebridUI,
upload_ui: UploadUI,
pub upload_ui: UploadUI,
help_ui: HelpUI,
}

Expand Down
5 changes: 1 addition & 4 deletions src/modules/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crossbeam_channel::{Receiver, Sender};
use eframe::egui::{Button, Context, ScrollArea, Window};
use self_update::update::Release;
use self_update::version::bump_is_greater;
use crate::modules::app::{DOCUMENTATION, HOMEPAGE};

#[derive(Default)]
pub enum UpdateStatus {
Expand Down Expand Up @@ -60,10 +61,6 @@ impl Default for HelpUI {
}
}


const HOMEPAGE: &str = "https://cs.rin.ru/forum/viewtopic.php?f=14&p=2822500#p2822500";
const DOCUMENTATION: &str = "https://reddiepoint.github.io/RedAlt-SteamUp-Documentation/using-the-creator.html";

impl HelpUI {
pub fn show_help_window(&mut self, ctx: &Context) {
Window::new("Help").open(&mut self.show_help).show(ctx, |ui| ScrollArea::vertical().min_scrolled_height(ui.available_height()).id_source("Help").show(ui, |ui| {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ mod filter;
mod general;
mod help;
mod links;
mod upload;
pub mod upload;

0 comments on commit 4f7bd29

Please sign in to comment.