package com.dev.patcher.common.local;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import com.dev.patcher_core.model.Patch;
public class LocalPatch implements Patch<LocalPatchFile>
{
private final String version;
private final long publishDate;
private final long patchSize;
private final LocalPatchFile[] patchFiles;
private LocalPatch()
{
this.version = "0.0";
this.publishDate = 0;
this.patchSize = -1;
this.patchFiles = null;
}
[MENTION=295804]Override[/MENTION]
public String getVersion()
{
return this.version;
}
[MENTION=295804]Override[/MENTION]
public LocalDateTime getPublishDate()
{
return LocalDateTime.ofEpochSecond(this.publishDate, 0, ZoneOffset.UTC);
}
[MENTION=295804]Override[/MENTION]
public long getPatchSize()
{
return this.patchSize;
}
[MENTION=295804]Override[/MENTION]
public LocalPatchFile[] getPatchFiles()
{
return this.patchFiles;
}
}
LocalPatchFile:
Code:
package com.dev.patcher.common.local;
import java.nio.file.Path;
import java.nio.file.Paths;
import com.dev.patcher_core.model.PatchFile;
public class LocalPatchFile implements PatchFile
{
private final String destinationPath;
private Path destinationPathAsObject;
private final String sourceChecksum;
private final long sourceFileSize;
private final String sourcePath;
private Path sourcePathAsObject;
public LocalPatchFile()
{
this.destinationPath = null;
this.sourceChecksum = null;
this.sourceFileSize = 0l;
this.sourcePath = null;
}
[MENTION=295804]Override[/MENTION]
public Path getDestinationPath()
{
if (this.destinationPathAsObject == null)
{
this.destinationPathAsObject = Paths.get(this.destinationPath);
}
return this.destinationPathAsObject;
}
[MENTION=295804]Override[/MENTION]
public String getSourceChecksum()
{
return this.sourceChecksum;
}
[MENTION=295804]Override[/MENTION]
public long getSourceFileSize()
{
return this.sourceFileSize;
}
public Path getSourcePath()
{
if (this.sourcePathAsObject == null)
{
this.sourcePathAsObject = Paths.get(this.sourcePath);
}
return this.sourcePathAsObject;
}
[MENTION=295804]Override[/MENTION]
public Path getSourceInformation()
{
return getSourcePath();
}
}
LocalPatcher:
Code:
package com.dev.patcher.common.local;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import com.dev.common.gson.GsonUtils;
import com.dev.patcher.common.SHA256PatchFileChecker;
import com.dev.patcher_core.IllegalPatchStateException;
import com.dev.patcher_core.Patcher;
import com.dev.patcher_core.report.ReadOnlyPatchReport;
import com.google.gson.JsonIOException;
import com.google.gson.JsonSyntaxException;
public class LocalPatcher extends Patcher<LocalPatchFile>
{
private final File patchList;
public LocalPatcher(File patchList)
{
super(
new SHA256PatchFileChecker<>(),
new LocalPatchExecutor()
);
this.patchList = patchList;
}
public ReadOnlyPatchReport<LocalPatchFile> patch() throws JsonSyntaxException, JsonIOException, FileNotFoundException, IllegalPatchStateException, InterruptedException, IOException
{
return super.patch(GsonUtils.objectFromJsonInputStream(new FileInputStream(this.patchList), LocalPatch.class));
}
}
LocalPatchExecuter:
Code:
package com.dev.patcher.common.local;
import java.io.File;
import java.io.FileInputStream;
import com.dev.patcher.common.InputStreamPatchExecutor;
import com.dev.patcher_core.report.PatchFileReport;
public class LocalPatchExecutor extends InputStreamPatchExecutor<LocalPatchFile>
{
public LocalPatchExecutor()
{
}
[MENTION=295804]Override[/MENTION]
public void executePatch(PatchFileReport<LocalPatchFile> patchFileReport) throws Exception
{
File source = patchFileReport.getPatchFile().getSourcePath().toFile();
if (!source.exists())
{
throw new Exception("source file doesnt exist");
}
super.executePatch(patchFileReport, source.length(), new FileInputStream(source));
}
}
An sich kann man mit diesem Aufbau mit sehr wenig Aufwand verschiedenste Patchmethoden implementieren (z.B. Patching von einem Webserver, FTP, aus einer Datenbank (Blob-Feld), uvm.)
Vielleicht kann damit ja jemand etwas anfangen
package com.dev.patcher.common.local;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import com.dev.patcher_core.model.Patch;
public class LocalPatch implements Patch<LocalPatchFile>
{
private final String version;
private final long publishDate;
private final long patchSize;
private final LocalPatchFile[] patchFiles;
private LocalPatch()
{
this.version = "0.0";
this.publishDate = 0;
this.patchSize = -1;
this.patchFiles = null;
}
[MENTION=295804]Override[/MENTION]
public String getVersion()
{
return this.version;
}
[MENTION=295804]Override[/MENTION]
public LocalDateTime getPublishDate()
{
return LocalDateTime.ofEpochSecond(this.publishDate, 0, ZoneOffset.UTC);
}
[MENTION=295804]Override[/MENTION]
public long getPatchSize()
{
return this.patchSize;
}
[MENTION=295804]Override[/MENTION]
public LocalPatchFile[] getPatchFiles()
{
return this.patchFiles;
}
}
LocalPatchFile:
Code:
package com.dev.patcher.common.local;
import java.nio.file.Path;
import java.nio.file.Paths;
import com.dev.patcher_core.model.PatchFile;
public class LocalPatchFile implements PatchFile
{
private final String destinationPath;
private Path destinationPathAsObject;
private final String sourceChecksum;
private final long sourceFileSize;
private final String sourcePath;
private Path sourcePathAsObject;
public LocalPatchFile()
{
this.destinationPath = null;
this.sourceChecksum = null;
this.sourceFileSize = 0l;
this.sourcePath = null;
}
[MENTION=295804]Override[/MENTION]
public Path getDestinationPath()
{
if (this.destinationPathAsObject == null)
{
this.destinationPathAsObject = Paths.get(this.destinationPath);
}
return this.destinationPathAsObject;
}
[MENTION=295804]Override[/MENTION]
public String getSourceChecksum()
{
return this.sourceChecksum;
}
[MENTION=295804]Override[/MENTION]
public long getSourceFileSize()
{
return this.sourceFileSize;
}
public Path getSourcePath()
{
if (this.sourcePathAsObject == null)
{
this.sourcePathAsObject = Paths.get(this.sourcePath);
}
return this.sourcePathAsObject;
}
[MENTION=295804]Override[/MENTION]
public Path getSourceInformation()
{
return getSourcePath();
}
}
LocalPatcher:
Code:
package com.dev.patcher.common.local;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import com.dev.common.gson.GsonUtils;
import com.dev.patcher.common.SHA256PatchFileChecker;
import com.dev.patcher_core.IllegalPatchStateException;
import com.dev.patcher_core.Patcher;
import com.dev.patcher_core.report.ReadOnlyPatchReport;
import com.google.gson.JsonIOException;
import com.google.gson.JsonSyntaxException;
public class LocalPatcher extends Patcher<LocalPatchFile>
{
private final File patchList;
public LocalPatcher(File patchList)
{
super(
new SHA256PatchFileChecker<>(),
new LocalPatchExecutor()
);
this.patchList = patchList;
}
public ReadOnlyPatchReport<LocalPatchFile> patch() throws JsonSyntaxException, JsonIOException, FileNotFoundException, IllegalPatchStateException, InterruptedException, IOException
{
return super.patch(GsonUtils.objectFromJsonInputStream(new FileInputStream(this.patchList), LocalPatch.class));
}
}
LocalPatchExecuter:
Code:
package com.dev.patcher.common.local;
import java.io.File;
import java.io.FileInputStream;
import com.dev.patcher.common.InputStreamPatchExecutor;
import com.dev.patcher_core.report.PatchFileReport;
public class LocalPatchExecutor extends InputStreamPatchExecutor<LocalPatchFile>
{
public LocalPatchExecutor()
{
}
[MENTION=295804]Override[/MENTION]
public void executePatch(PatchFileReport<LocalPatchFile> patchFileReport) throws Exception
{
File source = patchFileReport.getPatchFile().getSourcePath().toFile();
if (!source.exists())
{
throw new Exception("source file doesnt exist");
}
super.executePatch(patchFileReport, source.length(), new FileInputStream(source));
}
}
An sich kann man mit diesem Aufbau mit sehr wenig Aufwand verschiedenste Patchmethoden implementieren (z.B. Patching von einem Webserver, FTP, aus einer Datenbank (Blob-Feld), uvm.)
Vielleicht kann damit ja jemand etwas anfangen
[Release] Patcher Design für DE Patcher 09/14/2020 - Metin2 PServer Designs, Websites & Scripts - 24 Replies Abend,
habe dieses Design, wie dort angekündigt, für den DE-Patcher (Offi-Patcher, etc.) gecoded.
Screen vom Patcher (bisschen anders, musste sein)
http://i.epvpimg.com/OcNCh.png
Was alles im Anhang ist:
Die benötigten geslicten Bilder
[Release]AI Patcher / SD hack Patcher 05/26/2011 - Grand Chase Hacks, Bots, Cheats & Exploits - 153 Replies AI Patcher
Beta testing
what does it do?
- AI patcher aka spoon feed program, it automatically patches all AI lua files inside a given folder so that you don't have to bother editing them one by one. Auto-kill, Mobs @ Left side corner
just input "help" and you will see the available functions of the downloaded version
remember that my program is case sensitive, all functions are in lower cases
Beta: