Skip to content

Commit

Permalink
Download limiter format bugfix + cache optimizer now runs in debug mo…
Browse files Browse the repository at this point in the history
…de as well
  • Loading branch information
Yelo420 committed Sep 12, 2023
1 parent 1e718ed commit b34a5e9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
1 change: 1 addition & 0 deletions gamevault/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ private async void Application_Startup(object sender, StartupEventArgs e)

#if DEBUG
AppFilePath.InitDebugPaths();
await CacheHelper.OptimizeCache();
#else
try
{
Expand Down
20 changes: 8 additions & 12 deletions gamevault/Converter/DownloadLimitConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,24 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
{
return "Unlimited";
}
size = size / 1000000;
if (size > 100)

if (size >= 1000000)
{
size = size / 1000;
size /= 1000000;
size = Math.Round(size, 2);
return $"{size} GB/s";
}
else if (size > 0.1)
else if (size >= 1000)
{
size /= 1000;
size = Math.Round(size, 2);
return $"{size} MB/s";
}
else if (size > 0.0001)
{
size *= 1000; size = Math.Round(size, 2);
return $"{size} KB/s";
}
else
{
size *= 1000000; size = Math.Round(size, 2);
return $"{size} B/s";
}
size = Math.Round(size, 2);
return $"{size} KB/s";
}
}
catch
{
Expand Down
2 changes: 2 additions & 0 deletions gamevault/UserControls/GameDownloadUserControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ public void CancelDownload()
ViewModel.State = "Download Cancelled";
ViewModel.DownloadUIVisibility = System.Windows.Visibility.Hidden;
ViewModel.DownloadFailedVisibility = System.Windows.Visibility.Visible;

MainWindowViewModel.Instance.UpdateTaskbarProgress();
}
private void DownloadGame()
{
Expand Down
2 changes: 1 addition & 1 deletion gamevault/UserControls/SettingsUserControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<settingsComponents:ServerUrlUserControl Margin="10,10,0,0" HorizontalAlignment="Left"/>
<GroupBox Header="Download Limit" Margin="10,10,0,0" Width="510" HorizontalAlignment="Left" mah:ControlsHelper.CornerRadius="4">
<StackPanel>
<TextBox Text="{Binding DownloadLimitUIValue,UpdateSourceTrigger=PropertyChanged}" Margin="0,10,0,5" MaxLength="11" mah:TextBoxHelper.UseFloatingWatermark="True" mah:TextBoxHelper.Watermark="{Binding DownloadLimitUIValue,Converter={StaticResource downloadLimitConv}}" PreviewTextInput="DownloadLimit_InputValidation" TextChanged="DownloadLimit_InputValidation" KeyDown="DownloadLimit_Save"/>
<TextBox Text="{Binding DownloadLimitUIValue,UpdateSourceTrigger=PropertyChanged}" Margin="0,10,0,5" MaxLength="8" mah:TextBoxHelper.UseFloatingWatermark="True" mah:TextBoxHelper.Watermark="{Binding DownloadLimitUIValue,Converter={StaticResource downloadLimitConv}}" PreviewTextInput="DownloadLimit_InputValidation" TextChanged="DownloadLimit_InputValidation" KeyDown="DownloadLimit_Save"/>
<Button Content="Save" FontSize="15" Width="80" HorizontalAlignment="Left" Click="DownloadLimit_Save"/>
</StackPanel>
</GroupBox>
Expand Down

0 comments on commit b34a5e9

Please sign in to comment.