diff --git a/LoadEntriesWindow.xaml b/LoadEntriesWindow.xaml
index 52bcab1..545c6f5 100644
--- a/LoadEntriesWindow.xaml
+++ b/LoadEntriesWindow.xaml
@@ -30,8 +30,9 @@
-
-
+
+
+
diff --git a/LoadEntriesWindow.xaml.cs b/LoadEntriesWindow.xaml.cs
index 82c7799..39c3b22 100644
--- a/LoadEntriesWindow.xaml.cs
+++ b/LoadEntriesWindow.xaml.cs
@@ -1,17 +1,10 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.IO;
using System.Windows;
+using Microsoft.Win32;
using EDJournal;
-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;
+using EliteBGS.Util;
namespace EliteBGS {
///
@@ -22,6 +15,8 @@ namespace EliteBGS {
public event EntriesLoadedDelegate EntriesLoaded;
+ Config config = new Config();
+
public LoadEntriesWindow() {
InitializeComponent();
}
@@ -52,5 +47,31 @@ namespace EliteBGS {
private void Clear_Click(object sender, RoutedEventArgs e) {
Lines.Clear();
}
+
+ private void LoadFile_Click(object sender, RoutedEventArgs e) {
+ OpenFileDialog dialog = new OpenFileDialog();
+
+ dialog.DefaultExt = ".log";
+ dialog.Filter = "Log files (*.log)|*.log|All files (*.*)|*";
+
+ var location = config.Global.DefaultJournalLocation;
+ if (Directory.Exists(location)) {
+ dialog.InitialDirectory = location;
+ }
+
+ bool result = dialog.ShowDialog(this) ?? false;
+ if (!result) {
+ return;
+ }
+
+ try {
+ using (FileStream stream = File.OpenRead(dialog.FileName)) {
+ using (StreamReader reader = new StreamReader(stream)) {
+ Lines.Text = reader.ReadToEnd();
+ }
+ }
+ } catch (Exception) {
+ }
+ }
}
}