Scripting API

Scripting API

PackageList

Class in Abyss.Core, from Abyss.Core.

The packages a game has, as settings/packages.json lists them: the version of each and where it came from. Kept in git with the game, so a copy of it that is missing a package's folder (one git leaves out, as it is as the registry has it) has that folder put back from the registry by every build, the editor's as it opens among them (dotnet/build/AbyssRestorePackages.cs).

public static class PackageList

Remarks

Written as the Package Manager changes a game's packages (installing, updating, removing, making and exporting one), and by nothing else. A package the game has in its folder and the list has not, copied in by hand or the game older than the list, is listed by ListUnlisted.

{  "abyssPackages": 1,  "packages": {    "abyss.physics3d": { "version": "0.9.0", "from": "abyss" },    "acme.demo": { "version": "0.1.0", "from": "project" }  }}

Methods

FileIn

public static string FileIn(string game)

The list's file in the game game.

Parameters

  • game

SourceOf

public static PackageSource SourceOf(string id, bool registered)

Where a package not listed yet came from: the engine's by its id, the person's own where a registry has it, else made in the game.

Parameters

  • id: The package's id.
  • registered: Whether a registry has a version of it.

Read

public static IReadOnlyDictionary<string, ListedPackage> Read(string game)

The game's list, by id; empty where it has none.

Parameters

  • game

Exceptions

  • FormatException: The file is not a list this build reads, saying why.
  • IOException: The file is there and cannot be read.

Write

public static void Write(string game, IEnumerable<ListedPackage> packages)

Writes the game's list whole, by id, the folder made where it has none.

Parameters

  • game
  • packages

Exceptions

  • IOException: The file could not be written.

Note

public static void Note(string game, string id, string version, PackageSource from)

Lists one package at version, as having come from from, in place of what the list said of it.

Parameters

  • game
  • id
  • version
  • from

Exceptions

Forget

public static void Forget(string game, string id)

Takes one package off the list; nothing where it is not on it, or there is no list.

Parameters

  • game
  • id

Exceptions

ListUnlisted

public static IReadOnlyList<ListedPackage> ListUnlisted(string game, Func<string, bool> registered)

Lists each package the game has in its packages folder that its list has not — copied in by hand, or every one of a game older than the list — at the version it is, where it came from worked out (PackageList.SourceOf); none already listed is changed. Those it listed.

Parameters

  • game: The game's folder.
  • registered: Whether a registry has a version of the package with an id.

Exceptions

NameOf

public static string NameOf(PackageSource from)

What from is written as.

Parameters

  • from

Constants

FileName

public const string FileName = "packages.json"

The file, under BuildSettings.FolderName.

PathName

public const string PathName = "settings/packages.json"

What it is called in a game's folder: settings/packages.json.

EnginePrefix

public const string EnginePrefix = "abyss."

What the ids of the engine's own packages start with, and no other's may.

CurrentVersion

public const int CurrentVersion = 1

The version of the list's file this build writes, and the newest it reads.