fix a bug in serial key parsing
This commit is contained in:
parent
95e6ef4753
commit
a2d4db076d
@ -1,3 +1,6 @@
|
||||
## 0.2.4 (2017-03-23)
|
||||
- fix a bug in serial key parsing
|
||||
|
||||
## 0.2.3 (2017-03-23)
|
||||
- correctly parse serial keys (closes #8)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "gog-sync"
|
||||
version = "0.2.3"
|
||||
version = "0.2.4"
|
||||
authors = ["Sebastian Hugentobler <sebastian@vanwa.ch>"]
|
||||
description = "Synchronizes a GOG library with a local folder."
|
||||
documentation = "https://docs.rs/crate/gog-sync"
|
||||
|
12
src/gog.rs
12
src/gog.rs
@ -343,22 +343,22 @@ impl<'a> Gog<'a> {
|
||||
let mut raw_cd_keys_fix = raw_cd_keys.to_owned();
|
||||
|
||||
if raw_cd_keys_fix.contains("<span>") {
|
||||
raw_cd_keys_fix = raw_cd_keys_fix.replace("</span><span>", "<br>")
|
||||
raw_cd_keys_fix = raw_cd_keys_fix.replace("</span><span>", ":")
|
||||
.replace("<span>", "")
|
||||
.replace("</span>", "");
|
||||
}
|
||||
|
||||
if raw_cd_keys_fix.contains("<br>") {
|
||||
let splitted_keys = raw_cd_keys_fix.split("<br>");
|
||||
raw_cd_keys_fix = raw_cd_keys_fix.replace("<br>", ":").replace("::", ":");
|
||||
|
||||
if raw_cd_keys_fix.contains(":") {
|
||||
let splitted_keys = raw_cd_keys_fix.split(":");
|
||||
|
||||
let mut key_names: Vec<String> = Vec::new();
|
||||
let mut key_values: Vec<String> = Vec::new();
|
||||
|
||||
for (token_index, token) in splitted_keys.enumerate() {
|
||||
if token_index % 2 == 0 {
|
||||
let mut key_name = token.to_owned();
|
||||
key_name.truncate(token.len() - 1);
|
||||
key_names.push(key_name);
|
||||
key_names.push(token.to_owned());
|
||||
} else {
|
||||
key_values.push(token.trim().to_owned());
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ fn main() {
|
||||
env_logger::init().unwrap();
|
||||
|
||||
let matches = App::new("Gog Synchronizer")
|
||||
.version("0.2.3")
|
||||
.version("0.2.4")
|
||||
.author("Sebastian Hugentobler <sebastian@vanwa.ch>")
|
||||
.about("Synchronizes your gog library to a local folder.")
|
||||
.arg(Arg::with_name("game-storage")
|
||||
|
Loading…
Reference in New Issue
Block a user