chie

package module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2020 License: MIT Imports: 6 Imported by: 0

README

go-chie

chie is a Go port of the chie Node.js library which aims to be more performant and cross-platform. It serves a decryption/encryption library and command-line tool for Cave Story's script file format (TSC).

Getting Started

Get the package:

go get -u github.com/jozsefsallai/go-chie

Use it:

package main

import "github.com/jozsefsallai/go-chie"

func main() {
  tsc := chie.NewTSCParser()

  err := tsc.FromFile("./Ballo1.tsc")
  if err != nil {
    panic(err)
  }

  err = tsc.Decrypt().ToFile("./Ballo1.txt")
  if err != nil {
    panic(err)
  }
}

Full docs and reference: https://pkg.go.dev/github.com/jozsefsallai/go-chie

CLI

chie also comes with a CLI. You can either grab a release* or install via go get:

go get github.com/jozsefsallai/go-chie/cmd/chie

*) if you do this, you might want to download it somewhere inside your PATH

Usage:

chie tsc decrypt Ballo1.tsc
# will decrypt to output.txt

chie tsc decrypt Ballo1.tsc -o Ballo1.txt
# will decrypt to Ballo1.txt

chie tsc encrypt Ballo1.txt
# will encrypt to output.tsc

chie tsc encrypt Ballo1.txt -o Ballo1.tsc
# will encrypt to Ballo1.tsc

or decrypt/encrypt multiple files at once:

chie tsc decrypt "Stage/*.tsc" -o "Stage/*.txt"
# will decrypt all files with the extension ".tsc" in the Stage folder
# the quotes are necessary

Encrypt while preserving comments:

chie tsc encrypt Ballo1.tsc -o Ballo1.txt --allow-comments
# or
chie tsc encrypt Ballo1.tsc -o Ballo1.txt -c

License

MIT.

Documentation

Overview

Package chie is a powerful encryption/decryption tool for Cave Story's TSC script format

Decryption

tsc := chie.NewTSCParser()

err := tsc.FromFile("Ballo1.tsc")
if err != nil {
	panic(err)
}

err = tsc.Decrypt().ToFile("Ballo1.txt")
if err != nil {
	panic(err)
}

Encryption

tsc := chie.NewTSCParser()

err := tsc.FromFile("Ballo1.txt")
if err != nil {
	panic(err)
}

err = tsc.Encrypt().ToFile("Ballo1.tsc")
if err != nil {
	panic(err)
}

Index

Constants

View Source
const (
	// Encryption is the conversion factor used for encrypting a plaintext string
	// to TSC format (1)
	Encryption = 1

	// Decryption is the conversion factor used for decrypting a TSC file into
	// human-readable text (-1)
	Decryption = -1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type TSC

type TSC struct {
	// contains filtered or unexported fields
}

TSC is a struct that defines a TSC input. It contains the contents of the input, the size of the input, and the output string.

func NewTSCParser

func NewTSCParser() *TSC

NewTSCParser will return a new empty TSC struct

func (*TSC) AllowComments added in v1.0.2

func (tsc *TSC) AllowComments()

AllowComments will ensure that the comments will remain intact in the encrypted TSC file. If this method is not called, the TSC parser will remove all comments, since the base engine doesn't support them.

func (*TSC) Decrypt

func (tsc *TSC) Decrypt() *TSC

Decrypt will decrypt a string from encrypted TSC to human-readable format

func (*TSC) Encrypt

func (tsc *TSC) Encrypt() *TSC

Encrypt will encrypt a plaintext string to TSC that's parseable by the game

func (*TSC) FromFile

func (tsc *TSC) FromFile(path string) error

FromFile will read the input from a given file path

func (*TSC) FromString

func (tsc *TSC) FromString(input string)

FromString will fill the contents property of the TSC struct from the data inside of a given string

func (*TSC) ToFile

func (tsc *TSC) ToFile(path string) error

ToFile will save the output to a given file path

func (*TSC) ToString

func (tsc *TSC) ToString() string

ToString will return the output property of the TSC struct as a string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL