sc4
Version:
A command line utility for automating SimCity 4 modding tasks & modifying savegames
85 lines (84 loc) • 4.53 kB
TypeScript
import { LRUCache } from 'lru-cache';
import { DBPF, Entry, type Exemplar, type ExemplarPropertyKey as Key, TGI, type DecodedFileTypeId, type EntryFromType } from 'sc4/core';
import type { TGIArray, TGIQuery, uint32 } from 'sc4/types';
import { TGIIndex, type TGIFindParameters } from 'sc4/utils';
import type { Glob } from './directory-scan-operation.js';
export type PluginIndexOptions = {
scan?: string | string[];
core?: boolean;
mem?: number;
threads?: number;
};
type BuildOptions<T extends PluginIndex> = {
installation?: T['installation'];
plugins?: T['plugins'];
};
type ExemplarEntry = Entry<Exemplar>;
export default abstract class PluginIndex {
scan: string[];
dbpfs: DBPF[];
entries: TGIIndex<Entry>;
families: Map<number, TGI<number>[]>;
cache: LRUCache<string, Entry>;
core: boolean;
abstract installation?: unknown;
abstract plugins?: unknown;
constructor(opts: PluginIndexOptions);
get length(): number;
abstract createGlob(pattern: string | string[], cwd: unknown): Glob;
build(opts?: BuildOptions<typeof this>): Promise<this>;
buildFamilies(opts?: {
concurrency?: number;
}): Promise<void>;
touch(entry: Entry): Entry<import("../core/types.js").DecodedFile | Uint8Array<ArrayBufferLike>>;
find<T extends DecodedFileTypeId>(query: TGIQuery<T>): EntryFromType<T> | undefined;
find<T extends DecodedFileTypeId>(query: TGIArray<T>): EntryFromType<T> | undefined;
find<T extends DecodedFileTypeId>(type: T, group: uint32, instance: uint32): EntryFromType<T> | undefined;
find(...params: TGIFindParameters<Entry>): Entry | undefined;
findAll<T extends DecodedFileTypeId>(query: TGIQuery<T>): EntryFromType<T>[];
findAll<T extends DecodedFileTypeId>(query: TGIArray<T>): EntryFromType<T>[];
findAll<T extends DecodedFileTypeId>(type: T, group: uint32, instance: uint32): EntryFromType<T>[];
findAll(...params: TGIFindParameters<Entry>): Entry[];
getFamilyTGIs(family: uint32): TGI<number>[];
family(family: uint32): ExemplarEntry[] | null;
getHierarchicExemplar(exemplar: Exemplar): {
get: <K extends Key = Key>(key: K) => import("../core/exemplar-properties-types.js").Value<K> | undefined;
getAsync: <K extends Key = Key>(key: K) => Promise<import("../core/exemplar-properties-types.js").Value<K> | undefined>;
};
getProperty<K extends Key = Key>(exemplar: Exemplar, key: K): {
id: number;
type: import("../core/exemplar-properties-types.js").PropertyValueType;
value: import("../core/exemplar-properties-types.js").Value<K> | undefined;
getSafeValue(): import("../core/exemplar-properties-types.js").Value<K> | undefined;
readonly name: string;
readonly hex: string;
readonly hexType: number;
readonly keyType: 0 | 128;
readonly multiple: boolean;
readonly byteLength: number;
parse(rs: import("../core/stream.js").default): /*elided*/ any;
toBuffer(): Uint8Array<ArrayBufferLike>;
[Symbol.toPrimitive](hint: string): string | import("../core/exemplar-properties-types.js").Value<K> | undefined;
} | undefined;
getPropertyValue<K extends Key = Key>(exemplar: Exemplar, key: K): import("../core/exemplar-properties-types.js").Value<K> | undefined;
getPropertyAsync<K extends Key = Key>(exemplar: Exemplar, key: K): Promise<{
id: number;
type: import("../core/exemplar-properties-types.js").PropertyValueType;
value: import("../core/exemplar-properties-types.js").Value<K> | undefined;
getSafeValue(): import("../core/exemplar-properties-types.js").Value<K> | undefined;
readonly name: string;
readonly hex: string;
readonly hexType: number;
readonly keyType: 0 | 128;
readonly multiple: boolean;
readonly byteLength: number;
parse(rs: import("../core/stream.js").default): /*elided*/ any;
toBuffer(): Uint8Array<ArrayBufferLike>;
[Symbol.toPrimitive](hint: string): string | import("../core/exemplar-properties-types.js").Value<K> | undefined;
} | undefined>;
getPropertyValueAsync<K extends Key = Key>(exemplar: Exemplar, key: K): Promise<import("../core/exemplar-properties-types.js").Value<K> | undefined>;
toBuffer(): Uint8Array<ArrayBufferLike>;
load(buffer: Uint8Array): this;
[Symbol.iterator](): Generator<Entry<import("../core/types.js").DecodedFile | Uint8Array<ArrayBufferLike>>, void, unknown>;
}
export {};