Remove lombok dependency

This commit is contained in:
yangzhi 2023-06-20 17:50:35 +08:00
parent a26fec731d
commit 52f613b00d
24 changed files with 2708 additions and 169 deletions

View File

@ -112,7 +112,5 @@ dependencies {
implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}" implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}" implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
compileOnly 'org.projectlombok:lombok:1.18.16'
annotationProcessor 'org.projectlombok:lombok:1.18.16'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.6' coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.6'
} }

Binary file not shown.

View File

@ -2,32 +2,28 @@ package com.zane.smapiinstaller;
import android.app.Application; import android.app.Application;
import android.content.Context; import android.content.Context;
import com.hjq.language.MultiLanguages; import com.hjq.language.MultiLanguages;
import com.lzy.okgo.OkGo; import com.lzy.okgo.OkGo;
import com.zane.smapiinstaller.entity.DaoMaster; import com.zane.smapiinstaller.entity.DaoMaster;
import com.zane.smapiinstaller.entity.DaoSession; import com.zane.smapiinstaller.entity.DaoSession;
import com.zane.smapiinstaller.utils.DbOpenHelper; import com.zane.smapiinstaller.utils.DbOpenHelper;
import org.greenrobot.greendao.database.Database; import org.greenrobot.greendao.database.Database;
import androidx.multidex.MultiDex; import androidx.multidex.MultiDex;
import lombok.Getter;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
/** /**
* @author Zane * @author Zane
*/ */
@Getter
public class MainApplication extends Application { public class MainApplication extends Application {
private DaoSession daoSession; private DaoSession daoSession;
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
OkHttpClient okHttpClient = new OkHttpClient.Builder() OkHttpClient okHttpClient =
//开启Gzip压缩 //开启Gzip压缩
// .addInterceptor(new GzipRequestInterceptor()) // .addInterceptor(new GzipRequestInterceptor())
.build(); new OkHttpClient.Builder().build();
OkGo.getInstance().setOkHttpClient(okHttpClient).init(this); OkGo.getInstance().setOkHttpClient(okHttpClient).init(this);
MultiLanguages.init(this); MultiLanguages.init(this);
// note: DevOpenHelper is for dev only, use a OpenHelper subclass instead // note: DevOpenHelper is for dev only, use a OpenHelper subclass instead
@ -42,4 +38,11 @@ public class MainApplication extends Application {
super.attachBaseContext(MultiLanguages.attach(base)); super.attachBaseContext(MultiLanguages.attach(base));
MultiDex.install(this); MultiDex.install(this);
} }
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public DaoSession getDaoSession() {
return this.daoSession;
}
//</editor-fold>
} }

View File

@ -1,11 +1,8 @@
package com.zane.smapiinstaller.dto; package com.zane.smapiinstaller.dto;
import lombok.Data;
/** /**
* @author Zane * @author Zane
*/ */
@Data
public class AppUpdateCheckResultDto { public class AppUpdateCheckResultDto {
/** /**
* 版本号 * 版本号
@ -15,4 +12,79 @@ public class AppUpdateCheckResultDto {
* 版本名称 * 版本名称
*/ */
private String versionName; private String versionName;
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public AppUpdateCheckResultDto() {
}
/**
* 版本号
*/
@SuppressWarnings("all")
public long getVersionCode() {
return this.versionCode;
}
/**
* 版本名称
*/
@SuppressWarnings("all")
public String getVersionName() {
return this.versionName;
}
/**
* 版本号
*/
@SuppressWarnings("all")
public void setVersionCode(final long versionCode) {
this.versionCode = versionCode;
}
/**
* 版本名称
*/
@SuppressWarnings("all")
public void setVersionName(final String versionName) {
this.versionName = versionName;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof AppUpdateCheckResultDto)) return false;
final AppUpdateCheckResultDto other = (AppUpdateCheckResultDto) o;
if (!other.canEqual((Object) this)) return false;
if (this.getVersionCode() != other.getVersionCode()) return false;
final Object this$versionName = this.getVersionName();
final Object other$versionName = other.getVersionName();
if (this$versionName == null ? other$versionName != null : !this$versionName.equals(other$versionName)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof AppUpdateCheckResultDto;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
final long $versionCode = this.getVersionCode();
result = result * PRIME + (int) ($versionCode >>> 32 ^ $versionCode);
final Object $versionName = this.getVersionName();
result = result * PRIME + ($versionName == null ? 43 : $versionName.hashCode());
return result;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "AppUpdateCheckResultDto(versionCode=" + this.getVersionCode() + ", versionName=" + this.getVersionName() + ")";
}
//</editor-fold>
} }

View File

@ -1,8 +1,5 @@
package com.zane.smapiinstaller.dto; package com.zane.smapiinstaller.dto;
import lombok.Data;
@Data
public class AssemblyStoreAssembly { public class AssemblyStoreAssembly {
private Integer dataOffset; private Integer dataOffset;
private Integer dataSize; private Integer dataSize;
@ -10,4 +7,129 @@ public class AssemblyStoreAssembly {
private Integer debugDataSize; private Integer debugDataSize;
private Integer configDataOffset; private Integer configDataOffset;
private Integer configDataSize; private Integer configDataSize;
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public AssemblyStoreAssembly() {
}
@SuppressWarnings("all")
public Integer getDataOffset() {
return this.dataOffset;
}
@SuppressWarnings("all")
public Integer getDataSize() {
return this.dataSize;
}
@SuppressWarnings("all")
public Integer getDebugDataOffset() {
return this.debugDataOffset;
}
@SuppressWarnings("all")
public Integer getDebugDataSize() {
return this.debugDataSize;
}
@SuppressWarnings("all")
public Integer getConfigDataOffset() {
return this.configDataOffset;
}
@SuppressWarnings("all")
public Integer getConfigDataSize() {
return this.configDataSize;
}
@SuppressWarnings("all")
public void setDataOffset(final Integer dataOffset) {
this.dataOffset = dataOffset;
}
@SuppressWarnings("all")
public void setDataSize(final Integer dataSize) {
this.dataSize = dataSize;
}
@SuppressWarnings("all")
public void setDebugDataOffset(final Integer debugDataOffset) {
this.debugDataOffset = debugDataOffset;
}
@SuppressWarnings("all")
public void setDebugDataSize(final Integer debugDataSize) {
this.debugDataSize = debugDataSize;
}
@SuppressWarnings("all")
public void setConfigDataOffset(final Integer configDataOffset) {
this.configDataOffset = configDataOffset;
}
@SuppressWarnings("all")
public void setConfigDataSize(final Integer configDataSize) {
this.configDataSize = configDataSize;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof AssemblyStoreAssembly)) return false;
final AssemblyStoreAssembly other = (AssemblyStoreAssembly) o;
if (!other.canEqual((Object) this)) return false;
final Object this$dataOffset = this.getDataOffset();
final Object other$dataOffset = other.getDataOffset();
if (this$dataOffset == null ? other$dataOffset != null : !this$dataOffset.equals(other$dataOffset)) return false;
final Object this$dataSize = this.getDataSize();
final Object other$dataSize = other.getDataSize();
if (this$dataSize == null ? other$dataSize != null : !this$dataSize.equals(other$dataSize)) return false;
final Object this$debugDataOffset = this.getDebugDataOffset();
final Object other$debugDataOffset = other.getDebugDataOffset();
if (this$debugDataOffset == null ? other$debugDataOffset != null : !this$debugDataOffset.equals(other$debugDataOffset)) return false;
final Object this$debugDataSize = this.getDebugDataSize();
final Object other$debugDataSize = other.getDebugDataSize();
if (this$debugDataSize == null ? other$debugDataSize != null : !this$debugDataSize.equals(other$debugDataSize)) return false;
final Object this$configDataOffset = this.getConfigDataOffset();
final Object other$configDataOffset = other.getConfigDataOffset();
if (this$configDataOffset == null ? other$configDataOffset != null : !this$configDataOffset.equals(other$configDataOffset)) return false;
final Object this$configDataSize = this.getConfigDataSize();
final Object other$configDataSize = other.getConfigDataSize();
if (this$configDataSize == null ? other$configDataSize != null : !this$configDataSize.equals(other$configDataSize)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof AssemblyStoreAssembly;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $dataOffset = this.getDataOffset();
result = result * PRIME + ($dataOffset == null ? 43 : $dataOffset.hashCode());
final Object $dataSize = this.getDataSize();
result = result * PRIME + ($dataSize == null ? 43 : $dataSize.hashCode());
final Object $debugDataOffset = this.getDebugDataOffset();
result = result * PRIME + ($debugDataOffset == null ? 43 : $debugDataOffset.hashCode());
final Object $debugDataSize = this.getDebugDataSize();
result = result * PRIME + ($debugDataSize == null ? 43 : $debugDataSize.hashCode());
final Object $configDataOffset = this.getConfigDataOffset();
result = result * PRIME + ($configDataOffset == null ? 43 : $configDataOffset.hashCode());
final Object $configDataSize = this.getConfigDataSize();
result = result * PRIME + ($configDataSize == null ? 43 : $configDataSize.hashCode());
return result;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "AssemblyStoreAssembly(dataOffset=" + this.getDataOffset() + ", dataSize=" + this.getDataSize() + ", debugDataOffset=" + this.getDebugDataOffset() + ", debugDataSize=" + this.getDebugDataSize() + ", configDataOffset=" + this.getConfigDataOffset() + ", configDataSize=" + this.getConfigDataSize() + ")";
}
//</editor-fold>
} }

View File

@ -2,21 +2,173 @@ package com.zane.smapiinstaller.dto;
import java.util.List; import java.util.List;
import lombok.Data;
/** /**
* @author Zane * @author Zane
*/ */
@Data
public class GoogleTranslationDto { public class GoogleTranslationDto {
private List<Entry> sentences; private List<Entry> sentences;
private String src; private String src;
private double confidence; private double confidence;
@Data
public static class Entry { public static class Entry {
private String trans; private String trans;
private String orig; private String orig;
private int backend; private int backend;
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public Entry() {
} }
@SuppressWarnings("all")
public String getTrans() {
return this.trans;
}
@SuppressWarnings("all")
public String getOrig() {
return this.orig;
}
@SuppressWarnings("all")
public int getBackend() {
return this.backend;
}
@SuppressWarnings("all")
public void setTrans(final String trans) {
this.trans = trans;
}
@SuppressWarnings("all")
public void setOrig(final String orig) {
this.orig = orig;
}
@SuppressWarnings("all")
public void setBackend(final int backend) {
this.backend = backend;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof GoogleTranslationDto.Entry)) return false;
final GoogleTranslationDto.Entry other = (GoogleTranslationDto.Entry) o;
if (!other.canEqual((Object) this)) return false;
if (this.getBackend() != other.getBackend()) return false;
final Object this$trans = this.getTrans();
final Object other$trans = other.getTrans();
if (this$trans == null ? other$trans != null : !this$trans.equals(other$trans)) return false;
final Object this$orig = this.getOrig();
final Object other$orig = other.getOrig();
if (this$orig == null ? other$orig != null : !this$orig.equals(other$orig)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof GoogleTranslationDto.Entry;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
result = result * PRIME + this.getBackend();
final Object $trans = this.getTrans();
result = result * PRIME + ($trans == null ? 43 : $trans.hashCode());
final Object $orig = this.getOrig();
result = result * PRIME + ($orig == null ? 43 : $orig.hashCode());
return result;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "GoogleTranslationDto.Entry(trans=" + this.getTrans() + ", orig=" + this.getOrig() + ", backend=" + this.getBackend() + ")";
}
//</editor-fold>
}
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public GoogleTranslationDto() {
}
@SuppressWarnings("all")
public List<Entry> getSentences() {
return this.sentences;
}
@SuppressWarnings("all")
public String getSrc() {
return this.src;
}
@SuppressWarnings("all")
public double getConfidence() {
return this.confidence;
}
@SuppressWarnings("all")
public void setSentences(final List<Entry> sentences) {
this.sentences = sentences;
}
@SuppressWarnings("all")
public void setSrc(final String src) {
this.src = src;
}
@SuppressWarnings("all")
public void setConfidence(final double confidence) {
this.confidence = confidence;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof GoogleTranslationDto)) return false;
final GoogleTranslationDto other = (GoogleTranslationDto) o;
if (!other.canEqual((Object) this)) return false;
if (Double.compare(this.getConfidence(), other.getConfidence()) != 0) return false;
final Object this$sentences = this.getSentences();
final Object other$sentences = other.getSentences();
if (this$sentences == null ? other$sentences != null : !this$sentences.equals(other$sentences)) return false;
final Object this$src = this.getSrc();
final Object other$src = other.getSrc();
if (this$src == null ? other$src != null : !this$src.equals(other$src)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof GoogleTranslationDto;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
final long $confidence = Double.doubleToLongBits(this.getConfidence());
result = result * PRIME + (int) ($confidence >>> 32 ^ $confidence);
final Object $sentences = this.getSentences();
result = result * PRIME + ($sentences == null ? 43 : $sentences.hashCode());
final Object $src = this.getSrc();
result = result * PRIME + ($src == null ? 43 : $src.hashCode());
return result;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "GoogleTranslationDto(sentences=" + this.getSentences() + ", src=" + this.getSrc() + ", confidence=" + this.getConfidence() + ")";
}
//</editor-fold>
} }

View File

@ -1,15 +1,11 @@
package com.zane.smapiinstaller.dto; package com.zane.smapiinstaller.dto;
import android.webkit.JavascriptInterface; import android.webkit.JavascriptInterface;
import java.util.function.Consumer; import java.util.function.Consumer;
import lombok.AllArgsConstructor;
/** /**
* @author Zane * @author Zane
*/ */
@AllArgsConstructor
public class JsonEditorObject { public class JsonEditorObject {
private String text; private String text;
private String mode; private String mode;
@ -26,7 +22,7 @@ public class JsonEditorObject {
@JavascriptInterface @JavascriptInterface
public void setText(String text) { public void setText(String text) {
this.text = text; this.text = text;
if(setterCallback != null) { if (setterCallback != null) {
setterCallback.accept(text); setterCallback.accept(text);
} }
} }
@ -50,4 +46,16 @@ public class JsonEditorObject {
public String getLanguage() { public String getLanguage() {
return language; return language;
} }
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public JsonEditorObject(final String text, final String mode, final String language, final boolean editable, final int height, final Consumer<String> setterCallback) {
this.text = text;
this.mode = mode;
this.language = language;
this.editable = editable;
this.height = height;
this.setterCallback = setterCallback;
}
//</editor-fold>
} }

View File

@ -1,15 +1,11 @@
package com.zane.smapiinstaller.dto; package com.zane.smapiinstaller.dto;
import android.webkit.JavascriptInterface; import android.webkit.JavascriptInterface;
import java.util.function.Consumer; import java.util.function.Consumer;
import lombok.AllArgsConstructor;
/** /**
* @author Zane * @author Zane
*/ */
@AllArgsConstructor
public class KeyboardEditorObject { public class KeyboardEditorObject {
private String text; private String text;
private String language; private String language;
@ -27,7 +23,7 @@ public class KeyboardEditorObject {
@JavascriptInterface @JavascriptInterface
public void setText(String text) { public void setText(String text) {
this.text = text; this.text = text;
if(setterCallback != null) { if (setterCallback != null) {
setterCallback.accept(text); setterCallback.accept(text);
} }
} }
@ -56,4 +52,17 @@ public class KeyboardEditorObject {
public String getLanguage() { public String getLanguage() {
return language; return language;
} }
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public KeyboardEditorObject(final String text, final String language, final int height, final int width, final float scale, final boolean landscape, final Consumer<String> setterCallback) {
this.text = text;
this.language = language;
this.height = height;
this.width = width;
this.scale = scale;
this.landscape = landscape;
this.setterCallback = setterCallback;
}
//</editor-fold>
} }

View File

@ -1,30 +1,19 @@
package com.zane.smapiinstaller.dto; package com.zane.smapiinstaller.dto;
import android.util.Log; import android.util.Log;
import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.google.common.base.CharMatcher; import com.google.common.base.CharMatcher;
import com.google.common.base.Splitter; import com.google.common.base.Splitter;
import com.zane.smapiinstaller.constant.Constants; import com.zane.smapiinstaller.constant.Constants;
import com.zane.smapiinstaller.entity.ModManifestEntry; import com.zane.smapiinstaller.entity.ModManifestEntry;
import org.apache.commons.lang3.RegExUtils; import org.apache.commons.lang3.RegExUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.util.List; import java.util.List;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
/** /**
* @author Zane * @author Zane
*/ */
@Data
@RequiredArgsConstructor
public class ModUpdateCheckRequestDto { public class ModUpdateCheckRequestDto {
public ModUpdateCheckRequestDto(List<ModInfo> mods, SemanticVersion gameVersion) { public ModUpdateCheckRequestDto(List<ModInfo> mods, SemanticVersion gameVersion) {
this.mods = mods; this.mods = mods;
this.gameVersion = gameVersion; this.gameVersion = gameVersion;
@ -33,7 +22,6 @@ public class ModUpdateCheckRequestDto {
/** /**
* 待检查MOD列表 * 待检查MOD列表
*/ */
@NonNull
private List<ModInfo> mods; private List<ModInfo> mods;
/** /**
* SMAPI版本 * SMAPI版本
@ -52,7 +40,7 @@ public class ModUpdateCheckRequestDto {
*/ */
private boolean includeExtendedMetadata = false; private boolean includeExtendedMetadata = false;
@Data
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE) @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE)
public static class SemanticVersion { public static class SemanticVersion {
private int MajorVersion; private int MajorVersion;
@ -80,23 +68,20 @@ public class ModUpdateCheckRequestDto {
int i = 0; int i = 0;
if (versionSections.size() > i) { if (versionSections.size() > i) {
MajorVersion = Integer.parseInt(versionSections.get(i)); MajorVersion = Integer.parseInt(versionSections.get(i));
} } else {
else {
return; return;
} }
i++; i++;
if (versionSections.size() > i) { if (versionSections.size() > i) {
MinorVersion = Integer.parseInt(versionSections.get(i)); MinorVersion = Integer.parseInt(versionSections.get(i));
} } else {
else {
return; return;
} }
i++; i++;
// read optional patch version // read optional patch version
if (versionSections.size() > i) { if (versionSections.size() > i) {
PatchVersion = Integer.parseInt(versionSections.get(i)); PatchVersion = Integer.parseInt(versionSections.get(i));
} } else {
else {
return; return;
} }
i++; i++;
@ -104,8 +89,7 @@ public class ModUpdateCheckRequestDto {
try { try {
if (versionSections.size() > i) { if (versionSections.size() > i) {
PlatformRelease = Integer.parseInt(versionSections.get(i)); PlatformRelease = Integer.parseInt(versionSections.get(i));
} } else {
else {
return; return;
} }
} catch (NumberFormatException ignored) { } catch (NumberFormatException ignored) {
@ -114,8 +98,7 @@ public class ModUpdateCheckRequestDto {
versionSections = Splitter.on("-").limit(2).splitToList(versionStr); versionSections = Splitter.on("-").limit(2).splitToList(versionStr);
if (versionSections.size() > 1) { if (versionSections.size() > 1) {
PrereleaseTag = RegExUtils.removeFirst(versionSections.get(1), "\\+.*"); PrereleaseTag = RegExUtils.removeFirst(versionSections.get(1), "\\+.*");
} } else {
else {
return; return;
} }
// read optional build tag // read optional build tag
@ -124,10 +107,118 @@ public class ModUpdateCheckRequestDto {
BuildMetadata = versionSections.get(1); BuildMetadata = versionSections.get(1);
} }
} }
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public int getMajorVersion() {
return this.MajorVersion;
} }
@Data @SuppressWarnings("all")
@EqualsAndHashCode(of = "id") public int getMinorVersion() {
return this.MinorVersion;
}
@SuppressWarnings("all")
public int getPatchVersion() {
return this.PatchVersion;
}
@SuppressWarnings("all")
public int getPlatformRelease() {
return this.PlatformRelease;
}
@SuppressWarnings("all")
public String getPrereleaseTag() {
return this.PrereleaseTag;
}
@SuppressWarnings("all")
public String getBuildMetadata() {
return this.BuildMetadata;
}
@SuppressWarnings("all")
public void setMajorVersion(final int MajorVersion) {
this.MajorVersion = MajorVersion;
}
@SuppressWarnings("all")
public void setMinorVersion(final int MinorVersion) {
this.MinorVersion = MinorVersion;
}
@SuppressWarnings("all")
public void setPatchVersion(final int PatchVersion) {
this.PatchVersion = PatchVersion;
}
@SuppressWarnings("all")
public void setPlatformRelease(final int PlatformRelease) {
this.PlatformRelease = PlatformRelease;
}
@SuppressWarnings("all")
public void setPrereleaseTag(final String PrereleaseTag) {
this.PrereleaseTag = PrereleaseTag;
}
@SuppressWarnings("all")
public void setBuildMetadata(final String BuildMetadata) {
this.BuildMetadata = BuildMetadata;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof ModUpdateCheckRequestDto.SemanticVersion)) return false;
final ModUpdateCheckRequestDto.SemanticVersion other = (ModUpdateCheckRequestDto.SemanticVersion) o;
if (!other.canEqual((Object) this)) return false;
if (this.getMajorVersion() != other.getMajorVersion()) return false;
if (this.getMinorVersion() != other.getMinorVersion()) return false;
if (this.getPatchVersion() != other.getPatchVersion()) return false;
if (this.getPlatformRelease() != other.getPlatformRelease()) return false;
final Object this$PrereleaseTag = this.getPrereleaseTag();
final Object other$PrereleaseTag = other.getPrereleaseTag();
if (this$PrereleaseTag == null ? other$PrereleaseTag != null : !this$PrereleaseTag.equals(other$PrereleaseTag)) return false;
final Object this$BuildMetadata = this.getBuildMetadata();
final Object other$BuildMetadata = other.getBuildMetadata();
if (this$BuildMetadata == null ? other$BuildMetadata != null : !this$BuildMetadata.equals(other$BuildMetadata)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof ModUpdateCheckRequestDto.SemanticVersion;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
result = result * PRIME + this.getMajorVersion();
result = result * PRIME + this.getMinorVersion();
result = result * PRIME + this.getPatchVersion();
result = result * PRIME + this.getPlatformRelease();
final Object $PrereleaseTag = this.getPrereleaseTag();
result = result * PRIME + ($PrereleaseTag == null ? 43 : $PrereleaseTag.hashCode());
final Object $BuildMetadata = this.getBuildMetadata();
result = result * PRIME + ($BuildMetadata == null ? 43 : $BuildMetadata.hashCode());
return result;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "ModUpdateCheckRequestDto.SemanticVersion(MajorVersion=" + this.getMajorVersion() + ", MinorVersion=" + this.getMinorVersion() + ", PatchVersion=" + this.getPatchVersion() + ", PlatformRelease=" + this.getPlatformRelease() + ", PrereleaseTag=" + this.getPrereleaseTag() + ", BuildMetadata=" + this.getBuildMetadata() + ")";
}
//</editor-fold>
}
public static class ModInfo { public static class ModInfo {
private String id; private String id;
private List<String> updateKeys; private List<String> updateKeys;
@ -144,5 +235,219 @@ public class ModUpdateCheckRequestDto {
modInfo.setUpdateKeys(mod.getUpdateKeys()); modInfo.setUpdateKeys(mod.getUpdateKeys());
return modInfo; return modInfo;
} }
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public ModInfo() {
} }
@SuppressWarnings("all")
public String getId() {
return this.id;
}
@SuppressWarnings("all")
public List<String> getUpdateKeys() {
return this.updateKeys;
}
@SuppressWarnings("all")
public SemanticVersion getInstalledVersion() {
return this.installedVersion;
}
@SuppressWarnings("all")
public void setId(final String id) {
this.id = id;
}
@SuppressWarnings("all")
public void setUpdateKeys(final List<String> updateKeys) {
this.updateKeys = updateKeys;
}
@SuppressWarnings("all")
public void setInstalledVersion(final SemanticVersion installedVersion) {
this.installedVersion = installedVersion;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "ModUpdateCheckRequestDto.ModInfo(id=" + this.getId() + ", updateKeys=" + this.getUpdateKeys() + ", installedVersion=" + this.getInstalledVersion() + ")";
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof ModUpdateCheckRequestDto.ModInfo)) return false;
final ModUpdateCheckRequestDto.ModInfo other = (ModUpdateCheckRequestDto.ModInfo) o;
if (!other.canEqual((Object) this)) return false;
final Object this$id = this.getId();
final Object other$id = other.getId();
if (this$id == null ? other$id != null : !this$id.equals(other$id)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof ModUpdateCheckRequestDto.ModInfo;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $id = this.getId();
result = result * PRIME + ($id == null ? 43 : $id.hashCode());
return result;
}
//</editor-fold>
}
//<editor-fold defaultstate="collapsed" desc="delombok">
/**
* 待检查MOD列表
*/
@SuppressWarnings("all")
public List<ModInfo> getMods() {
return this.mods;
}
/**
* SMAPI版本
*/
@SuppressWarnings("all")
public SemanticVersion getApiVersion() {
return this.apiVersion;
}
/**
* 游戏版本
*/
@SuppressWarnings("all")
public SemanticVersion getGameVersion() {
return this.gameVersion;
}
/**
* 平台版本
*/
@SuppressWarnings("all")
public String getPlatform() {
return this.platform;
}
/**
* 是否拉取MOD详情
*/
@SuppressWarnings("all")
public boolean isIncludeExtendedMetadata() {
return this.includeExtendedMetadata;
}
/**
* 待检查MOD列表
*/
@SuppressWarnings("all")
public void setMods(final List<ModInfo> mods) {
if (mods == null) {
throw new NullPointerException("mods is marked non-null but is null");
}
this.mods = mods;
}
/**
* SMAPI版本
*/
@SuppressWarnings("all")
public void setApiVersion(final SemanticVersion apiVersion) {
this.apiVersion = apiVersion;
}
/**
* 游戏版本
*/
@SuppressWarnings("all")
public void setGameVersion(final SemanticVersion gameVersion) {
this.gameVersion = gameVersion;
}
/**
* 平台版本
*/
@SuppressWarnings("all")
public void setPlatform(final String platform) {
this.platform = platform;
}
/**
* 是否拉取MOD详情
*/
@SuppressWarnings("all")
public void setIncludeExtendedMetadata(final boolean includeExtendedMetadata) {
this.includeExtendedMetadata = includeExtendedMetadata;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof ModUpdateCheckRequestDto)) return false;
final ModUpdateCheckRequestDto other = (ModUpdateCheckRequestDto) o;
if (!other.canEqual((Object) this)) return false;
if (this.isIncludeExtendedMetadata() != other.isIncludeExtendedMetadata()) return false;
final Object this$mods = this.getMods();
final Object other$mods = other.getMods();
if (this$mods == null ? other$mods != null : !this$mods.equals(other$mods)) return false;
final Object this$apiVersion = this.getApiVersion();
final Object other$apiVersion = other.getApiVersion();
if (this$apiVersion == null ? other$apiVersion != null : !this$apiVersion.equals(other$apiVersion)) return false;
final Object this$gameVersion = this.getGameVersion();
final Object other$gameVersion = other.getGameVersion();
if (this$gameVersion == null ? other$gameVersion != null : !this$gameVersion.equals(other$gameVersion)) return false;
final Object this$platform = this.getPlatform();
final Object other$platform = other.getPlatform();
if (this$platform == null ? other$platform != null : !this$platform.equals(other$platform)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof ModUpdateCheckRequestDto;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
result = result * PRIME + (this.isIncludeExtendedMetadata() ? 79 : 97);
final Object $mods = this.getMods();
result = result * PRIME + ($mods == null ? 43 : $mods.hashCode());
final Object $apiVersion = this.getApiVersion();
result = result * PRIME + ($apiVersion == null ? 43 : $apiVersion.hashCode());
final Object $gameVersion = this.getGameVersion();
result = result * PRIME + ($gameVersion == null ? 43 : $gameVersion.hashCode());
final Object $platform = this.getPlatform();
result = result * PRIME + ($platform == null ? 43 : $platform.hashCode());
return result;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "ModUpdateCheckRequestDto(mods=" + this.getMods() + ", apiVersion=" + this.getApiVersion() + ", gameVersion=" + this.getGameVersion() + ", platform=" + this.getPlatform() + ", includeExtendedMetadata=" + this.isIncludeExtendedMetadata() + ")";
}
@SuppressWarnings("all")
public ModUpdateCheckRequestDto(final List<ModInfo> mods) {
if (mods == null) {
throw new NullPointerException("mods is marked non-null but is null");
}
this.mods = mods;
}
//</editor-fold>
} }

View File

@ -2,34 +2,310 @@ package com.zane.smapiinstaller.dto;
import java.util.List; import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/** /**
* @author Zane * @author Zane
*/ */
@Data
public class ModUpdateCheckResponseDto { public class ModUpdateCheckResponseDto {
private String id; private String id;
private UpdateInfo suggestedUpdate; private UpdateInfo suggestedUpdate;
private List<String> errors; private List<String> errors;
private Metadata metadata; private Metadata metadata;
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class UpdateInfo { public static class UpdateInfo {
private String version; private String version;
private String url; private String url;
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public String getVersion() {
return this.version;
} }
@Data @SuppressWarnings("all")
public String getUrl() {
return this.url;
}
@SuppressWarnings("all")
public void setVersion(final String version) {
this.version = version;
}
@SuppressWarnings("all")
public void setUrl(final String url) {
this.url = url;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof ModUpdateCheckResponseDto.UpdateInfo)) return false;
final ModUpdateCheckResponseDto.UpdateInfo other = (ModUpdateCheckResponseDto.UpdateInfo) o;
if (!other.canEqual((Object) this)) return false;
final Object this$version = this.getVersion();
final Object other$version = other.getVersion();
if (this$version == null ? other$version != null : !this$version.equals(other$version)) return false;
final Object this$url = this.getUrl();
final Object other$url = other.getUrl();
if (this$url == null ? other$url != null : !this$url.equals(other$url)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof ModUpdateCheckResponseDto.UpdateInfo;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $version = this.getVersion();
result = result * PRIME + ($version == null ? 43 : $version.hashCode());
final Object $url = this.getUrl();
result = result * PRIME + ($url == null ? 43 : $url.hashCode());
return result;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "ModUpdateCheckResponseDto.UpdateInfo(version=" + this.getVersion() + ", url=" + this.getUrl() + ")";
}
@SuppressWarnings("all")
public UpdateInfo() {
}
@SuppressWarnings("all")
public UpdateInfo(final String version, final String url) {
this.version = version;
this.url = url;
}
//</editor-fold>
}
public static class Metadata { public static class Metadata {
private Main main; private Main main;
@Data
public static class Main { public static class Main {
private String version; private String version;
private String url; private String url;
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public Main() {
} }
@SuppressWarnings("all")
public String getVersion() {
return this.version;
} }
@SuppressWarnings("all")
public String getUrl() {
return this.url;
}
@SuppressWarnings("all")
public void setVersion(final String version) {
this.version = version;
}
@SuppressWarnings("all")
public void setUrl(final String url) {
this.url = url;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof ModUpdateCheckResponseDto.Metadata.Main)) return false;
final ModUpdateCheckResponseDto.Metadata.Main other = (ModUpdateCheckResponseDto.Metadata.Main) o;
if (!other.canEqual((Object) this)) return false;
final Object this$version = this.getVersion();
final Object other$version = other.getVersion();
if (this$version == null ? other$version != null : !this$version.equals(other$version)) return false;
final Object this$url = this.getUrl();
final Object other$url = other.getUrl();
if (this$url == null ? other$url != null : !this$url.equals(other$url)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof ModUpdateCheckResponseDto.Metadata.Main;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $version = this.getVersion();
result = result * PRIME + ($version == null ? 43 : $version.hashCode());
final Object $url = this.getUrl();
result = result * PRIME + ($url == null ? 43 : $url.hashCode());
return result;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "ModUpdateCheckResponseDto.Metadata.Main(version=" + this.getVersion() + ", url=" + this.getUrl() + ")";
}
//</editor-fold>
}
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public Metadata() {
}
@SuppressWarnings("all")
public Main getMain() {
return this.main;
}
@SuppressWarnings("all")
public void setMain(final Main main) {
this.main = main;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof ModUpdateCheckResponseDto.Metadata)) return false;
final ModUpdateCheckResponseDto.Metadata other = (ModUpdateCheckResponseDto.Metadata) o;
if (!other.canEqual((Object) this)) return false;
final Object this$main = this.getMain();
final Object other$main = other.getMain();
if (this$main == null ? other$main != null : !this$main.equals(other$main)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof ModUpdateCheckResponseDto.Metadata;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $main = this.getMain();
result = result * PRIME + ($main == null ? 43 : $main.hashCode());
return result;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "ModUpdateCheckResponseDto.Metadata(main=" + this.getMain() + ")";
}
//</editor-fold>
}
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public ModUpdateCheckResponseDto() {
}
@SuppressWarnings("all")
public String getId() {
return this.id;
}
@SuppressWarnings("all")
public UpdateInfo getSuggestedUpdate() {
return this.suggestedUpdate;
}
@SuppressWarnings("all")
public List<String> getErrors() {
return this.errors;
}
@SuppressWarnings("all")
public Metadata getMetadata() {
return this.metadata;
}
@SuppressWarnings("all")
public void setId(final String id) {
this.id = id;
}
@SuppressWarnings("all")
public void setSuggestedUpdate(final UpdateInfo suggestedUpdate) {
this.suggestedUpdate = suggestedUpdate;
}
@SuppressWarnings("all")
public void setErrors(final List<String> errors) {
this.errors = errors;
}
@SuppressWarnings("all")
public void setMetadata(final Metadata metadata) {
this.metadata = metadata;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof ModUpdateCheckResponseDto)) return false;
final ModUpdateCheckResponseDto other = (ModUpdateCheckResponseDto) o;
if (!other.canEqual((Object) this)) return false;
final Object this$id = this.getId();
final Object other$id = other.getId();
if (this$id == null ? other$id != null : !this$id.equals(other$id)) return false;
final Object this$suggestedUpdate = this.getSuggestedUpdate();
final Object other$suggestedUpdate = other.getSuggestedUpdate();
if (this$suggestedUpdate == null ? other$suggestedUpdate != null : !this$suggestedUpdate.equals(other$suggestedUpdate)) return false;
final Object this$errors = this.getErrors();
final Object other$errors = other.getErrors();
if (this$errors == null ? other$errors != null : !this$errors.equals(other$errors)) return false;
final Object this$metadata = this.getMetadata();
final Object other$metadata = other.getMetadata();
if (this$metadata == null ? other$metadata != null : !this$metadata.equals(other$metadata)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof ModUpdateCheckResponseDto;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $id = this.getId();
result = result * PRIME + ($id == null ? 43 : $id.hashCode());
final Object $suggestedUpdate = this.getSuggestedUpdate();
result = result * PRIME + ($suggestedUpdate == null ? 43 : $suggestedUpdate.hashCode());
final Object $errors = this.getErrors();
result = result * PRIME + ($errors == null ? 43 : $errors.hashCode());
final Object $metadata = this.getMetadata();
result = result * PRIME + ($metadata == null ? 43 : $metadata.hashCode());
return result;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "ModUpdateCheckResponseDto(id=" + this.getId() + ", suggestedUpdate=" + this.getSuggestedUpdate() + ", errors=" + this.getErrors() + ", metadata=" + this.getMetadata() + ")";
}
//</editor-fold>
} }

View File

@ -1,11 +1,73 @@
package com.zane.smapiinstaller.dto; package com.zane.smapiinstaller.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class Tuple2<U, V> { public class Tuple2<U, V> {
private U first; private U first;
private V second; private V second;
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public U getFirst() {
return this.first;
}
@SuppressWarnings("all")
public V getSecond() {
return this.second;
}
@SuppressWarnings("all")
public void setFirst(final U first) {
this.first = first;
}
@SuppressWarnings("all")
public void setSecond(final V second) {
this.second = second;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof Tuple2)) return false;
final Tuple2<?, ?> other = (Tuple2<?, ?>) o;
if (!other.canEqual((Object) this)) return false;
final Object this$first = this.getFirst();
final Object other$first = other.getFirst();
if (this$first == null ? other$first != null : !this$first.equals(other$first)) return false;
final Object this$second = this.getSecond();
final Object other$second = other.getSecond();
if (this$second == null ? other$second != null : !this$second.equals(other$second)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof Tuple2;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $first = this.getFirst();
result = result * PRIME + ($first == null ? 43 : $first.hashCode());
final Object $second = this.getSecond();
result = result * PRIME + ($second == null ? 43 : $second.hashCode());
return result;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "Tuple2(first=" + this.getFirst() + ", second=" + this.getSecond() + ")";
}
@SuppressWarnings("all")
public Tuple2(final U first, final V second) {
this.first = first;
this.second = second;
}
//</editor-fold>
} }

View File

@ -2,21 +2,172 @@ package com.zane.smapiinstaller.dto;
import java.util.List; import java.util.List;
import lombok.Data;
/** /**
* @author Zane * @author Zane
*/ */
@Data
public class YouDaoTranslationDto { public class YouDaoTranslationDto {
private String type; private String type;
private int errorCode; private int errorCode;
private int elapsedTime; private int elapsedTime;
private List<List<Entry>> translateResult; private List<List<Entry>> translateResult;
@Data
public static class Entry { public static class Entry {
private String src; private String src;
private String tgt; private String tgt;
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public Entry() {
} }
@SuppressWarnings("all")
public String getSrc() {
return this.src;
}
@SuppressWarnings("all")
public String getTgt() {
return this.tgt;
}
@SuppressWarnings("all")
public void setSrc(final String src) {
this.src = src;
}
@SuppressWarnings("all")
public void setTgt(final String tgt) {
this.tgt = tgt;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof YouDaoTranslationDto.Entry)) return false;
final YouDaoTranslationDto.Entry other = (YouDaoTranslationDto.Entry) o;
if (!other.canEqual((Object) this)) return false;
final Object this$src = this.getSrc();
final Object other$src = other.getSrc();
if (this$src == null ? other$src != null : !this$src.equals(other$src)) return false;
final Object this$tgt = this.getTgt();
final Object other$tgt = other.getTgt();
if (this$tgt == null ? other$tgt != null : !this$tgt.equals(other$tgt)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof YouDaoTranslationDto.Entry;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $src = this.getSrc();
result = result * PRIME + ($src == null ? 43 : $src.hashCode());
final Object $tgt = this.getTgt();
result = result * PRIME + ($tgt == null ? 43 : $tgt.hashCode());
return result;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "YouDaoTranslationDto.Entry(src=" + this.getSrc() + ", tgt=" + this.getTgt() + ")";
}
//</editor-fold>
}
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public YouDaoTranslationDto() {
}
@SuppressWarnings("all")
public String getType() {
return this.type;
}
@SuppressWarnings("all")
public int getErrorCode() {
return this.errorCode;
}
@SuppressWarnings("all")
public int getElapsedTime() {
return this.elapsedTime;
}
@SuppressWarnings("all")
public List<List<Entry>> getTranslateResult() {
return this.translateResult;
}
@SuppressWarnings("all")
public void setType(final String type) {
this.type = type;
}
@SuppressWarnings("all")
public void setErrorCode(final int errorCode) {
this.errorCode = errorCode;
}
@SuppressWarnings("all")
public void setElapsedTime(final int elapsedTime) {
this.elapsedTime = elapsedTime;
}
@SuppressWarnings("all")
public void setTranslateResult(final List<List<Entry>> translateResult) {
this.translateResult = translateResult;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof YouDaoTranslationDto)) return false;
final YouDaoTranslationDto other = (YouDaoTranslationDto) o;
if (!other.canEqual((Object) this)) return false;
if (this.getErrorCode() != other.getErrorCode()) return false;
if (this.getElapsedTime() != other.getElapsedTime()) return false;
final Object this$type = this.getType();
final Object other$type = other.getType();
if (this$type == null ? other$type != null : !this$type.equals(other$type)) return false;
final Object this$translateResult = this.getTranslateResult();
final Object other$translateResult = other.getTranslateResult();
if (this$translateResult == null ? other$translateResult != null : !this$translateResult.equals(other$translateResult)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof YouDaoTranslationDto;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
result = result * PRIME + this.getErrorCode();
result = result * PRIME + this.getElapsedTime();
final Object $type = this.getType();
result = result * PRIME + ($type == null ? 43 : $type.hashCode());
final Object $translateResult = this.getTranslateResult();
result = result * PRIME + ($translateResult == null ? 43 : $translateResult.hashCode());
return result;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "YouDaoTranslationDto(type=" + this.getType() + ", errorCode=" + this.getErrorCode() + ", elapsedTime=" + this.getElapsedTime() + ", translateResult=" + this.getTranslateResult() + ")";
}
//</editor-fold>
} }

View File

@ -3,13 +3,10 @@ package com.zane.smapiinstaller.entity;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import lombok.Data;
/** /**
* SMAPI所需处理的文件清单 * SMAPI所需处理的文件清单
* @author Zane * @author Zane
*/ */
@Data
public class ApkFilesManifest { public class ApkFilesManifest {
/** /**
* 最小兼容版本包含 * 最小兼容版本包含
@ -23,10 +20,141 @@ public class ApkFilesManifest {
* 兼容包基础文件路径 * 兼容包基础文件路径
*/ */
private String basePath; private String basePath;
private Set<String> targetPackageName; private Set<String> targetPackageName;
/** /**
* 文件清单 * 文件清单
*/ */
private List<ManifestEntry> manifestEntries; private List<ManifestEntry> manifestEntries;
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public ApkFilesManifest() {
}
/**
* 最小兼容版本包含
*/
@SuppressWarnings("all")
public long getMinBuildCode() {
return this.minBuildCode;
}
/**
* 最大兼容版本包含
*/
@SuppressWarnings("all")
public Long getMaxBuildCode() {
return this.maxBuildCode;
}
/**
* 兼容包基础文件路径
*/
@SuppressWarnings("all")
public String getBasePath() {
return this.basePath;
}
@SuppressWarnings("all")
public Set<String> getTargetPackageName() {
return this.targetPackageName;
}
/**
* 文件清单
*/
@SuppressWarnings("all")
public List<ManifestEntry> getManifestEntries() {
return this.manifestEntries;
}
/**
* 最小兼容版本包含
*/
@SuppressWarnings("all")
public void setMinBuildCode(final long minBuildCode) {
this.minBuildCode = minBuildCode;
}
/**
* 最大兼容版本包含
*/
@SuppressWarnings("all")
public void setMaxBuildCode(final Long maxBuildCode) {
this.maxBuildCode = maxBuildCode;
}
/**
* 兼容包基础文件路径
*/
@SuppressWarnings("all")
public void setBasePath(final String basePath) {
this.basePath = basePath;
}
@SuppressWarnings("all")
public void setTargetPackageName(final Set<String> targetPackageName) {
this.targetPackageName = targetPackageName;
}
/**
* 文件清单
*/
@SuppressWarnings("all")
public void setManifestEntries(final List<ManifestEntry> manifestEntries) {
this.manifestEntries = manifestEntries;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof ApkFilesManifest)) return false;
final ApkFilesManifest other = (ApkFilesManifest) o;
if (!other.canEqual((Object) this)) return false;
if (this.getMinBuildCode() != other.getMinBuildCode()) return false;
final Object this$maxBuildCode = this.getMaxBuildCode();
final Object other$maxBuildCode = other.getMaxBuildCode();
if (this$maxBuildCode == null ? other$maxBuildCode != null : !this$maxBuildCode.equals(other$maxBuildCode)) return false;
final Object this$basePath = this.getBasePath();
final Object other$basePath = other.getBasePath();
if (this$basePath == null ? other$basePath != null : !this$basePath.equals(other$basePath)) return false;
final Object this$targetPackageName = this.getTargetPackageName();
final Object other$targetPackageName = other.getTargetPackageName();
if (this$targetPackageName == null ? other$targetPackageName != null : !this$targetPackageName.equals(other$targetPackageName)) return false;
final Object this$manifestEntries = this.getManifestEntries();
final Object other$manifestEntries = other.getManifestEntries();
if (this$manifestEntries == null ? other$manifestEntries != null : !this$manifestEntries.equals(other$manifestEntries)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof ApkFilesManifest;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
final long $minBuildCode = this.getMinBuildCode();
result = result * PRIME + (int) ($minBuildCode >>> 32 ^ $minBuildCode);
final Object $maxBuildCode = this.getMaxBuildCode();
result = result * PRIME + ($maxBuildCode == null ? 43 : $maxBuildCode.hashCode());
final Object $basePath = this.getBasePath();
result = result * PRIME + ($basePath == null ? 43 : $basePath.hashCode());
final Object $targetPackageName = this.getTargetPackageName();
result = result * PRIME + ($targetPackageName == null ? 43 : $targetPackageName.hashCode());
final Object $manifestEntries = this.getManifestEntries();
result = result * PRIME + ($manifestEntries == null ? 43 : $manifestEntries.hashCode());
return result;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "ApkFilesManifest(minBuildCode=" + this.getMinBuildCode() + ", maxBuildCode=" + this.getMaxBuildCode() + ", basePath=" + this.getBasePath() + ", targetPackageName=" + this.getTargetPackageName() + ", manifestEntries=" + this.getManifestEntries() + ")";
}
//</editor-fold>
} }

View File

@ -1,12 +1,9 @@
package com.zane.smapiinstaller.entity; package com.zane.smapiinstaller.entity;
import lombok.Data;
/** /**
* 可下载内容包 * 可下载内容包
* @author Zane * @author Zane
*/ */
@Data
public class DownloadableContent { public class DownloadableContent {
/** /**
* 类型COMPAT:兼容包/LOCALE:语言包 * 类型COMPAT:兼容包/LOCALE:语言包
@ -32,4 +29,165 @@ public class DownloadableContent {
* 文件SHA3-256校验码 * 文件SHA3-256校验码
*/ */
private String hash; private String hash;
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public DownloadableContent() {
}
/**
* 类型COMPAT:兼容包/LOCALE:语言包
*/
@SuppressWarnings("all")
public String getType() {
return this.type;
}
/**
* 名称
*/
@SuppressWarnings("all")
public String getName() {
return this.name;
}
/**
* 资源存放位置
*/
@SuppressWarnings("all")
public String getAssetPath() {
return this.assetPath;
}
/**
* 下载位置
*/
@SuppressWarnings("all")
public String getUrl() {
return this.url;
}
/**
* 描述
*/
@SuppressWarnings("all")
public String getDescription() {
return this.description;
}
/**
* 文件SHA3-256校验码
*/
@SuppressWarnings("all")
public String getHash() {
return this.hash;
}
/**
* 类型COMPAT:兼容包/LOCALE:语言包
*/
@SuppressWarnings("all")
public void setType(final String type) {
this.type = type;
}
/**
* 名称
*/
@SuppressWarnings("all")
public void setName(final String name) {
this.name = name;
}
/**
* 资源存放位置
*/
@SuppressWarnings("all")
public void setAssetPath(final String assetPath) {
this.assetPath = assetPath;
}
/**
* 下载位置
*/
@SuppressWarnings("all")
public void setUrl(final String url) {
this.url = url;
}
/**
* 描述
*/
@SuppressWarnings("all")
public void setDescription(final String description) {
this.description = description;
}
/**
* 文件SHA3-256校验码
*/
@SuppressWarnings("all")
public void setHash(final String hash) {
this.hash = hash;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof DownloadableContent)) return false;
final DownloadableContent other = (DownloadableContent) o;
if (!other.canEqual((Object) this)) return false;
final Object this$type = this.getType();
final Object other$type = other.getType();
if (this$type == null ? other$type != null : !this$type.equals(other$type)) return false;
final Object this$name = this.getName();
final Object other$name = other.getName();
if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false;
final Object this$assetPath = this.getAssetPath();
final Object other$assetPath = other.getAssetPath();
if (this$assetPath == null ? other$assetPath != null : !this$assetPath.equals(other$assetPath)) return false;
final Object this$url = this.getUrl();
final Object other$url = other.getUrl();
if (this$url == null ? other$url != null : !this$url.equals(other$url)) return false;
final Object this$description = this.getDescription();
final Object other$description = other.getDescription();
if (this$description == null ? other$description != null : !this$description.equals(other$description)) return false;
final Object this$hash = this.getHash();
final Object other$hash = other.getHash();
if (this$hash == null ? other$hash != null : !this$hash.equals(other$hash)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof DownloadableContent;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $type = this.getType();
result = result * PRIME + ($type == null ? 43 : $type.hashCode());
final Object $name = this.getName();
result = result * PRIME + ($name == null ? 43 : $name.hashCode());
final Object $assetPath = this.getAssetPath();
result = result * PRIME + ($assetPath == null ? 43 : $assetPath.hashCode());
final Object $url = this.getUrl();
result = result * PRIME + ($url == null ? 43 : $url.hashCode());
final Object $description = this.getDescription();
result = result * PRIME + ($description == null ? 43 : $description.hashCode());
final Object $hash = this.getHash();
result = result * PRIME + ($hash == null ? 43 : $hash.hashCode());
return result;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "DownloadableContent(type=" + this.getType() + ", name=" + this.getName() + ", assetPath=" + this.getAssetPath() + ", url=" + this.getUrl() + ", description=" + this.getDescription() + ", hash=" + this.getHash() + ")";
}
//</editor-fold>
} }

View File

@ -2,18 +2,70 @@ package com.zane.smapiinstaller.entity;
import java.util.List; import java.util.List;
import lombok.Data;
import lombok.EqualsAndHashCode;
/** /**
* 可下载内容列表 * 可下载内容列表
* @author Zane * @author Zane
*/ */
@Data
@EqualsAndHashCode(callSuper = true)
public class DownloadableContentList extends UpdatableList { public class DownloadableContentList extends UpdatableList {
/** /**
* 列表 * 列表
*/ */
List<DownloadableContent> contents; List<DownloadableContent> contents;
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public DownloadableContentList() {
}
/**
* 列表
*/
@SuppressWarnings("all")
public List<DownloadableContent> getContents() {
return this.contents;
}
/**
* 列表
*/
@SuppressWarnings("all")
public void setContents(final List<DownloadableContent> contents) {
this.contents = contents;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "DownloadableContentList(contents=" + this.getContents() + ")";
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof DownloadableContentList)) return false;
final DownloadableContentList other = (DownloadableContentList) o;
if (!other.canEqual((Object) this)) return false;
if (!super.equals(o)) return false;
final Object this$contents = this.getContents();
final Object other$contents = other.getContents();
if (this$contents == null ? other$contents != null : !this$contents.equals(other$contents)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof DownloadableContentList;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = super.hashCode();
final Object $contents = this.getContents();
result = result * PRIME + ($contents == null ? 43 : $contents.hashCode());
return result;
}
//</editor-fold>
} }

View File

@ -4,14 +4,11 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
/** /**
* SMAPI的配置 * SMAPI的配置
* @author Zane * @author Zane
*/ */
@Data @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE)
@JsonAutoDetect(fieldVisibility=JsonAutoDetect.Visibility.ANY, getterVisibility= JsonAutoDetect.Visibility.NONE)
public class FrameworkConfig { public class FrameworkConfig {
@JsonIgnore @JsonIgnore
private transient boolean initial; private transient boolean initial;
@ -30,22 +27,182 @@ public class FrameworkConfig {
*/ */
@JsonProperty("DeveloperMode") @JsonProperty("DeveloperMode")
private boolean DeveloperMode = false; private boolean DeveloperMode = false;
/** /**
* 禁用MonoMod * 禁用MonoMod
*/ */
@JsonProperty("DisableMonoMod") @JsonProperty("DisableMonoMod")
private boolean DisableMonoMod = false; private boolean DisableMonoMod = false;
/** /**
* 是否启用重写丢失的引用点 * 是否启用重写丢失的引用点
*/ */
@JsonProperty("RewriteMissing") @JsonProperty("RewriteMissing")
private boolean RewriteMissing = false; private boolean RewriteMissing = false;
/** /**
* Mod存放位置 * Mod存放位置
*/ */
@JsonProperty("ModsPath") @JsonProperty("ModsPath")
private String ModsPath = "StardewValley/Mods"; private String ModsPath = "StardewValley/Mods";
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public FrameworkConfig() {
}
@SuppressWarnings("all")
public boolean isInitial() {
return this.initial;
}
/**
* 详细日志
*/
@SuppressWarnings("all")
public boolean isVerboseLogging() {
return this.VerboseLogging;
}
/**
* 检查更新
*/
@SuppressWarnings("all")
public boolean isCheckForUpdates() {
return this.CheckForUpdates;
}
/**
* 开发者模式
*/
@SuppressWarnings("all")
public boolean isDeveloperMode() {
return this.DeveloperMode;
}
/**
* 禁用MonoMod
*/
@SuppressWarnings("all")
public boolean isDisableMonoMod() {
return this.DisableMonoMod;
}
/**
* 是否启用重写丢失的引用点
*/
@SuppressWarnings("all")
public boolean isRewriteMissing() {
return this.RewriteMissing;
}
/**
* Mod存放位置
*/
@SuppressWarnings("all")
public String getModsPath() {
return this.ModsPath;
}
@JsonIgnore
@SuppressWarnings("all")
public void setInitial(final boolean initial) {
this.initial = initial;
}
/**
* 详细日志
*/
@JsonProperty("VerboseLogging")
@SuppressWarnings("all")
public void setVerboseLogging(final boolean VerboseLogging) {
this.VerboseLogging = VerboseLogging;
}
/**
* 检查更新
*/
@JsonProperty("CheckForUpdates")
@SuppressWarnings("all")
public void setCheckForUpdates(final boolean CheckForUpdates) {
this.CheckForUpdates = CheckForUpdates;
}
/**
* 开发者模式
*/
@JsonProperty("DeveloperMode")
@SuppressWarnings("all")
public void setDeveloperMode(final boolean DeveloperMode) {
this.DeveloperMode = DeveloperMode;
}
/**
* 禁用MonoMod
*/
@JsonProperty("DisableMonoMod")
@SuppressWarnings("all")
public void setDisableMonoMod(final boolean DisableMonoMod) {
this.DisableMonoMod = DisableMonoMod;
}
/**
* 是否启用重写丢失的引用点
*/
@JsonProperty("RewriteMissing")
@SuppressWarnings("all")
public void setRewriteMissing(final boolean RewriteMissing) {
this.RewriteMissing = RewriteMissing;
}
/**
* Mod存放位置
*/
@JsonProperty("ModsPath")
@SuppressWarnings("all")
public void setModsPath(final String ModsPath) {
this.ModsPath = ModsPath;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof FrameworkConfig)) return false;
final FrameworkConfig other = (FrameworkConfig) o;
if (!other.canEqual((Object) this)) return false;
if (this.isVerboseLogging() != other.isVerboseLogging()) return false;
if (this.isCheckForUpdates() != other.isCheckForUpdates()) return false;
if (this.isDeveloperMode() != other.isDeveloperMode()) return false;
if (this.isDisableMonoMod() != other.isDisableMonoMod()) return false;
if (this.isRewriteMissing() != other.isRewriteMissing()) return false;
final Object this$ModsPath = this.getModsPath();
final Object other$ModsPath = other.getModsPath();
if (this$ModsPath == null ? other$ModsPath != null : !this$ModsPath.equals(other$ModsPath)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof FrameworkConfig;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
result = result * PRIME + (this.isVerboseLogging() ? 79 : 97);
result = result * PRIME + (this.isCheckForUpdates() ? 79 : 97);
result = result * PRIME + (this.isDeveloperMode() ? 79 : 97);
result = result * PRIME + (this.isDisableMonoMod() ? 79 : 97);
result = result * PRIME + (this.isRewriteMissing() ? 79 : 97);
final Object $ModsPath = this.getModsPath();
result = result * PRIME + ($ModsPath == null ? 43 : $ModsPath.hashCode());
return result;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "FrameworkConfig(initial=" + this.isInitial() + ", VerboseLogging=" + this.isVerboseLogging() + ", CheckForUpdates=" + this.isCheckForUpdates() + ", DeveloperMode=" + this.isDeveloperMode() + ", DisableMonoMod=" + this.isDisableMonoMod() + ", RewriteMissing=" + this.isRewriteMissing() + ", ModsPath=" + this.getModsPath() + ")";
}
//</editor-fold>
} }

View File

@ -1,12 +1,9 @@
package com.zane.smapiinstaller.entity; package com.zane.smapiinstaller.entity;
import lombok.Data;
/** /**
* 帮助信息 * 帮助信息
* @author Zane * @author Zane
*/ */
@Data
public class HelpItem { public class HelpItem {
/** /**
* 标题 * 标题
@ -20,4 +17,102 @@ public class HelpItem {
* 作者 * 作者
*/ */
private String author; private String author;
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public HelpItem() {
}
/**
* 标题
*/
@SuppressWarnings("all")
public String getTitle() {
return this.title;
}
/**
* 内容
*/
@SuppressWarnings("all")
public String getContent() {
return this.content;
}
/**
* 作者
*/
@SuppressWarnings("all")
public String getAuthor() {
return this.author;
}
/**
* 标题
*/
@SuppressWarnings("all")
public void setTitle(final String title) {
this.title = title;
}
/**
* 内容
*/
@SuppressWarnings("all")
public void setContent(final String content) {
this.content = content;
}
/**
* 作者
*/
@SuppressWarnings("all")
public void setAuthor(final String author) {
this.author = author;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof HelpItem)) return false;
final HelpItem other = (HelpItem) o;
if (!other.canEqual((Object) this)) return false;
final Object this$title = this.getTitle();
final Object other$title = other.getTitle();
if (this$title == null ? other$title != null : !this$title.equals(other$title)) return false;
final Object this$content = this.getContent();
final Object other$content = other.getContent();
if (this$content == null ? other$content != null : !this$content.equals(other$content)) return false;
final Object this$author = this.getAuthor();
final Object other$author = other.getAuthor();
if (this$author == null ? other$author != null : !this$author.equals(other$author)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof HelpItem;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $title = this.getTitle();
result = result * PRIME + ($title == null ? 43 : $title.hashCode());
final Object $content = this.getContent();
result = result * PRIME + ($content == null ? 43 : $content.hashCode());
final Object $author = this.getAuthor();
result = result * PRIME + ($author == null ? 43 : $author.hashCode());
return result;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "HelpItem(title=" + this.getTitle() + ", content=" + this.getContent() + ", author=" + this.getAuthor() + ")";
}
//</editor-fold>
} }

View File

@ -2,18 +2,70 @@ package com.zane.smapiinstaller.entity;
import java.util.List; import java.util.List;
import lombok.Data;
import lombok.EqualsAndHashCode;
/** /**
* 帮助内容列表 * 帮助内容列表
* @author Zane * @author Zane
*/ */
@Data
@EqualsAndHashCode(callSuper = true)
public class HelpItemList extends UpdatableList { public class HelpItemList extends UpdatableList {
/** /**
* 列表 * 列表
*/ */
private List<HelpItem> items; private List<HelpItem> items;
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public HelpItemList() {
}
/**
* 列表
*/
@SuppressWarnings("all")
public List<HelpItem> getItems() {
return this.items;
}
/**
* 列表
*/
@SuppressWarnings("all")
public void setItems(final List<HelpItem> items) {
this.items = items;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "HelpItemList(items=" + this.getItems() + ")";
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof HelpItemList)) return false;
final HelpItemList other = (HelpItemList) o;
if (!other.canEqual((Object) this)) return false;
if (!super.equals(o)) return false;
final Object this$items = this.getItems();
final Object other$items = other.getItems();
if (this$items == null ? other$items != null : !this$items.equals(other$items)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof HelpItemList;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = super.hashCode();
final Object $items = this.getItems();
result = result * PRIME + ($items == null ? 43 : $items.hashCode());
return result;
}
//</editor-fold>
} }

View File

@ -2,13 +2,10 @@ package com.zane.smapiinstaller.entity;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
/** /**
* 文件映射关系 * 文件映射关系
* @author Zane * @author Zane
*/ */
@Data
public class ManifestEntry { public class ManifestEntry {
/** /**
* 目标路径 * 目标路径
@ -30,17 +27,14 @@ public class ManifestEntry {
* 文件是否不属于兼容包中 * 文件是否不属于兼容包中
*/ */
private boolean external; private boolean external;
/** /**
* 补丁CRC * 补丁CRC
*/ */
private String patchCrc; private String patchCrc;
/** /**
* 补丁后CRC * 补丁后CRC
*/ */
private String patchedCrc; private String patchedCrc;
/** /**
* 是否为高级模式补丁 * 是否为高级模式补丁
*/ */
@ -55,4 +49,233 @@ public class ManifestEntry {
*/ */
@JsonProperty("isXABA") @JsonProperty("isXABA")
private boolean isXABA; private boolean isXABA;
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public ManifestEntry() {
}
/**
* 目标路径
*/
@SuppressWarnings("all")
public String getTargetPath() {
return this.targetPath;
}
/**
* 资源路径
*/
@SuppressWarnings("all")
public String getAssetPath() {
return this.assetPath;
}
/**
* 压缩级别
*/
@SuppressWarnings("all")
public int getCompression() {
return this.compression;
}
/**
* 来源位置0:安装器自带/1:从APK中抽取
*/
@SuppressWarnings("all")
public int getOrigin() {
return this.origin;
}
/**
* 文件是否不属于兼容包中
*/
@SuppressWarnings("all")
public boolean isExternal() {
return this.external;
}
/**
* 补丁CRC
*/
@SuppressWarnings("all")
public String getPatchCrc() {
return this.patchCrc;
}
/**
* 补丁后CRC
*/
@SuppressWarnings("all")
public String getPatchedCrc() {
return this.patchedCrc;
}
/**
* 是否为高级模式补丁
*/
@SuppressWarnings("all")
public boolean isAdvanced() {
return this.advanced;
}
/**
* 是否为XALZ压缩格式
*/
@SuppressWarnings("all")
public boolean isXALZ() {
return this.isXALZ;
}
/**
* 是否为XABA压缩格式
*/
@SuppressWarnings("all")
public boolean isXABA() {
return this.isXABA;
}
/**
* 目标路径
*/
@SuppressWarnings("all")
public void setTargetPath(final String targetPath) {
this.targetPath = targetPath;
}
/**
* 资源路径
*/
@SuppressWarnings("all")
public void setAssetPath(final String assetPath) {
this.assetPath = assetPath;
}
/**
* 压缩级别
*/
@SuppressWarnings("all")
public void setCompression(final int compression) {
this.compression = compression;
}
/**
* 来源位置0:安装器自带/1:从APK中抽取
*/
@SuppressWarnings("all")
public void setOrigin(final int origin) {
this.origin = origin;
}
/**
* 文件是否不属于兼容包中
*/
@SuppressWarnings("all")
public void setExternal(final boolean external) {
this.external = external;
}
/**
* 补丁CRC
*/
@SuppressWarnings("all")
public void setPatchCrc(final String patchCrc) {
this.patchCrc = patchCrc;
}
/**
* 补丁后CRC
*/
@SuppressWarnings("all")
public void setPatchedCrc(final String patchedCrc) {
this.patchedCrc = patchedCrc;
}
/**
* 是否为高级模式补丁
*/
@SuppressWarnings("all")
public void setAdvanced(final boolean advanced) {
this.advanced = advanced;
}
/**
* 是否为XALZ压缩格式
*/
@JsonProperty("isXALZ")
@SuppressWarnings("all")
public void setXALZ(final boolean isXALZ) {
this.isXALZ = isXALZ;
}
/**
* 是否为XABA压缩格式
*/
@JsonProperty("isXABA")
@SuppressWarnings("all")
public void setXABA(final boolean isXABA) {
this.isXABA = isXABA;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof ManifestEntry)) return false;
final ManifestEntry other = (ManifestEntry) o;
if (!other.canEqual((Object) this)) return false;
if (this.getCompression() != other.getCompression()) return false;
if (this.getOrigin() != other.getOrigin()) return false;
if (this.isExternal() != other.isExternal()) return false;
if (this.isAdvanced() != other.isAdvanced()) return false;
if (this.isXALZ() != other.isXALZ()) return false;
if (this.isXABA() != other.isXABA()) return false;
final Object this$targetPath = this.getTargetPath();
final Object other$targetPath = other.getTargetPath();
if (this$targetPath == null ? other$targetPath != null : !this$targetPath.equals(other$targetPath)) return false;
final Object this$assetPath = this.getAssetPath();
final Object other$assetPath = other.getAssetPath();
if (this$assetPath == null ? other$assetPath != null : !this$assetPath.equals(other$assetPath)) return false;
final Object this$patchCrc = this.getPatchCrc();
final Object other$patchCrc = other.getPatchCrc();
if (this$patchCrc == null ? other$patchCrc != null : !this$patchCrc.equals(other$patchCrc)) return false;
final Object this$patchedCrc = this.getPatchedCrc();
final Object other$patchedCrc = other.getPatchedCrc();
if (this$patchedCrc == null ? other$patchedCrc != null : !this$patchedCrc.equals(other$patchedCrc)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof ManifestEntry;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
result = result * PRIME + this.getCompression();
result = result * PRIME + this.getOrigin();
result = result * PRIME + (this.isExternal() ? 79 : 97);
result = result * PRIME + (this.isAdvanced() ? 79 : 97);
result = result * PRIME + (this.isXALZ() ? 79 : 97);
result = result * PRIME + (this.isXABA() ? 79 : 97);
final Object $targetPath = this.getTargetPath();
result = result * PRIME + ($targetPath == null ? 43 : $targetPath.hashCode());
final Object $assetPath = this.getAssetPath();
result = result * PRIME + ($assetPath == null ? 43 : $assetPath.hashCode());
final Object $patchCrc = this.getPatchCrc();
result = result * PRIME + ($patchCrc == null ? 43 : $patchCrc.hashCode());
final Object $patchedCrc = this.getPatchedCrc();
result = result * PRIME + ($patchedCrc == null ? 43 : $patchedCrc.hashCode());
return result;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "ManifestEntry(targetPath=" + this.getTargetPath() + ", assetPath=" + this.getAssetPath() + ", compression=" + this.getCompression() + ", origin=" + this.getOrigin() + ", external=" + this.isExternal() + ", patchCrc=" + this.getPatchCrc() + ", patchedCrc=" + this.getPatchedCrc() + ", advanced=" + this.isAdvanced() + ", isXALZ=" + this.isXALZ() + ", isXABA=" + this.isXABA() + ")";
}
//</editor-fold>
} }

View File

@ -1,18 +1,14 @@
package com.zane.smapiinstaller.entity; package com.zane.smapiinstaller.entity;
import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonAutoDetect;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import lombok.Data;
/** /**
* Mod信息 * Mod信息
* @author Zane * @author Zane
*/ */
@Data @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE)
@JsonAutoDetect(fieldVisibility=JsonAutoDetect.Visibility.ANY, getterVisibility= JsonAutoDetect.Visibility.NONE)
public class ModManifestEntry { public class ModManifestEntry {
/** /**
* 存放位置 * 存放位置
@ -46,7 +42,6 @@ public class ModManifestEntry {
* 资源包类型 * 资源包类型
*/ */
private ModManifestEntry ContentPackFor; private ModManifestEntry ContentPackFor;
/** /**
* 最小依赖版本 * 最小依赖版本
*/ */
@ -55,17 +50,14 @@ public class ModManifestEntry {
* 是否必须依赖 * 是否必须依赖
*/ */
private Boolean IsRequired; private Boolean IsRequired;
/** /**
* 是否清理安装 * 是否清理安装
*/ */
private Boolean CleanInstall; private Boolean CleanInstall;
/** /**
* 原唯一ID列表 * 原唯一ID列表
*/ */
private List<String> OriginUniqueId; private List<String> OriginUniqueId;
/** /**
* 翻译后的Description * 翻译后的Description
*/ */
@ -74,4 +66,323 @@ public class ModManifestEntry {
* 文件修改日期 * 文件修改日期
*/ */
private transient Long lastModified; private transient Long lastModified;
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public ModManifestEntry() {
}
/**
* 存放位置
*/
@SuppressWarnings("all")
public String getAssetPath() {
return this.assetPath;
}
/**
* 名称
*/
@SuppressWarnings("all")
public String getName() {
return this.Name;
}
/**
* 唯一ID
*/
@SuppressWarnings("all")
public String getUniqueID() {
return this.UniqueID;
}
/**
* 版本
*/
@SuppressWarnings("all")
public String getVersion() {
return this.Version;
}
/**
* 描述
*/
@SuppressWarnings("all")
public String getDescription() {
return this.Description;
}
/**
* 依赖
*/
@SuppressWarnings("all")
public Set<ModManifestEntry> getDependencies() {
return this.Dependencies;
}
/**
* MOD更新源
*/
@SuppressWarnings("all")
public List<String> getUpdateKeys() {
return this.UpdateKeys;
}
/**
* 资源包类型
*/
@SuppressWarnings("all")
public ModManifestEntry getContentPackFor() {
return this.ContentPackFor;
}
/**
* 最小依赖版本
*/
@SuppressWarnings("all")
public String getMinimumVersion() {
return this.MinimumVersion;
}
/**
* 是否必须依赖
*/
@SuppressWarnings("all")
public Boolean getIsRequired() {
return this.IsRequired;
}
/**
* 是否清理安装
*/
@SuppressWarnings("all")
public Boolean getCleanInstall() {
return this.CleanInstall;
}
/**
* 原唯一ID列表
*/
@SuppressWarnings("all")
public List<String> getOriginUniqueId() {
return this.OriginUniqueId;
}
/**
* 翻译后的Description
*/
@SuppressWarnings("all")
public String getTranslatedDescription() {
return this.translatedDescription;
}
/**
* 文件修改日期
*/
@SuppressWarnings("all")
public Long getLastModified() {
return this.lastModified;
}
/**
* 存放位置
*/
@SuppressWarnings("all")
public void setAssetPath(final String assetPath) {
this.assetPath = assetPath;
}
/**
* 名称
*/
@SuppressWarnings("all")
public void setName(final String Name) {
this.Name = Name;
}
/**
* 唯一ID
*/
@SuppressWarnings("all")
public void setUniqueID(final String UniqueID) {
this.UniqueID = UniqueID;
}
/**
* 版本
*/
@SuppressWarnings("all")
public void setVersion(final String Version) {
this.Version = Version;
}
/**
* 描述
*/
@SuppressWarnings("all")
public void setDescription(final String Description) {
this.Description = Description;
}
/**
* 依赖
*/
@SuppressWarnings("all")
public void setDependencies(final Set<ModManifestEntry> Dependencies) {
this.Dependencies = Dependencies;
}
/**
* MOD更新源
*/
@SuppressWarnings("all")
public void setUpdateKeys(final List<String> UpdateKeys) {
this.UpdateKeys = UpdateKeys;
}
/**
* 资源包类型
*/
@SuppressWarnings("all")
public void setContentPackFor(final ModManifestEntry ContentPackFor) {
this.ContentPackFor = ContentPackFor;
}
/**
* 最小依赖版本
*/
@SuppressWarnings("all")
public void setMinimumVersion(final String MinimumVersion) {
this.MinimumVersion = MinimumVersion;
}
/**
* 是否必须依赖
*/
@SuppressWarnings("all")
public void setIsRequired(final Boolean IsRequired) {
this.IsRequired = IsRequired;
}
/**
* 是否清理安装
*/
@SuppressWarnings("all")
public void setCleanInstall(final Boolean CleanInstall) {
this.CleanInstall = CleanInstall;
}
/**
* 原唯一ID列表
*/
@SuppressWarnings("all")
public void setOriginUniqueId(final List<String> OriginUniqueId) {
this.OriginUniqueId = OriginUniqueId;
}
/**
* 翻译后的Description
*/
@SuppressWarnings("all")
public void setTranslatedDescription(final String translatedDescription) {
this.translatedDescription = translatedDescription;
}
/**
* 文件修改日期
*/
@SuppressWarnings("all")
public void setLastModified(final Long lastModified) {
this.lastModified = lastModified;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof ModManifestEntry)) return false;
final ModManifestEntry other = (ModManifestEntry) o;
if (!other.canEqual((Object) this)) return false;
final Object this$IsRequired = this.getIsRequired();
final Object other$IsRequired = other.getIsRequired();
if (this$IsRequired == null ? other$IsRequired != null : !this$IsRequired.equals(other$IsRequired)) return false;
final Object this$CleanInstall = this.getCleanInstall();
final Object other$CleanInstall = other.getCleanInstall();
if (this$CleanInstall == null ? other$CleanInstall != null : !this$CleanInstall.equals(other$CleanInstall)) return false;
final Object this$assetPath = this.getAssetPath();
final Object other$assetPath = other.getAssetPath();
if (this$assetPath == null ? other$assetPath != null : !this$assetPath.equals(other$assetPath)) return false;
final Object this$Name = this.getName();
final Object other$Name = other.getName();
if (this$Name == null ? other$Name != null : !this$Name.equals(other$Name)) return false;
final Object this$UniqueID = this.getUniqueID();
final Object other$UniqueID = other.getUniqueID();
if (this$UniqueID == null ? other$UniqueID != null : !this$UniqueID.equals(other$UniqueID)) return false;
final Object this$Version = this.getVersion();
final Object other$Version = other.getVersion();
if (this$Version == null ? other$Version != null : !this$Version.equals(other$Version)) return false;
final Object this$Description = this.getDescription();
final Object other$Description = other.getDescription();
if (this$Description == null ? other$Description != null : !this$Description.equals(other$Description)) return false;
final Object this$Dependencies = this.getDependencies();
final Object other$Dependencies = other.getDependencies();
if (this$Dependencies == null ? other$Dependencies != null : !this$Dependencies.equals(other$Dependencies)) return false;
final Object this$UpdateKeys = this.getUpdateKeys();
final Object other$UpdateKeys = other.getUpdateKeys();
if (this$UpdateKeys == null ? other$UpdateKeys != null : !this$UpdateKeys.equals(other$UpdateKeys)) return false;
final Object this$ContentPackFor = this.getContentPackFor();
final Object other$ContentPackFor = other.getContentPackFor();
if (this$ContentPackFor == null ? other$ContentPackFor != null : !this$ContentPackFor.equals(other$ContentPackFor)) return false;
final Object this$MinimumVersion = this.getMinimumVersion();
final Object other$MinimumVersion = other.getMinimumVersion();
if (this$MinimumVersion == null ? other$MinimumVersion != null : !this$MinimumVersion.equals(other$MinimumVersion)) return false;
final Object this$OriginUniqueId = this.getOriginUniqueId();
final Object other$OriginUniqueId = other.getOriginUniqueId();
if (this$OriginUniqueId == null ? other$OriginUniqueId != null : !this$OriginUniqueId.equals(other$OriginUniqueId)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof ModManifestEntry;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $IsRequired = this.getIsRequired();
result = result * PRIME + ($IsRequired == null ? 43 : $IsRequired.hashCode());
final Object $CleanInstall = this.getCleanInstall();
result = result * PRIME + ($CleanInstall == null ? 43 : $CleanInstall.hashCode());
final Object $assetPath = this.getAssetPath();
result = result * PRIME + ($assetPath == null ? 43 : $assetPath.hashCode());
final Object $Name = this.getName();
result = result * PRIME + ($Name == null ? 43 : $Name.hashCode());
final Object $UniqueID = this.getUniqueID();
result = result * PRIME + ($UniqueID == null ? 43 : $UniqueID.hashCode());
final Object $Version = this.getVersion();
result = result * PRIME + ($Version == null ? 43 : $Version.hashCode());
final Object $Description = this.getDescription();
result = result * PRIME + ($Description == null ? 43 : $Description.hashCode());
final Object $Dependencies = this.getDependencies();
result = result * PRIME + ($Dependencies == null ? 43 : $Dependencies.hashCode());
final Object $UpdateKeys = this.getUpdateKeys();
result = result * PRIME + ($UpdateKeys == null ? 43 : $UpdateKeys.hashCode());
final Object $ContentPackFor = this.getContentPackFor();
result = result * PRIME + ($ContentPackFor == null ? 43 : $ContentPackFor.hashCode());
final Object $MinimumVersion = this.getMinimumVersion();
result = result * PRIME + ($MinimumVersion == null ? 43 : $MinimumVersion.hashCode());
final Object $OriginUniqueId = this.getOriginUniqueId();
result = result * PRIME + ($OriginUniqueId == null ? 43 : $OriginUniqueId.hashCode());
return result;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "ModManifestEntry(assetPath=" + this.getAssetPath() + ", Name=" + this.getName() + ", UniqueID=" + this.getUniqueID() + ", Version=" + this.getVersion() + ", Description=" + this.getDescription() + ", Dependencies=" + this.getDependencies() + ", UpdateKeys=" + this.getUpdateKeys() + ", ContentPackFor=" + this.getContentPackFor() + ", MinimumVersion=" + this.getMinimumVersion() + ", IsRequired=" + this.getIsRequired() + ", CleanInstall=" + this.getCleanInstall() + ", OriginUniqueId=" + this.getOriginUniqueId() + ", translatedDescription=" + this.getTranslatedDescription() + ", lastModified=" + this.getLastModified() + ")";
}
//</editor-fold>
} }

View File

@ -1,15 +1,65 @@
package com.zane.smapiinstaller.entity; package com.zane.smapiinstaller.entity;
import lombok.Data;
/** /**
* 可更新列表 * 可更新列表
* @author Zane * @author Zane
*/ */
@Data
public class UpdatableList { public class UpdatableList {
/** /**
* 列表版本 * 列表版本
*/ */
private int version; private int version;
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public UpdatableList() {
}
/**
* 列表版本
*/
@SuppressWarnings("all")
public int getVersion() {
return this.version;
}
/**
* 列表版本
*/
@SuppressWarnings("all")
public void setVersion(final int version) {
this.version = version;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof UpdatableList)) return false;
final UpdatableList other = (UpdatableList) o;
if (!other.canEqual((Object) this)) return false;
if (this.getVersion() != other.getVersion()) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof UpdatableList;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
result = result * PRIME + this.getVersion();
return result;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "UpdatableList(version=" + this.getVersion() + ")";
}
//</editor-fold>
} }

View File

@ -2,15 +2,12 @@ package com.zane.smapiinstaller.logic;
import java.util.List; import java.util.List;
import java.util.function.Function; import java.util.function.Function;
import lombok.AllArgsConstructor;
import pxb.android.axml.NodeVisitor; import pxb.android.axml.NodeVisitor;
/** /**
* AndroidManifest文件节点访问器 * AndroidManifest文件节点访问器
*/ */
class ManifestTagVisitor extends NodeVisitor { class ManifestTagVisitor extends NodeVisitor {
private final Function<AttrArgs, List<AttrArgs>> attrProcessLogic; private final Function<AttrArgs, List<AttrArgs>> attrProcessLogic;
private final Function<ChildArgs, List<ChildArgs>> childProcessLogic; private final Function<ChildArgs, List<ChildArgs>> childProcessLogic;
@ -25,8 +22,8 @@ class ManifestTagVisitor extends NodeVisitor {
AttrArgs attrArgs = new AttrArgs(ns, name, resourceId, type, obj); AttrArgs attrArgs = new AttrArgs(ns, name, resourceId, type, obj);
List<AttrArgs> appendAttrs = attrProcessLogic.apply(attrArgs); List<AttrArgs> appendAttrs = attrProcessLogic.apply(attrArgs);
super.attr(attrArgs.ns, attrArgs.name, attrArgs.resourceId, attrArgs.type, attrArgs.obj); super.attr(attrArgs.ns, attrArgs.name, attrArgs.resourceId, attrArgs.type, attrArgs.obj);
if(appendAttrs != null) { if (appendAttrs != null) {
for (AttrArgs attr: appendAttrs) { for (AttrArgs attr : appendAttrs) {
super.attr(attr.ns, attr.name, attr.resourceId, attr.type, attr.obj); super.attr(attr.ns, attr.name, attr.resourceId, attr.type, attr.obj);
} }
} }
@ -37,11 +34,11 @@ class ManifestTagVisitor extends NodeVisitor {
ChildArgs childArgs = new ChildArgs(ns, name, null); ChildArgs childArgs = new ChildArgs(ns, name, null);
List<ChildArgs> appendChild = childProcessLogic.apply(childArgs); List<ChildArgs> appendChild = childProcessLogic.apply(childArgs);
NodeVisitor child = super.child(childArgs.ns, childArgs.name); NodeVisitor child = super.child(childArgs.ns, childArgs.name);
if(appendChild != null) { if (appendChild != null) {
for (ChildArgs c: appendChild) { for (ChildArgs c : appendChild) {
NodeVisitor visitor = super.child(c.ns, c.name); NodeVisitor visitor = super.child(c.ns, c.name);
if(c.attrArgs != null) { if (c.attrArgs != null) {
for (AttrArgs attr: c.attrArgs) { for (AttrArgs attr : c.attrArgs) {
visitor.attr(attr.ns, attr.name, attr.resourceId, attr.type, attr.obj); visitor.attr(attr.ns, attr.name, attr.resourceId, attr.type, attr.obj);
} }
} }
@ -49,18 +46,40 @@ class ManifestTagVisitor extends NodeVisitor {
} }
return new ManifestTagVisitor(child, attrProcessLogic, childProcessLogic); return new ManifestTagVisitor(child, attrProcessLogic, childProcessLogic);
} }
@AllArgsConstructor
public static class ChildArgs { public static class ChildArgs {
String ns; String ns;
String name; String name;
List<AttrArgs> attrArgs; List<AttrArgs> attrArgs;
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public ChildArgs(final String ns, final String name, final List<AttrArgs> attrArgs) {
this.ns = ns;
this.name = name;
this.attrArgs = attrArgs;
} }
@AllArgsConstructor //</editor-fold>
}
public static class AttrArgs { public static class AttrArgs {
String ns; String ns;
String name; String name;
int resourceId; int resourceId;
int type; int type;
Object obj; Object obj;
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public AttrArgs(final String ns, final String name, final int resourceId, final int type, final Object obj) {
this.ns = ns;
this.name = name;
this.resourceId = resourceId;
this.type = type;
this.obj = obj;
}
//</editor-fold>
} }
} }

View File

@ -1,9 +1,7 @@
package com.zane.smapiinstaller.utils; package com.zane.smapiinstaller.utils;
import android.os.Build; import android.os.Build;
import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.ForkJoinPool; import java.util.concurrent.ForkJoinPool;
@ -14,24 +12,18 @@ import java.util.concurrent.atomic.AtomicLong;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Supplier; import java.util.function.Supplier;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.SneakyThrows;
/** /**
* @author Zane * @author Zane
*/ */
public class MultiprocessingUtil { public class MultiprocessingUtil {
public final static ExecutorService EXECUTOR_SERVICE = getExecutorService(); public static final ExecutorService EXECUTOR_SERVICE = getExecutorService();
public static ExecutorService getExecutorService() { public static ExecutorService getExecutorService() {
int processors = Runtime.getRuntime().availableProcessors(); int processors = Runtime.getRuntime().availableProcessors();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return new ForkJoinPool(processors, ForkJoinPool.defaultForkJoinWorkerThreadFactory, null, true); return new ForkJoinPool(processors, ForkJoinPool.defaultForkJoinWorkerThreadFactory, null, true);
} }
return new ThreadPoolExecutor(processors, processors, return new ThreadPoolExecutor(processors, processors, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), new ThreadFactoryBuilder().build());
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<>(), new ThreadFactoryBuilder().build());
} }
public static <T> TaskBundle<T> newTaskBundle(Consumer<T> onResult) { public static <T> TaskBundle<T> newTaskBundle(Consumer<T> onResult) {
@ -61,8 +53,7 @@ public class MultiprocessingUtil {
return new TaskBundle<>(taskCount, doneLatch, futureResults); return new TaskBundle<>(taskCount, doneLatch, futureResults);
} }
@Data
@AllArgsConstructor
public static class TaskBundle<T> { public static class TaskBundle<T> {
private AtomicLong taskCount; private AtomicLong taskCount;
private CountDownLatch doneLatch; private CountDownLatch doneLatch;
@ -79,10 +70,96 @@ public class MultiprocessingUtil {
}); });
} }
@SneakyThrows
public void join() { public void join() {
try {
taskCount.decrementAndGet(); taskCount.decrementAndGet();
doneLatch.await(); doneLatch.await();
} catch (final java.lang.Throwable $ex) {
throw new RuntimeException($ex);
} }
} }
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public AtomicLong getTaskCount() {
return this.taskCount;
}
@SuppressWarnings("all")
public CountDownLatch getDoneLatch() {
return this.doneLatch;
}
@SuppressWarnings("all")
public LinkedBlockingQueue<T> getFutureResults() {
return this.futureResults;
}
@SuppressWarnings("all")
public void setTaskCount(final AtomicLong taskCount) {
this.taskCount = taskCount;
}
@SuppressWarnings("all")
public void setDoneLatch(final CountDownLatch doneLatch) {
this.doneLatch = doneLatch;
}
@SuppressWarnings("all")
public void setFutureResults(final LinkedBlockingQueue<T> futureResults) {
this.futureResults = futureResults;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof MultiprocessingUtil.TaskBundle)) return false;
final MultiprocessingUtil.TaskBundle<?> other = (MultiprocessingUtil.TaskBundle<?>) o;
if (!other.canEqual((Object) this)) return false;
final Object this$taskCount = this.getTaskCount();
final Object other$taskCount = other.getTaskCount();
if (this$taskCount == null ? other$taskCount != null : !this$taskCount.equals(other$taskCount)) return false;
final Object this$doneLatch = this.getDoneLatch();
final Object other$doneLatch = other.getDoneLatch();
if (this$doneLatch == null ? other$doneLatch != null : !this$doneLatch.equals(other$doneLatch)) return false;
final Object this$futureResults = this.getFutureResults();
final Object other$futureResults = other.getFutureResults();
if (this$futureResults == null ? other$futureResults != null : !this$futureResults.equals(other$futureResults)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof MultiprocessingUtil.TaskBundle;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $taskCount = this.getTaskCount();
result = result * PRIME + ($taskCount == null ? 43 : $taskCount.hashCode());
final Object $doneLatch = this.getDoneLatch();
result = result * PRIME + ($doneLatch == null ? 43 : $doneLatch.hashCode());
final Object $futureResults = this.getFutureResults();
result = result * PRIME + ($futureResults == null ? 43 : $futureResults.hashCode());
return result;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "MultiprocessingUtil.TaskBundle(taskCount=" + this.getTaskCount() + ", doneLatch=" + this.getDoneLatch() + ", futureResults=" + this.getFutureResults() + ")";
}
@SuppressWarnings("all")
public TaskBundle(final AtomicLong taskCount, final CountDownLatch doneLatch, final LinkedBlockingQueue<T> futureResults) {
this.taskCount = taskCount;
this.doneLatch = doneLatch;
this.futureResults = futureResults;
}
//</editor-fold>
}
} }

View File

@ -10,14 +10,11 @@ import com.google.common.io.ByteStreams;
import com.google.common.io.Files; import com.google.common.io.Files;
import com.zane.smapiinstaller.dto.AssemblyStoreAssembly; import com.zane.smapiinstaller.dto.AssemblyStoreAssembly;
import com.zane.smapiinstaller.dto.Tuple2; import com.zane.smapiinstaller.dto.Tuple2;
import net.fornwall.apksigner.zipio.ZioEntry; import net.fornwall.apksigner.zipio.ZioEntry;
import net.fornwall.apksigner.zipio.ZipInput; import net.fornwall.apksigner.zipio.ZipInput;
import net.fornwall.apksigner.zipio.ZipOutput; import net.fornwall.apksigner.zipio.ZipOutput;
import net.jpountz.lz4.LZ4Factory; import net.jpountz.lz4.LZ4Factory;
import org.bouncycastle.pqc.math.linearalgebra.ByteUtils; import org.bouncycastle.pqc.math.linearalgebra.ByteUtils;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@ -36,20 +33,15 @@ import java.util.function.Function;
import java.util.function.Supplier; import java.util.function.Supplier;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
/** /**
* @author Zane * @author Zane
*/ */
public class ZipUtils { public class ZipUtils {
private static final byte[] MAGIC_BLOB = new byte[] {'X', 'A', 'B', 'A'};
private final static byte[] MAGIC_BLOB = new byte[]{'X', 'A', 'B', 'A'}; private static final byte[] MAGIC_COMPRESSED = new byte[] {'X', 'A', 'L', 'Z'};
private final static byte[] MAGIC_COMPRESSED = new byte[]{'X', 'A', 'L', 'Z'};
public static int fromBytes(byte[] bytes) { public static int fromBytes(byte[] bytes) {
return (bytes[0] & 0xff) | ((bytes[1] & 0xff) << 8) | ((bytes[2] & 0xff) << 16) | ((bytes[3] & 0xff) << 24); return (bytes[0] & 255) | ((bytes[1] & 255) << 8) | ((bytes[2] & 255) << 16) | ((bytes[3] & 255) << 24);
} }
public static byte[] decompressXALZ(byte[] bytes) { public static byte[] decompressXALZ(byte[] bytes) {
@ -58,16 +50,14 @@ public class ZipUtils {
} }
if (Arrays.equals(ByteUtils.subArray(bytes, 0, 4), MAGIC_COMPRESSED)) { if (Arrays.equals(ByteUtils.subArray(bytes, 0, 4), MAGIC_COMPRESSED)) {
byte[] length = ByteUtils.subArray(bytes, 8, 12); byte[] length = ByteUtils.subArray(bytes, 8, 12);
int len = (length[0] & 0xff) | ((length[1] & 0xff) << 8) | ((length[2] & 0xff) << 16) | ((length[3] & 0xff) << 24); int len = (length[0] & 255) | ((length[1] & 255) << 8) | ((length[2] & 255) << 16) | ((length[3] & 255) << 24);
bytes = LZ4Factory.fastestJavaInstance().fastDecompressor().decompress(bytes, 12, len); bytes = LZ4Factory.fastestJavaInstance().fastDecompressor().decompress(bytes, 12, len);
} }
return bytes; return bytes;
} }
public static Map<String, byte[]> unpackXABA(byte[] manifestBytes, byte[] xabaBytes) { public static Map<String, byte[]> unpackXABA(byte[] manifestBytes, byte[] xabaBytes) {
List<List<String>> manifest = Splitter.on('\n').omitEmptyStrings().splitToList(new String(manifestBytes, StandardCharsets.UTF_8)) List<List<String>> manifest = Splitter.on('\n').omitEmptyStrings().splitToList(new String(manifestBytes, StandardCharsets.UTF_8)).stream().skip(1).map(line -> Splitter.on(CharMatcher.whitespace()).omitEmptyStrings().splitToList(line)).collect(Collectors.toList());
.stream().skip(1).map(line -> Splitter.on(CharMatcher.whitespace()).omitEmptyStrings().splitToList(line)).collect(Collectors.toList());
ByteSource source = ByteSource.wrap(xabaBytes); ByteSource source = ByteSource.wrap(xabaBytes);
Map<String, byte[]> result = new HashMap<>(); Map<String, byte[]> result = new HashMap<>();
try { try {
@ -101,13 +91,11 @@ public class ZipUtils {
assembly.setConfigDataOffset(fromBytes(buffer)); assembly.setConfigDataOffset(fromBytes(buffer));
buffer = source.slice(offset += 4, 4).read(); buffer = source.slice(offset += 4, 4).read();
assembly.setConfigDataSize(fromBytes(buffer)); assembly.setConfigDataSize(fromBytes(buffer));
buffer = source.slice(assembly.getDataOffset(), 4).read(); buffer = source.slice(assembly.getDataOffset(), 4).read();
byte[] bytes; byte[] bytes;
if (Arrays.equals(buffer, MAGIC_COMPRESSED)) { if (Arrays.equals(buffer, MAGIC_COMPRESSED)) {
byte[] lzBytes = source.slice(assembly.getDataOffset(), assembly.getDataSize()).read(); byte[] lzBytes = source.slice(assembly.getDataOffset(), assembly.getDataSize()).read();
bytes = decompressXALZ(lzBytes); bytes = decompressXALZ(lzBytes);
} else { } else {
bytes = source.slice(assembly.getDataOffset(), assembly.getDataSize()).read(); bytes = source.slice(assembly.getDataOffset(), assembly.getDataSize()).read();
} }
@ -133,7 +121,7 @@ public class ZipUtils {
AtomicLong count = new AtomicLong(); AtomicLong count = new AtomicLong();
int reportInterval = size / 100; int reportInterval = size / 100;
ConcurrentHashMap<String, Boolean> replacedFileSet = new ConcurrentHashMap<>(entryMap.size()); ConcurrentHashMap<String, Boolean> replacedFileSet = new ConcurrentHashMap<>(entryMap.size());
MultiprocessingUtil.TaskBundle<ZioEntry> taskBundle = MultiprocessingUtil.newTaskBundle((zioEntry) -> { MultiprocessingUtil.TaskBundle<ZioEntry> taskBundle = MultiprocessingUtil.newTaskBundle(zioEntry -> {
try { try {
zipOutput.write(zioEntry); zipOutput.write(zioEntry);
long index = count.incrementAndGet(); long index = count.incrementAndGet();
@ -175,7 +163,7 @@ public class ZipUtils {
taskBundle.join(); taskBundle.join();
Sets.SetView<String> difference = Sets.difference(entryMap.keySet(), replacedFileSet.keySet()); Sets.SetView<String> difference = Sets.difference(entryMap.keySet(), replacedFileSet.keySet());
count.set(0); count.set(0);
taskBundle = MultiprocessingUtil.newTaskBundle((zioEntry) -> { taskBundle = MultiprocessingUtil.newTaskBundle(zioEntry -> {
try { try {
zipOutput.write(zioEntry); zipOutput.write(zioEntry);
long index = count.incrementAndGet(); long index = count.incrementAndGet();
@ -203,7 +191,7 @@ public class ZipUtils {
for (String resourcePack : resourcePacks) { for (String resourcePack : resourcePacks) {
try (ZipInput input = new ZipInput(resourcePack)) { try (ZipInput input = new ZipInput(resourcePack)) {
for (ZioEntry inEntry : input.entries.values()) { for (ZioEntry inEntry : input.entries.values()) {
if(inEntry.getName().startsWith("assets/Content")) { if (inEntry.getName().startsWith("assets/Content")) {
ZioEntry zioEntry = new ZioEntry(inEntry.getName()); ZioEntry zioEntry = new ZioEntry(inEntry.getName());
zioEntry.setCompression(inEntry.getCompression()); zioEntry.setCompression(inEntry.getCompression());
try (InputStream inputStream = inEntry.getInputStream()) { try (InputStream inputStream = inEntry.getInputStream()) {
@ -250,9 +238,7 @@ public class ZipUtils {
} }
} }
@Data
@AllArgsConstructor
@EqualsAndHashCode(of = "path")
public static class ZipEntrySource { public static class ZipEntrySource {
private String path; private String path;
private int compressionMethod; private int compressionMethod;
@ -270,5 +256,78 @@ public class ZipUtils {
} }
return null; return null;
} }
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public String getPath() {
return this.path;
}
@SuppressWarnings("all")
public int getCompressionMethod() {
return this.compressionMethod;
}
@SuppressWarnings("all")
public Supplier<InputStream> getDataSupplier() {
return this.dataSupplier;
}
@SuppressWarnings("all")
public void setPath(final String path) {
this.path = path;
}
@SuppressWarnings("all")
public void setCompressionMethod(final int compressionMethod) {
this.compressionMethod = compressionMethod;
}
@SuppressWarnings("all")
public void setDataSupplier(final Supplier<InputStream> dataSupplier) {
this.dataSupplier = dataSupplier;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "ZipUtils.ZipEntrySource(path=" + this.getPath() + ", compressionMethod=" + this.getCompressionMethod() + ", dataSupplier=" + this.getDataSupplier() + ")";
}
@SuppressWarnings("all")
public ZipEntrySource(final String path, final int compressionMethod, final Supplier<InputStream> dataSupplier) {
this.path = path;
this.compressionMethod = compressionMethod;
this.dataSupplier = dataSupplier;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof ZipUtils.ZipEntrySource)) return false;
final ZipUtils.ZipEntrySource other = (ZipUtils.ZipEntrySource) o;
if (!other.canEqual((Object) this)) return false;
final Object this$path = this.getPath();
final Object other$path = other.getPath();
if (this$path == null ? other$path != null : !this$path.equals(other$path)) return false;
return true;
}
@SuppressWarnings("all")
protected boolean canEqual(final Object other) {
return other instanceof ZipUtils.ZipEntrySource;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $path = this.getPath();
result = result * PRIME + ($path == null ? 43 : $path.hashCode());
return result;
}
//</editor-fold>
} }
} }