Archived
1
0

Compare commits

..

No commits in common. "master" and "5d3af78a695c727a921c4e111c286fe994d7465c" have entirely different histories.

54 changed files with 758 additions and 2026 deletions

View File

@ -1,4 +1,11 @@
using System.Windows; using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using NonaBGS.Journal;
namespace NonaBGS namespace NonaBGS
{ {

View File

@ -1,6 +1,10 @@
using System.Linq; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; using System.Text;
using EDJournal; using System.Globalization;
using System.Threading.Tasks;
using NonaBGS.Journal;
namespace NonaBGS.BGS { namespace NonaBGS.BGS {
public class Cartographics : LogEntry { public class Cartographics : LogEntry {
@ -22,7 +26,7 @@ namespace NonaBGS.BGS {
public override string ToString() { public override string ToString() {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat("Sold {0} worth of Cartographics Data", Credits.FormatCredits(TotalSum)); builder.AppendFormat("Sold {0} CR worth of Cartographics Data", TotalSum);
return builder.ToString(); return builder.ToString();
} }

View File

@ -1,32 +1,11 @@
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NonaBGS.BGS { namespace NonaBGS.BGS {
public class CombatZone : LogEntry, IComparable { public class CombatZone {
public string Type { get; set; } private int level;
public string Grade { get; set; }
public int Amount { get; set; }
public int CompareTo(object obj) {
if (obj.GetType() != typeof(CombatZone)) {
return -1;
}
var b = obj as CombatZone;
if (b.Faction != Faction || b.System != System) {
return -1; // System and faction don't match
}
if (b.Type != b.Type || b.Grade != b.Grade) {
return -1; // grade and type don't match
}
return 0;
}
public override string ToString() {
return string.Format("Won {0} x {1} {2} Combat Zone(s) for {3}",
Amount, Grade, Type, Faction);
}
} }
} }

View File

@ -1,4 +1,10 @@
namespace NonaBGS.BGS { using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NonaBGS.BGS {
public interface IDiscordLogGenerator { public interface IDiscordLogGenerator {
string GenerateDiscordLog(Report report); string GenerateDiscordLog(Report report);
} }

View File

@ -1,45 +0,0 @@
using System.Linq;
using System.Globalization;
using EDJournal;
namespace NonaBGS.BGS {
public class FactionKillBonds : LogEntry {
public int TotalSum {
get {
return Entries
.OfType<FactionKillBondEntry>()
.Sum(x => x.Reward)
;
}
}
public string VictimFaction {
get {
return Entries
.OfType<FactionKillBondEntry>()
.First()
.VictimFaction
;
}
}
public override int CompareTo(LogEntry other) {
if (other.GetType() != typeof(FactionKillBonds)) {
return -1;
}
var b = other as FactionKillBonds;
if (b.VictimFaction == VictimFaction) {
return 0;
}
return -1;
}
public override string ToString() {
return string.Format("Faction Kill Bonds: {0} against {1}",
Credits.FormatCredits(TotalSum),
VictimFaction);
}
}
}

View File

@ -1,26 +1,18 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using EDJournal; using System.Text;
using System.Threading.Tasks;
using NonaBGS.Journal;
namespace NonaBGS.BGS { namespace NonaBGS.BGS {
public class LogEntry : IComparable<LogEntry> { public class LogEntry {
private List<Entry> entries = new List<Entry>(); private List<Entry> entries = new List<Entry>();
/// <summary>
/// Controlling faction of the station this entry was made/turned into.
/// </summary>
public string ControllingFaction { get; set; } = "";
public List<Entry> Entries => entries; public List<Entry> Entries => entries;
public string Station { get; set; } public string Station { get; set; }
public string System { get; set; } public string System { get; set; }
public string Faction { get; set; } public string Faction { get; set; }
/// <summary>
/// Whether this entry was manually added. Manually added entries are not deleted
/// when a new scan is made. Instead they are preserved.
/// </summary>
public bool ManuallyAdded { get; set; }
/// <summary> /// <summary>
/// Whether this entry only benefits the controlling faction or not, default: no /// Whether this entry only benefits the controlling faction or not, default: no
@ -28,9 +20,5 @@ namespace NonaBGS.BGS {
public virtual bool OnlyControllingFaction { public virtual bool OnlyControllingFaction {
get { return false; } get { return false; }
} }
public virtual int CompareTo(LogEntry other) {
throw new NotImplementedException("not implemented");
}
} }
} }

View File

@ -1,5 +1,10 @@
using System.Text; using System;
using EDJournal; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NonaBGS.Journal;
using Newtonsoft.Json.Linq;
namespace NonaBGS.BGS { namespace NonaBGS.BGS {
public class MissionCompleted : LogEntry { public class MissionCompleted : LogEntry {

View File

@ -2,7 +2,9 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using EDJournal; using System.Globalization;
using System.Threading.Tasks;
using NonaBGS.Journal;
namespace NonaBGS.BGS { namespace NonaBGS.BGS {
public class NonaDiscordLog : IDiscordLogGenerator { public class NonaDiscordLog : IDiscordLogGenerator {
@ -40,27 +42,7 @@ namespace NonaBGS.BGS {
} }
return string.Format("Sold {0} page(s) worth of universal cartographics\n" + return string.Format("Sold {0} page(s) worth of universal cartographics\n" +
"(Total value: {1})\n", pages, Credits.FormatCredits(sum)); "(Total value: {1} CR)\n", pages, sum);
}
private string BuildCargoSold(Objective objective) {
StringBuilder builder = new StringBuilder();
SellCargo[] sold = objective.LogEntries
.OfType<SellCargo>()
.ToArray()
;
if (sold == null && sold.Length > 0) {
return builder.ToString();
}
foreach (SellCargo sell in sold) {
builder.AppendFormat("{0}\n", sell.ToString());
}
builder.AppendFormat("\n");
return builder.ToString();
} }
private string BuildMicroResourcesSold(Objective objective) { private string BuildMicroResourcesSold(Objective objective) {
@ -74,28 +56,7 @@ namespace NonaBGS.BGS {
return ""; return "";
} }
return string.Format("Sold {0} worth of Micro Resources\n", return string.Format("Sold {0} CR worth of Micro Resources\n", sum);
Credits.FormatCredits(sum));
}
private string BuildKillBonds(Objective objective) {
StringBuilder builder = new StringBuilder();
FactionKillBonds[] bonds = objective.LogEntries
.OfType<FactionKillBonds>()
.ToArray()
;
if (bonds == null || bonds.Length == 0) {
return builder.ToString();
}
foreach (FactionKillBonds bond in bonds) {
builder.AppendFormat("{0}\n", bond.ToString());
}
builder.AppendFormat("\n");
return builder.ToString();
} }
private string BuildVouchers(Objective objective) { private string BuildVouchers(Objective objective) {
@ -112,7 +73,7 @@ namespace NonaBGS.BGS {
foreach (var mission in missions) { foreach (var mission in missions) {
var m = mission as Vouchers; var m = mission as Vouchers;
builder.AppendFormat("Handed in {0} vouchers for {1}\n", m.Type, m.Faction); builder.AppendFormat("Handed in {0} vouchers for {1}\n", m.Type, m.Faction);
builder.AppendFormat("(Total value: {0})\n", Credits.FormatCredits(m.TotalSum)); builder.AppendFormat("(Total value: {0} CR)\n", m.TotalSum);
builder.AppendFormat("\n"); builder.AppendFormat("\n");
} }
@ -122,7 +83,6 @@ namespace NonaBGS.BGS {
private string BuildMissionList(Objective objective) { private string BuildMissionList(Objective objective) {
Dictionary<string, Dictionary<string, int>> collated = new Dictionary<string, Dictionary<string, int>>(); Dictionary<string, Dictionary<string, int>> collated = new Dictionary<string, Dictionary<string, int>>();
StringBuilder output = new StringBuilder(); StringBuilder output = new StringBuilder();
int total_influence = 0;
var missions = from entries in objective.LogEntries var missions = from entries in objective.LogEntries
where entries.GetType() == typeof(MissionCompleted) where entries.GetType() == typeof(MissionCompleted)
@ -142,8 +102,6 @@ namespace NonaBGS.BGS {
} }
++collated[m.MissionName][m.Influence]; ++collated[m.MissionName][m.Influence];
total_influence += m.Influence.Length;
} }
foreach (var mission in collated) { foreach (var mission in collated) {
@ -160,33 +118,9 @@ namespace NonaBGS.BGS {
output.Append(")\n\n"); output.Append(")\n\n");
} }
if (total_influence > 0) {
output.AppendFormat("Total Influence: {0}\n\n", total_influence);
}
return output.ToString(); return output.ToString();
} }
private string BuildCombatZones(Objective objective) {
StringBuilder builder = new StringBuilder();
CombatZone[] zones = objective.LogEntries
.OfType<CombatZone>()
.ToArray()
;
if (zones == null || zones.Length == 0) {
return builder.ToString();
}
foreach (CombatZone zone in zones) {
builder.AppendFormat("{0}\n", zone.ToString());
}
builder.Append("\n");
return builder.ToString();
}
public string GenerateDiscordLog(Report report) { public string GenerateDiscordLog(Report report) {
StringBuilder log = new StringBuilder(); StringBuilder log = new StringBuilder();
@ -208,21 +142,12 @@ namespace NonaBGS.BGS {
var vouchers = BuildVouchers(objective); var vouchers = BuildVouchers(objective);
entries.Append(vouchers); entries.Append(vouchers);
var zones = BuildCombatZones(objective);
entries.Append(zones);
var bonds = BuildKillBonds(objective);
entries.Append(bonds);
var carto = BuildCartoGraphics(objective); var carto = BuildCartoGraphics(objective);
entries.Append(carto); entries.Append(carto);
var micro = BuildMicroResourcesSold(objective); var micro = BuildMicroResourcesSold(objective);
entries.Append(micro); entries.Append(micro);
var sold = BuildCargoSold(objective);
entries.Append(sold);
log.Append(entries.ToString().Trim()); log.Append(entries.ToString().Trim());
log.Append("\n```\n"); log.Append("\n```\n");
} }

View File

@ -1,10 +1,9 @@
using System.Collections.Generic; using System.Collections.Generic;
using System;
using System.Text; using System.Text;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace NonaBGS.BGS { namespace NonaBGS.BGS {
public class Objective : IComparable<Objective> { public class Objective {
private string system; private string system;
private string station; private string station;
private string faction; private string faction;
@ -16,12 +15,6 @@ namespace NonaBGS.BGS {
get => entries; get => entries;
set => entries = value; set => entries = value;
} }
public void Clear() {
if (entries == null) {
return;
}
entries.RemoveAll(x => !x.ManuallyAdded);
}
public int Matches(LogEntry e) { public int Matches(LogEntry e) {
int match_count = 0; int match_count = 0;
@ -32,23 +25,20 @@ namespace NonaBGS.BGS {
} }
} }
if (e.System != null && system != null) { if (e.System != null && system != null &&
if (string.Compare(e.System, system, true) == 0) { e.System == system) {
++match_count; ++match_count;
} }
}
if (e.Station != null && station != null) { if (e.Station != null && station != null &&
if (string.Compare(e.Station, station, true) == 0) { e.Station == station) {
++match_count; ++match_count;
} }
}
if (e.Faction != null && faction != null) { if (e.Faction != null && faction != null &&
if (string.Compare(e.Faction, faction, true) == 0) { e.Faction == faction) {
++match_count; ++match_count;
} }
}
return match_count; return match_count;
} }

View File

@ -1,7 +1,11 @@
using System; using System;
using System.ComponentModel;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq; using System.Linq;
using EDJournal; using System.Text;
using System.Threading.Tasks;
using NonaBGS.Journal;
namespace NonaBGS.BGS { namespace NonaBGS.BGS {
public class Report { public class Report {
@ -17,7 +21,7 @@ namespace NonaBGS.BGS {
} }
public bool AddObjective(Objective objective) { public bool AddObjective(Objective objective) {
var found = objectives.Find(x => x.CompareTo(objective) == 0); var found = objectives.Find(x => x == objective);
bool added = false; bool added = false;
if (found == null) { if (found == null) {
@ -34,9 +38,7 @@ namespace NonaBGS.BGS {
e.Is(Events.FSDJump) || e.Is(Events.FSDJump) ||
e.Is(Events.MultiSellExplorationData) || e.Is(Events.MultiSellExplorationData) ||
e.Is(Events.SellMicroResources) || e.Is(Events.SellMicroResources) ||
e.Is(Events.RedeemVoucher) || e.Is(Events.RedeemVoucher)
e.Is(Events.FactionKillBond) ||
e.Is(Events.MarketSell)
; ;
} }
@ -54,64 +56,37 @@ namespace NonaBGS.BGS {
string current_station = null; string current_station = null;
string controlling_faction = null; string controlling_faction = null;
objectives.ForEach(x => x.Clear()); this.objectives.ForEach(x => x.LogEntries.Clear());
foreach (var e in relevant) { foreach (var e in relevant) {
LogEntry entry = null; LogEntry entry = null;
bool collate = false;
if (e.Is(Events.Docked)) { if (e.Is(Events.Docked)) {
/* gleem the current station from this message /* gleem the current station from this message
*/ */
current_station = (e as DockedEntry).StationName; current_station = (e as DockedEntry).StationName;
} else if (e.Is(Events.FSDJump)) { } else if (e.Is(Events.FSDJump)) {
/* Gleem current system and controlling faction from this message.
*/
current_system = (e as FSDJumpEntry).StarSystem; current_system = (e as FSDJumpEntry).StarSystem;
controlling_faction = (e as FSDJumpEntry).SystemFaction; controlling_faction = (e as FSDJumpEntry).SystemFaction;
} else if (e.Is(Events.MissionCompleted)) { } else if (e.Is(Events.MissionCompleted)) {
var completed = e as MissionCompletedEntry; var completed = e as MissionCompletedEntry;
entry = new MissionCompleted(completed, current_system, current_station); entry = new MissionCompleted(completed, current_system, current_station);
if (completed.HumanReadableNameWasGenerated) { if (completed.HumanReadableNameWasGenerated) {
/* If the human readable name was generated, we send a log message. Because the
* generated names all sort of suck, we should have more human readable names in
* in the lookup dictionary.
*/
OnLog?.Invoke("Human readable name for mission \"" + OnLog?.Invoke("Human readable name for mission \"" +
completed.Name + completed.Name +
"\" was generated, please report this."); "\" was generated, please report this.");
} }
} else if (e.Is(Events.MultiSellExplorationData)) { } else if (e.Is(Events.MultiSellExplorationData)) {
/* For multi-sell-exploraton-data only the controlling faction of the station sold to matters.
*/
entry = new Cartographics(e as MultiSellExplorationDataEntry, current_system, current_station); entry = new Cartographics(e as MultiSellExplorationDataEntry, current_system, current_station);
entry.Faction = controlling_faction; entry.Faction = controlling_faction;
} else if (e.Is(Events.RedeemVoucher)) { } else if (e.Is(Events.RedeemVoucher)) {
/* Same for selling combat vouchers. Only the current controlling faction matters here.
*/
entry = new Vouchers(); entry = new Vouchers();
entry.Entries.Add(e); entry.Entries.Add(e);
entry.System = current_system; entry.System = current_system;
entry.Station = current_station; entry.Station = current_station;
entry.Faction = (e as RedeemVoucherEntry).Factions.FirstOrDefault() ?? ""; entry.Faction = controlling_faction;
entry.ControllingFaction = controlling_faction;
collate = true;
} else if (e.Is(Events.SellMicroResources)) { } else if (e.Is(Events.SellMicroResources)) {
entry = new SellMicroResources() { entry = new SellMicroResources(current_system, current_station);
Faction = controlling_faction,
Station = current_station,
System = current_system
};
entry.Entries.Add(e);
} else if (e.Is(Events.MarketSell)) {
entry = new SellCargo() {
Faction = controlling_faction,
Station = current_station,
System = current_system
};
entry.Entries.Add(e); entry.Entries.Add(e);
} }
@ -119,8 +94,6 @@ namespace NonaBGS.BGS {
continue; continue;
} }
/* Find all objectives that generally match.
*/
var matches = objectives var matches = objectives
.Where(x => x.Matches(entry) > 0) .Where(x => x.Matches(entry) > 0)
.OrderBy(x => x.Matches(entry)) .OrderBy(x => x.Matches(entry))
@ -129,31 +102,13 @@ namespace NonaBGS.BGS {
continue; continue;
} }
/* Then select the one that matches the most.
*/
var objective = matches var objective = matches
.OrderBy(x => x.Matches(entry)) .OrderBy(x => x.Matches(entry))
.Reverse() .Reverse()
.First() .First()
; ;
if (objective == null) { if (objective != null) {
continue;
}
LogEntry existing = null;
existing = objective.LogEntries.Find(x => {
try {
return x.CompareTo(entry) == 0;
} catch (NotImplementedException) {
return false;
}
});
if (collate && existing != null) {
existing.Entries.Add(e);
} else if (!collate || existing == null) {
objective.LogEntries.Add(entry); objective.LogEntries.Add(entry);
} }
} }

View File

@ -1,31 +0,0 @@
using System.Text;
using System.Linq;
using EDJournal;
namespace NonaBGS.BGS {
public class SellCargo : LogEntry {
public override string ToString() {
StringBuilder builder = new StringBuilder();
var sold = Entries.OfType<MarketSellEntry>().ToArray();
if (sold == null || sold.Length == 0) {
return builder.ToString();
}
foreach (MarketSellEntry sell in sold) {
builder.AppendFormat("Sold {0} {1} to the {2}\n",
sell.Count,
sell.Type,
sell.BlackMarket ? "Black Market" : "Commodity Market"
);
}
return builder.ToString().Trim();
}
/// <summary>
/// Selling resources to a market only helps the controlling faction
/// </summary>
public override bool OnlyControllingFaction => true;
}
}

View File

@ -1,8 +1,17 @@
using System.Linq; using System;
using EDJournal; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NonaBGS.Journal;
namespace NonaBGS.BGS { namespace NonaBGS.BGS {
public class SellMicroResources : LogEntry { public class SellMicroResources : LogEntry {
public SellMicroResources(string system, string station) {
System = system;
Station = Station;
}
public int TotalSum { public int TotalSum {
get { get {
return Entries return Entries
@ -13,9 +22,7 @@ namespace NonaBGS.BGS {
} }
public override string ToString() { public override string ToString() {
return string.Format("Sell Micro Resources: {0}", Credits.FormatCredits(TotalSum)); return string.Format("Sell Micro Resources: {0} CR", TotalSum);
} }
public override bool OnlyControllingFaction => true;
} }
} }

View File

@ -1,10 +1,12 @@
using System.Linq; using System;
using System.Globalization; using System.Collections.Generic;
using EDJournal; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NonaBGS.Journal;
namespace NonaBGS.BGS { namespace NonaBGS.BGS {
public class Vouchers : LogEntry { public class Vouchers : LogEntry {
private string type = null;
public int TotalSum { public int TotalSum {
get { get {
@ -17,40 +19,26 @@ namespace NonaBGS.BGS {
public string Type { public string Type {
get { get {
if (type == null) {
string v = Entries string v = Entries
.Where(x => x.GetType() == typeof(RedeemVoucherEntry)) .Where(x => x.GetType() == typeof(RedeemVoucherEntry))
.GroupBy(x => (x as RedeemVoucherEntry).Type) .GroupBy(x => (x as RedeemVoucherEntry).Type)
.Select(x => x.Key) .Select(x => x.Key)
.First(); .First();
if (v == "CombatBond") { return v;
type = "Combat Bond";
} else if (v == "bounty") {
type = "Bounty";
} else {
type = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(v);
} }
} }
return type;
}
}
public override int CompareTo(LogEntry other) {
if (other.GetType() != typeof(Vouchers)) {
return -1;
}
var b = other as Vouchers;
if (b.Type == Type) {
return 0;
}
return -1;
}
public override string ToString() { public override string ToString() {
return string.Format("{0} Vouchers: {1}", Type, Credits.FormatCredits(TotalSum)); StringBuilder builder = new StringBuilder();
builder.AppendFormat("{0} Vouchers: {1} CR", TotalSum, Type);
return builder.ToString();
} }
/// <summary>
/// Vouchers only help the controlling faction
/// </summary>
public override bool OnlyControllingFaction => true;
} }
} }

View File

@ -1,48 +0,0 @@
<Window x:Class="NonaBGS.CombatZoneDialog"
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:NonaBGS"
mc:Ignorable="d"
Title="Add Combat Zone Wins" Height="150" Width="370" Icon="NONA.ico" WindowStartupLocation="CenterOwner">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<GroupBox Header="Add Combat Zone" Grid.Row="0" Grid.Column="0" Width="Auto">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ComboBox x:Name="type" Grid.Column="0" VerticalAlignment="Top" Width="Auto" IsReadOnly="True" Height="23" Margin="5" SelectedIndex="0">
<ComboBoxItem Content="Ship"/>
<ComboBoxItem Content="On Foot"/>
</ComboBox>
<ComboBox x:Name="grade" Grid.Column="1" VerticalAlignment="Top" IsReadOnly="True" Margin="5" Height="23" Width="Auto" SelectedIndex="0">
<ComboBoxItem Content="Low"/>
<ComboBoxItem Content="Medium"/>
<ComboBoxItem Content="High"/>
</ComboBox>
<TextBox x:Name="amount" Grid.Column="2" Height="23" TextWrapping="Wrap" Text="1" VerticalAlignment="Top" Width="Auto" Margin="5" HorizontalContentAlignment="Right"/>
</Grid>
</GroupBox>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button x:Name="Accept" Content="Accept" HorizontalAlignment="Right" Grid.Column="0" Grid.Row="1" VerticalAlignment="Top" Width="75" Margin="5" IsDefault="True" Click="Accept_Click"/>
<Button x:Name="Cancel" Content="Cancel" HorizontalAlignment="Right" Grid.Column="1" Grid.Row="1" VerticalAlignment="Top" Width="75" Margin="5" IsCancel="True" Click="Cancel_Click"/>
</Grid>
</Grid>
</Window>

View File

@ -1,47 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Forms;
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 NonaBGS {
/// <summary>
/// Interaction logic for CombatZoneDialog.xaml
/// </summary>
public partial class CombatZoneDialog : Window {
public CombatZoneDialog() {
InitializeComponent();
}
public string Type => (type.SelectedItem as ComboBoxItem).Content.ToString();
public string Grade => (grade.SelectedItem as ComboBoxItem).Content.ToString();
public int Amount {
get {
try {
return int.Parse(amount.Text);
} catch (Exception) {
return 1;
}
}
}
private void Accept_Click(object sender, RoutedEventArgs e) {
DialogResult = true;
Close();
}
private void Cancel_Click(object sender, RoutedEventArgs e) {
DialogResult = false;
Close();
}
}
}

View File

@ -1,180 +0,0 @@
using System;
using System.Threading.Tasks;
using System.IO;
using System.Net;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace NonaBGS.EDDB {
public class API {
private static readonly string EDDB_SYSTEMS_ARCHIVE = "https://eddb.io/archive/v6/systems_populated.json";
private static readonly string EDDB_STATIONS_ARCHIVE = "https://eddb.io/archive/v6/stations.json";
private string cache_folder = null;
private string systems_file = null;
private string stations_file = null;
private string stations_file_short = null;
public delegate void DatabaseAvailableDelegate();
public delegate void DatabaseUpdateProgressDelegate();
public event DatabaseAvailableDelegate SystemsAvailable;
public event DatabaseAvailableDelegate StationsAvailable;
public event DatabaseUpdateProgressDelegate DatabaseUpdateProgress;
public event DatabaseUpdateProgressDelegate DatabaseUpdateFinished;
public string SystemsFile => systems_file;
public string StationsFile => stations_file;
public string StationsFileShort => stations_file_short;
public string Cache {
get => cache_folder;
set => cache_folder = value;
}
public API(string cache_folder) {
Initialise(cache_folder);
}
private void Initialise(string cache_folder) {
this.cache_folder = cache_folder;
systems_file = Path.Combine(this.cache_folder, "systems_populated.json");
stations_file = Path.Combine(this.cache_folder, "stations.json");
stations_file_short = Path.Combine(this.cache_folder, "stations_short.json");
this.StationsAvailable += API_StationsAvailable;
}
private void API_StationsAvailable() {
TranslateStations();
DatabaseUpdateFinished?.Invoke();
}
private void DownloadFile(string url, string file, DatabaseAvailableDelegate notifier) {
WebClient client = new WebClient();
client.DownloadFileCompleted += Client_DownloadFileCompleted;
client.DownloadProgressChanged += Client_DownloadProgressChanged;
client.DownloadFileAsync(new Uri(url), file, notifier);
}
private void Client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) {
DatabaseUpdateProgress?.Invoke();
}
private void Client_DownloadFileCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e) {
DatabaseAvailableDelegate notifier = e.UserState as DatabaseAvailableDelegate;
notifier?.Invoke();
}
private void TranslateStations() {
if (!HaveStationsFile) {
return;
}
var short_time = File.GetLastWriteTimeUtc(StationsFileShort);
var long_time = File.GetLastWriteTimeUtc(StationsFile);
if (HaveStationsFileShort && long_time <= short_time) {
return;
}
Dictionary<int, List<string>> systems = new Dictionary<int, List<string>>();
using (var str = new StreamReader(StationsFile)) {
using (var reader = new JsonTextReader(str)) {
JArray obj = (JArray)JToken.ReadFrom(reader);
foreach (JObject child in obj.Children<JObject>()) {
int system_id = child.Value<int>("system_id");
string name = child.Value<string>("name");
if (!systems.ContainsKey(system_id)) {
systems.Add(system_id, new List<string>());
}
DatabaseUpdateProgress?.Invoke();
systems[system_id].Add(name);
}
}
}
JObject short_stations = new JObject();
foreach(int ids in systems.Keys) {
JArray station_names = new JArray();
foreach(string system in systems[ids]) {
station_names.Add(system);
}
short_stations.Add(ids.ToString(), station_names);
}
using (var outstr = new StreamWriter(stations_file_short)) {
using (var jwriter = new JsonTextWriter(outstr)) {
short_stations.WriteTo(jwriter);
}
}
}
public void CheckDatabases() {
if (HaveSystemsFile) {
SystemsAvailable?.Invoke();
}
if (HaveStationsFile) {
StationsAvailable?.Invoke();
}
}
public void Download(bool force) {
if (!HaveSystemsFile || force) {
DownloadFile(EDDB_SYSTEMS_ARCHIVE, systems_file, SystemsAvailable);
} else if (HaveSystemsFile) {
SystemsAvailable?.Invoke();
}
if (!HaveStationsFile || force) {
DownloadFile(EDDB_STATIONS_ARCHIVE, stations_file, StationsAvailable);
} else if (HaveStationsFile) {
StationsAvailable?.Invoke();
}
}
public void Download() {
Download(false);
}
public bool HaveSystemsFile {
get { return systems_file != null && File.Exists(systems_file); }
}
public bool HaveStationsFile {
get { return stations_file != null && File.Exists(stations_file); }
}
public bool HaveStationsFileShort {
get { return stations_file_short != null && File.Exists(stations_file_short); }
}
public PopulatedSystems MakePopulatedSystems() {
if (!HaveSystemsFile) {
throw new InvalidOperationException("no local systems file downloaded");
}
return PopulatedSystems.FromFile(SystemsFile);
}
public Stations MakeStations() {
if (!HaveStationsFile) {
throw new InvalidOperationException("no local systems file downloaded");
}
TranslateStations();
return Stations.FromFile(StationsFileShort);
}
}
}

View File

@ -1,71 +0,0 @@
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using Newtonsoft.Json.Linq;
namespace NonaBGS.EDDB {
public class PopulatedSystems {
private string json_file = null;
private JArray root = null;
private string[] system_names = null;
private Dictionary<string, int> to_id;
public static PopulatedSystems FromFile(string file) {
PopulatedSystems pop = new PopulatedSystems();
string content = File.ReadAllText(file);
pop.json_file = file;
pop.root = JArray.Parse(content);
pop.Initialise();
return pop;
}
private void Initialise() {
MakeSystemNames();
to_id = root.ToDictionary(x => x.Value<string>("name"), x => x.Value<int>("id"));
}
public int ToId(string name) {
return to_id.First(x => string.Compare(x.Key, name, true) == 0).Value;
}
private void MakeSystemNames() {
if (root == null) {
throw new InvalidDataException("no JSON loaded");
}
if (system_names != null && system_names.Length > 0) {
return;
}
var names = root.Children<JObject>().Select(x => x.Value<string>("name"));
system_names = names.ToArray();
}
public string[] SystemNames {
get {
MakeSystemNames();
return system_names;
}
}
public string[] SystemNamesByFilter(string filter) {
MakeSystemNames();
var culture = CultureInfo.InvariantCulture;
return system_names.Where(x => culture.CompareInfo.IndexOf(x, filter, CompareOptions.IgnoreCase) > -1)
.ToArray()
;
}
public string JSONFile {
get => json_file;
}
public JArray Root {
get => root;
}
}
}

View File

@ -1,51 +0,0 @@
using System.Globalization;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using Newtonsoft.Json.Linq;
namespace NonaBGS.EDDB {
public class Stations {
private JObject root = null;
private Dictionary<int, List<string>> by_system_id = null;
public JObject JSON => root;
private Stations() {
}
private void Initialise() {
by_system_id = new Dictionary<int, List<string>>();
foreach (var station in root.Properties()) {
int id = int.Parse(station.Name);
var names = root.Value<JArray>(id.ToString()).Values<string>().ToArray();
if (!by_system_id.ContainsKey(id)) {
by_system_id[id] = new List<string>();
}
by_system_id[id].AddRange(names);
}
}
public static Stations FromFile(string filename) {
string alltext = File.ReadAllText(filename);
Stations stations = new Stations {
root = JObject.Parse(alltext),
};
stations.Initialise();
return stations;
}
public string[] StationNamesBySystemId(int systemid, string filter) {
if (!by_system_id.ContainsKey(systemid)) {
return new string[0];
}
return by_system_id[systemid]
.Where(x => CultureInfo.InvariantCulture.CompareInfo.IndexOf(x, filter, CompareOptions.IgnoreCase) > -1)
.ToArray()
;
}
}
}

13
Journal/DockedEntry.cs Normal file
View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NonaBGS.Journal {
public class DockedEntry : Entry {
public string StationName {
get { return JSON.GetValue("StationName").ToString(); }
}
}
}

15
Journal/EliteDangerous.cs Normal file
View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NonaBGS.Journal {
public class EliteDangerous {
/// <summary>
/// The ingame universe is 1286 years in the future. This is needed to convert dates
/// and times to ingame dates and times
/// </summary>
public static readonly int YearOffset = 1286;
}
}

88
Journal/Entry.cs Normal file
View File

@ -0,0 +1,88 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace NonaBGS.Journal {
/// <summary>
/// Base class for a single entry within the player journal. If no specific sub class is available
/// this class gives basic information, such as EventType or date when it happened. It also allows
/// base classes access to the underlying JSON object. Base classes should be named after the event
/// type that they map + Entry. So "FSDJump" event is handled by FSDJumpEntry.
/// </summary>
public class Entry {
private static readonly Dictionary<string, Type> classes = new Dictionary<string, Type> {
{ Events.Docked, typeof(DockedEntry) },
{ Events.FSDJump, typeof(FSDJumpEntry) },
{ Events.MissionCompleted, typeof(MissionCompletedEntry) },
{ Events.MultiSellExplorationData, typeof(MultiSellExplorationDataEntry) },
{ Events.MarketSell, typeof(MarketSellEntry) },
{ Events.SellMicroResources, typeof(SellMicroResourcesEntry) },
{ Events.RedeemVoucher, typeof(RedeemVoucherEntry) },
};
private string eventtype = null;
private string datetime = null;
private DateTime timestamp;
private string jsonstr = null;
protected JObject json = null;
public Entry() {
}
public static Entry Parse(string journalline) {
var json = JObject.Parse(journalline);
return Parse(json);
}
public static Entry Parse(JObject json) {
string event_name = json.GetValue("event").ToString();
classes.TryGetValue(event_name, out Type classhandler);
if (classhandler == null) {
classhandler = typeof(Entry);
}
var obj = (Entry)Activator.CreateInstance(classhandler);
obj.InternalInitialise(json);
obj.Initialise();
return obj;
}
private void InternalInitialise(JObject jobject) {
this.json = jobject;
this.jsonstr = json.ToString(formatting: Formatting.None);
this.eventtype = json.GetValue("event").ToString();
this.datetime = json.GetValue("timestamp").ToString();
this.timestamp = DateTime.Parse(this.datetime);
}
protected virtual void Initialise() {
}
public bool Is(string eventtype) {
if (eventtype == null || this.eventtype == null) {
return false;
}
return String.Equals(this.eventtype, eventtype, StringComparison.OrdinalIgnoreCase);
}
public string Event {
get { return eventtype; }
}
public DateTime Timestamp {
get { return timestamp; }
}
public JObject JSON {
get { return this.json; }
}
}
}

17
Journal/Events.cs Normal file
View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NonaBGS.Journal {
public class Events {
public static readonly string MissionCompleted = "MissionCompleted";
public static readonly string Docked = "Docked";
public static readonly string FSDJump = "FSDJump";
public static readonly string MultiSellExplorationData = "MultiSellExplorationData";
public static readonly string MarketSell = "MarketSell";
public static readonly string SellMicroResources = "SellMicroResources";
public static readonly string RedeemVoucher = "RedeemVoucher";
}
}

23
Journal/FSDJumpEntry.cs Normal file
View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
namespace NonaBGS.Journal {
public class FSDJumpEntry : Entry {
private string starsystem = null;
private string systemfaction = null;
protected override void Initialise() {
starsystem = JSON.Value<string>("StarSystem");
var faction = JSON.Value<JObject>("SystemFaction");
if (faction != null) {
systemfaction = faction.Value<string>("Name");
}
}
public string StarSystem => starsystem;
public string SystemFaction => systemfaction;
}
}

View File

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace NonaBGS.Journal {
public class JournalException : Exception {
public JournalException(string message) : base(message) {
}
}
}

112
Journal/JournalFile.cs Normal file
View File

@ -0,0 +1,112 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
using System.Globalization;
namespace NonaBGS.Journal
{
public class JournalFile : IComparable<JournalFile>
{
private string fullpath = null;
private string part = null;
private int intpart = 0;
private DateTime datetime;
private DateTime normalised;
private List<Entry> entries = new List<Entry>();
private static Regex fileregex = new Regex("Journal\\.(\\d+)\\.(\\d+)\\.log");
private static string iso8601 = "yyyyMMddTHHmmss";
private static string iso8601_notime = "yyyyMMdd";
private void SetFilename(string path) {
string filename = Path.GetFileName(path);
if (!File.Exists(path) || filename == null) {
throw new JournalException(string.Format("Invalid journal file: {0}", filename));
}
var matches = fileregex.Matches(filename);
if (matches.Count < 1) {
throw new JournalException(string.Format("Invalid journal file: {0}", filename));
}
this.fullpath = path;
this.part = matches[0].Groups[2].ToString();
this.intpart = int.Parse(part);
// The ISO is not quite correct on journal filenames, so build
// a proper ISO 8601 date time stamp out of it.
var date = new StringBuilder();
date.Append("20"); // Add the missing century in front.
date.Append(matches[0].Groups[1].ToString());
date.Insert(8, "T"); // Add the "T" separating date and time
this.datetime = DateTime.ParseExact(date.ToString(), iso8601, CultureInfo.InvariantCulture);
this.normalised = DateTime.Parse(this.datetime.ToShortDateString());
}
public int CompareTo(JournalFile other) {
if (datetime == null || other.datetime == null) {
return 0;
}
var comp = DateTime.Compare(datetime, other.datetime);
if (comp == 0) {
/* If we have the exact same datetime we compare by parts.
*/
return intpart - other.intpart;
} else {
return comp;
}
}
public JournalFile(string path) {
SetFilename(path);
}
public DateTime Timestamp {
get { return datetime; }
}
public DateTime NormalisedTimestamp {
get { return normalised; }
}
public int Part {
get { return intpart; }
}
public IEnumerable<Entry> Entries {
get {
if (entries == null || entries.Count == 0) {
try {
LoadEntries();
} catch (IOException) {
entries = new List<Entry>();
}
}
return entries;
}
}
public void LoadEntries() {
List<string> lines = new List<string>();
/* This needs to be done this way, otherwise, if the game is still running the journal files cannot
* be accessed. And it is very much convenient to generate logs while the game is still running.
*/
using (var fs = new FileStream(this.fullpath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) {
using (var sr = new StreamReader(fs, Encoding.UTF8)) {
string line = null;
while ((line = sr.ReadLine()) != null) {
lines.Add(line);
}
}
}
entries.Clear();
foreach(var line in lines) {
Entry entry = Entry.Parse(line);
entries.Add(entry);
}
}
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NonaBGS.Journal {
public class MarketSellEntry : Entry {
private int totalsale = 0;
protected override void Initialise() {
totalsale = JSON.Value<int>("TotalSale");
}
public int TotalSale => totalsale;
}
}

View File

@ -0,0 +1,146 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace NonaBGS.Journal {
public class MissionCompletedEntry : Entry {
private Dictionary<string, string> influences = new Dictionary<string, string>();
private string readable_name = null;
private bool readable_name_generated = false;
private string name = null;
private string commodity = null;
private int count = 0;
private int donated = 0;
private readonly Dictionary<string, string> humanreadable = new Dictionary<string, string> {
{ "Mission_AltruismCredits_name", "Donate Credits" },
{ "Mission_Collect_name", "Collect" },
{ "Mission_Courier_Elections_name", "Courier (Elections)" },
{ "Mission_Courier_name", "Courier" },
{ "Mission_Courier_RankEmp_name", "Courier (Empire)" },
{ "Mission_Delivery_Boom_name", "Delivery (Boom)" },
{ "Mission_Delivery_Retreat_name", "Delivery (Retreat)" },
{ "Mission_Delivery_name", "Delivery" },
{ "Mission_Delivery_Agriculture_name", "Delivery (Agriculture)" },
{ "Mission_HackMegaship_name", "Hack Megaship" },
{ "Mission_MassacreWing_name", "Massacre (Wing)" },
{ "Mission_OnFoot_Onslaught_MB_name", "On Foot Onslaught" },
{ "Mission_OnFoot_RebootRestore_MB_name", "On Foot Reboot/Restore" },
{ "Mission_OnFoot_Reboot_MB_name", "On Foot Reboot" },
{ "Mission_Rescue_Planet_name", "Planet Rescue" },
{ "Mission_Salvage_name", "Salvage" },
{ "MISSION_Salvage_Illegal_name", "Salvage (Illegal)" },
{ "MISSION_Salvage_Retreat_name", "Salvage (Retreat)" },
{ "MISSION_Salvage_Expansion_name", "Salvage (Expansion)" },
{ "Mission_Salvage_RankEmp_name", "Salvage (Imperial Navy)" },
{ "MISSION_Scan_name", "Scan" },
};
protected override void Initialise() {
MakeHumanReadableName();
name = JSON.Value<string>("Name");
if (JSON.ContainsKey("Commodity_Localised")) {
commodity = JSON.Value<string>("Commodity_Localised");
}
if (JSON.ContainsKey("Count")) {
count = JSON.Value<int>("Count");
}
if (JSON.ContainsKey("Donated")) {
donated = JSON.Value<int>("Donated");
}
}
public string Name => name;
public string Commodity => commodity;
public int Count => count;
private void MakeHumanReadableName() {
if (readable_name != null && readable_name.Length > 0) {
return;
}
if (Name == null) {
return;
}
StringBuilder builder;
if (humanreadable.ContainsKey(Name)) {
builder = new StringBuilder(humanreadable[Name]);
readable_name_generated = false;
} else {
builder = new StringBuilder(Name);
builder.Replace("Mission_", "");
builder.Replace("_name", "");
builder.Replace("_MB", "");
builder.Replace('_', ' ');
builder.Replace("Illegal", " (Illegal)");
builder.Replace("OnFoot", "On Foot");
builder.Replace(" BS", "");
builder.Replace("HackMegaship", "Hack Megaship");
builder.Replace("Boom", "");
builder.Replace("RebootRestore", "Reboot/Restore");
builder.Replace("CivilLiberty", "");
readable_name_generated = true;
}
if (count > 0 && commodity != null) {
builder.AppendFormat(" ({0} {1})", count, commodity);
}
if (donated > 0) {
builder.AppendFormat(" ({0} CR)", donated);
}
readable_name = builder.ToString().Trim();
}
public string HumanReadableName {
get {
MakeHumanReadableName();
return readable_name;
}
}
public bool HumanReadableNameWasGenerated {
get {
MakeHumanReadableName();
return readable_name_generated;
}
}
public string GetInfluenceForFaction(string faction) {
if (influences.ContainsKey(faction)) {
return influences[faction];
}
var effects = JSON.Value<JArray>("FactionEffects");
foreach (var effect in effects.Children<JObject>()) {
if (effect.GetValue("Faction").ToString() != faction) {
continue;
}
var influence = effect.Value<JArray>("Influence");
if (influence == null || influence.Count == 0) {
// No influence reward, happens on courier missions sometimes.
// There is always one point of rep, even if the mission won't state it
influences.Add(faction, "+");
}
foreach (var infl in influence.Children<JObject>()) {
infl.TryGetValue("Influence", out JToken result);
if (result != null && result.Type == JTokenType.String) {
influences.Add(faction, result.ToString());
return result.ToString();
}
}
}
return "";
}
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NonaBGS.Journal {
public class MultiSellExplorationDataEntry : Entry {
private int totalearnings = 0;
protected override void Initialise() {
totalearnings = JSON.Value<int>("TotalEarnings");
}
public int TotalEarnings => totalearnings;
}
}

56
Journal/PlayerJournal.cs Normal file
View File

@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
namespace NonaBGS.Journal {
public class PlayerJournal {
public static string DefaultPath = "%UserProfile%\\Saved Games\\Frontier Developments\\Elite Dangerous";
private List<JournalFile> journalfiles = new List<JournalFile>();
private string basepath = null;
public PlayerJournal() {
Initialise(DefaultPath);
}
public PlayerJournal(string path) {
Initialise(path);
}
private void Initialise(string path) {
basepath = Environment.ExpandEnvironmentVariables(path);
}
public List<JournalFile> Files {
get { return journalfiles; }
}
public void Open() {
if (!Directory.Exists(basepath)) {
throw new JournalException("Invalid base path, path could not be found");
}
this.ScanFiles();
}
public void ScanFiles() {
var files = Directory.EnumerateFiles(basepath);
journalfiles.Clear();
foreach (var file in files) {
string full = Path.Combine(basepath, file);
try {
JournalFile journalfile = new JournalFile(full);
journalfiles.Add(journalfile);
} catch (JournalException) {
/* invalid journal file, or one of the other json files in there */
continue;
}
}
journalfiles.Sort();
}
}
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NonaBGS.Journal {
public class RedeemVoucherEntry : Entry {
private int amount = 0;
private string type = null;
protected override void Initialise() {
amount = JSON.Value<int>("Amount");
type = JSON.Value<string>("Type");
}
public int Amount => amount;
public string Type => type;
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NonaBGS.Journal {
public class SellMicroResourcesEntry : Entry {
private int price;
protected override void Initialise() {
price = JSON.Value<int>("Price");
}
public int Price => price;
}
}

View File

@ -1,674 +0,0 @@
 GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View File

@ -3,11 +3,10 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:abc="http://wpfcontrols.com/"
xmlns:local="clr-namespace:NonaBGS" xmlns:local="clr-namespace:NonaBGS"
xmlns:BGS="clr-namespace:NonaBGS.BGS" xmlns:Util="clr-namespace:NonaBGS.Util" d:DataContext="{d:DesignInstance Type=Util:AppConfig}" x:Name="window" x:Class="NonaBGS.MainWindow" xmlns:BGS="clr-namespace:NonaBGS.BGS" xmlns:Util="clr-namespace:NonaBGS.Util" d:DataContext="{d:DesignInstance Type=Util:AppConfig}" x:Name="window" x:Class="NonaBGS.MainWindow"
mc:Ignorable="d" mc:Ignorable="d"
Title="Nova Navy BGS Helper" Height="520" Width="890" Icon="NONA.ico"> Title="Nova Navy BGS Helper" Height="513.8" Width="885.658">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
@ -30,15 +29,13 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<ToolBar VerticalAlignment="Top" Grid.Row="0" Width="Auto" Grid.ColumnSpan="3" Height="Auto" Margin="0,0,0,0" HorizontalAlignment="Left"> <ToolBar VerticalAlignment="Top" Grid.Row="0" Width="Auto" Grid.ColumnSpan="3" Height="Auto" Margin="0,0,0,0" HorizontalAlignment="Left">
<Label Content="System:" HorizontalAlignment="Left" VerticalAlignment="Top"/> <Label Content="System:" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<abc:AutoCompleteTextBox x:Name="system" VerticalAlignment="Center" MinWidth="120" MinHeight="22" KeyDown="Filter_KeyDown"/> <TextBox x:Name="system" HorizontalAlignment="Center" TextWrapping="Wrap" VerticalAlignment="Center" Margin="0,0,0,3.286" MinWidth="120" VerticalContentAlignment="Center"/>
<Label Content="Station:" Height="26.2857142857143" VerticalAlignment="Top"/> <Label Content="Station:" Height="26.2857142857143" VerticalAlignment="Top"/>
<abc:AutoCompleteTextBox x:Name="station" Margin="0" VerticalAlignment="Center" MinWidth="120" MinHeight="22" KeyDown="Filter_KeyDown" GotFocus="station_GotFocus"/> <TextBox x:Name="station" Margin="0" TextWrapping="Wrap" VerticalAlignment="Center" MinWidth="120"/>
<Label Content="Faction:" Height="26.2857142857143" VerticalAlignment="Top"/> <Label Content="Faction:" Height="26.2857142857143" VerticalAlignment="Top"/>
<abc:AutoCompleteTextBox x:Name="faction" Margin="0" VerticalAlignment="Center" MinWidth="120" MinHeight="22" KeyDown="Filter_KeyDown"/> <TextBox x:Name="faction" Margin="0" TextWrapping="Wrap" VerticalAlignment="Center" MinWidth="120"/>
<Separator Height="26.2857142857143" Margin="0" VerticalAlignment="Top"/> <Separator Height="26.2857142857143" Margin="0" VerticalAlignment="Top"/>
<Button x:Name="AddFilter" Content="Add Objective" VerticalAlignment="Stretch" Click="AddFilter_Click" Margin="0,0,0,0.286" RenderTransformOrigin="0.5,0.505"/> <Button x:Name="AddFilter" Content="Add Objective" VerticalAlignment="Stretch" Click="AddFilter_Click" Margin="0,0,0,0.286" RenderTransformOrigin="0.5,0.505"/>
<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"/>
</ToolBar> </ToolBar>
<ToolBar VerticalAlignment="Top" Grid.Row="1" Width="Auto" Margin="0,0,0,0" Height="Auto" Grid.ColumnSpan="3" HorizontalAlignment="Left"> <ToolBar VerticalAlignment="Top" Grid.Row="1" Width="Auto" Margin="0,0,0,0" Height="Auto" Grid.ColumnSpan="3" HorizontalAlignment="Left">
<Button x:Name="ParseJournal" Content="Parse Journal" VerticalAlignment="Center" Click="ParseJournal_Click" HorizontalAlignment="Center"/> <Button x:Name="ParseJournal" Content="Parse Journal" VerticalAlignment="Center" Click="ParseJournal_Click" HorizontalAlignment="Center"/>
@ -64,7 +61,7 @@
<ToolBar HorizontalAlignment="Left" Height="36" VerticalAlignment="Top" Width="Auto"> <ToolBar HorizontalAlignment="Left" Height="36" VerticalAlignment="Top" Width="Auto">
<Button x:Name="GenerateDiscord" Content="Genereate Discord Report" VerticalAlignment="Center" Margin="0,0,0,4.857" Click="GenerateDiscord_Click" Height="26"/> <Button x:Name="GenerateDiscord" Content="Genereate Discord Report" VerticalAlignment="Center" Margin="0,0,0,4.857" Click="GenerateDiscord_Click" Height="26"/>
</ToolBar> </ToolBar>
<TextBox x:Name="DiscordLog" Height="Auto" TextWrapping="Wrap" FontFamily="Consolas" FontSize="14" Grid.Row="1" Grid.ColumnSpan="2" AcceptsReturn="True" AcceptsTab="True"/> <TextBox x:Name="DiscordLog" Height="Auto" Margin="0,0,-0.285,-0.429" TextWrapping="Wrap" FontFamily="Consolas" FontSize="14" Grid.Row="1" Grid.ColumnSpan="2"/>
</Grid> </Grid>
</TabItem> </TabItem>
<TabItem Header="Settings" HorizontalAlignment="Left" Height="20" VerticalAlignment="Top" Width="53.7142857142857"> <TabItem Header="Settings" HorizontalAlignment="Left" Height="20" VerticalAlignment="Top" Width="53.7142857142857">
@ -101,11 +98,10 @@
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="26*"/>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="285*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<CheckBox x:Name="useeddb" Content="Use eddb station and system data for autocompletion" HorizontalAlignment="Left" Margin="0,10,0,10" VerticalAlignment="Top" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="1" Click="useeddb_Click"/> <CheckBox x:Name="useeddb" Content="Use eddb station and system data for autocompletion" HorizontalAlignment="Left" Margin="0,10,0,10" VerticalAlignment="Top" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Click="useeddb_Click"/>
<Button x:Name="DownloadData" Content="Download Data" HorizontalAlignment="Center" Grid.Column="1" VerticalAlignment="Center" Width="Auto" Click="DownloadData_Click"/>
</Grid> </Grid>
</GroupBox> </GroupBox>
</Grid> </Grid>
@ -116,20 +112,9 @@
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBox IsReadOnly="True" Grid.Row="1" x:Name="log" Height="Auto" Margin="5" TextWrapping="Wrap" FontFamily="Courier New" Background="{x:Null}"/> <TextBox x:Name="log" Height="Auto" Margin="0,0,0,0" TextWrapping="Wrap" FontFamily="Courier New"/>
<RichTextBox IsReadOnly="True" HorizontalAlignment="Left" Height="Auto" Margin="5" Width="Auto" VerticalContentAlignment="Stretch" VerticalAlignment="Top" Background="{x:Null}" BorderBrush="{x:Null}" SelectionBrush="{x:Null}">
<FlowDocument>
<Paragraph>
<Run Text="This tool does not recognise every option and/or configuration that E:D outputs through its JSON files."/>
</Paragraph>
<Paragraph>
<Run Text="Within this log you will find error messages that are of interest to the author (CMDR Hekateh/Nohla). If something appears here please send it to me via Discord."/>
</Paragraph>
</FlowDocument>
</RichTextBox>
</Grid> </Grid>
</TabItem> </TabItem>
</TabControl> </TabControl>

View File

@ -1,16 +1,23 @@
using System; using System;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Ookii.Dialogs.Wpf; using Ookii.Dialogs.Wpf;
using EDJournal; using NonaBGS.Journal;
using NonaBGS.BGS; using NonaBGS.BGS;
using NonaBGS.Util; using NonaBGS.Util;
using NonaBGS.EDDB;
using NonaBGS.UI;
namespace NonaBGS { namespace NonaBGS {
/// <summary> /// <summary>
@ -20,10 +27,7 @@ namespace NonaBGS {
private PlayerJournal journal = null; private PlayerJournal journal = null;
private Report report = new Report(); private Report report = new Report();
private Config config = new Config(); private Config config = new Config();
private API api = null; private EDDB eddb = null;
private PopulatedSystems systems_db = null;
private Stations stations_db = null;
public Config Config => config; public Config Config => config;
@ -40,7 +44,7 @@ namespace NonaBGS {
report.OnLog += Report_OnLog; report.OnLog += Report_OnLog;
api = new API(config.ConfigPath); eddb = new EDDB(config.ConfigPath);
journal = new PlayerJournal(config.Global.JournalLocation); journal = new PlayerJournal(config.Global.JournalLocation);
// Set both to now // Set both to now
@ -52,34 +56,10 @@ namespace NonaBGS {
try { try {
config.LoadObjectives(Report); config.LoadObjectives(Report);
RefreshObjectives(); RefreshObjectives();
} catch (Exception e) {
Log(e.Message);
}
api.SystemsAvailable += Api_SystemsAvailable; SyncDatabases();
api.StationsAvailable += Api_StationsAvailable; } catch (Exception) {
/* ignored */
try {
api.CheckDatabases();
} catch (Exception e) {
Log(e.Message);
}
}
private void Api_StationsAvailable() {
try {
stations_db = api.MakeStations();
} catch (Exception e) {
Log(e.Message);
}
}
private void Api_SystemsAvailable() {
try {
systems_db = api.MakePopulatedSystems();
system.Provider = new SystemSuggestionProvider(systems_db);
} catch (Exception e) {
Log(e.Message);
} }
} }
@ -94,8 +74,12 @@ namespace NonaBGS {
log.AppendText(builder.ToString()); log.AppendText(builder.ToString());
} }
private void Log(string message) { private void SyncDatabases() {
Report_OnLog(message); if (!config.Global.UseEDDB) {
return;
}
eddb.Download();
} }
private void RefreshObjectives() { private void RefreshObjectives() {
@ -135,7 +119,7 @@ namespace NonaBGS {
RefreshObjectives(); RefreshObjectives();
} }
private void AddObjective() { private void AddFilter_Click(object sender, RoutedEventArgs e) {
Objective objective = new Objective { Objective objective = new Objective {
System = system.Text, System = system.Text,
Faction = faction.Text, Faction = faction.Text,
@ -152,10 +136,6 @@ namespace NonaBGS {
} }
} }
private void AddFilter_Click(object sender, RoutedEventArgs e) {
AddObjective();
}
private void GenerateDiscord_Click(object sender, RoutedEventArgs e) { private void GenerateDiscord_Click(object sender, RoutedEventArgs e) {
NonaDiscordLog discord = new NonaDiscordLog(); NonaDiscordLog discord = new NonaDiscordLog();
string report = discord.GenerateDiscordLog(Report); string report = discord.GenerateDiscordLog(Report);
@ -206,75 +186,7 @@ namespace NonaBGS {
private void useeddb_Click(object sender, RoutedEventArgs e) { private void useeddb_Click(object sender, RoutedEventArgs e) {
Config.Global.UseEDDB = (bool)useeddb.IsChecked; Config.Global.UseEDDB = (bool)useeddb.IsChecked;
} SyncDatabases();
private void Filter_KeyDown(object sender, KeyEventArgs e) {
if (e.Key == Key.Enter) {
AddObjective();
}
}
private void station_GotFocus(object sender, RoutedEventArgs e) {
try {
if (stations_db == null || systems_db == null) {
return;
}
var sys = system.Text;
if (sys == null || sys.Length <= 0) {
return;
}
int system_id = systems_db.ToId(sys);
station.Provider = new StationSuggestionProvider(stations_db, system_id);
} catch (Exception exc) {
Log(exc.Message);
}
}
private void DownloadData_Click(object sender, RoutedEventArgs e) {
if (!Config.Global.UseEDDB) {
return;
}
ProgressDialog dialog = new ProgressDialog(api);
dialog.StartDownload();
dialog.ShowDialog();
}
private void AddCombatZone_Click(object sender, RoutedEventArgs e) {
if (entries.SelectedItem == null) {
return;
}
TreeViewItem item = entries.SelectedItem as TreeViewItem;
var obj = item.Tag;
if (obj.GetType() != typeof(Objective)) {
return;
}
Objective objective = obj as Objective;
CombatZoneDialog dialog = new CombatZoneDialog() { Owner = this };
if (!(dialog.ShowDialog() ?? false)) {
return;
}
CombatZone zone = new CombatZone();
zone.ManuallyAdded = true;
zone.Faction = objective.Faction;
zone.System = objective.System;
zone.Station = objective.Station;
zone.Grade = dialog.Grade;
zone.Type = dialog.Type;
zone.Amount = dialog.Amount;
objective.LogEntries.Add(zone);
RefreshObjectives();
} }
} }
} }

BIN
NONA.ico

Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 KiB

View File

@ -1,21 +0,0 @@
<Window x:Class="NonaBGS.ProgressDialog"
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:NonaBGS"
mc:Ignorable="d"
Title="Progress" Height="100" Width="450" Icon="NONA.ico">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Content="Downloading EDDB databases might take a while, please be patient." Grid.Row="0" Grid.Column="0" HorizontalAlignment="Center" Margin="0,0,0,0" VerticalAlignment="Top"/>
<ProgressBar x:Name="progress" Height="25" Margin="10,10" Grid.Row="1" Grid.Column="0" VerticalAlignment="Top" Width="Auto" IsIndeterminate="True"/>
</Grid>
</Window>

View File

@ -1,30 +0,0 @@
using System.Windows;
using NonaBGS.EDDB;
namespace NonaBGS {
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class ProgressDialog : Window {
private readonly API api = null;
public ProgressDialog(API api) {
InitializeComponent();
this.api = api;
this.api.DatabaseUpdateFinished += Api_DatabaseUpdateFinished;
this.api.DatabaseUpdateProgress += Api_DatabaseUpdateProgress;
}
private void Api_DatabaseUpdateProgress() {
progress.Value = (progress.Value + 1) % 100;
}
private void Api_DatabaseUpdateFinished() {
Close();
}
public void StartDownload() {
api.Download(true);
}
}
}

View File

@ -7,12 +7,12 @@ using System.Windows;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("NoNaBGS")] [assembly: AssemblyTitle("nonabgs")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NoNaBGS")] [assembly: AssemblyProduct("nonabgs")]
[assembly: AssemblyCopyright("Copyright © 2021 by Florian Stinglmayr")] [assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -51,5 +51,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]

125
README.md
View File

@ -1,125 +0,0 @@
# NonaBGS
This tool is meant to help people contributing to the Nova Navy BGS effor to create
BGS reports. The tool allows you to configure BGS objectives, and will then parse your
player journal for tasks you completed relating to that BGS objective. Once the JSON
player journal has been parsed, you may then generate a BGS report for the Nova Navy
discord.
Source code is available [here](https://git.aror.org/florian/nonabgs).
Binary downloads can be found here: [https://bgs.n0la.org/](https://bgs.n0la.org/).
## How To
![Main Window Objectives](main-objectives.png)
Use the main tab to add objectives to the program. To do this, insert the system name,
faction, and, optionally, a station. Then press "Add Objective". You can find this
information in the Nova Navy discord, in the "daily objectives" channel. Objectives can
be deleted by selecting them and pressing the "DEL" key.
Once you have your objectives have been configured, you can press "Parse Journal", which
will check your Elite Dangerous player journal for completed missions. Currently the tool
recognises the following completed tasks:
* Completed missions
* Vouchers, including bounty vouchers, combat bonds, and settlement vouchers (aka intel packages)
* Selling of micro resources (Odyssey only)
* Selling cartography data
* Selling of cargo to stations
Please note that cartography data, and micro resources only help the controlling faction
of a station. The tool is clever enough to exclude these if the station you turn them in at, is not
controlled by the faction you specified in the objective.
There is no entry in the journal if you win a combat zone. So you have to add those manually. Select
an objective for which you wish to log a combat zone. The faction in the objective, must be the
faction you fought for in the combat zone. Then click "Add Combat Zone Win". Select type,
either "On Foot" for Odyssey, or "Ship" for regular ones. Then select the grade (low, medium or
high), and how many you won. Then press "Accept". Select "Cancel" to abort. You can of course remove
the combat zone entries by selecting them, and pressing "DEL".
![Main Window with entries](main-entries.png)
The window will then list all the journal entries it has found, and group them by objectives. You
can remove individual entries (if you think the tool detected soemthing you thought was wrong), by
selecting the entry, and pressing the "DEL" key.
Once you are satisfied with the result, move to "Discord Report" tab, and click "Generate Report".
![Generated Report](main-report.png)
The resulting discord report is kept in the Nova Navy format. Before you copy/paste it into the
Nova Navy discord, you should check the log. You can of course edit it, if something is wrong
or the tool itself missed something.
## Known Issues and Bugs
Settlement vouchers (aka Intel Packages) help every faction aligned with the given superpower.
So if you turn in an Imperial intel package on an imperial station, all factions aligned with
the Empire will gain a bit of INF boost. The tool currently cannot handle that. All intel packages
are displayed instead.
Sometimes bounty vouchers are not properly recognised. This is a bug in the player journal, where
the faction information is not properly written out in the journal:
```
{
"timestamp":"2021-10-07T14:57:50Z", "event":"RedeemVoucher",
"Type":"bounty", "Amount":20750,
"Factions":[ { "Faction":"", "Amount":500 }, { "Faction":"", "Amount":20250 }]
}
```
Since the tool does not know for which faction these bounties were redeemed for, it cannot assign
it to an objective.
The player journal currently does not make an entry when you win or lose a combat zone. This is a
an ommission from FDev:
* [https://issues.frontierstore.net/issue-detail/43509](https://issues.frontierstore.net/issue-detail/43509)
Please upvote the issue to get it fixed. Until then, you have to add combat zone wins manually.
Also missions accepted from NPCs in Odyssey concourses do not get a player journal entry. This is
also an ommission from FDev:
* [https://issues.frontierstore.net/issue-detail/43586](https://issues.frontierstore.net/issue-detail/43586)
Until this is fixed, please edit the resulting BGS log text, and manually add such entries.
## Use EDDB information
NonaBGS can download information from EDDB to auto complete system- and station names. You can
enable its use in the "Settings". Once enabled, you must also press "Download", to download and
process the current version of the EDDB database.
Please note that the database is rather large (>200 MB), and processing it takes some time. It is
best if you don't use this feature if you are on a slow or metered internet connection.
## Nothing's Perfect
The tool itself is still a work in progress, and it might miss something. If you think the tool
missed a task you have done, please contact `CMDR Hekateh` on the Nova Navy discord. It would be
helpful if you included the JSON player journal. This player journal can be found here:
```
%userprofile%\saved Games\Frontier Developments\Elite Dangerous\
```
## Build Dependencies
Handling of Elite Dangerous player journals have been moved to a separate project called `EDJournal`.
Its source can be found [here](https://git.aror.org/florian/edjournal). This project simply depends
on the binary DLL that `EDJournal` builds.
The project also requires `Ookii.Dialogs.WPF` controls, which contains the auto complete text box.
And of course, `Newtonsoft.Json` as the JSON parser.
## About
This tool was made by CMDR Hekateh (Discord: `nola#2457`) of the Nova Navy.
Long live the Empire.

73
Resources.Designer.cs generated
View File

@ -1,73 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace NonaBGS {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NonaBGS.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon NONA {
get {
object obj = ResourceManager.GetObject("NONA", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
}
}

View File

@ -1,124 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="NONA" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\NONA.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 KiB

View File

@ -1,19 +0,0 @@
using System.Collections;
using AutoCompleteTextBox.Editors;
using NonaBGS.EDDB;
namespace NonaBGS.UI {
public class StationSuggestionProvider : ISuggestionProvider {
private int system_id = 0;
private Stations stations = null;
public StationSuggestionProvider(Stations stations, int system_id) {
this.system_id = system_id;
this.stations = stations;
}
public IEnumerable GetSuggestions(string filter) {
return stations.StationNamesBySystemId(system_id, filter);
}
}
}

View File

@ -1,23 +0,0 @@
using System;
using System.Collections;
using AutoCompleteTextBox.Editors;
using NonaBGS.EDDB;
namespace NonaBGS.UI {
public class SystemSuggestionProvider : ISuggestionProvider {
private PopulatedSystems systems = null;
public SystemSuggestionProvider(PopulatedSystems systems) {
this.systems = systems;
}
public PopulatedSystems Data {
get => systems;
set => systems = value;
}
public IEnumerable GetSuggestions(string filter) {
return systems.SystemNamesByFilter(filter);
}
}
}

View File

@ -1,4 +1,9 @@
using System.ComponentModel; using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NonaBGS.Util { namespace NonaBGS.Util {
public class AppConfig : INotifyPropertyChanged { public class AppConfig : INotifyPropertyChanged {

48
Util/EDDB.cs Normal file
View File

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading.Tasks;
using System.Net;
namespace NonaBGS.Util {
public class EDDB {
private static readonly string EDDB_SYSTEMS_ARCHIVE = "https://eddb.io/archive/v6/systems_populated.json";
private string cache_folder = null;
private WebClient client = new WebClient();
private string systems_file = null;
public string SystemsFile => systems_file;
public string Cache {
get => cache_folder;
set => cache_folder = value;
}
public EDDB(string cache_folder) {
this.cache_folder = cache_folder;
Initialise();
}
public void Initialise() {
client.DownloadDataCompleted += Client_DownloadDataCompleted;
}
private void DownloadFile(string url) {
Uri uri = new Uri(url);
string name = Path.GetFileName(uri.AbsolutePath);
systems_file = Path.Combine(this.cache_folder, name);
client.DownloadFileAsync(new Uri(EDDB_SYSTEMS_ARCHIVE), systems_file);
}
public void Download() {
DownloadFile(EDDB_SYSTEMS_ARCHIVE);
}
private void Client_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e) {
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

View File

@ -7,7 +7,7 @@
<ProjectGuid>{73BFB315-C808-40E7-8D69-B651F875880C}</ProjectGuid> <ProjectGuid>{73BFB315-C808-40E7-8D69-B651F875880C}</ProjectGuid>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<RootNamespace>NonaBGS</RootNamespace> <RootNamespace>NonaBGS</RootNamespace>
<AssemblyName>NonaBGS</AssemblyName> <AssemblyName>nonabgs</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
@ -37,17 +37,7 @@
<PropertyGroup> <PropertyGroup>
<StartupObject>NonaBGSApplication</StartupObject> <StartupObject>NonaBGSApplication</StartupObject>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<ApplicationIcon>NONA.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="AutoCompleteTextBox, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\AutoCompleteTextBox.1.1.1\lib\net472\AutoCompleteTextBox.dll</HintPath>
</Reference>
<Reference Include="EDJournal, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\edjournal\bin\Debug\EDJournal.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
@ -79,27 +69,15 @@
</ApplicationDefinition> </ApplicationDefinition>
<Compile Include="BGS\DiscordLogGenerator.cs" /> <Compile Include="BGS\DiscordLogGenerator.cs" />
<Compile Include="BGS\NonaDiscordLog.cs" /> <Compile Include="BGS\NonaDiscordLog.cs" />
<Compile Include="BGS\SellCargo.cs" />
<Compile Include="BGS\SellMicroResources.cs" /> <Compile Include="BGS\SellMicroResources.cs" />
<Compile Include="BGS\FactionKillBonds.cs" /> <Compile Include="Journal\EliteDangerous.cs" />
<Compile Include="EDDB\PopulatedSystems.cs" /> <Compile Include="Journal\MarketSellEntry.cs" />
<Compile Include="EDDB\Stations.cs" /> <Compile Include="Journal\MultiSellExplorationDataEntry.cs" />
<Compile Include="Resources.Designer.cs"> <Compile Include="Journal\RedeemVoucherEntry.cs" />
<AutoGen>True</AutoGen> <Compile Include="Journal\SellMicroResourcesEntry.cs" />
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="UI\StationSuggestionProvider.cs" />
<Compile Include="UI\SystemSuggestionProvider.cs" />
<Compile Include="Util\AppConfig.cs" /> <Compile Include="Util\AppConfig.cs" />
<Compile Include="Util\Config.cs" /> <Compile Include="Util\Config.cs" />
<Compile Include="EDDB\API.cs" /> <Compile Include="Util\EDDB.cs" />
<Compile Include="ProgressDialog.xaml.cs">
<DependentUpon>ProgressDialog.xaml</DependentUpon>
</Compile>
<Compile Include="CombatZoneDialog.xaml.cs">
<DependentUpon>CombatZoneDialog.xaml</DependentUpon>
</Compile>
<Page Include="MainWindow.xaml"> <Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
@ -114,19 +92,19 @@
<Compile Include="BGS\CombatZone.cs" /> <Compile Include="BGS\CombatZone.cs" />
<Compile Include="BGS\LogEntry.cs" /> <Compile Include="BGS\LogEntry.cs" />
<Compile Include="BGS\MissionCompleted.cs" /> <Compile Include="BGS\MissionCompleted.cs" />
<Compile Include="Journal\DockedEntry.cs" />
<Compile Include="Journal\Entry.cs" />
<Compile Include="BGS\Objective.cs" /> <Compile Include="BGS\Objective.cs" />
<Compile Include="Journal\Events.cs" />
<Compile Include="Journal\FSDJumpEntry.cs" />
<Compile Include="Journal\JournalException.cs" />
<Compile Include="Journal\JournalFile.cs" />
<Compile Include="Journal\MissionCompletedEntry.cs" />
<Compile Include="Journal\PlayerJournal.cs" />
<Compile Include="MainWindow.xaml.cs"> <Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon> <DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Page Include="ProgressDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="CombatZoneDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs"> <Compile Include="Properties\AssemblyInfo.cs">
@ -142,10 +120,6 @@
<DependentUpon>Settings.settings</DependentUpon> <DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput> <DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile> </Compile>
<EmbeddedResource Include="Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
@ -155,42 +129,12 @@
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None> </None>
<None Include="README.md">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="App.config" /> <None Include="App.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="main-objectives.png"> <Folder Include="UI\" />
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
</ItemGroup>
<ItemGroup>
<Resource Include="main-entries.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
</ItemGroup>
<ItemGroup>
<Resource Include="main-report.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
</ItemGroup>
<ItemGroup>
<Resource Include="LICENCE.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
</ItemGroup>
<ItemGroup>
<Resource Include="logo_v4.png" />
<Resource Include="logo_v4_bg.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\NONA.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="NONA.ico" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

@ -15,10 +15,6 @@ Global
{73BFB315-C808-40E7-8D69-B651F875880C}.Debug|Any CPU.Build.0 = Debug|Any CPU {73BFB315-C808-40E7-8D69-B651F875880C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73BFB315-C808-40E7-8D69-B651F875880C}.Release|Any CPU.ActiveCfg = Release|Any CPU {73BFB315-C808-40E7-8D69-B651F875880C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73BFB315-C808-40E7-8D69-B651F875880C}.Release|Any CPU.Build.0 = Release|Any CPU {73BFB315-C808-40E7-8D69-B651F875880C}.Release|Any CPU.Build.0 = Release|Any CPU
{C84BD6A6-55AF-48F0-A73E-51D1FAF65BC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C84BD6A6-55AF-48F0-A73E-51D1FAF65BC2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C84BD6A6-55AF-48F0-A73E-51D1FAF65BC2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C84BD6A6-55AF-48F0-A73E-51D1FAF65BC2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="AutoCompleteTextBox" version="1.1.1" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" /> <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
<package id="Ookii.Dialogs.Wpf" version="3.1.0" targetFramework="net472" /> <package id="Ookii.Dialogs.Wpf" version="3.1.0" targetFramework="net472" />
</packages> </packages>