|
|
|
@ -3,17 +3,13 @@ use std::fs::File;
|
|
|
|
|
use std::io::Read;
|
|
|
|
|
use base64::engine::{general_purpose::URL_SAFE, Engine};
|
|
|
|
|
use flate2::read::GzDecoder;
|
|
|
|
|
use quick_xml::Reader;
|
|
|
|
|
use quick_xml::{Reader, events::Event};
|
|
|
|
|
|
|
|
|
|
struct User {
|
|
|
|
|
name: String,
|
|
|
|
|
id: Option<u64>,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct InnerLevel; // TODO: write this
|
|
|
|
|
|
|
|
|
|
type Difficulty = u8;
|
|
|
|
|
|
|
|
|
|
enum Song {
|
|
|
|
|
Official{id: i32 /*k8*/},
|
|
|
|
|
Newgrounds{id: i32 /*k45*/},
|
|
|
|
@ -24,6 +20,11 @@ struct Level {
|
|
|
|
|
song: Song,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct OuterLevel {
|
|
|
|
|
name: String, // k2
|
|
|
|
|
inner: String, // k4
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn gd_path() -> PathBuf {
|
|
|
|
|
let mut path_buf = home::home_dir().unwrap();
|
|
|
|
|
#[cfg(unix)]
|
|
|
|
@ -36,7 +37,7 @@ pub fn gd_path() -> PathBuf {
|
|
|
|
|
path_buf
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn load_levels() -> Vec<Level> {
|
|
|
|
|
fn load_levels() -> Vec<OuterLevel> {
|
|
|
|
|
let raw_save_data = {
|
|
|
|
|
let mut save_file = File::open(gd_path().join("CCLocalLevels.dat")).expect("No save file found!");
|
|
|
|
|
let mut sd = Vec::new();
|
|
|
|
@ -53,9 +54,13 @@ fn load_levels() -> Vec<Level> {
|
|
|
|
|
}
|
|
|
|
|
plist
|
|
|
|
|
};
|
|
|
|
|
let reader = Reader::from_str(plist.as_ref());
|
|
|
|
|
let mut reader = Reader::from_str(plist.as_ref());
|
|
|
|
|
let mut out = vec![];
|
|
|
|
|
loop {
|
|
|
|
|
let token = reader.read_event().unwrap();
|
|
|
|
|
match token {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
break out;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|