typo fixes + whitespace refactorings
This commit is contained in:
@@ -16,7 +16,7 @@ import { IApplicationCode } from './Code/IApplicationCode';
|
||||
export class ApplicationState implements IApplicationState {
|
||||
/** Get singleton application state */
|
||||
public static GetAsync(): Promise<IApplicationState> {
|
||||
return ApplicationState.instance.getValueAsync();
|
||||
return ApplicationState.instance.getValueAsync();
|
||||
}
|
||||
|
||||
/** Application instance with all scripts. */
|
||||
@@ -36,10 +36,10 @@ export class ApplicationState implements IApplicationState {
|
||||
private readonly app: Application,
|
||||
/** Initially selected scripts */
|
||||
public readonly defaultScripts: Script[]) {
|
||||
this.selection = new UserSelection(app, defaultScripts);
|
||||
this.code = new ApplicationCode(this.selection, app.version.toString());
|
||||
this.filter = new UserFilter(app);
|
||||
}
|
||||
this.selection = new UserSelection(app, defaultScripts);
|
||||
this.code = new ApplicationCode(this.selection, app.version.toString());
|
||||
this.filter = new UserFilter(app);
|
||||
}
|
||||
|
||||
public getCategory(categoryId: number): ICategory | undefined {
|
||||
return this.app.findCategory(categoryId);
|
||||
|
||||
@@ -2,17 +2,19 @@ import { FunctionRenderer } from './FunctionRenderer';
|
||||
|
||||
export class AdminRightsFunctionRenderer {
|
||||
private readonly functionRenderer: FunctionRenderer;
|
||||
|
||||
constructor() {
|
||||
this.functionRenderer = new FunctionRenderer();
|
||||
}
|
||||
|
||||
public renderAdminRightsFunction() {
|
||||
const name = 'Ensure admin priviliges';
|
||||
const name = 'Ensure admin privileges';
|
||||
const code = 'fltmc >nul 2>&1 || (\n' +
|
||||
' echo This batch script requires administrator privileges. Right-click on\n' +
|
||||
' echo the script and select "Run as administrator".\n' +
|
||||
' pause\n' +
|
||||
' exit 1\n' +
|
||||
')';
|
||||
' echo This batch script requires administrator privileges. Right-click on\n' +
|
||||
' echo the script and select "Run as administrator".\n' +
|
||||
' pause\n' +
|
||||
' exit 1\n' +
|
||||
')';
|
||||
return this.functionRenderer.renderFunction(name, code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,15 +2,17 @@ import { CodeRenderer } from './CodeRenderer';
|
||||
|
||||
export class AsciiArtRenderer extends CodeRenderer {
|
||||
public renderAsciiArt(version: string): string {
|
||||
if (!version) { throw new Error('Version is not defined'); }
|
||||
if (!version) {
|
||||
throw new Error('Version is not defined');
|
||||
}
|
||||
return (
|
||||
'██████╗ ██████╗ ██╗██╗ ██╗ █████╗ ██████╗██╗ ██╗███████╗███████╗██╗ ██╗██╗ ██╗\n' +
|
||||
'██╔══██╗██╔══██╗██║██║ ██║██╔══██╗██╔════╝╚██╗ ██╔╝██╔════╝██╔════╝╚██╗██╔╝╚██╗ ██╔╝\n' +
|
||||
'██████╔╝██████╔╝██║██║ ██║███████║██║ ╚████╔╝ ███████╗█████╗ ╚███╔╝ ╚████╔╝ \n' +
|
||||
'██╔═══╝ ██╔══██╗██║╚██╗ ██╔╝██╔══██║██║ ╚██╔╝ ╚════██║██╔══╝ ██╔██╗ ╚██╔╝ \n' +
|
||||
'██║ ██║ ██║██║ ╚████╔╝ ██║ ██║╚██████╗ ██║██╗███████║███████╗██╔╝ ██╗ ██║ \n' +
|
||||
'╚═╝ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝╚═╝╚══════╝╚══════╝╚═╝ ╚═╝ ╚═╝ ')
|
||||
.split('\n').map((line) => this.renderComment(line)).join('\n')
|
||||
+ `\n${this.renderComment(`https://privacy.sexy — v${version} — ${new Date().toUTCString()}`)}`;
|
||||
'██████╗ ██████╗ ██╗██╗ ██╗ █████╗ ██████╗██╗ ██╗███████╗███████╗██╗ ██╗██╗ ██╗\n' +
|
||||
'██╔══██╗██╔══██╗██║██║ ██║██╔══██╗██╔════╝╚██╗ ██╔╝██╔════╝██╔════╝╚██╗██╔╝╚██╗ ██╔╝\n' +
|
||||
'██████╔╝██████╔╝██║██║ ██║███████║██║ ╚████╔╝ ███████╗█████╗ ╚███╔╝ ╚████╔╝ \n' +
|
||||
'██╔═══╝ ██╔══██╗██║╚██╗ ██╔╝██╔══██║██║ ╚██╔╝ ╚════██║██╔══╝ ██╔██╗ ╚██╔╝ \n' +
|
||||
'██║ ██║ ██║██║ ╚████╔╝ ██║ ██║╚██████╗ ██║██╗███████║███████╗██╔╝ ██╗ ██║ \n' +
|
||||
'╚═╝ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝╚═╝╚══════╝╚══════╝╚═╝ ╚═╝ ╚═╝ ')
|
||||
.split('\n').map((line) => this.renderComment(line)).join('\n') +
|
||||
`\n${this.renderComment(`https://privacy.sexy — v${version} — ${new Date().toUTCString()}`)}`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@ export class FunctionRenderer extends CodeRenderer {
|
||||
}
|
||||
|
||||
private renderFunctionName(functionName: string) {
|
||||
const autoFirstHypens = '-'.repeat(Math.floor((this.totalFunctionSeparatorChars - functionName.length) / 2));
|
||||
const secondHypens = '-'.repeat(Math.ceil((this.totalFunctionSeparatorChars - functionName.length) / 2));
|
||||
return `${this.renderComment()}${autoFirstHypens}${functionName}${secondHypens}`;
|
||||
const firstHyphens = '-'.repeat(Math.floor((this.totalFunctionSeparatorChars - functionName.length) / 2));
|
||||
const secondHyphens = '-'.repeat(Math.ceil((this.totalFunctionSeparatorChars - functionName.length) / 2));
|
||||
return `${this.renderComment()}${firstHyphens}${functionName}${secondHyphens}`;
|
||||
}
|
||||
|
||||
private renderFunctionEndComment(): string {
|
||||
|
||||
@@ -16,8 +16,8 @@ export class UserFilter implements IUserFilter {
|
||||
throw new Error('Filter must be defined and not empty. Use removeFilter() to remove the filter');
|
||||
}
|
||||
const filteredScripts = this.application.getAllScripts().filter(
|
||||
(script) => script.name.toLowerCase().includes(filter.toLowerCase())
|
||||
|| script.code.toLowerCase().includes(filter.toLowerCase()));
|
||||
(script) => script.name.toLowerCase().includes(filter.toLowerCase()) ||
|
||||
script.code.toLowerCase().includes(filter.toLowerCase()));
|
||||
|
||||
const matches: IFilterMatches = {
|
||||
scriptMatches: filteredScripts,
|
||||
|
||||
@@ -18,4 +18,3 @@ export interface IApplicationState {
|
||||
readonly defaultScripts: ReadonlyArray<IScript>;
|
||||
getCategory(categoryId: number): ICategory | undefined;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user