248 lines
7.1 KiB
TypeScript
Executable File
248 lines
7.1 KiB
TypeScript
Executable File
export namespace main {
|
|
|
|
export class FabricDefinition {
|
|
Separator: string;
|
|
Build: number;
|
|
Maven: string;
|
|
Version: string;
|
|
Stable: boolean;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new FabricDefinition(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.Separator = source["Separator"];
|
|
this.Build = source["Build"];
|
|
this.Maven = source["Maven"];
|
|
this.Version = source["Version"];
|
|
this.Stable = source["Stable"];
|
|
}
|
|
}
|
|
export class FabricLibrary {
|
|
Name: string;
|
|
Url: string;
|
|
Sha1: string;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new FabricLibrary(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.Name = source["Name"];
|
|
this.Url = source["Url"];
|
|
this.Sha1 = source["Sha1"];
|
|
}
|
|
}
|
|
export class FabricLibraries {
|
|
Client: FabricLibrary[];
|
|
Common: FabricLibrary[];
|
|
Server: FabricLibrary[];
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new FabricLibraries(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.Client = this.convertValues(source["Client"], FabricLibrary);
|
|
this.Common = this.convertValues(source["Common"], FabricLibrary);
|
|
this.Server = this.convertValues(source["Server"], FabricLibrary);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
|
|
export class FabricMeta {
|
|
Version: number;
|
|
Libraries: FabricLibraries;
|
|
MainClass: {[key: string]: string};
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new FabricMeta(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.Version = source["Version"];
|
|
this.Libraries = this.convertValues(source["Libraries"], FabricLibraries);
|
|
this.MainClass = source["MainClass"];
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
export class FabricVersion {
|
|
Loader: FabricDefinition;
|
|
Intermediary: FabricDefinition;
|
|
LauncherMeta: FabricMeta;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new FabricVersion(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.Loader = this.convertValues(source["Loader"], FabricDefinition);
|
|
this.Intermediary = this.convertValues(source["Intermediary"], FabricDefinition);
|
|
this.LauncherMeta = this.convertValues(source["LauncherMeta"], FabricMeta);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
export class Instance {
|
|
InstanceName: string;
|
|
ModpackId: string;
|
|
ModpackVersion: string;
|
|
MinecraftVersion: string;
|
|
ForgeVersion: string;
|
|
NeoForgeVersion: string;
|
|
FabricVersion: string;
|
|
QuiltVersion: string;
|
|
JavaVersion: number;
|
|
Libraries: string[];
|
|
MainClass: string;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new Instance(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.InstanceName = source["InstanceName"];
|
|
this.ModpackId = source["ModpackId"];
|
|
this.ModpackVersion = source["ModpackVersion"];
|
|
this.MinecraftVersion = source["MinecraftVersion"];
|
|
this.ForgeVersion = source["ForgeVersion"];
|
|
this.NeoForgeVersion = source["NeoForgeVersion"];
|
|
this.FabricVersion = source["FabricVersion"];
|
|
this.QuiltVersion = source["QuiltVersion"];
|
|
this.JavaVersion = source["JavaVersion"];
|
|
this.Libraries = source["Libraries"];
|
|
this.MainClass = source["MainClass"];
|
|
}
|
|
}
|
|
export class Version {
|
|
Version: string;
|
|
// Go type: time
|
|
Data: any;
|
|
File: string;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new Version(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.Version = source["Version"];
|
|
this.Data = this.convertValues(source["Data"], null);
|
|
this.File = source["File"];
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
export class Modpack {
|
|
Name: string;
|
|
Id: string;
|
|
Last_updated: string;
|
|
Versions: Version[];
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new Modpack(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.Name = source["Name"];
|
|
this.Id = source["Id"];
|
|
this.Last_updated = source["Last_updated"];
|
|
this.Versions = this.convertValues(source["Versions"], Version);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
|
|
}
|
|
|