diff --git a/AddApp.xaml b/AddApp.xaml
index 932e319..b753b82 100644
--- a/AddApp.xaml
+++ b/AddApp.xaml
@@ -4,9 +4,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Elite_Dangerous_Addon_Launcer_V2"
Title="Add App"
- Width="521"
- Height="273"
- xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ Width="540"
+ Height="280"
+ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextElement.FontWeight="Regular"
TextElement.FontSize="13"
@@ -26,47 +26,45 @@
-
-
-
-
+
+
+
-
-
-
+
+
-
-
-
-
-
+
+
+
-
-
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
diff --git a/AddApp.xaml.cs b/AddApp.xaml.cs
index 07436ec..25ffe59 100644
--- a/AddApp.xaml.cs
+++ b/AddApp.xaml.cs
@@ -26,6 +26,21 @@ public AddApp()
this.Loaded += AddApp_Loaded;
}
+ private void Tb_AppExeName_TextChanged(object sender, TextChangedEventArgs e)
+ {
+ if (Tb_AppExeName.Text == "edlaunch.exe")
+ {
+ CheckBox1.Visibility = Visibility.Visible;
+ CheckBox2.Visibility = Visibility.Visible;
+ CheckBox3.Visibility = Visibility.Visible;
+ }
+ else
+ {
+ CheckBox1.Visibility = Visibility.Hidden;
+ CheckBox2.Visibility = Visibility.Hidden;
+ CheckBox3.Visibility = Visibility.Hidden;
+ }
+ }
private void AddApp_Loaded(object sender, RoutedEventArgs e)
{
@@ -55,6 +70,51 @@ private void Bt_BrowsePath_Click(object sender, RoutedEventArgs e)
Tb_AppExeName.Text = fileName;
}
}
+ private void CheckBox1_Checked(object sender, RoutedEventArgs e)
+ {
+ if (!Tb_App_Args.Text.Contains("/autorun"))
+ {
+ Tb_App_Args.Text += " /autorun";
+ }
+ }
+
+ private void CheckBox1_Unchecked(object sender, RoutedEventArgs e)
+ {
+ Tb_App_Args.Text = Tb_App_Args.Text.Replace(" /autorun", "");
+ }
+
+ private void CheckBox2_Checked(object sender, RoutedEventArgs e)
+ {
+ if (!Tb_App_Args.Text.Contains("/autoquit"))
+ {
+ Tb_App_Args.Text += " /autoquit";
+ }
+ }
+
+ private void CheckBox2_Unchecked(object sender, RoutedEventArgs e)
+ {
+ Tb_App_Args.Text = Tb_App_Args.Text.Replace(" /autoquit", "");
+ }
+
+ private void Tb_App_Args_TextChanged(object sender, TextChangedEventArgs e)
+ {
+ CheckBox1.IsChecked = Tb_App_Args.Text.Contains("/autorun");
+ CheckBox2.IsChecked = Tb_App_Args.Text.Contains("/autoquit");
+ CheckBox3.IsChecked = Tb_App_Args.Text.Contains("/vr");
+ }
+ private void CheckBox3_Unchecked(object sender, RoutedEventArgs e)
+ {
+ Tb_App_Args.Text = Tb_App_Args.Text.Replace(" /vr", "");
+ }
+ private void CheckBox3_Checked(object sender, RoutedEventArgs e)
+ {
+ if (!Tb_App_Args.Text.Contains("/vr"))
+ {
+ Tb_App_Args.Text += " /vr";
+ }
+ }
+
+
private void addApp(object sender, RoutedEventArgs e)
{
diff --git a/App.config b/App.config
index 58162d8..ceab020 100644
--- a/App.config
+++ b/App.config
@@ -19,6 +19,9 @@
True
+
+
+
\ No newline at end of file
diff --git a/CustomDialog.xaml b/CustomDialog.xaml
new file mode 100644
index 0000000..a02b661
--- /dev/null
+++ b/CustomDialog.xaml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CustomDialog.xaml.cs b/CustomDialog.xaml.cs
new file mode 100644
index 0000000..ee90a16
--- /dev/null
+++ b/CustomDialog.xaml.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace Elite_Dangerous_Addon_Launcer_V2
+{
+ ///
+ /// Interaction logic for CustomDialog.xaml
+ ///
+ public partial class CustomDialog : Window
+ {
+ public MessageBoxResult Result { get; set; }
+
+ public CustomDialog(string message)
+ {
+ InitializeComponent();
+ MessageTextBlock.Text = message;
+ }
+
+ private void YesButton_Click(object sender, RoutedEventArgs e)
+ {
+ Result = MessageBoxResult.Yes;
+ this.Close();
+ }
+
+ private void NoButton_Click(object sender, RoutedEventArgs e)
+ {
+ Result = MessageBoxResult.No;
+ this.Close();
+ }
+ }
+
+}
diff --git a/Elite Dangerous Addon Launcher V2.csproj b/Elite Dangerous Addon Launcher V2.csproj
index c185ba9..84137a7 100644
--- a/Elite Dangerous Addon Launcher V2.csproj
+++ b/Elite Dangerous Addon Launcher V2.csproj
@@ -6,8 +6,8 @@
Elite_Dangerous_Addon_Launcer_V2
enable
true
- 1.1.2.253
- 1.1.2.253
+ 1.1.2.335
+ 1.1.2.335
elite-dangerous-icon.ico
app.png
https://github.com/jimmyeao/Elite-Dangerous-Addon-Launcher-V2
diff --git a/ErrorBox.xaml b/ErrorBox.xaml
new file mode 100644
index 0000000..ad4e20d
--- /dev/null
+++ b/ErrorBox.xaml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ErrorBox.xaml.cs b/ErrorBox.xaml.cs
new file mode 100644
index 0000000..dbe107e
--- /dev/null
+++ b/ErrorBox.xaml.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace Elite_Dangerous_Addon_Launcer_V2
+{
+ ///
+ /// Interaction logic for CustomDialog.xaml
+ ///
+ public partial class ErrorDialog : Window
+ {
+ public MessageBoxResult Result { get; set; }
+
+ public ErrorDialog(string message)
+ {
+ InitializeComponent();
+ MessageTextBlock.Text = message;
+ }
+
+ private void YesButton_Click(object sender, RoutedEventArgs e)
+ {
+ Result = MessageBoxResult.Yes;
+ this.Close();
+ }
+
+ private void NoButton_Click(object sender, RoutedEventArgs e)
+ {
+ Result = MessageBoxResult.No;
+ this.Close();
+ }
+ }
+
+}
diff --git a/MainWindow.xaml b/MainWindow.xaml
index 5a27c8f..4d033df 100644
--- a/MainWindow.xaml
+++ b/MainWindow.xaml
@@ -49,8 +49,6 @@
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index 175c4d8..0a74b96 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -1,4 +1,5 @@
using GongSolutions.Wpf.DragDrop;
+using Microsoft.Win32;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
@@ -12,6 +13,7 @@
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
+using System.Windows.Documents;
using System.Windows.Media;
namespace Elite_Dangerous_Addon_Launcer_V2
@@ -24,9 +26,9 @@ public partial class MainWindow : Window, INotifyPropertyChanged
public List processList = new List();
private string _applicationVersion;
-
+ private bool _isChecking = false;
private string _appVersion;
-
+ private bool _isLoading = true;
// The row that will be dragged.
private DataGridRow _rowToDrag;
@@ -61,7 +63,7 @@ public string ApplicationVersion
public MainWindow(string profileName = null)
{
InitializeComponent();
-
+
if (!string.IsNullOrEmpty(profileName))
{
// Use the profileName to load the appropriate profile
@@ -96,7 +98,6 @@ protected override void OnClosed(EventArgs e)
Properties.Settings.Default.MainWindowLocation = new System.Drawing.Point((int)this.Left, (int)this.Top);
Properties.Settings.Default.Save();
}
-
protected override void OnContentRendered(EventArgs e)
{
@@ -142,6 +143,8 @@ public void DragOver(IDropInfo dropInfo)
{
dropInfo.DropTargetAdorner = DropTargetAdorners.Highlight;
dropInfo.Effects = DragDropEffects.Move;
+
+ SaveProfilesAsync();
}
}
@@ -193,7 +196,6 @@ public async Task LoadProfilesAsync(string profileName = null)
}
}
-
public async Task SaveProfilesAsync()
{
// Serialize the profiles into a JSON string
@@ -261,7 +263,6 @@ private void Bt_AddApp_Click_1(object sender, RoutedEventArgs e)
{
if (AppState.Instance.CurrentProfile != null)
{
-
AddApp addAppWindow = new AddApp()
{
MainPageReference = this,
@@ -286,7 +287,6 @@ private void Bt_AddProfile_Click_1(object sender, RoutedEventArgs e)
window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
window.Owner = this; // Or replace 'this' with reference to the main window
-
if (window.ShowDialog() == true)
{
string profileName = window.ProfileName;
@@ -300,15 +300,43 @@ private void Bt_AddProfile_Click_1(object sender, RoutedEventArgs e)
}
}
- private void Bt_RemoveProfile_Click_1(object sender, RoutedEventArgs e)
+ private async void Bt_RemoveProfile_Click_1(object sender, RoutedEventArgs e)
{
Profile profileToRemove = (Profile)Cb_Profiles.SelectedItem;
if (profileToRemove != null)
{
- AppState.Instance.Profiles.Remove(profileToRemove);
- _ = SaveProfilesAsync();
- UpdateDataGrid();
+ CustomDialog dialog = new CustomDialog("Are you sure you want to delete this profile?");
+ dialog.Owner = Application.Current.MainWindow;
+ dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
+ dialog.ShowDialog();
+
+ if (dialog.Result == MessageBoxResult.Yes)
+ {
+ AppState.Instance.Profiles.Remove(profileToRemove);
+
+ // Check if another profile can be selected
+ if (AppState.Instance.Profiles.Any())
+ {
+ // Select the next profile, or the first one if no next profile exists
+ AppState.Instance.CurrentProfile = AppState.Instance.Profiles.FirstOrDefault(p => p != profileToRemove) ?? AppState.Instance.Profiles.First();
+
+ // If no profile is set as default, set the current profile as the default
+ if (!AppState.Instance.Profiles.Any(p => p.IsDefault))
+ {
+ AppState.Instance.CurrentProfile.IsDefault = true;
+ DefaultCheckBox.IsChecked = true;
+ }
+ }
+ else
+ {
+ // No profiles left, so set CurrentProfile to null
+ AppState.Instance.CurrentProfile = null;
+ }
+
+ _ = SaveProfilesAsync();
+ UpdateDataGrid();
+ }
}
}
@@ -322,12 +350,72 @@ private void Btn_Edit_Click(object sender, RoutedEventArgs e)
AddApp addAppWindow = new AddApp();
addAppWindow.AppToEdit = appToEdit; // Set the AppToEdit to the app you want to edit
addAppWindow.MainPageReference = this; // Assuming this is done from MainWindow, else replace 'this' with the instance of MainWindow
- // Set the owner and startup location
+ // Set the owner and startup location
addAppWindow.Owner = this; // Or replace 'this' with reference to the main window
addAppWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
+ addAppWindow.Title = "Edit App";
addAppWindow.ShowDialog();
}
}
+ public void ShowWhatsNewIfUpdated()
+ {
+ // Get the current assembly version.
+ var assemblyVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
+
+ // Get the last seen version from the application settings.
+ var lastSeenVersion = Properties.Settings.Default.LastSeenVersion;
+
+ // If the last seen version is empty (which it will be the first time this method is run)
+ // or if the assembly version is greater than the last seen version, show the what's new dialog.
+ if (string.IsNullOrEmpty(lastSeenVersion) || new Version(lastSeenVersion) < assemblyVersion)
+ {
+ ShowWhatsNew();
+
+ // Update the last seen version in the application settings.
+ Properties.Settings.Default.LastSeenVersion = assemblyVersion.ToString();
+
+ // Save the application settings.
+ Properties.Settings.Default.Save();
+ }
+ }
+
+ public void ShowWhatsNew()
+ {
+ WhatsNewWindow whatsNewWindow = new WhatsNewWindow();
+
+ // Set the text to what's new
+ Paragraph titleParagraph = new Paragraph();
+ titleParagraph.Inlines.Add(new Bold(new Run("New for this version")));
+ whatsNewWindow.WhatsNewText.Document.Blocks.Add(titleParagraph);
+
+ List list = new List();
+
+ ListItem listItem1 = new ListItem(new Paragraph(new Run("Launch Options For Elite")));
+ list.ListItems.Add(listItem1);
+
+ ListItem listItem2 = new ListItem(new Paragraph(new Run("Profile Options for import/export and copy/rename/delete")));
+ list.ListItems.Add(listItem2);
+
+ ListItem listItem3 = new ListItem(new Paragraph(new Run("Added themed dialogs")));
+ list.ListItems.Add(listItem3);
+
+ ListItem listItem4 = new ListItem(new Paragraph(new Run("Fly safe, Cmdr! o7")));
+ list.ListItems.Add(listItem4);
+
+ whatsNewWindow.WhatsNewText.Document.Blocks.Add(list);
+
+ whatsNewWindow.Owner = this; // Set owner to this MainWindow
+ whatsNewWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; // Center the window over its owner
+
+ whatsNewWindow.ShowDialog();
+ }
+
+
+
+
+
+
+
private void Btn_Launch_Click(object sender, RoutedEventArgs e)
{
@@ -352,10 +440,17 @@ private void Cb_Profiles_SelectionChanged(object sender, SelectionChangedEventAr
{
UpdateDataGrid();
DefaultCheckBox.IsChecked = selectedProfile.IsDefault;
+ if (!_isLoading) // Change here
+ {
+ _isChecking = true;
+ CheckEdLaunchInProfile();
+ _isChecking = false;
+ }
}
}
}
+
private void CheckBox_Unchecked(object sender, RoutedEventArgs e) // this is the checkbox fo r the defaul profile
{
var checkBox = (CheckBox)sender;
@@ -413,13 +508,20 @@ private void DeleteButton_Click(object sender, RoutedEventArgs e)
{
// get the button that raised the event
var button = (Button)sender;
+ CustomDialog dialog = new CustomDialog("Are you sure?");
+ dialog.Owner = Application.Current.MainWindow;
+ dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
+ dialog.ShowDialog();
- // retrieve the item associated with this button
- var appToDelete = (MyApp)button.DataContext;
+ if (dialog.Result == MessageBoxResult.Yes)
+ {
+ // retrieve the item associated with this button
+ var appToDelete = (MyApp)button.DataContext;
- // remove the item from the collection
- AppState.Instance.CurrentProfile.Apps.Remove(appToDelete);
- _ = SaveProfilesAsync();
+ // remove the item from the collection
+ AppState.Instance.CurrentProfile.Apps.Remove(appToDelete);
+ _ = SaveProfilesAsync();
+ }
}
private void LaunchApp(MyApp app) // function to launch enabled applications
@@ -512,6 +614,7 @@ private async Task LoadSettingsAsync()
private async void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
+ _isLoading = true;
await LoadProfilesAsync(App.ProfileName);
settings = await LoadSettingsAsync();
isDarkTheme = settings.Theme == "Dark";
@@ -527,10 +630,16 @@ private async void MainWindow_Loaded(object sender, RoutedEventArgs e)
}
}
}
+ _isLoading = false;
+ if (_isChecking == false)
+ {
+ _isChecking = true;
+ CheckEdLaunchInProfile();
+ _isChecking = false;
+ }
+ ShowWhatsNewIfUpdated();
}
-
-
private void ModifyTheme(Uri newThemeUri)
{
var appResources = Application.Current.Resources;
@@ -693,6 +802,159 @@ private void UpdateStatus(string status)
#endregion Private Methods
+ public static async Task> ScanComputerForEdLaunch()
+ {
+ List foundPaths = new List();
+ string targetFolder = "Elite Dangerous";
+ string targetFile = "edlaunch.exe";
+ var tokenSource = new CancellationTokenSource();
+ var token = tokenSource.Token;
+
+ SearchProgressWindow progressWindow = new SearchProgressWindow();
+
+ progressWindow.Owner = Application.Current.MainWindow;
+ progressWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
+ progressWindow.Closing += (s, e) => tokenSource.Cancel();
+
+ progressWindow.Show(); // Show the window before starting the task
+
+ await Task.Run(() =>
+ {
+ try
+ {
+ foreach (DriveInfo drive in DriveInfo.GetDrives())
+ {
+ if (token.IsCancellationRequested)
+ break;
+
+ if (drive.DriveType == DriveType.Fixed)
+ {
+ try
+ {
+ string driveRoot = drive.RootDirectory.ToString();
+ if (TraverseDirectories(driveRoot, targetFolder, targetFile, foundPaths, progressWindow, 7, token))
+ {
+ break;
+ }
+ }
+ catch (UnauthorizedAccessException)
+ {
+ // If we don't have access to the directory, skip it
+ }
+ catch (IOException)
+ {
+ // If another error occurs, skip it
+ }
+ }
+ }
+ }
+ catch (OperationCanceledException)
+ {
+ // If operation is canceled, return
+ return;
+ }
+ }, token);
+
+ if (progressWindow.IsVisible)
+ progressWindow.Close();
+
+ return foundPaths;
+ }
+
+ public static bool TraverseDirectories(string root, string targetFolder, string targetFile, List foundPaths, SearchProgressWindow window, int maxDepth, CancellationToken token, int currentDepth = 0)
+ {
+ // Array of directories to exclude
+ string[] excludeDirs = {
+ "windows",
+ "users",
+ "OneDriveTemp",
+ "ProgramData",
+ "$Recycle.Bin",
+ "OneDrive"
+ };
+
+ if (token.IsCancellationRequested)
+ return false;
+
+ // Make sure not to exceed maximum depth
+ if (currentDepth > maxDepth) return false;
+
+ foreach (string dir in Directory.GetDirectories(root))
+ {
+ // Check for excluded directories
+ bool isExcluded = false;
+ foreach (string excludeDir in excludeDirs)
+ {
+ if (dir.ToLower().Contains(excludeDir.ToLower()))
+ {
+ isExcluded = true;
+ break;
+ }
+ }
+
+ if (isExcluded || token.IsCancellationRequested)
+ {
+ continue;
+ }
+
+ try
+ {
+ string dirName = new DirectoryInfo(dir).Name;
+
+ if (dirName.Equals(targetFolder, StringComparison.OrdinalIgnoreCase))
+ {
+ // The folder has the name we're looking for, now we just need to check if
+ // the file is there
+ foreach (string file in Directory.GetFiles(dir))
+ {
+ if (Path.GetFileName(file).Equals(targetFile, StringComparison.OrdinalIgnoreCase))
+ {
+ foundPaths.Add(file);
+ return true; // File has been found
+ }
+ }
+ }
+
+ // Trim the path for display in the UI
+ string trimmedPath = dir;
+ if (dir.Count(f => f == '\\') > 2)
+ {
+ var parts = dir.Split('\\');
+ trimmedPath = string.Join("\\", parts.Take(3)) + "\\...";
+ }
+
+ window.Dispatcher.Invoke(() =>
+ {
+ window.searchStatusTextBlock.Text = $"Checking: {trimmedPath}";
+ });
+
+ // Move on to the next level
+ bool found = TraverseDirectories(dir, targetFolder, targetFile, foundPaths, window, maxDepth, token, currentDepth + 1);
+
+ if (found)
+ {
+ return true; // File has been found in a subdirectory, so we stop the search
+ }
+ }
+ catch (UnauthorizedAccessException)
+ {
+ // If we don't have access to the directory, skip it
+ }
+ catch (IOException)
+ {
+ // If another error occurs, skip it
+ }
+ }
+
+ return false; // If we get to this point, we haven't found the file
+ }
+
+ private static string ShortenPath(string fullPath, int maxParts)
+ {
+ var parts = fullPath.Split(Path.DirectorySeparatorChar);
+ return string.Join(Path.DirectorySeparatorChar, parts.Take(maxParts));
+ }
+
private void AddonDataGrid_ContextMenuOpening(object sender, ContextMenuEventArgs e)
{
var dataGrid = (DataGrid)sender;
@@ -744,13 +1006,17 @@ private void Bt_CopyProfile_Click(object sender, RoutedEventArgs e)
Apps = new ObservableCollection(currentProfile.Apps)
};
AppState.Instance.Profiles.Add(newProfile);
+ AppState.Instance.CurrentProfile = newProfile; // switch to the new profile
_ = SaveProfilesAsync();
-
+ Cb_Profiles.SelectedItem = newProfile; // update combobox selected item
isUnique = true;
}
else
{
- MessageBox.Show("Profile name must be unique. Please enter a different name.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+ ErrorDialog errdialog = new ErrorDialog("Profile name must be unique. Please enter a different name.");
+ errdialog.Owner = Application.Current.MainWindow;
+ errdialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
+ errdialog.ShowDialog();
}
}
else
@@ -783,6 +1049,67 @@ private void Bt_RenameProfile_Click(object sender, RoutedEventArgs e)
}
}
+ private async void CheckEdLaunchInProfile()
+ {
+ // Get the current profile
+ var currentProfile = AppState.Instance.CurrentProfile;
+ if (currentProfile == null)
+ {
+ return;
+ }
+ // Check if edlaunch.exe exists in the current profile
+ if (!currentProfile.Apps.Any(a => a.ExeName.Equals("edlaunch.exe", StringComparison.OrdinalIgnoreCase)))
+ {
+ // edlaunch.exe does not exist in the current profile Prompt the user with a dialog
+ // offering to scan their computer for it
+ CustomDialog dialog = new CustomDialog("Elite Dangerous does not exist in the current profile. Would you like to scan your computer for it?");
+ dialog.Owner = Application.Current.MainWindow;
+ dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
+ dialog.ShowDialog();
+
+ // If the user clicked Yes, call the method that scans the computer for edlaunch.exe
+ if (dialog.Result == MessageBoxResult.Yes)
+ {
+ var EdLuanchPaths = await ScanComputerForEdLaunch(); // Note the "await" keyword here
+ if (EdLuanchPaths.Count > 0)
+ {
+ // Add edlaunch.exe to the current profile
+ var edlaunch = new MyApp
+ {
+ Name = "Elite Dangerous",
+ ExeName = "edlaunch.exe",
+ Path = Path.GetDirectoryName(EdLuanchPaths[0]),
+ IsEnabled = true,
+ Order = 0
+ };
+ currentProfile.Apps.Add(edlaunch);
+ await SaveProfilesAsync(); // You can also "await" here since SaveProfilesAsync is probably asynchronous
+ }
+ else
+ {
+ MessageBox.Show(
+ "edlaunch.exe was not found on your computer. Please add it manually.",
+ "edlaunch.exe Not Found",
+ MessageBoxButton.OK,
+ MessageBoxImage.Error
+ );
+ }
+ }
+ }
+ }
+
+ private void CloseAllAppsCheckbox_Checked_1(object sender, RoutedEventArgs e)
+ {
+ Properties.Settings.Default.CloseAllAppsOnExit = true;
+ Properties.Settings.Default.Save();
+ }
+
+ private void CloseAllAppsCheckbox_Unchecked_1(object sender, RoutedEventArgs e)
+ {
+ Properties.Settings.Default.CloseAllAppsOnExit = false;
+ Properties.Settings.Default.Save();
+ }
+
private DataGridRow GetDataGridRow(MenuItem menuItem)
{
DependencyObject obj = menuItem;
@@ -826,18 +1153,55 @@ private void ProfileMenuItem_Click(object sender, RoutedEventArgs e)
Debug.WriteLine("No app selected");
}
}
-
- private void CloseAllAppsCheckbox_Checked_1(object sender, RoutedEventArgs e)
+ private void ExportProfiles(object sender, RoutedEventArgs e)
{
- Properties.Settings.Default.CloseAllAppsOnExit = true;
- Properties.Settings.Default.Save();
- }
+ var saveFileDialog = new SaveFileDialog();
+ saveFileDialog.Filter = "JSON file (*.json)|*.json";
+ saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
- private void CloseAllAppsCheckbox_Unchecked_1(object sender, RoutedEventArgs e)
+ if (saveFileDialog.ShowDialog() == true)
+ {
+ string json = JsonConvert.SerializeObject(AppState.Instance.Profiles);
+ File.WriteAllText(saveFileDialog.FileName, json);
+ }
+ }
+ private async void ImportProfiles(object sender, RoutedEventArgs e)
{
- Properties.Settings.Default.CloseAllAppsOnExit = false;
- Properties.Settings.Default.Save();
+ var openFileDialog = new OpenFileDialog();
+ openFileDialog.Filter = "JSON file (*.json)|*.json";
+ openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
+
+ if (openFileDialog.ShowDialog() == true)
+ {
+ string json = File.ReadAllText(openFileDialog.FileName);
+ var importedProfiles = JsonConvert.DeserializeObject>(json);
+ CustomDialog dialog = new CustomDialog("Are you sure you, this will remove all current profiles?");
+ dialog.Owner = Application.Current.MainWindow;
+ dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
+ dialog.ShowDialog();
+
+ if (dialog.Result == MessageBoxResult.No)
+ {
+ return;
+ }
+ // remove current profiles
+ AppState.Instance.Profiles.Clear();
+
+ // add imported profiles
+ foreach (var profile in importedProfiles)
+ {
+ AppState.Instance.Profiles.Add(profile);
+ }
+
+ // save the changes
+ _ = SaveProfilesAsync();
+
+ // update the UI
+ UpdateDataGrid();
+ Cb_Profiles.SelectedIndex = 0; // if you want to automatically select the first imported profile
+ }
}
+
}
}
\ No newline at end of file
diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs
index ced0e42..c367b66 100644
--- a/Properties/Settings.Designer.cs
+++ b/Properties/Settings.Designer.cs
@@ -70,5 +70,17 @@ public bool UpdateSettings {
this["UpdateSettings"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("")]
+ public string LastSeenVersion {
+ get {
+ return ((string)(this["LastSeenVersion"]));
+ }
+ set {
+ this["LastSeenVersion"] = value;
+ }
+ }
}
}
diff --git a/Properties/Settings.settings b/Properties/Settings.settings
index 4c7fde5..c9e9d69 100644
--- a/Properties/Settings.settings
+++ b/Properties/Settings.settings
@@ -14,5 +14,8 @@
True
+
+
+
\ No newline at end of file
diff --git a/SearchProgressWindow.xaml b/SearchProgressWindow.xaml
new file mode 100644
index 0000000..f52faea
--- /dev/null
+++ b/SearchProgressWindow.xaml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
diff --git a/SearchProgressWindow.xaml.cs b/SearchProgressWindow.xaml.cs
new file mode 100644
index 0000000..4a72282
--- /dev/null
+++ b/SearchProgressWindow.xaml.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace Elite_Dangerous_Addon_Launcer_V2
+{
+ ///
+ /// Interaction logic for SearchProgressWindow.xaml
+ ///
+ public partial class SearchProgressWindow : Window
+ {
+ public SearchProgressWindow()
+ {
+ InitializeComponent();
+ }
+
+
+ }
+}
diff --git a/WhatsNew.xaml b/WhatsNew.xaml
new file mode 100644
index 0000000..923718c
--- /dev/null
+++ b/WhatsNew.xaml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/WhatsNew.xaml.cs b/WhatsNew.xaml.cs
new file mode 100644
index 0000000..79ed331
--- /dev/null
+++ b/WhatsNew.xaml.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace Elite_Dangerous_Addon_Launcer_V2
+{
+ ///
+ /// Interaction logic for WhatsNew.xaml
+ ///
+ public partial class WhatsNewWindow : Window
+ {
+ public WhatsNewWindow()
+ {
+ InitializeComponent();
+ }
+ private void Bt_Close_Click(object sender, RoutedEventArgs e)
+ {
+ this.Close();
+ }
+ }
+}