mirror of
https://github.com/billsonnn/nitro-converter.git
synced 2025-02-17 02:22:36 +01:00
Add check for existing assets
This commit is contained in:
parent
7b463ab250
commit
88425a79c3
@ -34,7 +34,7 @@ export class EffectConverter extends SWFConverter
|
|||||||
|
|
||||||
try
|
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();
|
spinner.text = 'Parsing Effect: ' + habboAssetSwf.getDocumentClass();
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ import { singleton } from 'tsyringe';
|
|||||||
import { Configuration } from '../../common/config/Configuration';
|
import { Configuration } from '../../common/config/Configuration';
|
||||||
import { IEffectMap } from '../../mapping/json';
|
import { IEffectMap } from '../../mapping/json';
|
||||||
import { HabboAssetSWF } from '../../swf/HabboAssetSWF';
|
import { HabboAssetSWF } from '../../swf/HabboAssetSWF';
|
||||||
|
import File from '../../utils/File';
|
||||||
import { FileUtilities } from '../../utils/FileUtilities';
|
import { FileUtilities } from '../../utils/FileUtilities';
|
||||||
import { Logger } from '../../utils/Logger';
|
import { Logger } from '../../utils/Logger';
|
||||||
|
|
||||||
@ -15,7 +16,7 @@ export class EffectDownloader
|
|||||||
private readonly _logger: Logger)
|
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 effectMap = await this.parseEffectMap();
|
||||||
const classNames: string[] = [];
|
const classNames: string[] = [];
|
||||||
@ -26,6 +27,10 @@ export class EffectDownloader
|
|||||||
{
|
{
|
||||||
const className = library.lib;
|
const className = library.lib;
|
||||||
|
|
||||||
|
const existingFile = new File(directory.path + '/' + className + '.nitro');
|
||||||
|
|
||||||
|
if(existingFile.isDirectory) continue;
|
||||||
|
|
||||||
if(classNames.indexOf(className) >= 0) continue;
|
if(classNames.indexOf(className) >= 0) continue;
|
||||||
|
|
||||||
classNames.push(className);
|
classNames.push(className);
|
||||||
|
@ -34,7 +34,7 @@ export class FigureConverter extends SWFConverter
|
|||||||
|
|
||||||
try
|
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();
|
spinner.text = 'Parsing Figure: ' + habboAssetSwf.getDocumentClass();
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ import { singleton } from 'tsyringe';
|
|||||||
import { Configuration } from '../../common/config/Configuration';
|
import { Configuration } from '../../common/config/Configuration';
|
||||||
import { IFigureMap } from '../../mapping/json';
|
import { IFigureMap } from '../../mapping/json';
|
||||||
import { HabboAssetSWF } from '../../swf/HabboAssetSWF';
|
import { HabboAssetSWF } from '../../swf/HabboAssetSWF';
|
||||||
|
import File from '../../utils/File';
|
||||||
import { FileUtilities } from '../../utils/FileUtilities';
|
import { FileUtilities } from '../../utils/FileUtilities';
|
||||||
import { Logger } from '../../utils/Logger';
|
import { Logger } from '../../utils/Logger';
|
||||||
|
|
||||||
@ -15,7 +16,7 @@ export class FigureDownloader
|
|||||||
private readonly _logger: Logger)
|
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 figureMap = await this.parseFigureMap();
|
||||||
const classNames: string[] = [];
|
const classNames: string[] = [];
|
||||||
@ -26,6 +27,10 @@ export class FigureDownloader
|
|||||||
{
|
{
|
||||||
const className = library.id.split('*')[0];
|
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(className === 'hh_human_fx' || className === 'hh_pets') continue;
|
||||||
|
|
||||||
if(classNames.indexOf(className) >= 0) continue;
|
if(classNames.indexOf(className) >= 0) continue;
|
||||||
|
@ -34,7 +34,7 @@ export class FurnitureConverter extends SWFConverter
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await this._furniDownloader.download(async (habboAssetSwf: HabboAssetSWF) =>
|
await this._furniDownloader.download(directory, async (habboAssetSwf: HabboAssetSWF) =>
|
||||||
{
|
{
|
||||||
spinner.text = 'Parsing Furniture: ' + habboAssetSwf.getDocumentClass();
|
spinner.text = 'Parsing Furniture: ' + habboAssetSwf.getDocumentClass();
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ import { singleton } from 'tsyringe';
|
|||||||
import { Configuration } from '../../common/config/Configuration';
|
import { Configuration } from '../../common/config/Configuration';
|
||||||
import { IFurnitureData } from '../../mapping/json';
|
import { IFurnitureData } from '../../mapping/json';
|
||||||
import { HabboAssetSWF } from '../../swf/HabboAssetSWF';
|
import { HabboAssetSWF } from '../../swf/HabboAssetSWF';
|
||||||
|
import File from '../../utils/File';
|
||||||
import { FileUtilities } from '../../utils/FileUtilities';
|
import { FileUtilities } from '../../utils/FileUtilities';
|
||||||
import { Logger } from '../../utils/Logger';
|
import { Logger } from '../../utils/Logger';
|
||||||
|
|
||||||
@ -13,7 +14,7 @@ export class FurnitureDownloader
|
|||||||
private readonly _logger: Logger)
|
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();
|
const furniData = await this.parseFurniData();
|
||||||
|
|
||||||
@ -30,6 +31,10 @@ export class FurnitureDownloader
|
|||||||
const className = furniType.classname.split('*')[0];
|
const className = furniType.classname.split('*')[0];
|
||||||
const revision = furniType.revision;
|
const revision = furniType.revision;
|
||||||
|
|
||||||
|
const existingFile = new File(directory.path + '/' + className + '.nitro');
|
||||||
|
|
||||||
|
if(existingFile.isDirectory) continue;
|
||||||
|
|
||||||
if(classNames.indexOf(className) >= 0) continue;
|
if(classNames.indexOf(className) >= 0) continue;
|
||||||
|
|
||||||
classNames.push(className);
|
classNames.push(className);
|
||||||
@ -57,6 +62,10 @@ export class FurnitureDownloader
|
|||||||
const className = furniType.classname.split('*')[0];
|
const className = furniType.classname.split('*')[0];
|
||||||
const revision = furniType.revision;
|
const revision = furniType.revision;
|
||||||
|
|
||||||
|
const existingFile = new File(directory.path + '/' + className + '.nitro');
|
||||||
|
|
||||||
|
if(existingFile.isDirectory) continue;
|
||||||
|
|
||||||
if(classNames.indexOf(className) >= 0) continue;
|
if(classNames.indexOf(className) >= 0) continue;
|
||||||
|
|
||||||
classNames.push(className);
|
classNames.push(className);
|
||||||
|
@ -34,7 +34,7 @@ export class PetConverter extends SWFConverter
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await this._petDownloader.download(async (habboAssetSwf: HabboAssetSWF) =>
|
await this._petDownloader.download(directory, async (habboAssetSwf: HabboAssetSWF) =>
|
||||||
{
|
{
|
||||||
spinner.text = 'Parsing Pet: ' + habboAssetSwf.getDocumentClass();
|
spinner.text = 'Parsing Pet: ' + habboAssetSwf.getDocumentClass();
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { singleton } from 'tsyringe';
|
import { singleton } from 'tsyringe';
|
||||||
import { Configuration } from '../../common/config/Configuration';
|
import { Configuration } from '../../common/config/Configuration';
|
||||||
import { HabboAssetSWF } from '../../swf/HabboAssetSWF';
|
import { HabboAssetSWF } from '../../swf/HabboAssetSWF';
|
||||||
|
import File from '../../utils/File';
|
||||||
import { FileUtilities } from '../../utils/FileUtilities';
|
import { FileUtilities } from '../../utils/FileUtilities';
|
||||||
import { Logger } from '../../utils/Logger';
|
import { Logger } from '../../utils/Logger';
|
||||||
|
|
||||||
@ -12,7 +13,7 @@ export class PetDownloader
|
|||||||
private readonly _logger: Logger)
|
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();
|
const petTypes = await this.parsePetTypes();
|
||||||
|
|
||||||
@ -22,6 +23,10 @@ export class PetDownloader
|
|||||||
|
|
||||||
for(const petType of petTypes)
|
for(const petType of petTypes)
|
||||||
{
|
{
|
||||||
|
const existingFile = new File(directory.path + '/' + petType + '.nitro');
|
||||||
|
|
||||||
|
if(existingFile.isDirectory) continue;
|
||||||
|
|
||||||
if(classNames.indexOf(petType) >= 0) continue;
|
if(classNames.indexOf(petType) >= 0) continue;
|
||||||
|
|
||||||
classNames.push(petType);
|
classNames.push(petType);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user