Skip to content

Commit 431fdba

Browse files
committed
0.1.1
- Cleanup Code. - Cleaner 'debug' console window call. - Progress wheel now correctly stops spinning after texture conversion complete - Error Handling for existing textures already in Project Directory - Remove additional MainWindow references by having ExeClass constructor use one MainWindow reference - Disable upload button when no texture path is set. - Added a helper tooltip to upload button. - Error handling for missing SDK - Error handling for missing layoutgenerator. - Window no longer resizable - Debug output now readonly.
1 parent d70267e commit 431fdba

File tree

5 files changed

+172
-135
lines changed

5 files changed

+172
-135
lines changed

CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,15 @@
1+
# 0.1.1
2+
- Cleanup Code.
3+
- Cleaner 'debug' console window call.
4+
- Progress wheel now correctly stops spinning after texture conversion complete
5+
- Error Handling for existing textures already in Project Directory
6+
- Remove additional MainWindow references by having ExeClass constructor use one MainWindow reference
7+
- Disable upload button when no texture path is set.
8+
- Added a helper tooltip to upload button.
9+
- Error handling for missing SDK
10+
- Error handling for missing layoutgenerator.
11+
- Window no longer resizable
12+
- Debug output now readonly.
13+
114
# 0.1.0
2-
Initial Release.
15+
Initial Release.

ExeClass.cs

Lines changed: 28 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,44 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Diagnostics;
4-
using System.Linq;
5-
using System.Text;
6-
using System.Threading.Tasks;
1+
using System.Diagnostics;
72

83
namespace LiveryConverter2024
94
{
10-
internal class ExeClass
5+
internal class ExeClass(MainWindow mainWindowRef)
116
{
12-
public async Task SpawnProc(string proc, string args, MainWindow dbg)
7+
public MainWindow mainWindowRef = mainWindowRef;
8+
9+
private void consoleWriteLine(string line)
1310
{
14-
using (Process? p2 = new Process())
11+
mainWindowRef.Dispatcher.Invoke(() =>
1512
{
16-
p2.StartInfo.FileName = proc;
17-
p2.StartInfo.Arguments = args;
18-
p2.StartInfo.RedirectStandardOutput = true;
19-
p2.StartInfo.CreateNoWindow = true;
20-
p2.StartInfo.UseShellExecute = false;
21-
p2.EnableRaisingEvents = true;
22-
p2.OutputDataReceived += (object sender, DataReceivedEventArgs args) =>
23-
{
24-
dbg.Dispatcher.Invoke(() =>
25-
{
26-
dbg.DebugConsole = " " + args.Data + "\n";
27-
});
28-
29-
};
30-
p2.Start();
31-
p2.BeginOutputReadLine();
32-
await p2.WaitForExitAsync();
33-
}
13+
mainWindowRef.DebugConsole = line + "\n";
14+
});
15+
}
16+
17+
public async Task SpawnProc(string proc, string args)
18+
{
19+
using Process? p2 = new Process();
20+
p2.StartInfo.FileName = proc;
21+
p2.StartInfo.Arguments = args;
22+
p2.StartInfo.RedirectStandardOutput = true;
23+
p2.StartInfo.CreateNoWindow = true;
24+
p2.StartInfo.UseShellExecute = false;
25+
p2.EnableRaisingEvents = true;
26+
p2.OutputDataReceived += (object sender, DataReceivedEventArgs args) =>
27+
{
28+
consoleWriteLine(" " + args.Data);
29+
};
30+
p2.Start();
31+
p2.BeginOutputReadLine();
32+
await p2.WaitForExitAsync();
3433
}
35-
public async Task ProcMon(string processName, MainWindow dbg)
34+
public async Task ProcMon(string processName)
3635
{
3736
Thread.Sleep(2000);
3837
Process[]? processes = Process.GetProcessesByName(processName);
3938
foreach (Process p in processes)
4039
{
41-
dbg.Dispatcher.Invoke(() =>
42-
{
43-
dbg.DebugConsole = "Found Process " + p.ProcessName + " Waiting for exit...\n";
44-
});
40+
consoleWriteLine("Found Process " + p.ProcessName + " Waiting for exit...");
4541
await p.WaitForExitAsync();
46-
4742
}
4843
}
4944
}

MainWindow.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
xmlns:local="clr-namespace:LiveryConverter2024"
77
mc:Ignorable="d"
88
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
9-
Title="MSFS 2020 to MSFS 2024 Livery Converter" Height="450" Width="800">
9+
Title="MSFS 2020 to MSFS 2024 Livery Converter" Height="450" Width="800" ResizeMode="NoResize">
1010
<Grid Background="#FF1A1A1A">
1111
<Grid.RowDefinitions>
1212
<RowDefinition Height="22*"/>
@@ -38,14 +38,14 @@
3838
<Button x:Name="button2" Content="..." Click="button2_Click" Grid.Column="3" Grid.Row="3" HorizontalAlignment="Center" Height="32" Width="33"/>
3939
<TextBox x:Name="layoutGenPath" Margin="10,2,10,2" TextWrapping="Wrap" Text="..." Grid.Column="2" Grid.Row="4"/>
4040
<Button x:Name="button3" Content="..." Click="button3_Click" Grid.Column="3" Grid.Row="4" HorizontalAlignment="Center" Height="32" Width="33"/>
41-
<TextBox x:Name="debug" TextWrapping="Wrap" SnapsToDevicePixels="True" Grid.Column="1" Grid.ColumnSpan="4" Grid.Row="7" Margin="5,5,5,15"/>
41+
<TextBox x:Name="debug" TextWrapping="Wrap" SnapsToDevicePixels="True" Grid.Column="1" Grid.ColumnSpan="4" Grid.Row="7" Margin="5,5,5,15" IsReadOnly="True"/>
4242
<Label x:Name="label" Content="Project Directory" HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Row="1" Height="23" Width="104" Grid.Column="1"/>
4343
<Label x:Name="label_Copy" Content="Texture Directory" HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Row="2" Height="23" Width="105" Grid.Column="1"/>
4444
<Label x:Name="label_Copy1" Content="MSFS24 SDK Directory" HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Row="3" Height="23" Width="139" Grid.Column="1"/>
4545
<Label x:Name="label_Copy2" Content="Layout Generator Directory" HorizontalAlignment="Left" VerticalAlignment="Center" RenderTransformOrigin="0.474,0.567" Grid.Row="4" Grid.Column="1" Height="22" Width="168"/>
4646
<Label x:Name="label_Copy3" Content="Game Version" HorizontalAlignment="Left" VerticalAlignment="Center" RenderTransformOrigin="0.474,0.567" Grid.Row="5" Height="23" Width="85" Grid.Column="1"/>
4747
<Label x:Name="label_Copy4" Content="Debug Output:" HorizontalAlignment="Left" VerticalAlignment="Center" RenderTransformOrigin="0.474,0.567" Grid.Column="1" Grid.Row="6"/>
48-
<ui:Button x:Name="button4" Content="Upload MSFS 2020 Textures" Click="button4_Click" Grid.Column="4" HorizontalAlignment="Stretch" Grid.Row="1" Grid.RowSpan="3" VerticalAlignment="Stretch" Margin="5,5,5,5"/>
48+
<ui:Button x:Name="uploadButton" Content="Upload MSFS 2020 Textures" Click="button4_Click" MouseEnter="uploadButton_MouseEnter" Grid.Column="4" HorizontalAlignment="Stretch" Grid.Row="1" Grid.RowSpan="3" VerticalAlignment="Stretch" Margin="5,5,5,5" ToolTip="Ready to upload textures!"/>
4949
<ui:ProgressRing x:Name="Progress" Grid.Column="4" HorizontalAlignment="Center" Grid.Row="4" VerticalAlignment="Center" Grid.RowSpan="2" Visibility="Hidden" Progress="0"/>
5050

5151
</Grid>

0 commit comments

Comments
 (0)