From 5a9fd51a6712e2f17dc1185c3b0285fa09105811 Mon Sep 17 00:00:00 2001 From: Ryan McCarvill Date: Fri, 13 May 2016 19:29:21 +1200 Subject: [PATCH] added filepicker to load rust engine. --- XiEditor/MainWindow.xaml.cs | 24 +++++++++++++++++++++++- XiEditor/XiEditor.csproj | 3 +++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/XiEditor/MainWindow.xaml.cs b/XiEditor/MainWindow.xaml.cs index fdf36d1..882d6ed 100644 --- a/XiEditor/MainWindow.xaml.cs +++ b/XiEditor/MainWindow.xaml.cs @@ -40,7 +40,29 @@ public MainWindow() { InitializeComponent(); - var filename = @"C:\Users\Clayton\Source\xi-editor\rust\target\debug\xicore.exe"; + + string filename = (string)Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\xieditor\", "path", null); + if (String.IsNullOrWhiteSpace(filename) ) + { + + OpenFileDialog xiEnginePicker = new OpenFileDialog(); + + xiEnginePicker.InitialDirectory = "c:\\"; + xiEnginePicker.Filter = "xi-editor core (*.exe)|*.exe|All files (*.*)|*.*"; + xiEnginePicker.Title = "Please select the xi-editor.exe in your rust > target directory."; + + if (xiEnginePicker.ShowDialog() == true ) + { + filename = xiEnginePicker.FileName; + Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\xieditor\", "path", filename ); + } else + { + System.Windows.MessageBox.Show("You must select a xi-editor core engine."); + Environment.Exit(1); + } + } + + // filename = @"C:\Users\Clayton\Source\xi-editor\rust\target\debug\xicore.exe"; coreConnection = new CoreConnection(filename, delegate (object data) { handleCoreCmd(data); }); diff --git a/XiEditor/XiEditor.csproj b/XiEditor/XiEditor.csproj index d1abce0..2d5d99b 100644 --- a/XiEditor/XiEditor.csproj +++ b/XiEditor/XiEditor.csproj @@ -104,6 +104,9 @@ + + +