UNPKG

kshoot-tools

Version:

A collection of tools related to KSH and KSON chart files of K-Shoot Mania

80 lines (79 loc) 2.81 kB
import AdmZip from 'adm-zip'; import * as kshoot from 'kshoot'; export * as kshoot from 'kshoot'; import { Radar } from "./radar.js"; export * as radar from "./radar.js"; import { Renderer, Params as RendererParams } from "./render.js"; export * as render from "./render.js"; export * as npy from "./npy.js"; export { OffsetComputer, CrossCorrelation, computeOffset, computeCrossCorrelation } from "./offset-computer.js"; export type LoadPathParams = { type: 'path'; file_or_dir_path: string; }; export type LoadFileParams = { type: 'files'; file_paths: string[]; }; export type LoadArchiveParams = { type: 'archive'; file_path?: string; data?: Buffer; }; export type SetDataParams = { type: 'set'; data: Record<string, string | Buffer>; }; export type LoadDirectoryParams = { type: 'directory'; dir_path: string; }; export type LoadParams = LoadPathParams | LoadFileParams | LoadArchiveParams | SetDataParams | LoadDirectoryParams; export type RenderParams = RendererParams & { save_to_file?: boolean; out_dir?: string; }; export declare class KShootChartContext { readonly context: KShootContext; file_path: string; file_name: string; chart?: kshoot.Chart; timing?: kshoot.Timing; constructor(context: KShootContext); set(source_path: string, chart_data: string | Buffer): LoadedKShootChartContext; load(file_path: string): Promise<LoadedKShootChartContext>; resolve(res_path: string): Promise<Buffer | null>; toString(): string; getStatDescription(this: { chart: kshoot.Chart; timing: kshoot.Timing; }): string; } export type LoadedKShootChartContext = KShootChartContext & { chart: kshoot.Chart; timing: kshoot.Timing; }; export interface KShootContext { dir_path: string; charts: LoadedKShootChartContext[]; resolve: (chart_path: string, res_path: string) => Promise<Buffer | null>; } export declare class KShootTools implements KShootContext { dir_path: string; zip_archive: AdmZip | null; charts: LoadedKShootChartContext[]; reset(): void; load(params: LoadParams): Promise<void>; resolve(chart_path: string, res_path: string): Promise<Buffer | null>; sort(): void; loadFiles(params: LoadFileParams): Promise<void>; loadArchiveFile(params: LoadArchiveParams): Promise<void>; setData(params: SetDataParams): void; loadDirectory(params: LoadDirectoryParams): Promise<void>; getSummary(): string; getStatDescriptions(): string[]; getRadars(): Radar[]; getRenderers(): Renderer[]; save(out_dir: string, data: (Buffer | string | null)[], extension: string): Promise<void>; save(out_dir: string, data: (Buffer | string | null)[], pathMap: (chart_ctx: LoadedKShootChartContext) => string): Promise<void>; }