diff --git a/.idea/.idea.VaultSmpInstaller/.idea/vcs.xml b/.idea/.idea.VaultSmpInstaller/.idea/vcs.xml
index 94a25f7..bf23b9e 100644
--- a/.idea/.idea.VaultSmpInstaller/.idea/vcs.xml
+++ b/.idea/.idea.VaultSmpInstaller/.idea/vcs.xml
@@ -1,6 +1,7 @@
+
\ No newline at end of file
diff --git a/VaultSmpInstaller.csproj b/VaultSmpInstaller.csproj
index e56ba92..2d0f054 100644
--- a/VaultSmpInstaller.csproj
+++ b/VaultSmpInstaller.csproj
@@ -31,9 +31,4 @@
-
-
-
-
-
diff --git a/VaultSmpInstaller.sln b/VaultSmpInstaller.sln
index 9ae67c8..685abf2 100644
--- a/VaultSmpInstaller.sln
+++ b/VaultSmpInstaller.sln
@@ -2,8 +2,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VaultSmpInstaller", "VaultSmpInstaller.csproj", "{5111A3E1-248F-43AF-A70B-51248B418BE9}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiNET.LevelDB", "..\..\MiNET.LevelDB\MiNET.LevelDB\MiNET.LevelDB.csproj", "{7CD1B124-DEEE-4745-820F-C499E7AE3A6B}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -14,9 +12,5 @@ Global
{5111A3E1-248F-43AF-A70B-51248B418BE9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5111A3E1-248F-43AF-A70B-51248B418BE9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5111A3E1-248F-43AF-A70B-51248B418BE9}.Release|Any CPU.Build.0 = Release|Any CPU
- {7CD1B124-DEEE-4745-820F-C499E7AE3A6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {7CD1B124-DEEE-4745-820F-C499E7AE3A6B}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {7CD1B124-DEEE-4745-820F-C499E7AE3A6B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {7CD1B124-DEEE-4745-820F-C499E7AE3A6B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
diff --git a/ViewModels/ProfileWindow1ViewModel.cs b/ViewModels/ProfileWindow1ViewModel.cs
index 725eb8f..a6949e3 100644
--- a/ViewModels/ProfileWindow1ViewModel.cs
+++ b/ViewModels/ProfileWindow1ViewModel.cs
@@ -2,10 +2,9 @@
using System.IO;
using System.Reactive;
using System.Reactive.Linq;
-using System.Text;
using System.Text.Json.Nodes;
using Avalonia.Media;
-using MiNET.LevelDB;
+using Microsoft.Win32;
using ReactiveUI;
namespace VaultSmpInstaller.ViewModels;
@@ -16,13 +15,11 @@ public class ProfileWindow1ViewModel : ViewModelBase
public ReactiveCommand UseCurseforgeCommand { get; }
public ReactiveCommand UsePrismCommand { get; }
- public ReactiveCommand UseOverwolfCommand { get; }
public ProfileWindow1ViewModel()
{
var curseforgeDir = CurseforgeInstanceDir;
var prismDir = PrismInstanceDir;
- var overwolfDir = OverwolfInstanceDir;
ShowProfileSelectionDialog = new Interaction();
@@ -37,13 +34,6 @@ public class ProfileWindow1ViewModel : ViewModelBase
var profileWindowModel = new ProfileWindow2ViewModel(ProfileWindow2ViewModel.InstanceType.Prism, prismDir);
return await ShowProfileSelectionDialog.Handle(profileWindowModel);
});
-
- UseOverwolfCommand = ReactiveCommand.CreateFromTask(async () =>
- {
- var profileWindowModel = new ProfileWindow2ViewModel(ProfileWindow2ViewModel.InstanceType.Overwolf, overwolfDir);
- return await ShowProfileSelectionDialog.Handle(profileWindowModel);
- });
-
}
public static Brush Background => SolidColorBrush.Parse("#282A36");
@@ -91,25 +81,7 @@ public class ProfileWindow1ViewModel : ViewModelBase
}
}
- public bool IsOverwolfInstalled { get; set; } = false;
-
- private string? _overwolfInstanceDir = null;
- public string OverwolfButtonText => IsOverwolfInstalled ? "Curseforge (Overwolf)" : "Curseforge (Overwolf) Not Detected";
-
- public string? OverwolfInstanceDir
- {
- get
- {
- if (_overwolfInstanceDir == null && TryGetOverwolfMinecraftRoot(out _overwolfInstanceDir))
- {
- IsOverwolfInstalled = true;
- this.RaisePropertyChanged(nameof(IsOverwolfInstalled));
- this.RaisePropertyChanged(nameof(OverwolfButtonText));
- this.RaisePropertyChanged();
- }
- return _overwolfInstanceDir;
- }
- }
+ public bool IsOverwolfInstalled { get; set; } = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Overwolf", "UninstallString", null) != null;
public bool TryGetCurseforgeMinecraftRoot(out string? minecraftRoot)
{
@@ -161,60 +133,60 @@ public class ProfileWindow1ViewModel : ViewModelBase
return false;
}
- public bool TryGetOverwolfMinecraftRoot(out string? minecraftRoot)
- {
- minecraftRoot = null;
-
- var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
- var overwolfDbDirectory = Path.Combine(localAppData, "Overwolf", "BrowserCache", "Local Storage", "leveldb");
-
- if (!Directory.Exists(overwolfDbDirectory)) return false;
-
- var overwolfDb = new Database(new(overwolfDbDirectory), false, new Options() { ReadOnly = true });
- byte[] databaseKey = new byte[]
- {
- 0x5F, 0x6F,
- 0x76, 0x65, 0x72, 0x77, 0x6F, 0x6C, 0x66, 0x2D,
- 0x65, 0x78, 0x74, 0x65, 0x6E, 0x73, 0x69, 0x6F,
- 0x6E, 0x3A, 0x2F, 0x2F, 0x63, 0x63, 0x68, 0x68,
- 0x63, 0x61, 0x69, 0x61, 0x70, 0x65, 0x69, 0x6B,
- 0x6A, 0x62, 0x64, 0x62, 0x70, 0x66, 0x70, 0x6C,
- 0x67, 0x6D, 0x70, 0x6F, 0x62, 0x62, 0x63, 0x64,
- 0x6B, 0x64, 0x61, 0x70, 0x68, 0x63, 0x6C, 0x62,
- 0x6D, 0x6B, 0x62, 0x6A, 0x00, 0x01, 0x6D, 0x69,
- 0x6E, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x2D,
- 0x73, 0x65, 0x74, 0x74, 0x69, 0x6E, 0x67, 0x73
- };
- String? curseforgeMinecraftSettings = "";
- try
- {
- overwolfDb.Open();
- curseforgeMinecraftSettings = Encoding.ASCII.GetString(overwolfDb.Get(databaseKey))[1..];
- }
- catch (NullReferenceException e)
- {
- minecraftRoot = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "curseforge", "minecraft", "Instances");
- return true;
- }
- finally
- {
- overwolfDb.Close();
- overwolfDb.Dispose();
- }
- if(String.IsNullOrEmpty(curseforgeMinecraftSettings))
- {
- minecraftRoot = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "curseforge", "minecraft", "Instances");
- return true;
- }
-
- var minecraftSettings = JsonNode.Parse(curseforgeMinecraftSettings);
- if (!minecraftSettings!.AsObject().TryGetPropertyValue("minecraftRoot", out var minecraftRootNode)) {
- minecraftRoot = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "curseforge", "minecraft", "Instances");
- return true;
- }
- if (!minecraftRootNode!.AsValue().TryGetValue(out minecraftRoot)) return false;
-
- minecraftRoot = Path.Combine(minecraftRoot, "Instances");
- return true;
- }
+ // public bool TryGetOverwolfMinecraftRoot(out string? minecraftRoot)
+ // {
+ // minecraftRoot = null;
+ //
+ // var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
+ // var overwolfDbDirectory = Path.Combine(localAppData, "Overwolf", "BrowserCache", "Local Storage", "leveldb");
+ //
+ // if (!Directory.Exists(overwolfDbDirectory)) return false;
+ //
+ // var overwolfDb = new Database(new(overwolfDbDirectory), false, new Options() { ReadOnly = true});
+ // byte[] databaseKey = new byte[]
+ // {
+ // 0x5F, 0x6F,
+ // 0x76, 0x65, 0x72, 0x77, 0x6F, 0x6C, 0x66, 0x2D,
+ // 0x65, 0x78, 0x74, 0x65, 0x6E, 0x73, 0x69, 0x6F,
+ // 0x6E, 0x3A, 0x2F, 0x2F, 0x63, 0x63, 0x68, 0x68,
+ // 0x63, 0x61, 0x69, 0x61, 0x70, 0x65, 0x69, 0x6B,
+ // 0x6A, 0x62, 0x64, 0x62, 0x70, 0x66, 0x70, 0x6C,
+ // 0x67, 0x6D, 0x70, 0x6F, 0x62, 0x62, 0x63, 0x64,
+ // 0x6B, 0x64, 0x61, 0x70, 0x68, 0x63, 0x6C, 0x62,
+ // 0x6D, 0x6B, 0x62, 0x6A, 0x00, 0x01, 0x6D, 0x69,
+ // 0x6E, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x2D,
+ // 0x73, 0x65, 0x74, 0x74, 0x69, 0x6E, 0x67, 0x73
+ // };
+ // String? curseforgeMinecraftSettings = "";
+ // try
+ // {
+ // overwolfDb.Open();
+ // curseforgeMinecraftSettings = Encoding.ASCII.GetString(overwolfDb.Get(databaseKey))[1..];
+ // }
+ // catch (NullReferenceException e)
+ // {
+ // minecraftRoot = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "curseforge", "minecraft", "Instances");
+ // return true;
+ // }
+ // finally
+ // {
+ // overwolfDb.Close();
+ // overwolfDb.Dispose();
+ // }
+ // if(String.IsNullOrEmpty(curseforgeMinecraftSettings))
+ // {
+ // minecraftRoot = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "curseforge", "minecraft", "Instances");
+ // return true;
+ // }
+ //
+ // var minecraftSettings = JsonNode.Parse(curseforgeMinecraftSettings);
+ // if (!minecraftSettings!.AsObject().TryGetPropertyValue("minecraftRoot", out var minecraftRootNode)) {
+ // minecraftRoot = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "curseforge", "minecraft", "Instances");
+ // return true;
+ // }
+ // if (!minecraftRootNode!.AsValue().TryGetValue(out minecraftRoot)) return false;
+ //
+ // minecraftRoot = Path.Combine(minecraftRoot, "Instances");
+ // return true;
+ // }
}
\ No newline at end of file
diff --git a/Views/ProfileWindow1.axaml b/Views/ProfileWindow1.axaml
index 2b50199..81da0ca 100644
--- a/Views/ProfileWindow1.axaml
+++ b/Views/ProfileWindow1.axaml
@@ -11,10 +11,9 @@
Width="400" Height="175"
WindowStartupLocation="CenterOwner"
CanResize="False">
-
+
Please Select Prism Launcher or Curseforge
-
diff --git a/Views/ProfileWindow1.axaml.cs b/Views/ProfileWindow1.axaml.cs
index 0e6ed84..f9c08cb 100644
--- a/Views/ProfileWindow1.axaml.cs
+++ b/Views/ProfileWindow1.axaml.cs
@@ -1,6 +1,7 @@
using System;
using System.Threading.Tasks;
using Avalonia.ReactiveUI;
+using Avalonia.Threading;
using ReactiveUI;
using VaultSmpInstaller.ViewModels;
@@ -14,10 +15,22 @@ public partial class ProfileWindow1 : ReactiveWindow
this.WhenActivated(d => d(ViewModel!.UseCurseforgeCommand.Subscribe(Close)));
this.WhenActivated(d => d(ViewModel!.UsePrismCommand.Subscribe(Close)));
- this.WhenActivated(d => d(ViewModel!.UseOverwolfCommand.Subscribe(Close)));
- this.WhenActivated(action =>
- action(ViewModel!.ShowProfileSelectionDialog.RegisterHandler(DoShowDialogAsync)));
+ this.WhenActivated(action => action(ViewModel!.ShowProfileSelectionDialog.RegisterHandler(DoShowDialogAsync)));
+
+ this.WhenActivated(_ =>
+ {
+ if (ViewModel!.IsOverwolfInstalled)
+ {
+ var removeOverwolfWindow = new RemoveOverwolfWindow();
+ removeOverwolfWindow.DataContext = new ThemeViewModel();
+
+ Dispatcher.UIThread.Invoke( () =>
+ {
+ removeOverwolfWindow.ShowDialog(this);
+ });
+ }
+ });
}
private async Task DoShowDialogAsync(InteractionContext interaction)
{
@@ -27,5 +40,4 @@ public partial class ProfileWindow1 : ReactiveWindow
var result = await dialog.ShowDialog(this);
interaction.SetOutput(result);
}
-
}
\ No newline at end of file
diff --git a/Views/RemoveOverwolfWindow.axaml b/Views/RemoveOverwolfWindow.axaml
new file mode 100644
index 0000000..6671736
--- /dev/null
+++ b/Views/RemoveOverwolfWindow.axaml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+ Curseforge with Overwolf Detected
+ Please note: Curseforge installed with Overwolf is not
+ and will never be supported by this installer.
+ A standalone Curseforge launcher exists and is created by Curseforge, use it instead.
+ It uses the same default instance folder as the Overwolf launcher.
+ If you didn't change the instance folder, it will keep your instances.
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Views/RemoveOverwolfWindow.axaml.cs b/Views/RemoveOverwolfWindow.axaml.cs
new file mode 100644
index 0000000..65b0d63
--- /dev/null
+++ b/Views/RemoveOverwolfWindow.axaml.cs
@@ -0,0 +1,77 @@
+using System;
+using System.Diagnostics;
+using System.IO;
+using System.Runtime.InteropServices;
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Interactivity;
+using Avalonia.Markup.Xaml;
+using Avalonia.Threading;
+using FluentAvalonia.UI.Controls;
+using Microsoft.Win32;
+
+namespace VaultSmpInstaller.Views;
+
+public partial class RemoveOverwolfWindow : Window
+{
+ public RemoveOverwolfWindow()
+ {
+ InitializeComponent();
+ }
+
+ private void Continue(object? sender, RoutedEventArgs e)
+ {
+ Dispatcher.UIThread.Invoke(Close);
+ }
+
+ private void UninstallOldVersion(object? sender, RoutedEventArgs e)
+ {
+ string keyPath = @"HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Overwolf";
+ string valueName = "UninstallString";
+ String? uninstallPath = (string?)Registry.GetValue(keyPath, valueName, null);
+
+
+ if (uninstallPath != null)
+ {
+ Process proc = new Process();
+ proc.StartInfo.FileName = uninstallPath[..uninstallPath.LastIndexOf('/')].Replace('"', ' ').Trim();
+ proc.StartInfo.UseShellExecute = true;
+ proc.StartInfo.Verb = "runas";
+ proc.Start();
+ }
+ }
+
+ private void DownloadNewLaucher(object? sender, RoutedEventArgs e)
+ {
+ OpenUrl("https://download.overwolf.com/install/Download?ExtensionId=cfiahnpaolfnlgaihhmobmnjdafknjnjdpdabpcm");
+ }
+
+ private void OpenUrl(string url)
+ {
+ try
+ {
+ Process.Start(url);
+ }
+ catch
+ {
+ // hack because of this: https://github.com/dotnet/corefx/issues/10361
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ url = url.Replace("&", "^&");
+ Process.Start(new ProcessStartInfo(url) { UseShellExecute = true });
+ }
+ else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+ {
+ Process.Start("xdg-open", url);
+ }
+ else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
+ {
+ Process.Start("open", url);
+ }
+ else
+ {
+ throw;
+ }
+ }
+ }
+}
\ No newline at end of file