Skip to content

Commit

Permalink
Version 1.0.0.1 Hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
trigger-segfault committed Aug 19, 2017
1 parent b66b7f1 commit 21021a6
Show file tree
Hide file tree
Showing 14 changed files with 579 additions and 284 deletions.
4 changes: 4 additions & 0 deletions TerrariaMidiPlayer/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<runtime>
<!--<legacyUnhandledExceptionPolicy enabled="1"/>-->
<ThrowUnobservedTaskExceptions enabled="true"/>
</runtime>
</configuration>
34 changes: 27 additions & 7 deletions TerrariaMidiPlayer/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,40 @@ namespace TerrariaMidiPlayer {
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application {
// Prevents multiple error windows opening for the same exception.
private static object lastException = null;

private void OnAppStartup(object sender, StartupEventArgs e) {
// Catch exceptions not in a UI thread
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(OnAppDomainUnhandledException);
TaskScheduler.UnobservedTaskException += OnTaskSchedulerUnobservedTaskException;
}

private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) {
if (ErrorMessageBox.Show(e.Exception))
Environment.Exit(0);
e.Handled = true;
if (e.Exception != lastException) {
lastException = e.Exception;
if (ErrorMessageBox.Show(e.Exception))
Environment.Exit(0);
e.Handled = true;
}
}
private void OnAppDomainUnhandledException(object sender, UnhandledExceptionEventArgs e) {
Dispatcher.Invoke(() => {
if (ErrorMessageBox.Show(e.ExceptionObject))
Environment.Exit(0);
});
if (e.ExceptionObject != lastException) {
lastException = e.ExceptionObject;
Dispatcher.Invoke(() => {
if (ErrorMessageBox.Show(e.ExceptionObject))
Environment.Exit(0);
});
}
}
private void OnTaskSchedulerUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e) {
if (e.Exception != lastException) {
lastException = e.Exception;
Dispatcher.Invoke(() => {
if (ErrorMessageBox.Show(e.Exception))
Environment.Exit(0);
});
}
}
}
}
13 changes: 12 additions & 1 deletion TerrariaMidiPlayer/Keybind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,19 @@ private enum MapType : uint {
}

char mappedChar = Char.ToUpper(GetCharFromKey(Key));
if (Key >= Key.NumPad0 && Key <= Key.Divide)
if (Key >= Key.NumPad0 && Key <= Key.NumPad9)
displayString += Key.ToString();
else if (Key >= Key.Multiply && Key <= Key.Divide && Key != Key.Separator) {
switch (Key) {
case Key.Multiply: displayString += "NumPad*"; break;
case Key.Add: displayString += "NumPad+"; break;
case Key.Subtract: displayString += "NumPad-"; break;
case Key.Decimal: displayString += "NumPad."; break;
case Key.Divide: displayString += "NumPad/"; break;
}
}
else if (Key == Key.Pause)
displayString += "PauseBreak";
else if (mappedChar > 32) // Yes, exclude space
displayString += mappedChar;
else if (Key == Key.Back)
Expand Down
22 changes: 15 additions & 7 deletions TerrariaMidiPlayer/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
<Image Source="Resources/Icons/Keybinds.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Executable Name..." Click="OnTerrariaExeName">
<MenuItem.Icon>
<Image Source="Resources/Icons/TerrariaIcon.png" />
</MenuItem.Icon>
</MenuItem>
<Separator Margin="0"/>
<MenuItem Header="Save Config" Click="OnSaveConfig">
<MenuItem.Icon>
Expand Down Expand Up @@ -170,17 +175,17 @@
<CheckBox x:Name="checkBoxTrackEnabled" Content="Enabled" HorizontalAlignment="Right" Margin="0,107,14,0" VerticalAlignment="Top" Click="OnTrackEnabledClicked" IsChecked="True" Padding="4,-1,5,0" RenderTransformOrigin="0.516,5.667"/>
<Label Content="Octave Offset" HorizontalAlignment="Right" Margin="0,128,81,0" VerticalAlignment="Top"/>
<local:NumericUpDown x:Name="numericOctaveOffset" Margin="0,130,10,0" HorizontalAlignment="Right" VerticalAlignment="Top" Width="66" Increment="1" Maximum="10" Value="0" ValueChanged="OnOctaveOffsetChanged" Minimum="-10"/>

<Separator Height="7" Margin="10,157,10,0" VerticalAlignment="Top"/>

<Label x:Name="labelTotalNotes" Content="Total Notes:" HorizontalAlignment="Left" Margin="10,168,0,0" VerticalAlignment="Top"/>
<Label x:Name="labelDuration" Content="Duration:" HorizontalAlignment="Left" Margin="10,198,0,0" VerticalAlignment="Top"/>

<Label Content="Note Offset" HorizontalAlignment="Right" Margin="0,168,81,0" VerticalAlignment="Top"/>
<local:NumericUpDown x:Name="numericNoteOffset" Margin="0,170,10,0" HorizontalAlignment="Right" VerticalAlignment="Top" Width="66" Increment="1" Maximum="11" Value="0" ValueChanged="OnNoteOffsetChanged" Minimum="-11"/>
<Label Content="Speed (%)" HorizontalAlignment="Right" Margin="0,198,81,0" VerticalAlignment="Top"/>
<local:NumericUpDown x:Name="numericSpeed" Margin="0,200,10,0" HorizontalAlignment="Right" VerticalAlignment="Top" Width="66" Increment="1" Maximum="10000" Value="100" ValueChanged="OnSpeedChanged" Minimum="1"/>

<Label Content="Keybind" HorizontalAlignment="Right" Margin="0,229,195,0" VerticalAlignment="Top"/>
<local:KeybindReader x:Name="keybindReaderMidi" Margin="0,231,10,0" HorizontalAlignment="Right" KeybindChanged="OnMidiKeybindChanged"/>
</Grid>
Expand All @@ -193,7 +198,7 @@
<System:String>Host</System:String>
</ComboBox>
<Separator Height="7" Margin="10,37,10,0" VerticalAlignment="Top"/>
<Grid x:Name="gridSyncClient" Visibility="Visible" Margin="0,44,0,0">
<Grid x:Name="gridSyncClient" Visibility="Hidden" Margin="0,44,0,0">
<Label Content="IP" Width="36" HorizontalAlignment="Left" VerticalAlignment="Top" HorizontalContentAlignment="Right" Margin="10,8,0,0"/>
<TextBox x:Name="textBoxClientIP" Height="23" Margin="51,10,131,0" TextWrapping="Wrap" VerticalAlignment="Top" AllowDrop="False"/>
<Label Content="Port" Width="36" HorizontalAlignment="Right" VerticalAlignment="Top" HorizontalContentAlignment="Right" Margin="0,8,90,0"/>
Expand All @@ -208,12 +213,12 @@
<TextBox x:Name="textBoxClientNextSong" IsReadOnly="True" Height="23" Margin="90,107,15,0" TextWrapping="Wrap" VerticalAlignment="Top" Text="" AllowDrop="False" IsUndoEnabled="False" IsTabStop="False"/>
<Label Content="Time Offset (ms)" HorizontalAlignment="Left" Margin="10,139,0,0" VerticalAlignment="Top" Width="98" HorizontalContentAlignment="Right"/>
<local:NumericUpDown x:Name="numericClientPlayOffset" VerticalAlignment="Top" Margin="113,141,15,0" Width="Auto" Value="0" Minimum="-100000000" Maximum="100000000" ValueChanged="OnClientTimeOffsetChanged" IsManipulationEnabled="True" Focusable="True" HorizontalAlignment="Stretch"/>

<Separator Height="7" Margin="10,169,10,0" VerticalAlignment="Top"/>
<Label x:Name="labelClientPlaying" Content="Stopped" HorizontalAlignment="Left" VerticalAlignment="Top" HorizontalContentAlignment="Right" Margin="10,179,0,0"/>
<Button x:Name="buttonClientReady" Content="Ready" HorizontalAlignment="Right" Margin="0,181,15,0" VerticalAlignment="Top" Width="75" Click="OnClientReady" IsTabStop="False" Focusable="False"/>
</Grid>
<Grid x:Name="gridSyncHost" Visibility="Hidden" Margin="0,44,0,0">
<Grid x:Name="gridSyncHost" Visibility="Visible" Margin="0,44,0,0">
<Label Content="Pass" Width="36" HorizontalAlignment="Left" VerticalAlignment="Top" HorizontalContentAlignment="Right" Margin="10,8,0,0"/>
<TextBox x:Name="textBoxHostPassword" Height="23" Margin="51,10,131,0" TextWrapping="Wrap" VerticalAlignment="Top" AllowDrop="False"/>
<Label Content="Port" Width="36" HorizontalAlignment="Right" VerticalAlignment="Top" HorizontalContentAlignment="Right" Margin="0,8,90,0"/>
Expand All @@ -223,9 +228,12 @@
<Label Content="Wait (ms)" Width="60" HorizontalAlignment="Left" VerticalAlignment="Top" HorizontalContentAlignment="Right" Margin="10,36,0,0" ToolTip="The pause before all users begin playing"/>
<local:NumericUpDown x:Name="numericHostWait" VerticalAlignment="Top" Margin="75,38,131,0" Width="Auto" Value="5000" Maximum="60000" Focusable="True" HorizontalAlignment="Stretch"/>

<Label Content="Next Song" Width="69" HorizontalAlignment="Left" VerticalAlignment="Top" HorizontalContentAlignment="Right" Margin="10,77,0,0"/>
<Label x:Name="labelHostNextSong" Content="Next Song" Width="69" HorizontalAlignment="Left" VerticalAlignment="Top" HorizontalContentAlignment="Right" Margin="10,77,0,0"/>
<TextBox x:Name="textBoxHostNextSong" Height="23" Margin="84,79,43,0" TextWrapping="Wrap" VerticalAlignment="Top" AllowDrop="False" IsTabStop="False"/>
<Button x:Name="buttonHostAssignSong" Content="" HorizontalAlignment="Right" Margin="0,79,15,0" VerticalAlignment="Top" Width="23" Click="OnHostAssignSong" IsTabStop="False" Focusable="False"/>
<Grid x:Name="gridHostPlaying" Background="#FFF9F9F9" VerticalAlignment="Top" Height="26" Margin="10,77,10,0">
<Label x:Name="labelHostPlaying" Content="Stopped" HorizontalAlignment="Left" VerticalAlignment="Top" HorizontalContentAlignment="Right" Margin="0"/>
</Grid>
<ListView x:Name="listViewClients" Margin="15,108,15,5"/>
</Grid>
</Grid>
Expand Down
Loading

0 comments on commit 21021a6

Please sign in to comment.