d2

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModMaphackIdentifier is the identifier we use to look for installs of maphack.
	ModMaphackIdentifier = "BH.dll"

	// ModHDIdentifier is the identifier we use to look for installs of hd mod.
	ModHDIdentifier = "D2HD.dll"
)
View Source
const (
	Name = int(core.Qt__UserRole) + 1<<iota
	D2Path
	RemoteCRC
	LocalCRC
	FileAction
)

Model Roles.

Variables

View Source
var (
	// ErrCRCFileNotFound is used when the file to be hashed didn't exist.
	ErrCRCFileNotFound = errors.New("file not found")
)

Functions

This section is empty.

Types

type Action added in v1.1.0

type Action string

Action is an action performed while patching.

const (
	ActionDownload Action = "download"
	ActionDelete   Action = "delete"
)

Allowed actions.

type File added in v1.1.0

type File struct {
	core.QObject
	Name       string
	D2Path     string
	RemoteCRC  string
	LocalCRC   string
	FileAction string
}

File ...

type FileModel added in v1.1.0

type FileModel struct {
	core.QAbstractListModel
	// contains filtered or unexported fields
}

FileModel represents a patch file.

type Manifest

type Manifest struct {
	Files []PatchFile `json:"files"`
}

Manifest represents the current patch.

type PatchAction added in v1.1.0

type PatchAction struct {
	Action   Action
	File     PatchFile
	D2Path   string
	LocalCRC string
}

PatchAction is performed while patching.

type PatchFile

type PatchFile struct {
	Name          string    `json:"name"`
	CRC           string    `json:"crc"`
	LastModified  time.Time `json:"last_modified"`
	ContentLength int64     `json:"content_length"`
	IgnoreCRC     bool      `json:"ignore_crc"`
	Deprecated    bool      `json:"deprecated"`
}

PatchFile represents a file that should be patched.

type PatchState

type PatchState struct {
	Message string
	Error   error
}

PatchState represents the state given on every patch cycle.

type Service

type Service interface {
	// Exec is responsible for executing the Diablo II game.
	Exec() error

	// ValidateGameVersions will make sure the game is up to date with expected patch.
	ValidateGameVersions() (bool, error)

	// Patch will patch Diablo II to the correct version.
	Patch(done chan bool) (<-chan float32, <-chan PatchState)

	// ApplyDEP will apply Windows specific fix for DEP.
	ApplyDEP(path string) error

	// SetLaunchDelay is responsible for setting the delay between each game launch.
	SetLaunchDelay(delay int) error
}

Service is responsible for all things related to the Slashdiablo ladder.

func NewService

func NewService(
	slashdiabloClient slashdiablo.Client,
	configuration config.Service,
	logger log.Logger,
	patchFileModel *FileModel,
) Service

NewService returns a service with all the dependencies.

type WriteCounter

type WriteCounter struct {
	Total   float32
	Written float32
	// contains filtered or unexported fields
}

WriteCounter counts the number of bytes written to it. It implements to the io.Writer interface and we can pass this into io.TeeReader() which will report progress on each write cycle.

func (*WriteCounter) Write

func (wc *WriteCounter) Write(p []byte) (int, error)

Write gets every write cycle reported on it.

Jump to

Keyboard shortcuts

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