Skip to content

Commit 59da5db

Browse files
committed
Persistent settings.
Bugfixes
1 parent 18431c9 commit 59da5db

File tree

9 files changed

+903
-153
lines changed

9 files changed

+903
-153
lines changed

ConsoleTestApp/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static void Main(string[] args)
4848

4949
//var l1 = JournalMonitor.GetLocaction("{ \"timestamp\":\"2018 - 03 - 17T20: 05:59Z\", \"event\":\"StartJump\", \"JumpType\":\"Hyperspace\", \"StarSystem\":\"Kyloarph IN-S d4-2021\", \"SystemAddress\":69449931411883, \"StarClass\":\"N\" }");
5050
//var l2 = JournalMonitor.GetLocaction("{ \"timestamp\":\"2018-03-17T20:03:25Z\", \"event\":\"Location\", \"Docked\":false, \"StarSystem\":\"Kyloarph DB-X e1-5559\", \"SystemAddress\":23876836747476, \"StarPos\":[-7504.34375,-727.28125,21081.59375], \"SystemAllegiance\":\"\", \"SystemEconomy\":\"$economy_None;\", \"SystemEconomy_Localised\":\"n/v\", \"SystemGovernment\":\"$government_None;\", \"SystemGovernment_Localised\":\"n/v\", \"SystemSecurity\":\"$GAlAXY_MAP_INFO_state_anarchy;\", \"SystemSecurity_Localised\":\"Anarchie\", \"Population\":0, \"Body\":\"Kyloarph DB-X e1-5559 1\", \"BodyID\":1, \"BodyType\":\"Planet\" }");
51-
var l3 = JournalMonitor.GetLocaction("{ \"timestamp\":\"2018-03-17T20:09:52Z\", \"event\":\"Scan\", \"ScanType\":\"Detailed\", \"BodyName\":\"Kyloarph PT-Q d5-3862 A 1\", \"BodyID\":7, \"Parents\":[ {\"Star\":1}, {\"Null\":0} ], \"DistanceFromArrivalLS\":239.561920, \"TidalLock\":false, \"TerraformState\":\"\", \"PlanetClass\":\"High metal content body\", \"Atmosphere\":\"thin sulfur dioxide atmosphere\", \"AtmosphereType\":\"SulphurDioxide\", \"AtmosphereComposition\":[ { \"Name\":\"SulphurDioxide\", \"Percent\":100.000000 } ], \"Volcanism\":\"\", \"MassEM\":0.134808, \"Radius\":3276403.500000, \"SurfaceGravity\":5.005291, \"SurfaceTemperature\":378.430450, \"SurfacePressure\":359.917908, \"Landable\":false, \"Composition\":{ \"Ice\":0.000000, \"Rock\":0.672977, \"Metal\":0.327023 }, \"SemiMajorAxis\":71812833280.000000, \"Eccentricity\":0.000085, \"OrbitalInclination\":-0.000587, \"Periapsis\":246.785690, \"OrbitalPeriod\":10816627.000000, \"RotationPeriod\":208069.937500, \"AxialTilt\":-0.499019 }");
51+
var l3 = JournalMonitor.GetLocation("{ \"timestamp\":\"2018-03-17T20:09:52Z\", \"event\":\"Scan\", \"ScanType\":\"Detailed\", \"BodyName\":\"Kyloarph PT-Q d5-3862 A 1\", \"BodyID\":7, \"Parents\":[ {\"Star\":1}, {\"Null\":0} ], \"DistanceFromArrivalLS\":239.561920, \"TidalLock\":false, \"TerraformState\":\"\", \"PlanetClass\":\"High metal content body\", \"Atmosphere\":\"thin sulfur dioxide atmosphere\", \"AtmosphereType\":\"SulphurDioxide\", \"AtmosphereComposition\":[ { \"Name\":\"SulphurDioxide\", \"Percent\":100.000000 } ], \"Volcanism\":\"\", \"MassEM\":0.134808, \"Radius\":3276403.500000, \"SurfaceGravity\":5.005291, \"SurfaceTemperature\":378.430450, \"SurfacePressure\":359.917908, \"Landable\":false, \"Composition\":{ \"Ice\":0.000000, \"Rock\":0.672977, \"Metal\":0.327023 }, \"SemiMajorAxis\":71812833280.000000, \"Eccentricity\":0.000085, \"OrbitalInclination\":-0.000587, \"Periapsis\":246.785690, \"OrbitalPeriod\":10816627.000000, \"RotationPeriod\":208069.937500, \"AxialTilt\":-0.499019 }");
5252

5353

5454
}

ED-Router.UI.Desktop/ED-Router.UI.Desktop.csproj

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,20 +100,11 @@
100100
<DesignTime>True</DesignTime>
101101
<DependentUpon>Resources.resx</DependentUpon>
102102
</Compile>
103-
<Compile Include="Properties\Settings.Designer.cs">
104-
<AutoGen>True</AutoGen>
105-
<DependentUpon>Settings.settings</DependentUpon>
106-
<DesignTimeSharedInput>True</DesignTimeSharedInput>
107-
</Compile>
108103
<EmbeddedResource Include="Properties\Resources.resx">
109104
<Generator>ResXFileCodeGenerator</Generator>
110105
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
111106
</EmbeddedResource>
112107
<None Include="packages.config" />
113-
<None Include="Properties\Settings.settings">
114-
<Generator>SettingsSingleFileGenerator</Generator>
115-
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
116-
</None>
117108
</ItemGroup>
118109
<ItemGroup>
119110
<None Include="App.config" />

ED-Router.UI.Desktop/Properties/Settings.Designer.cs

Lines changed: 0 additions & 30 deletions
This file was deleted.

ED-Router.UI.Desktop/Properties/Settings.settings

Lines changed: 0 additions & 7 deletions
This file was deleted.

ED-Router.VoiceAttack/VoiceAttackPlugin.cs

Lines changed: 65 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ namespace ED_Router.VoiceAttack
1111
{
1212
public class VoiceAttackPlugin
1313
{
14+
private static MainWindow window = null;
15+
1416
public static string VA_DisplayName()
1517
{
1618
return "VoiceAttack ED-Router Plugin"; //a name to distinguish my plugin from others
@@ -32,7 +34,14 @@ public static void VA_Init1(dynamic vaProxy)
3234

3335
public static void VA_Exit1(dynamic vaProxy)
3436
{
35-
//no need to do anything on exit with this implementation
37+
if (window != null)
38+
{
39+
try
40+
{
41+
window.Dispatcher.BeginInvoke((Action)window.Close);
42+
}
43+
catch (Exception) { }
44+
}
3645
}
3746

3847
public static void VA_StopCommand()
@@ -42,44 +51,74 @@ public static void VA_StopCommand()
4251

4352
public static void VA_Invoke1(dynamic vaProxy)
4453
{
45-
string context = vaProxy.Context;
54+
try
55+
{
56+
string context = vaProxy.Context;
4657

47-
switch (context)
58+
switch (context)
59+
{
60+
case "next_waypoint":
61+
var next = EdRouter.Instance.NextWaypoint();
62+
vaProxy.SetText("next_waypoint", next.System);
63+
break;
64+
case "prev_waypoint":
65+
var prev = EdRouter.Instance.PreviousWaypoint();
66+
vaProxy.SetText("prev_waypoint", prev.System);
67+
break;
68+
case "open_gui":
69+
InvokeConfiguration();
70+
break;
71+
case "calculate_route":
72+
EdRouter.Instance.CalculateRoute();
73+
vaProxy.SetText("total_jumps", EdRouter.Instance.Route.TotalJumps);
74+
break;
75+
default:
76+
break;
77+
}
78+
WaypointToClipboard();
79+
}
80+
catch (Exception ex)
4881
{
49-
case "next_waypoint":
50-
var next = EdRouter.Instance.NextWaypoint();
51-
vaProxy.SetText("next_waypoint", next.System);
52-
break;
53-
case "prev_waypoint":
54-
var prev = EdRouter.Instance.PreviousWaypoint();
55-
vaProxy.SetText("prev_waypoint", prev.System);
56-
break;
57-
case "open_gui":
58-
InvokeConfiguration();
59-
break;
60-
case "calculate_route":
61-
EdRouter.Instance.CalculateRoute();
62-
break;
63-
default:
64-
break;
82+
vaProxy.WriteToLog("Error from ED-Router: " + ex.Message, "red");
6583
}
6684
}
6785

6886
private static void InvokeConfiguration()
6987
{
70-
Thread thread = new Thread(() =>
88+
if (window == null)
7189
{
72-
MainWindow window = new MainWindow();
73-
window.ShowDialog();
90+
Thread configThread = new Thread(() =>
91+
{
92+
try
93+
{
94+
window = new MainWindow();
95+
window.ShowDialog();
96+
window = null;
97+
}
98+
catch(Exception ex) {
99+
100+
}
74101

75-
});
76-
thread.SetApartmentState(ApartmentState.STA);
77-
thread.Start();
102+
});
103+
configThread.SetApartmentState(ApartmentState.STA);
104+
configThread.Start();
105+
}
78106
}
79107

80108
private static void WaypointToClipboard()
81109
{
82-
Clipboard.SetText(EdRouter.Instance.CurrentWaypoint.System);
110+
Thread copyThread = new Thread(() =>
111+
{
112+
try
113+
{
114+
Clipboard.SetText(EdRouter.Instance.CurrentWaypoint.System);
115+
}
116+
catch (Exception)
117+
{ }
118+
119+
});
120+
copyThread.SetApartmentState(ApartmentState.STA);
121+
copyThread.Start();
83122
}
84123
}
85124
}

ED-Router.sln

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleTestApp", "ConsoleTe
1818
EndProject
1919
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CCE3E7A9-1F5D-47A2-9225-15A748D79231}"
2020
ProjectSection(SolutionItems) = preProject
21+
ed-router.vap = ed-router.vap
22+
License.md = License.md
2123
Readme.md = Readme.md
2224
EndProjectSection
2325
EndProject

0 commit comments

Comments
 (0)