@shockpkg/dir-projector
Version:
Package for creating Shockwave Director projectors
147 lines (146 loc) • 4.01 kB
TypeScript
import { Entry } from '@shockpkg/archive-files';
export interface IRceditOptionsVersionStrings {
[key: string]: string;
}
export interface IRceditOptions {
/**
* Icon path.
*
* @default null
*/
iconPath?: string | null;
/**
* File version.
*
* @default null
*/
fileVersion?: string | null;
/**
* Product version.
*
* @default null
*/
productVersion?: string | null;
/**
* Version strings.
*
* @default null
*/
versionStrings?: IRceditOptionsVersionStrings | null;
}
/**
* Default value if value is undefined.
*
* @param value Value.
* @param defaultValue Default value.
* @returns Value or the default value if undefined.
*/
export declare function defaultValue<T, U>(value: T, defaultValue: U): Exclude<T | U, undefined>;
/**
* Default null if value is undefined.
*
* @param value Value.
* @returns Value or null if undefined.
*/
export declare function defaultNull<T>(value: T): Exclude<T, undefined> | null;
/**
* Default false if value is undefined.
*
* @param value Value.
* @returns Value or false if undefined.
*/
export declare function defaultFalse<T>(value: T): boolean | Exclude<T, undefined>;
/**
* Default true if value is undefined.
*
* @param value Value.
* @returns Value or true if undefined.
*/
export declare function defaultTrue<T>(value: T): boolean | Exclude<T, undefined>;
/**
* Check if Archive Entry is empty resource fork.
*
* @param entry Archive Entry.
* @returns Is empty resource fork.
*/
export declare function entryIsEmptyResourceFork(entry: Entry): boolean;
/**
* Find path relative from base, if base matches.
*
* @param path Path to match against.
* @param start Search start.
* @param nocase Match case-insensitive.
* @returns Returns path, or null.
*/
export declare function pathRelativeBase(path: string, start: string, nocase?: boolean): string | null;
/**
* Same as pathRelativeBase, but retuns true on a match, else false.
*
* @param path Path to match against.
* @param start Search start.
* @param nocase Match case-insensitive.
* @returns Returns true on match, else false.
*/
export declare function pathRelativeBaseMatch(path: string, start: string, nocase?: boolean): boolean;
/**
* Trim a file extenion.
*
* @param path File path.
* @param ext File extension.
* @param nocase Match case-insensitive.
* @returns Path without file extension.
*/
export declare function trimExtension(path: string, ext: string, nocase?: boolean): string;
/**
* Encode string for XML.
*
* @param value String value.
* @returns Escaped string.
*/
export declare function xmlEntitiesEncode(value: string): string;
/**
* Decode string for XML.
*
* @param value Encoded value.
* @returns Decoded string.
*/
export declare function xmlEntitiesDecode(value: string): string;
/**
* Encode string into plist string tag.
*
* @param value String value.
* @returns Plist string.
*/
export declare function plistStringTagEncode(value: string): string;
/**
* Decode string from plist string tag.
*
* @param xml XML tag.
* @returns Plain string, or null.
*/
export declare function plistStringTagDecode(xml: string): string | null;
/**
* A small utility function for replacing Info.plist values.
*
* @param xml XML string.
* @param key Plist dict key.
* @param value Plist dict value, XML tag.
* @returns Updated document.
*/
export declare function infoPlistReplace(xml: string, key: string, value: string): string;
/**
* A small utility function for reading Info.plist values.
*
* @param xml XML string.
* @param key Plist dict key.
* @returns XML tag.
*/
export declare function infoPlistRead(xml: string, key: string): string | null;
/**
* Uses rcedit to edit the resources of a Windows EXE.
* Requires either Windows or wine in the path.
*
* @param path File path.
* @param options Options object.
*/
export declare function rcedit(path: string, options: IRceditOptions): Promise<void>;