Esempio n. 1
0
//Execute file located at path on rcon
//TODO: Shouldn't this be in TF2RconWrapper?
func ExecFile(path string, rcon *rcon.TF2RconConnection) error {
	configPath, _ := filepath.Abs("./configs/")
	data, _ := ioutil.ReadFile(configPath + "/" + path)

	lines := strings.Split(string(data), "\n")

	for _, line := range lines {
		rcon.Query(line)
	}
	return nil
}
Esempio n. 2
0
//Execute file located at path on rcon
//TODO: Shouldn't this be in TF2RconWrapper?
func ExecFile(path string, rcon *tf2rcon.TF2RconConnection) error {
	configPath, _ := filepath.Abs("./configs/")
	data, err := ioutil.ReadFile(configPath + "/" + path)
	if err != nil {
		return err
	}

	lines := strings.Split(string(data), "\n")

	for _, line := range lines {
		line = strings.TrimSpace(stripComments(line))
		_, err := rcon.Query(line)
		if err != nil {
			rcon.Reconnect(time.Second * 10)
			if _, err = rcon.Query(line); err != nil {
				continue
			}
		}

	}
	return nil

}