Skip to content

Commit

Permalink
fix cmds to work with new deserialization
Browse files Browse the repository at this point in the history
  • Loading branch information
cfi2017 committed Sep 11, 2020
1 parent 4abf548 commit 013e503
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cmd/decrypt.go
Expand Up @@ -25,9 +25,9 @@ var DecryptCommand = &cobra.Command{
defer f.Close()
var d []byte
if fileType == "character" {
_, d = character.Decrypt(f)
_, d = character.Decrypt(f, character.PCMagic)
} else if fileType == "profile" {
_, d = profile.Decrypt(f)
_, d = profile.Decrypt(f, profile.PCMagic)
} else {
log.Fatalln("invalid file type")
}
Expand Down
8 changes: 6 additions & 2 deletions cmd/items.go
Expand Up @@ -29,7 +29,11 @@ var ItemsCommand = &cobra.Command{
if err != nil {
cmd.PrintErrf("couldn't open character: %v\n", err)
}
s, c := character.Deserialize(f)
s, c, err := character.Deserialize(f, character.PCMagic)
if err != nil {
cmd.PrintErr(err)
return
}
err = f.Close()
if err != nil {
cmd.PrintErr(err)
Expand Down Expand Up @@ -146,7 +150,7 @@ var ItemsCommand = &cobra.Command{
if err != nil {
cmd.PrintErrf("couldn't create character: %v\n", err)
}
character.Serialize(f, s, c)
character.Serialize(f, s, c, character.PCMagic)
err = f.Close()
if err != nil {
cmd.PrintErr(err)
Expand Down

0 comments on commit 013e503

Please sign in to comment.