Skip to content

Commit

Permalink
updated serilog library
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyeao committed Jul 13, 2024
1 parent 6df282b commit 3b3141f
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 7 deletions.
10 changes: 5 additions & 5 deletions Elite Dangerous Addon Launcher V2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<RootNamespace>Elite_Dangerous_Addon_Launcher_V2</RootNamespace>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<AssemblyVersion>1.1.5.382</AssemblyVersion>
<FileVersion>1.1.5.382</FileVersion>
<AssemblyVersion>1.1.5.387</AssemblyVersion>
<FileVersion>1.1.5.387</FileVersion>
<ApplicationIcon>elite-dangerous-icon.ico</ApplicationIcon>
<PackageIcon>app.png</PackageIcon>
<PackageProjectUrl>https://github.com/jimmyeao/Elite-Dangerous-Addon-Launcher-V2</PackageProjectUrl>
Expand Down Expand Up @@ -39,9 +39,9 @@
<PackageReference Include="MaterialDesignColors" Version="2.1.4" />
<PackageReference Include="MaterialDesignThemes" Version="4.9.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog" Version="4.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
<Button x:Name="Bt_RenameProfile" Content="Rename Profile" Click="Bt_RenameProfile_Click" Style="{DynamicResource MaterialDesignRaisedButton}" />
<Button x:Name="Btn_Import" Content="Import" Click="ImportProfiles" Style="{DynamicResource MaterialDesignRaisedButton}" />
<Button x:Name="Btn_Export" Content="Export" Click="ExportProfiles" Style="{DynamicResource MaterialDesignRaisedButton}" />
<Button x:Name="Logs" Content="Logs" Click="Btn_ShowLogs" Style="{DynamicResource MaterialDesignRaisedButton}" />
</StackPanel>
</Expander>

Expand Down
36 changes: 35 additions & 1 deletion MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public partial class MainWindow : Window, INotifyPropertyChanged
private bool _isLoading = true;
// The row that will be dragged.
private DataGridRow _rowToDrag;

private string logpath;
// Store the position where the mouse button is clicked.
private Point _startPoint;

Expand Down Expand Up @@ -1226,6 +1226,40 @@ private async void ImportProfiles(object sender, RoutedEventArgs e)
}
}

private void Btn_ShowLogs(object sender, RoutedEventArgs e)
{
logpath = LoggingConfig.logFileFullPath;
// Ensure the directory exists
try
{
// Get the most recent log file

if (logpath != null && File.Exists(logpath))
{
try
{
ProcessStartInfo processStartInfo = new ProcessStartInfo
{
FileName = logpath,
UseShellExecute = true
};

Process.Start(processStartInfo);
}
catch (Exception ex)
{
Log.Error($"Error opening log file: {ex.Message}");
}
}
else
{
Log.Error("Log file does not exist.");
}
}
catch (Exception ex)
{
Log.Error($"Error opening log file: {ex.Message}");
}
}
}
}
2 changes: 1 addition & 1 deletion Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3b3141f

Please sign in to comment.