Add check for existing assets

This commit is contained in:
Bill 2021-02-22 00:50:21 -05:00
parent 7b463ab250
commit 88425a79c3
8 changed files with 32 additions and 8 deletions

View File

@ -34,7 +34,7 @@ export class EffectConverter extends SWFConverter
try
{
await this._effectDownloader.download(async (habboAssetSwf: HabboAssetSWF, className: string) =>
await this._effectDownloader.download(directory, async (habboAssetSwf: HabboAssetSWF, className: string) =>
{
spinner.text = 'Parsing Effect: ' + habboAssetSwf.getDocumentClass();

View File

@ -2,6 +2,7 @@ import { singleton } from 'tsyringe';
import { Configuration } from '../../common/config/Configuration';
import { IEffectMap } from '../../mapping/json';
import { HabboAssetSWF } from '../../swf/HabboAssetSWF';
import File from '../../utils/File';
import { FileUtilities } from '../../utils/FileUtilities';
import { Logger } from '../../utils/Logger';
@ -15,7 +16,7 @@ export class EffectDownloader
private readonly _logger: Logger)
{}
public async download(callback: (habboAssetSwf: HabboAssetSWF, className: string) => Promise<void>): Promise<void>
public async download(directory: File, callback: (habboAssetSwf: HabboAssetSWF, className: string) => Promise<void>): Promise<void>
{
const effectMap = await this.parseEffectMap();
const classNames: string[] = [];
@ -26,6 +27,10 @@ export class EffectDownloader
{
const className = library.lib;
const existingFile = new File(directory.path + '/' + className + '.nitro');
if(existingFile.isDirectory) continue;
if(classNames.indexOf(className) >= 0) continue;
classNames.push(className);

View File

@ -34,7 +34,7 @@ export class FigureConverter extends SWFConverter
try
{
await this._figureDownloader.download(async (habboAssetSwf: HabboAssetSWF, className: string) =>
await this._figureDownloader.download(directory, async (habboAssetSwf: HabboAssetSWF, className: string) =>
{
spinner.text = 'Parsing Figure: ' + habboAssetSwf.getDocumentClass();

View File

@ -2,6 +2,7 @@ import { singleton } from 'tsyringe';
import { Configuration } from '../../common/config/Configuration';
import { IFigureMap } from '../../mapping/json';
import { HabboAssetSWF } from '../../swf/HabboAssetSWF';
import File from '../../utils/File';
import { FileUtilities } from '../../utils/FileUtilities';
import { Logger } from '../../utils/Logger';
@ -15,7 +16,7 @@ export class FigureDownloader
private readonly _logger: Logger)
{}
public async download(callback: (habboAssetSwf: HabboAssetSWF, className: string) => Promise<void>): Promise<void>
public async download(directory: File, callback: (habboAssetSwf: HabboAssetSWF, className: string) => Promise<void>): Promise<void>
{
const figureMap = await this.parseFigureMap();
const classNames: string[] = [];
@ -26,6 +27,10 @@ export class FigureDownloader
{
const className = library.id.split('*')[0];
const existingFile = new File(directory.path + '/' + className + '.nitro');
if(existingFile.isDirectory) continue;
if(className === 'hh_human_fx' || className === 'hh_pets') continue;
if(classNames.indexOf(className) >= 0) continue;

View File

@ -34,7 +34,7 @@ export class FurnitureConverter extends SWFConverter
try
{
await this._furniDownloader.download(async (habboAssetSwf: HabboAssetSWF) =>
await this._furniDownloader.download(directory, async (habboAssetSwf: HabboAssetSWF) =>
{
spinner.text = 'Parsing Furniture: ' + habboAssetSwf.getDocumentClass();

View File

@ -2,6 +2,7 @@ import { singleton } from 'tsyringe';
import { Configuration } from '../../common/config/Configuration';
import { IFurnitureData } from '../../mapping/json';
import { HabboAssetSWF } from '../../swf/HabboAssetSWF';
import File from '../../utils/File';
import { FileUtilities } from '../../utils/FileUtilities';
import { Logger } from '../../utils/Logger';
@ -13,7 +14,7 @@ export class FurnitureDownloader
private readonly _logger: Logger)
{}
public async download(callback: (habboAssetSwf: HabboAssetSWF, className: string) => Promise<void>): Promise<void>
public async download(directory: File, callback: (habboAssetSwf: HabboAssetSWF, className: string) => Promise<void>): Promise<void>
{
const furniData = await this.parseFurniData();
@ -30,6 +31,10 @@ export class FurnitureDownloader
const className = furniType.classname.split('*')[0];
const revision = furniType.revision;
const existingFile = new File(directory.path + '/' + className + '.nitro');
if(existingFile.isDirectory) continue;
if(classNames.indexOf(className) >= 0) continue;
classNames.push(className);
@ -57,6 +62,10 @@ export class FurnitureDownloader
const className = furniType.classname.split('*')[0];
const revision = furniType.revision;
const existingFile = new File(directory.path + '/' + className + '.nitro');
if(existingFile.isDirectory) continue;
if(classNames.indexOf(className) >= 0) continue;
classNames.push(className);

View File

@ -34,7 +34,7 @@ export class PetConverter extends SWFConverter
try
{
await this._petDownloader.download(async (habboAssetSwf: HabboAssetSWF) =>
await this._petDownloader.download(directory, async (habboAssetSwf: HabboAssetSWF) =>
{
spinner.text = 'Parsing Pet: ' + habboAssetSwf.getDocumentClass();

View File

@ -1,6 +1,7 @@
import { singleton } from 'tsyringe';
import { Configuration } from '../../common/config/Configuration';
import { HabboAssetSWF } from '../../swf/HabboAssetSWF';
import File from '../../utils/File';
import { FileUtilities } from '../../utils/FileUtilities';
import { Logger } from '../../utils/Logger';
@ -12,7 +13,7 @@ export class PetDownloader
private readonly _logger: Logger)
{}
public async download(callback: (habboAssetSwf: HabboAssetSWF) => Promise<void>): Promise<void>
public async download(directory: File, callback: (habboAssetSwf: HabboAssetSWF) => Promise<void>): Promise<void>
{
const petTypes = await this.parsePetTypes();
@ -22,6 +23,10 @@ export class PetDownloader
for(const petType of petTypes)
{
const existingFile = new File(directory.path + '/' + petType + '.nitro');
if(existingFile.isDirectory) continue;
if(classNames.indexOf(petType) >= 0) continue;
classNames.push(petType);