Skip to content
This repository was archived by the owner on Jan 9, 2025. It is now read-only.

Commit

Permalink
Fix copy exception, other tidying.
Browse files Browse the repository at this point in the history
  • Loading branch information
Xjph committed Jun 22, 2019
1 parent 22126a7 commit f84f660
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 21 deletions.
7 changes: 0 additions & 7 deletions EDDisco/EDDisco.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,9 @@ namespace EDDisco
{
static class EDDisco
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
//JObject test = JObject.Parse("{ \"timestamp\":\"2019 - 06 - 05T01: 41:44Z\", \"event\":\"Scan\", \"ScanType\":\"Detailed\", \"BodyName\":\"Plaa Fleau QS-J c22-0 5 a\", \"BodyID\":8, \"Parents\":[ {\"Planet\":7}, {\"Star\":0} ], \"DistanceFromArrivalLS\":3068.617188, \"TidalLock\":false, \"TerraformState\":\"\", \"PlanetClass\":\"Icy body\", \"Atmosphere\":\"\", \"AtmosphereType\":\"None\", \"Volcanism\":\"\", \"MassEM\":0.039342, \"Radius\":2984278.000000, \"SurfaceGravity\":1.760719, \"SurfaceTemperature\":67.210930, \"SurfacePressure\":90.113243, \"Landable\":true, \"Materials\":[ { \"Name\":\"sulphur\", \"Percent\":27.437029 }, { \"Name\":\"carbon\", \"Percent\":23.071699 }, { \"Name\":\"phosphorus\", \"Percent\":14.770898 }, { \"Name\":\"iron\", \"Percent\":11.999499 }, { \"Name\":\"nickel\", \"Percent\":9.075918 }, { \"Name\":\"chromium\", \"Percent\":5.396573 }, { \"Name\":\"germanium\", \"Percent\":3.174578 }, { \"Name\":\"vanadium\", \"Percent\":2.946659 }, { \"Name\":\"cadmium\", \"Percent\":0.931815 }, { \"Name\":\"antimony\", \"Percent\":0.671342 }, { \"Name\":\"mercury\", \"Percent\":0.523998 } ], \"Composition\":{ \"Ice\":0.878241, \"Rock\":0.104724, \"Metal\":0.017035 }, \"SemiMajorAxis\":2443254784.000000, \"Eccentricity\":0.000000, \"OrbitalInclination\":-37.623867, \"Periapsis\":149.435867, \"OrbitalPeriod\":53715820.000000, \"RotationPeriod\":176866.078125, \"AxialTilt\":-0.354162, \"WasDiscovered\":false, \"WasMapped\":false }");
//ScanEvent scanEvent;
//scanEvent = test.ToObject<ScanEvent>();
//Properties.Settings.Default.
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new EDDiscoFrm());
Expand Down
1 change: 1 addition & 0 deletions EDDisco/EDDisco.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="EDDiscoMon.ico" />
<Content Include="TODO.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
Expand Down
7 changes: 7 additions & 0 deletions EDDisco/EDDiscoFrm.Designer.cs

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

31 changes: 17 additions & 14 deletions EDDisco/EDDiscoFrm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ namespace EDDisco
public partial class EDDiscoFrm : Form
{
private LogMonitor logMonitor;
private NotifyIcon notifyIcon;
private SpeechSynthesizer speech;

public EDDiscoFrm()
Expand All @@ -24,11 +23,8 @@ public EDDiscoFrm()
logMonitor = new LogMonitor("");
logMonitor.LogEntry += LogEvent;
Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
notifyIcon = new NotifyIcon()
{
Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath),
Visible = false
};
notifyIcon.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
notifyIcon.Visible = false;
}

private void BtnToggleMonitor_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -202,7 +198,6 @@ private void CbxTts_CheckedChanged(object sender, EventArgs e)
private void EDDiscoFrm_FormClosing(object sender, FormClosingEventArgs e)
{
notifyIcon.Icon = null;
notifyIcon.Dispose();
speech?.Dispose();
}

Expand Down Expand Up @@ -241,13 +236,21 @@ private void CopyAllSelected()
StringBuilder copyText = new StringBuilder();
foreach (ListViewItem item in listEvent.SelectedItems)
{
copyText.AppendLine(
item.SubItems[2].Text + " - " +
item.SubItems[0].Text + " - " +
(item.SubItems[4].Text.Length > 0 ? "Landable - " : string.Empty) +
item.SubItems[1].Text +
(item.SubItems[3].Text.Length > 0 ? " - " + item.SubItems[3].Text : string.Empty)
);
if (item.SubItems.Count == 5)
{
copyText.AppendLine(
item.SubItems[2].Text + " - " +
item.SubItems[0].Text + " - " +
(item.SubItems[4].Text.Length > 0 ? "Landable - " : string.Empty) +
item.SubItems[1].Text +
(item.SubItems[3].Text.Length > 0 ? " - " + item.SubItems[3].Text : string.Empty)
);
}
else
{
copyText.AppendLine(item.SubItems[0].Text + " - Uninteresting");
}


}
Clipboard.SetText(copyText.ToString());
Expand Down
3 changes: 3 additions & 0 deletions EDDisco/EDDiscoFrm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@
<metadata name="contextCopy.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="notifyIcon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>137, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
Expand Down
8 changes: 8 additions & 0 deletions EDDisco/TODO.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
TO DO:

- User configurable notification criteria
- Settings window
- Configure format of "copy all"
- Enable/disable built in criteria
- Configure TTS voice
- Investigate possibility of notifying via in-game chat

0 comments on commit f84f660

Please sign in to comment.