Skip to content

Commit 06683e7

Browse files
committed
Prefer local installation, copy installer .exe
1 parent ad6bb8a commit 06683e7

7 files changed

Lines changed: 39 additions & 1 deletion

File tree

Everest.Installer.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
<Compile Include="src\CustomControls\CustomTextBox.cs">
8282
<SubType>Component</SubType>
8383
</Compile>
84+
<Compile Include="src\Finders\LocalFinder.cs" />
8485
<Compile Include="src\Infos\EverestInfo.Installer.cs" />
8586
<Compile Include="src\ProgressShapes.cs" />
8687
<Compile Include="src\Extensions\StringExt.cs" />

Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@
3434
// You can specify all the values or you can default the Build and Revision Numbers
3535
// by using the '*' as shown below:
3636
// [assembly: AssemblyVersion("1.0.*")]
37-
[assembly: AssemblyVersion("18.04.1.*")]
37+
[assembly: AssemblyVersion("18.05.0.*")]
3838
[assembly: AssemblyFileVersion("1.0.0.0")]

src/Finders/GameFinder.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace MonoMod.Installer {
77
public abstract class GameFinder {
88

99
public abstract string ID { get; }
10+
public virtual int Priority => 0;
1011

1112
public abstract string FindGameDir(string gameid);
1213

src/Finders/LocalFinder.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using Microsoft.Win32;
2+
using MonoMod.Utils;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.IO;
6+
using System.Linq;
7+
using System.Text;
8+
using System.Text.RegularExpressions;
9+
10+
namespace MonoMod.Installer {
11+
public class LocalFinder : GameFinder {
12+
13+
public override string ID => "local";
14+
public override int Priority => -1000;
15+
16+
public override string FindGameDir(string gameid) {
17+
string path = Environment.CurrentDirectory;
18+
if (File.Exists(Path.Combine(path, gameid)))
19+
return path;
20+
return null;
21+
}
22+
23+
}
24+
}

src/GameModder.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public GameModder(GameModInfo info) {
2727

2828
public void Install() {
2929
Console.WriteLine("Starting installation");
30+
Console.WriteLine($"Installing: {Info.CurrentInstallingModVersion.Name}");
31+
Console.WriteLine($"To: {Info.CurrentGamePath}");
3032
OnStart?.Invoke();
3133
try {
3234

@@ -41,10 +43,18 @@ public void Install() {
4143
_DownloadAndUnpack();
4244
Console.WriteLine();
4345

46+
// Sneaky step: Copy the installer.
47+
try {
48+
string installerPath = Assembly.GetEntryAssembly().Location;
49+
File.Copy(installerPath, Path.Combine(Info.CurrentGamePath, Path.GetFileName(installerPath)), true);
50+
} catch {
51+
}
52+
4453
_Install();
4554
Console.WriteLine();
4655

4756
} catch (Exception e) {
57+
Console.WriteLine($"Failed installing {Info.CurrentInstallingModVersion.Name}");
4858
Console.WriteLine(e);
4959
Console.WriteLine("Error! Please check installer-log.txt");
5060
OnError?.Invoke(e);

src/Infos/EverestInfo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public override ModBackup[] Backups {
9696
public override Dictionary<string, string> GameIDs {
9797
get {
9898
return new Dictionary<string, string>() {
99+
{ "local", "Celeste.exe" },
99100
{ "steam", "Celeste" }
100101
};
101102
}

src/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ static void Main(string[] args) {
4242
Console.SetOut(logWriter);
4343

4444
GameModInfo info = new Everest.EverestInfo();
45+
Console.WriteLine($"{info.ModInstallerName} v{Assembly.GetEntryAssembly().GetName().Version}");
4546

4647
try {
4748
Application.EnableVisualStyles();

0 commit comments

Comments
 (0)