Skip to content

Commit

Permalink
Command that prints all entries in a .toc file #1
Browse files Browse the repository at this point in the history
  • Loading branch information
madsboddum committed Jul 12, 2020
0 parents commit fd2a2ab
Show file tree
Hide file tree
Showing 25 changed files with 960 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Gradle Test

on:
pull_request:
push:

jobs:
test:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Set up JDK 13
uses: actions/setup-java@v1
with:
java-version: 13
- name: Test with Gradle
run: ./gradlew --no-daemon test
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.gradle/
build/
out/
**.zip
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# toc
toc is a command line tool for working with **T**able **o**f **C**ontents files found in the game Star Wars Galaxies.

A toc file describes which tre file contains which files, such as iff, stf...

It's basically a lookup table, hence the name Table of Contents.

## Installation
The tool requires Java SE 13 or newer.

You can download the tool under Releases.

### Globally available in shells
```shell script
$ sudo ln -s /path/to/toc.sh /usr/bin/toc
```

## Examples
Here are some examples of use cases for the tool.

### Searching for a file
We'll search for a file named something along the lines of transport_arriving.snd in sku0_client.toc.
```shell script
$ toc -i sku0_client.toc -p | grep "transport_arriving.snd"
voice/sound/voice_starport_transport_arriving.snd@bottom.tre
```

### Counting amount of entries in a toc file
We want to know how many files are in sku0_client.toc
```shell script
$ toc -i sku0_client.toc -p | wc -l
193475
```
59 changes: 59 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
plugins {
id 'groovy'
id 'application'
}

group 'dk.madsboddum'
version '0.0.1'

repositories {
mavenCentral()
}

dependencies {
compile 'org.codehaus.groovy:groovy-all:3.0.3'

// https://mvnrepository.com/artifact/commons-cli/commons-cli
compile group: 'commons-cli', name: 'commons-cli', version: '1.4'

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.1.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.1.1'
}

test {
useJUnitPlatform()
}

def jarFile = project.name + ".jar"

jar {
// Write app version to version.properties
def properties = new Properties()
properties.setProperty("version", version)
properties.store(new FileOutputStream("src/main/resources/version.properties"), "This file is autogenerated by Gradle")

manifest {
attributes 'Main-Class': 'dk.madsboddum.toc.Application'
}

from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }

archiveFileName.set(jarFile)
}


task distribute(type: Zip) {
dependsOn 'jar'

// Copy the shell script into the libs folder so it'll be included in the zip file
copy {
from file("toc.sh")
into file("$buildDir/libs/")
}

// Create a zip file. Example: toc-0.0.1.zip
from 'build/libs'
include '**/*'
archiveName = project.name + "-" + version + ".zip"
destinationDir(file('.'))
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Loading

0 comments on commit fd2a2ab

Please sign in to comment.