Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
Poker-sang committed Jul 14, 2024
1 parent d479232 commit fb4da3c
Show file tree
Hide file tree
Showing 8 changed files with 386 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
# Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
Expand Down
9 changes: 4 additions & 5 deletions DanmakuPlayer/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ public partial class App : Application

public App()
{
RegisterUnhandledExceptionHandler();
this.UseSegoeMetrics();
_ = this.UseSegoeMetrics();
SettingsValueConverter.Context = SettingsSerializeContext.Default;
Environment.SetEnvironmentVariable("WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS", $"--remote-debugging-port={RemoteDebuggingPort}");
InitializeComponent();
AppContext.Initialize();
RegisterUnhandledExceptionHandler();
HttpClientHelper.Initialize();
InitializeComponent();
}

protected override void OnLaunched(LaunchActivatedEventArgs args)
Expand Down Expand Up @@ -59,8 +59,7 @@ protected override void OnLaunched(LaunchActivatedEventArgs args)

private void RegisterUnhandledExceptionHandler()
{
_logger = new FileLogger(@"C:\Users\poker\AppData\Local\Packages\PokerKo.DanmakuPlayer_0wpjzgvbyjvyr\LocalState\Logs");
// var logger = new FileLogger(Path.Combine(AppContext.AppLocalFolder, "Logs"));
_logger = new FileLogger(Path.Combine(AppContext.AppLocalFolder, "Logs"));
DebugSettings.BindingFailed += (o, e) =>
{
_logger.LogWarning(e.Message, null);
Expand Down
9 changes: 2 additions & 7 deletions DanmakuPlayer/AppConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,9 @@

namespace DanmakuPlayer;

[GenerateConstructor]
public partial record AppConfig
[GenerateConstructor(CallParameterlessConstructor = true)]
public partial record AppConfig()
{
public AppConfig()
{

}

#region 渲染设置

/// <summary>
Expand Down
374 changes: 374 additions & 0 deletions DanmakuPlayer/Package.StoreAssociation.xml

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions DanmakuPlayer/Views/Controls/BackgroundPanel.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using DanmakuPlayer.Resources;
using DanmakuPlayer.Services;
using DanmakuPlayer.Services.DanmakuServices;
using DanmakuPlayer.Views.Converters;
using DanmakuPlayer.Views.ViewModels;
using Microsoft.Graphics.Canvas.UI;
using Microsoft.Graphics.Canvas.UI.Xaml;
Expand Down Expand Up @@ -320,7 +319,7 @@ await WebView.LockOperationsAsync(async operations =>

private void TimeTextTapped(object sender, TappedRoutedEventArgs e)
{
TimeText.Text = DoubleToTimeTextConverter.ToTime(Vm.Time);
TimeText.Text = C.ToTime(Vm.Time);
Vm.EditingTime = true;
}

Expand Down
2 changes: 1 addition & 1 deletion DanmakuPlayer/Views/Controls/VideoLocatorDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace DanmakuPlayer.Views.Controls;

public class VideoLocatorDisplay
{
public override string ToString() => DoubleToTimeTextConverter.ToTime(Duration);
public override string ToString() => C.ToTime(Duration);

public ILocator Video { get; set; } = null!;

Expand Down
9 changes: 2 additions & 7 deletions DanmakuPlayer/Views/Converters/DoubleToTimeTextConverter.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
using System;
using DanmakuPlayer.Views.Controls;
using Microsoft.UI.Xaml.Data;
using WinUI3Utilities;

namespace DanmakuPlayer.Views.Converters;

public class DoubleToTimeTextConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language) => ToTime(value.To<double>());
public object Convert(object value, Type targetType, object parameter, string language) => C.ToTime(value.To<double>());

public object ConvertBack(object value, Type targetType, object parameter, string language) => ThrowHelper.InvalidCast<object>();

public static string ToTime(double sec)
{
var time = TimeSpan.FromSeconds(sec);
return time is { Hours: 0 } ? time.ToString(@"mm\:ss") : time.ToString(@"hh\:mm\:ss");
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<img src="readme/DanmakuPlayer.svg" alt="logo" width="200">

# DanmakuPlayer
# Danmaku Player

[<img src="https://get.microsoft.com/images/zh-cn%20dark.svg" alt="store-logo" width="200">](https://apps.microsoft.com/detail/Danmaku%20Player/9pmcjd6flbzs?launch=true&mode=mini)

Expand Down

0 comments on commit fb4da3c

Please sign in to comment.