profile

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SharedArchiveProfilePath = "mod-of-us.profile.json"
	SharedArchiveIconPath    = "icon.png"
)
View Source
const SharedProfileVersion = "1"

Variables

This section is empty.

Functions

func EncodeSharedArchive added in v1.5.0

func EncodeSharedArchive(shared SharedProfile, iconPNG []byte) ([]byte, error)

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(storagePath string) (*Manager, error)

func (*Manager) Add

func (m *Manager) Add(p Profile) error

func (*Manager) Get

func (m *Manager) Get(id uuid.UUID) (Profile, bool)

func (*Manager) List

func (m *Manager) List() []Profile

func (*Manager) LoadIconPNG added in v1.4.0

func (m *Manager) LoadIconPNG(id uuid.UUID) ([]byte, error)

func (*Manager) ProfileDir added in v1.5.2

func (m *Manager) ProfileDir(id uuid.UUID) (string, error)

func (*Manager) Remove

func (m *Manager) Remove(id uuid.UUID) error

func (*Manager) RemoveIcon added in v1.4.0

func (m *Manager) RemoveIcon(id uuid.UUID) error

func (*Manager) SaveIconPNG added in v1.4.0

func (m *Manager) SaveIconPNG(id uuid.UUID, png []byte) error

type Profile

type Profile struct {
	ID             uuid.UUID                    `json:"id"`
	Name           string                       `json:"name"`
	Author         string                       `json:"author"`
	Description    string                       `json:"description,omitempty"`
	ModVersions    map[string]modmgr.ModVersion `json:"mod_versions,omitempty"`
	UpdatedAt      time.Time                    `json:"updated_at"`
	PlayDurationNS int64                        `json:"play_duration_ns,omitempty"`
	LastLaunchedAt time.Time                    `json:"last_launched_at"`
}

func (*Profile) AddModVersion

func (p *Profile) AddModVersion(version modmgr.ModVersion)

func (*Profile) AddPlayDuration added in v1.4.0

func (p *Profile) AddPlayDuration(d time.Duration)

func (*Profile) Clone added in v1.6.12

func (p *Profile) Clone() Profile

func (*Profile) MakeShared added in v1.2.1

func (p *Profile) MakeShared() SharedProfile

func (*Profile) PlayDuration added in v1.4.0

func (p *Profile) PlayDuration() time.Duration

func (*Profile) RemoveModVersion

func (p *Profile) RemoveModVersion(modID string)

func (*Profile) Versions

func (p *Profile) Versions() []modmgr.ModVersion

type SharedProfile added in v1.2.1

type SharedProfile struct {
	ID          uuid.UUID         `json:"id"`
	Name        string            `json:"name"`
	Author      string            `json:"author"`
	Description string            `json:"description,omitempty"`
	ModVersions map[string]string `json:"mod_versions,omitempty"` // map of mod ID to version ID
	UpdatedAt   time.Time         `json:"updated_at"`
}

func DecodeSharedArchive added in v1.5.0

func DecodeSharedArchive(reader io.ReaderAt, size int64) (*SharedProfile, []byte, error)

Jump to

Keyboard shortcuts

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