Initial commit

This commit is contained in:
2024-09-07 16:33:35 +02:00
commit e7d20eb8fa
4 changed files with 75 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
steamcmd

24
download.sh Normal file
View File

@@ -0,0 +1,24 @@
gameId=445220
steamCmdPath=./steamcmd.exe
scriptFile=./steamcmdscript.txt
syncScript=./copyToRimworld.sh
if [ $# -eq 0 ]; then
sh $syncScript
exit 0
fi
rm $scriptFile
echo "@ShutdownOnFailedCommand 0" >> $scriptFile
echo "@NoPromptForPassword 1" >> $scriptFile
#echo "login veendetta2 -[dGFT6e65[@D4XPdJs_q<3(T4LM9K" >> $scriptFile
echo "login anonymous" >> $scriptFile
for arg in "$@"; do
echo "workshop_download_item $gameId $arg" >> $scriptFile
done
echo "quit" >> $scriptFile
$steamCmdPath +runscript $scriptFile
#sh $syncScript

3
go.mod Normal file
View File

@@ -0,0 +1,3 @@
module steamcmd-api
go 1.23.0

47
main.go Normal file
View File

@@ -0,0 +1,47 @@
package main
import (
"flag"
"fmt"
"io"
"log"
"os"
"path/filepath"
)
var Error *log.Logger
var Warning *log.Logger
func init() {
log.SetFlags(log.Lmicroseconds | log.Lshortfile)
logger := io.MultiWriter(os.Stdout)
log.SetOutput(logger)
Error = log.New(io.MultiWriter(os.Stderr, os.Stdout),
fmt.Sprintf("%sERROR:%s ", "\033[0;101m", "\033[0m"),
log.Lmicroseconds|log.Lshortfile)
Warning = log.New(io.MultiWriter(os.Stdout),
fmt.Sprintf("%sWarning:%s ", "\033[0;93m", "\033[0m"),
log.Lmicroseconds|log.Lshortfile)
}
func main() {
envfile := flag.String("envfile", ".env", "")
flag.Parse()
env, err := loadEnv(*envfile)
if err != nil {
Error.Printf("Error leading env file: %v", err)
return
}
log.Printf("%#v", env)
}
func loadEnv(fpath string) (map[string]string, error) {
res := make(map[string]string)
fpath = filepath.Clean(fpath)
log.Printf("Trying to open env file at %s", fpath)
return res, nil
}