mirror of
https://github.com/thunderspynetwork/creamsoda
synced 2026-01-16 20:04:49 -05:00
-MD5 should no longer self-relocate or self-update
Changing install directory SHOULD now also move the patcher to the new directory.
This commit is contained in:
committed by
Leandro Pardini
parent
2bd4b74c44
commit
0edba9fdde
@@ -6,6 +6,7 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
|
||||
namespace Tequila
|
||||
{
|
||||
@@ -106,6 +107,8 @@ namespace Tequila
|
||||
|
||||
} while (!PathValid);
|
||||
|
||||
SelfRelocate();
|
||||
|
||||
Settings.GamePath = myPath;
|
||||
}
|
||||
|
||||
@@ -159,5 +162,42 @@ namespace Tequila
|
||||
}
|
||||
}
|
||||
|
||||
private void SelfRelocate()
|
||||
{
|
||||
try {
|
||||
if (Application.StartupPath == Settings.GamePath) return;
|
||||
if (!File.Exists(Application.ExecutablePath)) return;
|
||||
|
||||
string ShortcutPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
|
||||
string ShortcutTarget = Path.Combine(Settings.GamePath, "Tequila.exe");
|
||||
|
||||
if (!Directory.Exists(Settings.GamePath))
|
||||
Directory.CreateDirectory(Settings.GamePath);
|
||||
|
||||
try {
|
||||
if (File.Exists(ShortcutTarget)) File.Delete(ShortcutTarget);
|
||||
File.Move(Application.ExecutablePath, ShortcutTarget);
|
||||
} catch (Exception ex) {
|
||||
File.Copy(Application.ExecutablePath, ShortcutTarget);
|
||||
try { File.Move(Application.ExecutablePath, Path.Combine(Application.StartupPath, "deleteme.txt")); }
|
||||
catch (Exception ex2) { }
|
||||
}
|
||||
|
||||
try {
|
||||
using (ShellLink shortcut = new ShellLink()) {
|
||||
shortcut.Target = ShortcutTarget;
|
||||
//shortcut.WorkingDirectory = Path.GetDirectoryName(ShortcutTarget);
|
||||
shortcut.Description = "Drink up!";
|
||||
shortcut.DisplayMode = ShellLink.LinkDisplayMode.edmNormal;
|
||||
shortcut.Save(Path.Combine(ShortcutPath, "Tequila.lnk"));
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
MyToolkit.ErrorReporter(ex, this.Name + ".SelfRelocate");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,6 +165,8 @@ namespace Tequila
|
||||
// Check for parameters overriding self patching
|
||||
else if (MyToolkit.args[i].Trim() == "-md5")
|
||||
{
|
||||
NoMove = true;
|
||||
WorkThread.DontSelfUpdate = true;
|
||||
WorkThread.GenerageChecksumToClipboard = true;
|
||||
}
|
||||
// Check for parameters disabling self relocate (this option also makes it not self patch)
|
||||
|
||||
Reference in New Issue
Block a user