Skip to content

Commit

Permalink
Remove Mod class
Browse files Browse the repository at this point in the history
The class was no longer used directly, only by ThunderstoreVersion
which extends it. Relevant attributes and getters/setters were moved
to ThunderstoreVersion definition. Mod.fromManifest was dropped since
it's not used and did return a Mod object anyway.
  • Loading branch information
anttimaki committed Feb 7, 2024
1 parent 8b096d4 commit 5ba2cad
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 152 deletions.
90 changes: 0 additions & 90 deletions src/model/Mod.ts

This file was deleted.

78 changes: 75 additions & 3 deletions src/model/ThunderstoreVersion.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import Mod from './Mod';
import VersionNumber from './VersionNumber';
import ReactiveObjectConverterInterface from './safety/ReactiveObjectConverter';
import CdnProvider from '../providers/generic/connection/CdnProvider';

export default class ThunderstoreVersion extends Mod implements ReactiveObjectConverterInterface {
export default class ThunderstoreVersion implements ReactiveObjectConverterInterface {

private name: string = '';
private versionNumber: VersionNumber = new VersionNumber('0.0.0');
private dependencies: string[] = [];
private fullName: string = '';
private description: string = ''
private icon: string = ''
private enabled: boolean = true;
private downloads: number = 0;
private downloadUrl: string = '';

Expand All @@ -21,12 +27,78 @@ export default class ThunderstoreVersion extends Mod implements ReactiveObjectCo
}

public fromReactive(reactive: any): ThunderstoreVersion {
super.fromReactive(reactive);
this.setName(reactive.name);
this.setVersionNumber(new VersionNumber('0.0.0').fromReactive(reactive.versionNumber));
this.setDependencies(reactive.dependencies);
this.setFullName(reactive.fullName);
this.setDescription(reactive.description);
this.setIcon(reactive.icon);
this.enabled = reactive.enabled;
this.setDownloadCount(reactive.downloadCount);
this.setDownloadUrl(reactive.downloadUrl);
return this;
}

public getName(): string {
return this.name;
}

public setName(name: string) {
this.name = name;
}

public getVersionNumber(): VersionNumber {
return this.versionNumber;
}

public setVersionNumber(versionNumber: VersionNumber) {
this.versionNumber = versionNumber;
}

public getDependencies(): string[] {
return this.dependencies;
}

public setDependencies(dependencies: string[]) {
this.dependencies = dependencies;
}

public getFullName(): string {
return this.fullName;
}

public setFullName(name: string) {
this.fullName = name;
}

public getDescription(): string {
return this.description;
}

public setDescription(description: string) {
this.description = description;
}

public getIcon(): string {
return this.icon;
}

public setIcon(icon: string) {
this.icon = icon;
}

public isEnabled(): boolean {
return this.enabled;
}

public enable() {
this.enabled = true;
}

public disable() {
this.enabled = false;
}

public getDownloadCount(): number {
return this.downloads;
}
Expand Down
59 changes: 0 additions & 59 deletions src/r2mm/mods/ModFromManifest.ts

This file was deleted.

0 comments on commit 5ba2cad

Please sign in to comment.