core

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2025 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadFile

func DownloadFile(url, filePath string) error

func FindJava

func FindJava() (string, bool)

func RunInstaller

func RunInstaller(installerPath string, loader string, version string, loaderVersion string, Download string, simpfun bool) error

Types

type Config

type Config struct {
	MaxConnections int `json:"maxconnections"`
}

Config 定义配置文件的结构

type InstConfig

type InstConfig struct {
	Version        string `json:"version"`
	Loader         string `json:"loader"`
	LoaderVersion  string `json:"loaderVersion"`
	Download       string `json:"download"`
	MaxConnections int    `json:"maxconnections"`
}

InstConfig 结构体表示 inst.json 的内容

type Library

type Library struct {
	Name      string `json:"name"`
	Downloads struct {
		Artifact struct {
			URL  string `json:"url"`
			Path string `json:"path"`
			SHA1 string `json:"sha1"`
		} `json:"artifact"`
	} `json:"downloads"`
}

Library 定义库的结构

type ProgressReader

type ProgressReader struct {
	Reader         io.ReadCloser
	Total          int64
	Current        int64
	FilePath       string
	UpdateInterval int64 // 更新间隔,单位秒
	// contains filtered or unexported fields
}

ProgressReader 用于跟踪 io.Reader 的进度

func (*ProgressReader) Read

func (pr *ProgressReader) Read(p []byte) (n int, err error)

Read 实现了 io.Reader 接口

type VersionInfo

type VersionInfo struct {
	Libraries []Library `json:"libraries"`
}

VersionInfo 定义 version.json 文件的结构

func ExtractVersionJson

func ExtractVersionJson(jarFilePath string) (VersionInfo, error)

从 JAR 文件中提取 version.json

Jump to

Keyboard shortcuts

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