Compare commits

...

5 Commits

7 changed files with 51 additions and 215 deletions

View File

@ -61,7 +61,7 @@ internal class TransactionParserContext {
}
if (OnFootKills > 0) {
cztype = "OnFoot";
cztype = "On Foot";
// High on foot combat zones have enforcers that bring 80k a pop
if (highest >= 80000) {
grade = "High";

View File

@ -1,24 +0,0 @@
<Window x:Class="EliteBGS.AdjustProfitWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:EliteBGS"
mc:Ignorable="d"
Title="Adjust Trade Profit" Height="130" Width="450">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Content="Use this dialog to adjust trade profits" Grid.Row="0" Grid.ColumnSpan="2" />
<TextBox x:Name="Profit" Grid.Row="1" Grid.ColumnSpan="2" Margin="10,10,10,10"/>
<Button x:Name="Cancel" Content="Cancel" Width="60" Grid.Row="2" Grid.Column="0" HorizontalAlignment="Right" Margin="5,0,5,0" IsCancel="true" Click="Cancel_Click"/>
<Button x:Name="Accept" Content="Accept" Width="60" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right" Margin="5,0,5,0" IsDefault="true" Click="Accept_Click" />
</Grid>
</Window>

View File

@ -1,34 +0,0 @@
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 EliteBGS {
/// <summary>
/// Interaction logic for AdjustProfitWindow.xaml
/// </summary>
public partial class AdjustProfitWindow : Window {
public AdjustProfitWindow() {
InitializeComponent();
}
private void Cancel_Click(object sender, RoutedEventArgs e) {
DialogResult = false;
Close();
}
private void Accept_Click(object sender, RoutedEventArgs e) {
DialogResult = true;
Close();
}
}
}

View File

@ -1,109 +0,0 @@
{
"$schema": "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.5.json",
"version": "2.1.0",
"runs": [
{
"tool": {
"driver": {
"name": "Dependency Analysis",
"semanticVersion": "0.4.355802",
"informationUri": "https://docs.microsoft.com/en-us/dotnet/core/porting/upgrade-assistant-overview",
"rules": [
{
"id": "UA106",
"name": "PackageToBeAdded",
"fullDescription": {
"text": "Packages that need to be added in order to upgrade the project to chosen TFM"
},
"helpUri": "https://docs.microsoft.com/en-us/dotnet/core/porting/upgrade-assistant-overview"
}
]
}
},
"results": [
{
"ruleId": "UA106",
"message": {
"text": "Package Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers, Version=0.4.355802 needs to be added."
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "file:///D:/src/EDBGS/EliteBGS/EliteBGS.csproj"
},
"region": {}
}
}
]
},
{
"ruleId": "UA106",
"message": {
"text": "Package Microsoft.Windows.Compatibility, Version=7.0.0 needs to be added."
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "file:///D:/src/EDBGS/EliteBGS/EliteBGS.csproj"
},
"region": {}
}
}
]
}
],
"columnKind": "utf16CodeUnits"
},
{
"tool": {
"driver": {
"name": "API Upgradability",
"semanticVersion": "0.4.355802",
"informationUri": "https://docs.microsoft.com/en-us/dotnet/core/porting/upgrade-assistant-overview"
}
},
"results": [],
"columnKind": "utf16CodeUnits"
},
{
"tool": {
"driver": {
"name": "Component Analysis",
"semanticVersion": "0.4.355802",
"informationUri": "https://docs.microsoft.com/en-us/dotnet/core/porting/upgrade-assistant-overview",
"rules": [
{
"id": "UA209",
"name": "Microsoft.DotNet.UpgradeAssistant.Extensions.Windows.WinformsDefaultFontUpdater",
"fullDescription": {
"text": "Default Font API Alert"
},
"helpUri": "about:blank"
}
]
}
},
"results": [
{
"ruleId": "UA209",
"message": {
"text": "Default font in Windows Forms has been changed from Microsoft Sans Serif to Seg Segoe UI, in order to change the default font use the API - Application.SetDefaultFont(Font font). For more details see here - https://devblogs.microsoft.com/dotnet/whats-new-in-windows-forms-in-net-6-0-preview-5/#application-wide-default-font."
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "file:///D:/src/EDBGS/EliteBGS/EliteBGS.csproj"
},
"region": {}
}
}
]
}
],
"columnKind": "utf16CodeUnits"
}
]
}

View File

@ -45,8 +45,6 @@
<DatePicker x:Name="enddate" Height="26.2857142857143" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Separator Height="26.2857142857143" Margin="0" VerticalAlignment="Top"/>
<Button x:Name="AddCombatZone" Content="Add Combat Zone Win" VerticalAlignment="Stretch" Margin="0,0,0,0.286" RenderTransformOrigin="0.5,0.505" Click="AddCombatZone_Click"/>
<Separator Height="26.2857142857143" Margin="0" VerticalAlignment="Top"/>
<Button x:Name="AdjustProfit" Content="Adjust Trade Profit" Margin="0" VerticalAlignment="Stretch" Click="AdjustProfit_Click" />
<Separator Margin="1" VerticalAlignment="Center" MinWidth="1" HorizontalAlignment="Center" MinHeight="22"/>
<Button x:Name="ManuallyParse" Content="Manually Parse JSON" Click="ManuallyParse_Click" />
</ToolBar>
@ -82,7 +80,7 @@
<TextBlock Text="{Binding Name}" FontWeight="DemiBold" TextAlignment="Center"/>
</StackPanel>
<Separator Visibility="Hidden" Grid.Column="1" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" />
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" x:Name="CombatZone">
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" x:Name="CombatZone" Visibility="{Binding IsCombatZone}">
<Button x:Name="Low" Content="Low" Click="Low_Click"/>
<Separator Margin="2,0,2,0" VerticalAlignment="Top"/>
<Button Content="Med" x:Name="Med" Click="Med_Click" />
@ -93,6 +91,10 @@
<Separator Margin="2,0,2,0" VerticalAlignment="Top"/>
<Button Content="Ship" x:Name="Ship" Click="Ship_Click"/>
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" x:Name="SellCargo" Visibility="{Binding IsSellCargo}">
<TextBlock Text="Adjust Profit: " TextAlignment="Center" />
<TextBox x:Name="Profit" MinWidth="80" HorizontalContentAlignment="Right" Text="{Binding Profit, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" TextChanged="Profit_TextChanged"/>
</StackPanel>
</Grid>
</HierarchicalDataTemplate>
</HierarchicalDataTemplate.ItemTemplate>

View File

@ -248,13 +248,14 @@ public partial class MainWindow : Window {
CombatZone zone = new CombatZone {
Faction = objective.Faction,
System = objective.System,
Grade = dialog.Grade,
Type = dialog.Type,
Amount = dialog.Amount
};
objective.Transactions.Add(zone);
UITransaction uitransaction = new UITransaction(zone);
objective.UITransactions.Add(uitransaction);
RefreshView();
}
@ -263,26 +264,6 @@ public partial class MainWindow : Window {
GenerateLog();
}
private void AdjustProfit_Click(object sender, RoutedEventArgs e) {
if (entries.SelectedItem == null || entries.SelectedItem.GetType() != typeof(SellCargo)) {
return;
}
SellCargo sell = entries.SelectedItem as SellCargo;
AdjustProfitWindow adjust = new AdjustProfitWindow() { Owner = this };
adjust.Profit.Text = sell.Profit.ToString();
if (!(adjust.ShowDialog() ?? false)) {
return;
}
if (int.TryParse(adjust.Profit.Text, out int newprofit)) {
sell.Profit = newprofit;
RefreshView();
}
}
private void LogType_SelectionChanged(object sender, SelectionChangedEventArgs e) {
if (LogType.SelectedItem == null) {
return;
@ -315,27 +296,6 @@ public partial class MainWindow : Window {
}
private void Transaction_Initialized(object sender, EventArgs e) {
Grid grid = sender as Grid;
if (grid == null || grid.DataContext == null) {
return;
}
UITransaction t = grid.DataContext as UITransaction;
if (t == null) {
return;
}
bool iscombatzone = (t.Transaction.GetType() == typeof(CombatZone));
var children = grid
.Children
.OfType<StackPanel>()
.Where(x => x.Name == "CombatZone")
;
foreach (var child in children ) {
child.Visibility = (iscombatzone ? Visibility.Visible : Visibility.Collapsed);
}
}
private TransactionType GetTransaction<TransactionType>(object sender) where TransactionType : Transaction {
@ -388,7 +348,7 @@ public partial class MainWindow : Window {
return;
}
transaction.Type = "OnFoot";
transaction.Type = "On Foot";
RefreshView();
}
@ -401,4 +361,8 @@ public partial class MainWindow : Window {
transaction.Type = "Ship";
RefreshView();
}
private void Profit_TextChanged(object sender, TextChangedEventArgs e) {
RefreshView();
}
}

View File

@ -4,6 +4,7 @@ using System.Text;
using Newtonsoft.Json;
using EDPlayerJournal.BGS;
using System.Linq;
using System.Windows;
namespace EliteBGS;
@ -12,6 +13,42 @@ public class UITransaction {
public bool IsExpanded { get; set; } = true;
public Visibility IsCombatZone {
get {
return (Transaction != null && Transaction.GetType() == typeof(CombatZone)) ? Visibility.Visible : Visibility.Hidden;
}
}
public Visibility IsSellCargo {
get {
return (Transaction != null && Transaction.GetType() == typeof(SellCargo)) ? Visibility.Visible : Visibility.Hidden;
}
}
/// <summary>
/// Profit from selling, used in the XAML ui for binding
/// </summary>
public string Profit {
get {
SellCargo cargo = Transaction as SellCargo;
if (cargo == null) {
return "";
}
return cargo.Profit.ToString();
}
set {
SellCargo cargo = Transaction as SellCargo;
if (cargo == null) {
return;
}
try {
long profit_as_number = Convert.ToInt64(value);
cargo.Profit = profit_as_number;
} catch (FormatException) {
}
}
}
public Transaction Transaction { get; set; }
public UITransaction() { }