common

package
v0.0.0-...-165de30 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package common provides common stuff for all of the other high-level packages in the codebase

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadTexture

func LoadTexture(fileData []byte, cb func(*g.Texture))

LoadTexture converts byte slice to image.Image and enqueues new request to giu.

func SortPaths

func SortPaths(rootPath *PathEntry)

SortPaths sorts paths

Types

type PathEntry

type PathEntry struct {
	// Children represents child files/folders inside a folder.
	Children []*PathEntry `json:"children"`

	// Name is the visible name of the path entry.
	Name string `json:"name"`

	// FullPath is the actual path of the entry (filesystem, or mpq relative).
	FullPath string `json:"fullPath"`

	// IsDirectory is true when this path represents a directory.
	IsDirectory bool `json:"isDirectory"`

	// IsRoot is true When this path represents the root path (the project node).
	IsRoot bool `json:"isRoot"`

	// IsRenaming is true when this path is currently being renamed in a tree view.
	IsRenaming bool `json:"isRenaming"`

	// OldName is the value of the path's Name before renaming started.
	// If renaming has not started, this value should be blank.
	OldName string `json:"oldMame"`

	// PathEntrySource is the type of path entry this is (MPQ or Filesystem).
	Source PathEntrySource `json:"source"`

	// MPQFile represents the full path to the MPQ that contains this file (if this is an MPQ path).
	MPQFile string `json:"mpqFile"`
}

PathEntry defines a file/folder

func (*PathEntry) GetFileBytes

func (p *PathEntry) GetFileBytes() ([]byte, error)

GetFileBytes reads the file and returns the contents

func (*PathEntry) GetUniqueID

func (p *PathEntry) GetUniqueID() string

GetUniqueID returns path's ID

func (*PathEntry) WriteFile

func (p *PathEntry) WriteFile(data []byte) error

WriteFile overwrites the file with the given data

type PathEntrySource

type PathEntrySource int

PathEntrySource represents the type of path entry.

const (
	// PathEntrySourceMPQ represents a PathEntry that is relative to a specific MPQ.
	PathEntrySourceMPQ PathEntrySource = iota

	// PathEntrySourceProject represents a PathEntry that is relative to the project.
	PathEntrySourceProject

	// PathEntryVirtual represents a PathEntry that is based on the composite view of
	// the project directory and all MPQs (Project first, then MPQs based on load order).
	PathEntryVirtual
)

Directories

Path Synopsis
Package enum provides enumerations used throughout the HellSpawner codebase.
Package enum provides enumerations used throughout the HellSpawner codebase.
Package hsfiletypes provides utilities for determining the type of a file.
Package hsfiletypes provides utilities for determining the type of a file.
hsfont
Package hsfont contains data for font file types
Package hsfont contains data for font file types
Package hsnode contains an implementation of a node graph, as parent and child nodes.
Package hsnode contains an implementation of a node graph, as parent and child nodes.
Package hsproject contains Hellspawner's Project implementation
Package hsproject contains Hellspawner's Project implementation
Package hsutil holds utility and helper functions
Package hsutil holds utility and helper functions

Jump to

Keyboard shortcuts

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