modhandler

package
v1.0.0-pr1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2019 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckForUpdates

func CheckForUpdates(install bool) bool

CheckForUpdates compares the installed version with the newest available and optionally downloads it

func DownloadModWithDependencies

func DownloadModWithDependencies(modID string, version string) (bool, int)

DownloadModWithDependencies downloads the mod and its dependencies

func GetDependencies

func GetDependencies(modID string, modVersion string) map[string]string

GetDependencies returns the non optional dependencies of a mod

func GetDownloadedModVersionWithConstraint

func GetDownloadedModVersionWithConstraint(modID string, versionConstraint string) string

GetDownloadedModVersionWithConstraint returns the latest downloaded version that meets the constraint

func GetDownloadedModVersions

func GetDownloadedModVersions(modID string) ([]string, error)

GetDownloadedModVersions Returns the downloaded versions of the mod

func GetInstalledModVersionWithConstraint

func GetInstalledModVersionWithConstraint(modID string, versionConstraint string, smlPath string) string

GetInstalledModVersionWithConstraint returns the latest installed version that meets the constraint

func GetLatestDownloadedVersion

func GetLatestDownloadedVersion(modID string) (string, error)

GetLatestDownloadedVersion Returns the latest downloaded version of the mod

func Install

func Install(modID string, modVersion string, smlPath string) bool

Install the mod to the SML path

func InstallModWithDependencies

func InstallModWithDependencies(modID string, version string, smlPath string) bool

InstallModWithDependencies installs the mod and its dependencies

func IsModInstalled

func IsModInstalled(modID string, smlPath string) bool

IsModInstalled checks if a mod is installed

func IsModVersionInstalled

func IsModVersionInstalled(modID string, version string, smlPath string) bool

IsModVersionInstalled checks if a mod is installed

func IsModVersionWithConstraintInstalled

func IsModVersionWithConstraintInstalled(modID string, versionConstraint string, smlPath string) bool

IsModVersionWithConstraintInstalled checks if a mod is installed

func Remove

func Remove(modID string, modVersion string) bool

Remove Removes the mod file from the downloaded mods

func Uninstall

func Uninstall(modID string, modVersion string, smlPath string) bool

Uninstall the mod from the SML path

func Update

func Update(modID string) (bool, int)

Update Tries to update the mod. Returns true if the mod was updated, false if the local file is already up to date

Types

type DataJSON

type DataJSON struct {
	ModID           string            `json:"mod_id"`
	Name            string            `json:"name"`
	Version         string            `json:"version"`
	Description     string            `json:"description"`
	Authors         []string          `json:"authors"`
	Objects         []ModFile         `json:"objects"`
	Dependencies    map[string]string `json:"dependencies"`
	OptDependencies map[string]string `json:"optional_dependencies"`
}

DataJSON contains the data.json information

func GetDataFromZip

func GetDataFromZip(zipFileName string) DataJSON

GetDataFromZip returns the data.json file in the zip

func GetDownloadedMods

func GetDownloadedMods() []DataJSON

GetDownloadedMods returns all mods found in the smlauncher mods dir

func GetInstalledModVersions

func GetInstalledModVersions(modID string, smlPath string) []DataJSON

GetInstalledModVersions returns the data.jsons of the versions of the mod

func GetInstalledMods

func GetInstalledMods(smlPath string) []DataJSON

GetInstalledMods returns all mods found in the sml mods dir

type ModFile

type ModFile struct {
	Path string `json:"path"`
	Type string `json:"type"`
}

ModFile contains the data.json objects information

Jump to

Keyboard shortcuts

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