Barotrauma Client
Loading...
Searching...
No Matches
Barotrauma.ContentPackage Class Referenceabstract
Inheritance diagram for Barotrauma.ContentPackage:
Barotrauma.CorePackage Barotrauma.RegularPackage

Public Types

enum  LoadResult { Success , Failure }
 

Public Member Functions

readonly record struct LoadError (string Message, Exception? Exception)
 
async Task< bool > IsUpToDate ()
 
bool HashMismatches (string expectedHash)
 
IEnumerable< T > GetFiles< T > ()
 
IEnumerable< ContentFileGetFiles (Type type)
 
bool NameMatches (Identifier name)
 
bool NameMatches (string name)
 
Md5Hash CalculateHash (bool logging=false, string? name=null, string? modVersion=null)
 
void LoadFilesOfType< T > ()
 
void UnloadFilesOfType< T > ()
 
LoadResult LoadContent ()
 
IEnumerable< ContentPackageManager.LoadProgress > LoadContentEnumerable ()
 
void UnloadContent ()
 
void ReloadSubsAndItemAssemblies ()
 
void LogErrors ()
 

Static Public Member Functions

static Result< ContentPackage, Exception > TryLoad (string path)
 
static bool PathAllowedAsLocalModFile (string path)
 

Public Attributes

readonly string Name
 
readonly ImmutableArray< string > AltNames
 
readonly string Path
 
readonly Option< ContentPackageIdUgcId
 
readonly Version GameVersion
 
readonly string ModVersion
 
readonly Option< SerializableDateTimeInstallTime
 

Static Public Attributes

static readonly Version MinimumHashCompatibleVersion = new Version(1, 1, 0, 0)
 
const string LocalModsDir = "LocalMods"
 
static readonly string WorkshopModsDir
 
const string FileListFileName = "filelist.xml"
 
const string DefaultModVersion = "1.0.0"
 

Protected Member Functions

 ContentPackage (XDocument doc, string path)
 
void AssertCondition (bool condition, string errorMsg)
 

Properties

string Dir [get]
 
Md5Hash Hash [get]
 
ImmutableArray< ContentFileFiles [get]
 
ImmutableArray< LoadErrorFatalLoadErrors [get]
 Errors that occurred when loading this content package. Currently, all errors are considered fatal and the game will refuse to load a content package that has any errors.
 
Option< ContentPackageManager.LoadProgress.Error > EnableError [get]
 An error that occurred when trying to enable this mod. This field doesn't directly affect whether or not this mod can be enabled, but if it's been set to anything other than Option.None then the game has already refused to enable it at least once.
 
bool HasAnyErrors [get]
 
int Index [get]
 
bool HasMultiplayerSyncedContent [get]
 Does the content package include some content that needs to match between all players in multiplayer.
 

Member Enumeration Documentation

◆ LoadResult

Enumerator
Success 
Failure 

Constructor & Destructor Documentation

◆ ContentPackage()

Barotrauma.ContentPackage.ContentPackage ( XDocument doc,
string path )
protected

Member Function Documentation

◆ AssertCondition()

void Barotrauma.ContentPackage.AssertCondition ( bool condition,
string errorMsg )
protected

◆ CalculateHash()

Md5Hash Barotrauma.ContentPackage.CalculateHash ( bool logging = false,
string? name = null,
string? modVersion = null )

◆ GetFiles()

IEnumerable< ContentFile > Barotrauma.ContentPackage.GetFiles ( Type type)

◆ GetFiles< T >()

IEnumerable< T > Barotrauma.ContentPackage.GetFiles< T > ( )
Type Constraints
T :ContentFile 

◆ HashMismatches()

bool Barotrauma.ContentPackage.HashMismatches ( string expectedHash)

◆ IsUpToDate()

async Task< bool > Barotrauma.ContentPackage.IsUpToDate ( )

◆ LoadContent()

LoadResult Barotrauma.ContentPackage.LoadContent ( )

◆ LoadContentEnumerable()

IEnumerable< ContentPackageManager.LoadProgress > Barotrauma.ContentPackage.LoadContentEnumerable ( )

◆ LoadError()

readonly record struct Barotrauma.ContentPackage.LoadError ( string Message,
Exception? Exception )

◆ LoadFilesOfType< T >()

void Barotrauma.ContentPackage.LoadFilesOfType< T > ( )
Type Constraints
T :ContentFile 

◆ LogErrors()

void Barotrauma.ContentPackage.LogErrors ( )

◆ NameMatches() [1/2]

bool Barotrauma.ContentPackage.NameMatches ( Identifier name)

◆ NameMatches() [2/2]

bool Barotrauma.ContentPackage.NameMatches ( string name)

◆ PathAllowedAsLocalModFile()

static bool Barotrauma.ContentPackage.PathAllowedAsLocalModFile ( string path)
static

◆ ReloadSubsAndItemAssemblies()

void Barotrauma.ContentPackage.ReloadSubsAndItemAssemblies ( )

◆ TryLoad()

static Result< ContentPackage, Exception > Barotrauma.ContentPackage.TryLoad ( string path)
static

◆ UnloadContent()

void Barotrauma.ContentPackage.UnloadContent ( )

◆ UnloadFilesOfType< T >()

void Barotrauma.ContentPackage.UnloadFilesOfType< T > ( )
Type Constraints
T :ContentFile 

Member Data Documentation

◆ AltNames

readonly ImmutableArray<string> Barotrauma.ContentPackage.AltNames

◆ DefaultModVersion

const string Barotrauma.ContentPackage.DefaultModVersion = "1.0.0"
static

◆ FileListFileName

const string Barotrauma.ContentPackage.FileListFileName = "filelist.xml"
static

◆ GameVersion

readonly Version Barotrauma.ContentPackage.GameVersion

◆ InstallTime

readonly Option<SerializableDateTime> Barotrauma.ContentPackage.InstallTime

◆ LocalModsDir

const string Barotrauma.ContentPackage.LocalModsDir = "LocalMods"
static

◆ MinimumHashCompatibleVersion

readonly Version Barotrauma.ContentPackage.MinimumHashCompatibleVersion = new Version(1, 1, 0, 0)
static

◆ ModVersion

readonly string Barotrauma.ContentPackage.ModVersion

◆ Name

readonly string Barotrauma.ContentPackage.Name

◆ Path

readonly string Barotrauma.ContentPackage.Path

◆ UgcId

readonly Option<ContentPackageId> Barotrauma.ContentPackage.UgcId

◆ WorkshopModsDir

readonly string Barotrauma.ContentPackage.WorkshopModsDir
static
Initial value:
= Barotrauma.IO.Path.Combine(
SaveUtil.DefaultSaveFolder,
"WorkshopMods",
"Installed")
Definition SafeIO.cs:208
Definition SafeIO.cs:13
Definition AchievementManager.cs:12

Property Documentation

◆ Dir

string Barotrauma.ContentPackage.Dir
get

◆ EnableError

Option<ContentPackageManager.LoadProgress.Error> Barotrauma.ContentPackage.EnableError
get

An error that occurred when trying to enable this mod. This field doesn't directly affect whether or not this mod can be enabled, but if it's been set to anything other than Option.None then the game has already refused to enable it at least once.

◆ FatalLoadErrors

ImmutableArray<LoadError> Barotrauma.ContentPackage.FatalLoadErrors
get

Errors that occurred when loading this content package. Currently, all errors are considered fatal and the game will refuse to load a content package that has any errors.

◆ Files

ImmutableArray<ContentFile> Barotrauma.ContentPackage.Files
get

◆ HasAnyErrors

bool Barotrauma.ContentPackage.HasAnyErrors
get

◆ Hash

Md5Hash Barotrauma.ContentPackage.Hash
get

◆ HasMultiplayerSyncedContent

bool Barotrauma.ContentPackage.HasMultiplayerSyncedContent
get

Does the content package include some content that needs to match between all players in multiplayer.

◆ Index

int Barotrauma.ContentPackage.Index
get

The documentation for this class was generated from the following file: