This commit is contained in:
parent
2a8166a0c5
commit
d881ed69e2
33 changed files with 580 additions and 640 deletions
|
@ -2,8 +2,8 @@
|
|||
using Plpext.Core.Interfaces;
|
||||
using Plpext.Core.Models;
|
||||
|
||||
namespace Plpext.Core.AudioConverter
|
||||
{
|
||||
namespace Plpext.Core.AudioConverter;
|
||||
|
||||
public class MP3AudioConverter : IAudioConverter
|
||||
{
|
||||
private readonly IMP3Parser _parser;
|
||||
|
@ -12,12 +12,12 @@ namespace Plpext.Core.AudioConverter
|
|||
{
|
||||
_parser = parser;
|
||||
}
|
||||
public async Task<AudioFile> ConvertAudioAsync(ReadOnlyMemory<byte> file, CancellationToken cancellationToken)
|
||||
public async Task<AudioFile> ConvertAudioAsync(ReadOnlyMemory<byte> mp3Input, CancellationToken cancellationToken)
|
||||
{
|
||||
var baseFile = await _parser.ParseIntoMP3(file, cancellationToken);
|
||||
var baseFile = await _parser.ParseIntoMP3(mp3Input, cancellationToken);
|
||||
byte[] pcmData = null!;
|
||||
using var mp3Stream = new MP3Stream(new MemoryStream(baseFile.Data.ToArray()));
|
||||
using var pcmStream = new MemoryStream();
|
||||
await using var mp3Stream = new MP3Stream(new MemoryStream(baseFile.Data.ToArray()));
|
||||
await using var pcmStream = new MemoryStream();
|
||||
var buffer = new byte[4096];
|
||||
int bytesReturned = 1;
|
||||
int totalBytesRead = 0;
|
||||
|
@ -28,42 +28,38 @@ namespace Plpext.Core.AudioConverter
|
|||
{
|
||||
try
|
||||
{
|
||||
bytesReturned = await mp3Stream.ReadAsync(buffer, 0, buffer.Length);
|
||||
bytesReturned = await mp3Stream.ReadAsync(buffer, 0, buffer.Length, cancellationToken);
|
||||
}
|
||||
catch (IndexOutOfRangeException ex)
|
||||
catch (IndexOutOfRangeException)
|
||||
{
|
||||
Console.WriteLine($"{ex.Message}");
|
||||
Console.WriteLine($"File reached a corrupted/non-compliant portion. Total bytes read: {totalBytesRead} | File: {baseFile.Name}");
|
||||
//File reached a corrupted/non-compliant portion.
|
||||
break;
|
||||
}
|
||||
catch (NullReferenceException ex)
|
||||
catch (NullReferenceException)
|
||||
{
|
||||
Console.WriteLine($"{ex.Message}");
|
||||
Console.WriteLine($"File reached a corrupted/non-compliant portion. Total bytes read: {totalBytesRead} | File: {baseFile.Name}");
|
||||
//File reached a corrupted/non-compliant portion that caused MP3Sharp to throw a NRE.
|
||||
break;
|
||||
}
|
||||
totalBytesRead += bytesReturned;
|
||||
await pcmStream.WriteAsync(buffer, 0, bytesReturned);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Exception details:");
|
||||
Console.WriteLine($"Message: {ex.Message}");
|
||||
Console.WriteLine($"StackTrace: {ex.StackTrace}");
|
||||
if (ex.InnerException != null)
|
||||
{
|
||||
Console.WriteLine($"InnerException: {ex.InnerException.Message}");
|
||||
Console.WriteLine($"InnerException StackTrace: {ex.InnerException.StackTrace}");
|
||||
}
|
||||
await pcmStream.WriteAsync(buffer, 0, bytesReturned, cancellationToken);
|
||||
}
|
||||
|
||||
pcmData = ResampleToMono(pcmStream.ToArray());
|
||||
|
||||
var audioDuration = (double)(pcmData.Length / 2) / mp3Stream.Frequency;
|
||||
|
||||
return new AudioFile() { Name = baseFile.Name, MP3Data = file, Data = pcmData, Duration = TimeSpan.FromSeconds(audioDuration), Format = AudioFormat.Mono16, Frequency = mp3Stream.Frequency };
|
||||
return new AudioFile() { Name = baseFile.Name, MP3Data = mp3Input, Data = pcmData, Duration = TimeSpan.FromSeconds(audioDuration), Format = AudioFormat.Mono16, Frequency = mp3Stream.Frequency };
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//An exception here would be something new.
|
||||
}
|
||||
return new AudioFile() { Name = $"${baseFile.Name} failed extraction", Data = ReadOnlyMemory<byte>.Empty, MP3Data = ReadOnlyMemory<byte>.Empty, Duration = TimeSpan.FromSeconds(0), Format = AudioFormat.Unknown, Frequency = 0 };
|
||||
}
|
||||
|
||||
/* This is pretty cursed, but it works.
|
||||
I don't remember where I got it from the first time, though. I think LLMs weren't a thing yet.
|
||||
*/
|
||||
private static byte[] ResampleToMono(Span<byte> data)
|
||||
{
|
||||
byte[] newData = new byte[data.Length / 2];
|
||||
|
@ -83,4 +79,3 @@ namespace Plpext.Core.AudioConverter
|
|||
return newData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
using OpenTK.Audio.OpenAL;
|
||||
using Plpext.Core.Interfaces;
|
||||
using Plpext.Core.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Plpext.Core.AudioPlayer;
|
||||
|
||||
|
@ -45,9 +38,8 @@ public sealed class AudioPlayer : IAudioPlayer, IDisposable
|
|||
return await Start();
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
Console.WriteLine($"init error: {ex}");
|
||||
await CleanupPlaybackResources();
|
||||
return false;
|
||||
}
|
||||
|
@ -63,7 +55,6 @@ public sealed class AudioPlayer : IAudioPlayer, IDisposable
|
|||
while (!cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
var sourceState = (ALSourceState)AL.GetSource(_currentSourceId.Value, ALGetSourcei.SourceState);
|
||||
Console.WriteLine($"source state: {sourceState}");
|
||||
if (sourceState == ALSourceState.Stopped)
|
||||
break;
|
||||
if (State != PlaybackState.Paused)
|
||||
|
@ -73,8 +64,6 @@ public sealed class AudioPlayer : IAudioPlayer, IDisposable
|
|||
((double)(_audioFile.Data.Length - (_audioFile.Data.Length - bytesPlayed)) / 2) / _audioFile.Frequency
|
||||
);
|
||||
|
||||
Console.WriteLine($"Progress: {currentPosition.TotalSeconds:F2}s / {_audioFile.Duration.TotalSeconds:F2}s");
|
||||
|
||||
OnProgressUpdated?.Invoke(this, new()
|
||||
{
|
||||
CurrentPosition = currentPosition,
|
||||
|
@ -86,15 +75,14 @@ public sealed class AudioPlayer : IAudioPlayer, IDisposable
|
|||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
Console.WriteLine("Playback cancelled");
|
||||
//An operation cancelled here is expected behavior.
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
Console.WriteLine($"Monitor error: {ex}");
|
||||
//There is little to be done if we get any other exception during monitoring. Finish up playback monitoring.
|
||||
}
|
||||
finally
|
||||
{
|
||||
Console.WriteLine("Monitor task ending");
|
||||
OnProgressUpdated?.Invoke(this, new()
|
||||
{
|
||||
CurrentPosition = _audioFile.Duration,
|
||||
|
@ -108,9 +96,9 @@ public sealed class AudioPlayer : IAudioPlayer, IDisposable
|
|||
{
|
||||
lock (_lock)
|
||||
{
|
||||
//If we try and start/resume playback without a proper source id or audio file, we can't go on.
|
||||
if (_currentSourceId == null || _audioFile == null)
|
||||
{
|
||||
Console.WriteLine("Cannot start - no source or audio file");
|
||||
return Task.FromResult(false);
|
||||
}
|
||||
|
||||
|
@ -137,16 +125,13 @@ public sealed class AudioPlayer : IAudioPlayer, IDisposable
|
|||
State = PlaybackState.Playing;
|
||||
OnPlaybackStarted?.Invoke(this, new PlaybackStartedEventArgs { AudioFile = _audioFile });
|
||||
|
||||
Console.WriteLine($"Rewind");
|
||||
AL.SourceRewind(_currentSourceId.Value);
|
||||
Console.WriteLine($"Play");
|
||||
AL.SourcePlay(_currentSourceId.Value);
|
||||
_playbackTask = Task.Run(() => MonitorPlaybackAsync(_playbackCts.Token));
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
Console.WriteLine($"Start error: {ex}");
|
||||
return Task.FromResult(false);
|
||||
}
|
||||
}
|
||||
|
@ -177,7 +162,6 @@ public sealed class AudioPlayer : IAudioPlayer, IDisposable
|
|||
|
||||
public void Stop()
|
||||
{
|
||||
Console.WriteLine($"STOP called");
|
||||
lock (_lock)
|
||||
{
|
||||
_playbackCts?.Cancel();
|
||||
|
@ -190,6 +174,7 @@ public sealed class AudioPlayer : IAudioPlayer, IDisposable
|
|||
_playbackCts?.Cancel();
|
||||
State = PlaybackState.Stopped;
|
||||
}
|
||||
if(_audioFile is not null)
|
||||
OnPlaybackStopped?.Invoke(this, new() { AudioFile = _audioFile });
|
||||
}
|
||||
|
||||
|
@ -209,9 +194,9 @@ public sealed class AudioPlayer : IAudioPlayer, IDisposable
|
|||
_currentBufferId = null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
Console.WriteLine($"Error during cleanup: {ex}");
|
||||
//Things might be pretty broken at this point if this exception pops.
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
|
|
@ -1,27 +1,21 @@
|
|||
using Plpext.Core.Interfaces;
|
||||
using Plpext.Core.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Plpext.Core.FileStorage
|
||||
{
|
||||
namespace Plpext.Core.FileStorage;
|
||||
|
||||
public class DiskFileStorage : IFileStorage
|
||||
{
|
||||
public async Task SaveFilesAsync(IEnumerable<MP3File> files, string targetPath)
|
||||
{
|
||||
HashSet<string> names = new HashSet<string>();
|
||||
HashSet<string> names = [];
|
||||
try
|
||||
{
|
||||
if (!Directory.Exists(targetPath))
|
||||
Directory.CreateDirectory(targetPath);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (Exception)
|
||||
{
|
||||
Debug.WriteLine(e);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -32,7 +26,10 @@ namespace Plpext.Core.FileStorage
|
|||
{
|
||||
await File.Create(Path.Combine(targetPath, $"{finalFileName}.mp3")).WriteAsync(file.Data);
|
||||
}
|
||||
catch (Exception e) { Debug.WriteLine(e); }
|
||||
catch (Exception)
|
||||
{
|
||||
//We can proceed with the next ones.
|
||||
}
|
||||
}
|
||||
}
|
||||
private static string TryAddName(HashSet<string> names, string newName)
|
||||
|
@ -42,4 +39,3 @@ namespace Plpext.Core.FileStorage
|
|||
return newName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
using Plpext.Core.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Plpext.Core.Interfaces;
|
||||
public interface IAudioConverter
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
using Plpext.Core.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Plpext.Core.Interfaces;
|
||||
|
||||
|
|
|
@ -1,14 +1,8 @@
|
|||
using Plpext.Core.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Plpext.Core.Interfaces
|
||||
{
|
||||
namespace Plpext.Core.Interfaces;
|
||||
|
||||
public interface IFileStorage
|
||||
{
|
||||
Task SaveFilesAsync(IEnumerable<MP3File> files, string targetPath);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,8 @@
|
|||
using Plpext.Core.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Plpext.Core.Interfaces
|
||||
{
|
||||
namespace Plpext.Core.Interfaces;
|
||||
|
||||
public interface IMP3Parser
|
||||
{
|
||||
Task<MP3File> ParseIntoMP3(ReadOnlyMemory<byte> data, CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Plpext.Core.Interfaces;
|
||||
namespace Plpext.Core.Interfaces;
|
||||
|
||||
public interface IPackExtractor
|
||||
{
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
using MP3Sharp;
|
||||
using Plpext.Core.Interfaces;
|
||||
using Plpext.Core.Interfaces;
|
||||
using Plpext.Core.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Plpext.Core.MP3Parser
|
||||
{
|
||||
namespace Plpext.Core.MP3Parser;
|
||||
|
||||
public class MP3Parser : IMP3Parser
|
||||
{
|
||||
public Task<MP3File> ParseIntoMP3(ReadOnlyMemory<byte> data, CancellationToken cancellationToken)
|
||||
|
@ -18,4 +13,3 @@ namespace Plpext.Core.MP3Parser
|
|||
return Task.FromResult(new MP3File() { Name = fileName, Data = fileData });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace Plpext.Core.Models;
|
||||
|
||||
namespace Plpext.Core.Models
|
||||
{
|
||||
public record AudioFile
|
||||
{
|
||||
public required string Name { get; init; }
|
||||
|
@ -15,4 +9,3 @@ namespace Plpext.Core.Models
|
|||
public AudioFormat Format { get; init; }
|
||||
public int Frequency { get; init; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Plpext.Core.Models;
|
||||
namespace Plpext.Core.Models;
|
||||
|
||||
public enum AudioFormat
|
||||
{
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Plpext.Core.Models;
|
||||
namespace Plpext.Core.Models;
|
||||
|
||||
public class PlaybackStoppedEventArgs : EventArgs
|
||||
{
|
||||
public AudioFile AudioFile { get; init; }
|
||||
public required AudioFile AudioFile { get; init; }
|
||||
}
|
||||
|
||||
public class PlaybackStartedEventArgs : EventArgs
|
||||
{
|
||||
public AudioFile AudioFile { get; init; }
|
||||
public required AudioFile AudioFile { get; init; }
|
||||
}
|
||||
|
|
|
@ -1,14 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace Plpext.Core.Models;
|
||||
|
||||
namespace Plpext.Core.Models
|
||||
{
|
||||
public record MP3File
|
||||
{
|
||||
public required string Name { get; init; }
|
||||
public ReadOnlyMemory<byte> Data { get; init; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,8 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace Plpext.Core.Models;
|
||||
|
||||
namespace Plpext.Core.Models
|
||||
{
|
||||
public record PlaybackProgress
|
||||
{
|
||||
public TimeSpan CurrentPosition { get; init; }
|
||||
public TimeSpan TotalDuration { get; init; }
|
||||
public double ProgressPercentage => TotalDuration.TotalSeconds > 0 ? (CurrentPosition.TotalSeconds / TotalDuration.TotalSeconds) * 100 : 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
using Plpext.Core.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Plpext.Core.PackExtractor
|
||||
{
|
||||
|
@ -12,8 +7,6 @@ namespace Plpext.Core.PackExtractor
|
|||
{
|
||||
private static readonly byte[] filePattern = { 0x53, 0x4E, 0x44, 0x55, 0x00 };
|
||||
public async Task<IEnumerable<ReadOnlyMemory<byte>>> GetFileListAsync(string filePath, CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
ReadOnlyMemory<byte> file = await File.ReadAllBytesAsync(filePath, cancellationToken);
|
||||
var fileIndexes = FindFileIndexes(file.Span);
|
||||
|
@ -26,12 +19,6 @@ namespace Plpext.Core.PackExtractor
|
|||
}
|
||||
return result;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Debug.WriteLine(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private static List<int> FindFileIndexes(ReadOnlySpan<byte> file)
|
||||
{
|
||||
|
@ -54,8 +41,10 @@ namespace Plpext.Core.PackExtractor
|
|||
idx += filePattern.Length;
|
||||
}
|
||||
else
|
||||
{
|
||||
idx += skipTable[file[idx + j]];
|
||||
}
|
||||
}
|
||||
result.Add(file.Length - 1);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
<Application
|
||||
x:Class="Plpext.UI.App"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
RequestedThemeVariant="Dark">
|
||||
|
||||
<Application.Resources>
|
||||
|
|
|
@ -2,16 +2,8 @@
|
|||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:Plpext.UI"
|
||||
xmlns:vm="clr-namespace:Plpext.UI.ViewModels"
|
||||
xmlns:cv="clr-namespace:Plpext.UI.Controls.Converters">
|
||||
|
||||
<!--
|
||||
Additional resources
|
||||
Using Control Themes:
|
||||
https://docs.avaloniaui.net/docs/basics/user-interface/styling/control-themes
|
||||
Using Theme Variants:
|
||||
https://docs.avaloniaui.net/docs/guides/styles-and-resources/how-to-use-theme-variants
|
||||
-->
|
||||
xmlns:cv="clr-namespace:Plpext.UI.Controls.Converters"
|
||||
xmlns:vm="clr-namespace:Plpext.UI.ViewModels">
|
||||
|
||||
<Design.PreviewWith>
|
||||
<Border Padding="10" Background="Brown">
|
||||
|
@ -26,50 +18,79 @@
|
|||
</Border>
|
||||
</Design.PreviewWith>
|
||||
|
||||
<ControlTheme x:Key="{x:Type controls:AudioPlayerControl}" TargetType="controls:AudioPlayerControl"
|
||||
x:DataType="vm:AudioPlayerViewModel">
|
||||
<ControlTheme
|
||||
x:Key="{x:Type controls:AudioPlayerControl}"
|
||||
x:DataType="vm:AudioPlayerViewModel"
|
||||
TargetType="controls:AudioPlayerControl">
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<Grid Name="ButtonGrid" ColumnDefinitions="*,*, Auto">
|
||||
<Grid.Transitions>
|
||||
<Transitions>
|
||||
<ThicknessTransition Property="Margin" Duration="0:0:0.3" Easing="SineEaseInOut"/>
|
||||
<ThicknessTransition
|
||||
Easing="SineEaseInOut"
|
||||
Property="Margin"
|
||||
Duration="0:0:0.3" />
|
||||
</Transitions>
|
||||
</Grid.Transitions>
|
||||
<Button Name="PlayButton" Grid.Column="0" IsEnabled="{TemplateBinding IsEnabled}"
|
||||
HorizontalAlignment="Center" Width="32" Height="32"
|
||||
Padding="6 6 6 6"
|
||||
<Button
|
||||
Name="PlayButton"
|
||||
Grid.Column="0"
|
||||
Width="32"
|
||||
Height="32"
|
||||
Padding="6,6,6,6"
|
||||
HorizontalAlignment="Center"
|
||||
Command="{TemplateBinding PlayCommand}"
|
||||
CommandParameter="{TemplateBinding PlayCommandParameter}"
|
||||
CornerRadius="12"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
CommandParameter="{TemplateBinding PlayCommandParameter}" Command="{TemplateBinding PlayCommand}">
|
||||
IsEnabled="{TemplateBinding IsEnabled}">
|
||||
<Path Fill="{Binding $parent[Button].Foreground}">
|
||||
<Path.Data>
|
||||
<Binding Path="PlaybackState"
|
||||
RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Converter="{x:Static cv:PlaybackStateToPathConverter.Instance}"/>
|
||||
<Binding
|
||||
Converter="{x:Static cv:PlaybackStateToPathConverter.Instance}"
|
||||
Path="PlaybackState"
|
||||
RelativeSource="{RelativeSource TemplatedParent}" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
</Button>
|
||||
<Button Name="StopButton" Grid.Column="1" IsEnabled="{TemplateBinding IsEnabled}" IsVisible="{TemplateBinding IsPlaying}"
|
||||
HorizontalAlignment="Center" Width="32" Height="32"
|
||||
Padding="6 6 6 6"
|
||||
<Button
|
||||
Name="StopButton"
|
||||
Grid.Column="1"
|
||||
Width="32"
|
||||
Height="32"
|
||||
Padding="6,6,6,6"
|
||||
HorizontalAlignment="Center"
|
||||
Command="{TemplateBinding StopCommand}"
|
||||
CommandParameter="{TemplateBinding StopCommandParameter}"
|
||||
CornerRadius="12"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
CommandParameter="{TemplateBinding StopCommandParameter}" Command="{TemplateBinding StopCommand}">
|
||||
IsEnabled="{TemplateBinding IsEnabled}"
|
||||
IsVisible="{TemplateBinding IsPlaying}">
|
||||
<Path Data="M2,2 H14 V14 H2 Z" Fill="{Binding $parent[Button].Foreground}" />
|
||||
</Button>
|
||||
<StackPanel Grid.Column="2" Name="ProgressPanel" Orientation="Vertical">
|
||||
<StackPanel
|
||||
Name="ProgressPanel"
|
||||
Grid.Column="2"
|
||||
Orientation="Vertical">
|
||||
<StackPanel.Transitions>
|
||||
<Transitions>
|
||||
<DoubleTransition Property="Width" Duration="0:0:0.3" Easing="SineEaseInOut"/>
|
||||
<DoubleTransition
|
||||
Easing="SineEaseInOut"
|
||||
Property="Width"
|
||||
Duration="0:0:0.3" />
|
||||
<DoubleTransition Property="Opacity" Duration="0:0:0.3" />
|
||||
</Transitions>
|
||||
</StackPanel.Transitions>
|
||||
<ProgressBar Name="ProgressPanelBar" Value="{TemplateBinding Progress}" HorizontalAlignment="Left" CornerRadius="2"/>
|
||||
<ProgressBar
|
||||
Name="ProgressPanelBar"
|
||||
HorizontalAlignment="Left"
|
||||
CornerRadius="2"
|
||||
Value="{TemplateBinding Progress}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label FontSize="{TemplateBinding FontSize}" Content="{TemplateBinding CurrentDuration}"/>
|
||||
<Label FontSize="{TemplateBinding FontSize}" Content="/"/>
|
||||
<Label FontSize="{TemplateBinding FontSize}" Content="{TemplateBinding TotalDuration}"/>
|
||||
<Label Content="{TemplateBinding CurrentDuration}" FontSize="{TemplateBinding FontSize}" />
|
||||
<Label Content="/" FontSize="{TemplateBinding FontSize}" />
|
||||
<Label Content="{TemplateBinding TotalDuration}" FontSize="{TemplateBinding FontSize}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
|
|
@ -7,10 +7,6 @@ using Plpext.Core.PackExtractor;
|
|||
using Plpext.UI.ViewModels;
|
||||
using Serilog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Plpext.Core.AudioConverter;
|
||||
using Plpext.Core.AudioPlayer;
|
||||
using Plpext.UI.Services;
|
||||
|
@ -19,8 +15,8 @@ using Plpext.UI.Services.FileLoader;
|
|||
using Plpext.UI.Services.PlatformStorage;
|
||||
using Plpext.UI.Views;
|
||||
|
||||
namespace Plpext.UI.DependencyInjection
|
||||
{
|
||||
namespace Plpext.UI.DependencyInjection;
|
||||
|
||||
public static class Container
|
||||
{
|
||||
private static IServiceProvider? _container;
|
||||
|
@ -42,8 +38,6 @@ namespace Plpext.UI.DependencyInjection
|
|||
services.AddSingleton<MainWindow>();
|
||||
services.AddSingleton<MainWindowViewModel>();
|
||||
|
||||
services.AddTransient<AudioPlayerViewModel>();
|
||||
|
||||
services.AddSingleton<AudioContext>();
|
||||
services.AddScoped<IAudioPlayer, AudioPlayer>();
|
||||
services.AddSingleton<IAudioConverter, MP3AudioConverter>();
|
||||
|
@ -60,4 +54,3 @@ namespace Plpext.UI.DependencyInjection
|
|||
return _container;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,10 +12,16 @@
|
|||
<PublishReadyToRun>true</PublishReadyToRun>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
|
||||
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\" />
|
||||
<AvaloniaResource Include="Assets\**" />
|
||||
<AvaloniaResource Remove="ViewModels\Mocks\**" />
|
||||
</ItemGroup>
|
||||
|
@ -45,15 +51,21 @@
|
|||
|
||||
<ItemGroup>
|
||||
<Compile Remove="ViewModels\Mocks\MockAudioPlayerViewModel.cs" />
|
||||
<Compile Remove="publish\**" />
|
||||
<Compile Remove="Releases\**" />
|
||||
<Compile Remove="ViewModels\Mocks\**" />
|
||||
<Compile Remove="ViewLocator.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AvaloniaXaml Remove="publish\**" />
|
||||
<AvaloniaXaml Remove="Releases\**" />
|
||||
<AvaloniaXaml Remove="ViewModels\Mocks\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Remove="publish\**" />
|
||||
<EmbeddedResource Remove="Releases\**" />
|
||||
<EmbeddedResource Remove="ViewModels\Mocks\**" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -62,13 +74,15 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="publish\**" />
|
||||
<None Remove="Releases\**" />
|
||||
<None Remove="ViewModels\Mocks\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<ItemGroup Condition="'$(RuntimeIdentifier)' == 'win-x86'">
|
||||
<OpenAL32Dll Include="$(MSBuildProjectDirectory)\..\..\..\deps\win\x86\OpenAL32.dll" Condition="'$(RuntimeIdentifier)' == 'win-x86'" />
|
||||
<OpenAL32Dll Include="$(MSBuildProjectDirectory)\..\..\..\deps\win\x64\OpenAL32.dll" Condition="'$(RuntimeIdentifier)' == 'win-x64'" />
|
||||
<ItemGroup>
|
||||
<OpenAL32Dll Include="$(MSBuildProjectDirectory)\..\..\..\deps\win\x86\OpenAL32.dll" Condition="'$(RuntimeIdentifier)' == 'win-x86' or '$(PlatformTarget)' == 'x86'" />
|
||||
<OpenAL32Dll Include="$(MSBuildProjectDirectory)\..\..\..\deps\win\x64\OpenAL32.dll" Condition="'$(RuntimeIdentifier)' == 'win-x64' or '$(PlatformTarget)' == 'x64'" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(OpenAL32Dll)" DestinationFiles="$(OutputPath)\OpenAL32.dll" />
|
||||
</Target>
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
using Avalonia;
|
||||
using Velopack;
|
||||
|
||||
namespace Plpext.UI
|
||||
{
|
||||
namespace Plpext.UI;
|
||||
|
||||
internal sealed class Program
|
||||
{
|
||||
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
||||
|
@ -23,4 +23,3 @@ namespace Plpext.UI
|
|||
.WithInterFont()
|
||||
.LogToTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ using System.Linq;
|
|||
using System.Threading.Tasks;
|
||||
using Plpext.Core.AudioPlayer;
|
||||
using Plpext.Core.Interfaces;
|
||||
using Plpext.Core.Models;
|
||||
using Plpext.UI.ViewModels;
|
||||
|
||||
namespace Plpext.UI.Services.FileLoader;
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Platform.Storage;
|
||||
|
||||
|
|
|
@ -1,22 +1,29 @@
|
|||
<Styles xmlns="https://github.com/avaloniaui"
|
||||
<Styles
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:c="clr-namespace:Plpext.UI"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:vm="clr-namespace:Plpext.UI.ViewModels">
|
||||
<Design.PreviewWith>
|
||||
<Border Padding="20" Background="RoyalBlue" BorderBrush="Black" BorderThickness="1">
|
||||
<Border
|
||||
Padding="20"
|
||||
Background="RoyalBlue"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1">
|
||||
<StackPanel>
|
||||
<Border Background="Navy" BorderBrush="White" BorderThickness="1">
|
||||
<Border
|
||||
Background="Navy"
|
||||
BorderBrush="White"
|
||||
BorderThickness="1">
|
||||
<c:AudioPlayerControl
|
||||
x:DataType="vm:AudioPlayerViewModel"
|
||||
CurrentDuration="0:15"
|
||||
IsPlaying="{Binding IsPlaying}"
|
||||
PlayCommand="{Binding PlayCommand}"
|
||||
StopCommand="{Binding StopCommand}"
|
||||
PlaybackState="{Binding PlaybackState}"
|
||||
TotalDuration="0:22"
|
||||
CurrentDuration="0:15"
|
||||
Progress="44.8"
|
||||
>
|
||||
StopCommand="{Binding StopCommand}"
|
||||
TotalDuration="0:22">
|
||||
<c:AudioPlayerControl.DataContext>
|
||||
<vm:AudioPlayerViewModel />
|
||||
</c:AudioPlayerControl.DataContext>
|
||||
|
@ -24,12 +31,11 @@
|
|||
</Border>
|
||||
<c:AudioPlayerControl
|
||||
x:DataType="vm:AudioPlayerViewModel"
|
||||
CurrentDuration="15"
|
||||
IsPlaying="True"
|
||||
PlayCommand="{Binding PlayCommand}"
|
||||
TotalDuration="22"
|
||||
CurrentDuration="15"
|
||||
Progress="44.8"
|
||||
>
|
||||
TotalDuration="22">
|
||||
<c:AudioPlayerControl.DataContext>
|
||||
<vm:AudioPlayerViewModel />
|
||||
</c:AudioPlayerControl.DataContext>
|
||||
|
@ -41,8 +47,8 @@
|
|||
<Style Selector="c|AudioPlayerControl">
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="Margin" Value="0,0,0,0" />
|
||||
<Setter Property="Width" Value="176"></Setter>
|
||||
<Setter Property="Height" Value="36"></Setter>
|
||||
<Setter Property="Width" Value="176" />
|
||||
<Setter Property="Height" Value="36" />
|
||||
</Style>
|
||||
<Style Selector="c|AudioPlayerControl Button">
|
||||
<Setter Property="Foreground" Value="{StaticResource SecondaryLightest}" />
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<Styles xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Design.PreviewWith>
|
||||
<Border Padding="20">
|
||||
<!-- Add Controls for Previewer Here -->
|
||||
<Border
|
||||
Width="100"
|
||||
Height="100"
|
||||
Classes="Section" />
|
||||
</Border>
|
||||
</Design.PreviewWith>
|
||||
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
<Styles xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Design.PreviewWith>
|
||||
<Border Padding="20">
|
||||
<StackPanel>
|
||||
<Button Classes="Primary" Content="Primary Button" />
|
||||
<Button IsEnabled="False" Classes="Primary" Content="Primary Button" />
|
||||
</StackPanel> <!-- Add Controls for Previewer Here -->
|
||||
<Button
|
||||
Classes="Primary"
|
||||
Content="Primary Button"
|
||||
IsEnabled="False" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Design.PreviewWith>
|
||||
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
<Styles xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Design.PreviewWith>
|
||||
<Border Padding="20">
|
||||
<!-- Add Controls for Previewer Here -->
|
||||
<TextBox Classes="Primary"></TextBox>
|
||||
<TextBox Classes="Primary" />
|
||||
</Border>
|
||||
</Design.PreviewWith>
|
||||
|
||||
<Style Selector="TextBox.Primary">
|
||||
<Setter Property="Height" Value="32" />
|
||||
|
||||
</Style>
|
||||
|
||||
</Styles>
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
</Design.PreviewWith>
|
||||
|
||||
<Style Selector="Window">
|
||||
<Setter Property="Background" Value="{StaticResource PrimaryBackground}"></Setter>
|
||||
<Setter Property="Background" Value="{StaticResource PrimaryBackground}"/>
|
||||
<Setter Property="CanResize" Value="False"/>
|
||||
<Setter Property="Width" Value="800"/>
|
||||
<Setter Property="Height" Value="450"/>
|
||||
</Style>
|
||||
</Styles>
|
||||
|
|
|
@ -2,15 +2,11 @@
|
|||
using Plpext.Core.AudioPlayer;
|
||||
using Plpext.Core.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
namespace Plpext.UI.ViewModels
|
||||
{
|
||||
namespace Plpext.UI.ViewModels;
|
||||
|
||||
public partial class AudioPlayerViewModel : ViewModelBase, IDisposable
|
||||
{
|
||||
private readonly AudioPlayer _audioPlayer = null!;
|
||||
|
@ -65,10 +61,12 @@ namespace Plpext.UI.ViewModels
|
|||
[ObservableProperty]
|
||||
private string _name = null!;
|
||||
|
||||
[ObservableProperty] private PlaybackState _playbackState = PlaybackState.Stopped;
|
||||
[ObservableProperty]
|
||||
private PlaybackState _playbackState = PlaybackState.Stopped;
|
||||
|
||||
[ObservableProperty]
|
||||
private double _progress;
|
||||
private bool disposedValue;
|
||||
|
||||
[RelayCommand]
|
||||
private async Task Play()
|
||||
|
@ -109,12 +107,24 @@ namespace Plpext.UI.ViewModels
|
|||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
|
||||
public void Dispose()
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!disposedValue)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_audioPlayer.OnPlaybackStopped -= OnPlaybackStopped;
|
||||
_audioPlayer.OnProgressUpdated -= OnProgressUpdated;
|
||||
_audioPlayer.Dispose();
|
||||
|
||||
}
|
||||
disposedValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(disposing: true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
|
@ -18,7 +18,9 @@ public partial class MainWindowViewModel : ViewModelBase
|
|||
{
|
||||
}
|
||||
|
||||
public MainWindowViewModel(IPlatformStorageService platformStorageService, IFileLoaderService fileLoaderService,
|
||||
public MainWindowViewModel(
|
||||
IPlatformStorageService platformStorageService,
|
||||
IFileLoaderService fileLoaderService,
|
||||
IConvertService convertService)
|
||||
{
|
||||
_fileLoaderService = fileLoaderService;
|
||||
|
@ -26,30 +28,43 @@ public partial class MainWindowViewModel : ViewModelBase
|
|||
_convertService = convertService;
|
||||
}
|
||||
|
||||
[ObservableProperty] [NotifyCanExecuteChangedFor(nameof(LoadFileCommand))]
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(LoadFileCommand))]
|
||||
private string _originPath = null!;
|
||||
|
||||
[ObservableProperty] [NotifyCanExecuteChangedFor(nameof(ConvertAllFilesCommand),nameof(ConvertSelectedFilesCommand))]
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(ConvertAllFilesCommand), nameof(ConvertSelectedFilesCommand))]
|
||||
private string _targetPath = null!;
|
||||
|
||||
[ObservableProperty] private int _totalFilesToExtract;
|
||||
[ObservableProperty]
|
||||
private int _totalFilesToExtract;
|
||||
|
||||
[ObservableProperty] private int _filesReady;
|
||||
[ObservableProperty]
|
||||
private int _filesReady;
|
||||
|
||||
[ObservableProperty] private string _progressBarText = null!;
|
||||
[ObservableProperty]
|
||||
private string _progressBarText = null!;
|
||||
|
||||
[ObservableProperty] private double _progressBarValue;
|
||||
[ObservableProperty]
|
||||
private double _progressBarValue;
|
||||
|
||||
[ObservableProperty] private bool _isProgressBarIndeterminate;
|
||||
[ObservableProperty]
|
||||
private bool _isProgressBarIndeterminate;
|
||||
|
||||
[ObservableProperty] private string _progressBarDetails = null!;
|
||||
[ObservableProperty]
|
||||
private string _progressBarDetails = null!;
|
||||
|
||||
[ObservableProperty] [NotifyCanExecuteChangedFor(nameof(ConvertAllFilesCommand), nameof(ConvertSelectedFilesCommand), nameof(LoadFileCommand))]
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(ConvertAllFilesCommand), nameof(ConvertSelectedFilesCommand), nameof(LoadFileCommand))]
|
||||
private bool _showProgressBar;
|
||||
|
||||
[ObservableProperty] [NotifyCanExecuteChangedFor(nameof(ConvertAllFilesCommand),nameof(ConvertSelectedFilesCommand))]
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(ConvertAllFilesCommand), nameof(ConvertSelectedFilesCommand))]
|
||||
private ObservableCollection<AudioPlayerViewModel> _audioFiles = new();
|
||||
|
||||
private bool CanLoadFile() => !string.IsNullOrEmpty(OriginPath) && !ShowProgressBar;
|
||||
private bool CanConvertAllFiles() => !string.IsNullOrEmpty(TargetPath) && AudioFiles.Any() && !ShowProgressBar;
|
||||
private bool CanConvertSelectFiles() => CanConvertAllFiles();
|
||||
|
||||
[RelayCommand(CanExecute = nameof(CanLoadFile))]
|
||||
private async Task LoadFile()
|
||||
|
@ -79,9 +94,6 @@ public partial class MainWindowViewModel : ViewModelBase
|
|||
await Dispatcher.UIThread.InvokeAsync(() => ShowProgressBar = false);
|
||||
}
|
||||
|
||||
private bool CanLoadFile() => !string.IsNullOrEmpty(OriginPath) && !ShowProgressBar;
|
||||
|
||||
|
||||
[RelayCommand]
|
||||
private async Task SelectOriginPath()
|
||||
{
|
||||
|
@ -108,10 +120,6 @@ public partial class MainWindowViewModel : ViewModelBase
|
|||
await Dispatcher.UIThread.InvokeAsync(() => ShowProgressBar = false);
|
||||
}
|
||||
|
||||
private bool CanConvertAllFiles() => !string.IsNullOrEmpty(TargetPath) && AudioFiles.Any() && !ShowProgressBar;
|
||||
private bool CanConvertSelectFiles() => CanConvertAllFiles();
|
||||
|
||||
|
||||
[RelayCommand(CanExecute = nameof(CanConvertSelectFiles))]
|
||||
private async Task ConvertSelectedFiles()
|
||||
{
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace Plpext.UI.ViewModels
|
||||
{
|
||||
namespace Plpext.UI.ViewModels;
|
||||
|
||||
public class ViewModelBase : ObservableObject
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
Title="Plpext"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
Width="800"
|
||||
Height="450"
|
||||
x:DataType="vm:MainWindowViewModel"
|
||||
Icon="/Assets/plpext.png"
|
||||
mc:Ignorable="d">
|
||||
|
@ -24,10 +22,6 @@
|
|||
</Window.Styles>
|
||||
|
||||
<Design.DataContext>
|
||||
<!--
|
||||
This only sets the DataContext for the previewer in an IDE,
|
||||
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs)
|
||||
-->
|
||||
<vm:MainWindowViewModel />
|
||||
</Design.DataContext>
|
||||
|
||||
|
@ -35,8 +29,10 @@
|
|||
Margin="16,8,16,8"
|
||||
ColumnDefinitions="300,32,*"
|
||||
RowDefinitions="Auto,Auto,*">
|
||||
<Border Grid.Row="0"
|
||||
Grid.Column="0" Classes="Section">
|
||||
<Border
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Classes="Section">
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid
|
||||
|
@ -44,8 +40,9 @@
|
|||
ColumnDefinitions="*"
|
||||
RowDefinitions="*, Auto, Auto">
|
||||
<Label Grid.Row="0" Content="Select your .plp pack file:" />
|
||||
<StackPanel Height="36"
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Height="36"
|
||||
Orientation="Horizontal"
|
||||
Spacing="2">
|
||||
<TextBox
|
||||
|
@ -59,10 +56,10 @@
|
|||
</Button>
|
||||
</StackPanel>
|
||||
<Button
|
||||
Height="38"
|
||||
Grid.Row="2"
|
||||
Height="38"
|
||||
Margin="0,4,0,0"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0 4 0 0"
|
||||
Classes="Primary"
|
||||
Command="{Binding LoadFileCommand}">
|
||||
<TextBlock VerticalAlignment="Center">Load</TextBlock>
|
||||
|
@ -78,10 +75,10 @@
|
|||
Grid.ColumnSpan="2"
|
||||
Content="Select output folder:" />
|
||||
<StackPanel
|
||||
Height="36"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Height="36"
|
||||
Orientation="Horizontal"
|
||||
Spacing="2">
|
||||
<TextBox
|
||||
|
@ -94,19 +91,19 @@
|
|||
</Button>
|
||||
</StackPanel>
|
||||
<Button
|
||||
HorizontalAlignment="Left"
|
||||
Height="38"
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Height="38"
|
||||
HorizontalAlignment="Left"
|
||||
Classes="Primary"
|
||||
Command="{Binding ConvertAllFilesCommand}">
|
||||
<TextBlock VerticalAlignment="Center">Extract All</TextBlock>
|
||||
</Button>
|
||||
<Button
|
||||
Height="38"
|
||||
HorizontalAlignment="Right"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Height="38"
|
||||
HorizontalAlignment="Right"
|
||||
Classes="Primary"
|
||||
Command="{Binding ConvertSelectedFilesCommand}">
|
||||
<TextBlock VerticalAlignment="Center">Extract Selected</TextBlock>
|
||||
|
@ -117,12 +114,21 @@
|
|||
|
||||
</Border>
|
||||
<Grid Grid.Row="2" Grid.Column="0">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" Height="60" IsVisible="{Binding ShowProgressBar}">
|
||||
<StackPanel
|
||||
Height="60"
|
||||
VerticalAlignment="Center"
|
||||
IsVisible="{Binding ShowProgressBar}"
|
||||
Orientation="Vertical">
|
||||
<Label Content="{Binding ProgressBarText}" />
|
||||
<Border Classes="Section">
|
||||
<ProgressBar Width="298" Orientation="Horizontal" Height="50" IsIndeterminate="{Binding IsProgressBarIndeterminate}" Value="{Binding ProgressBarValue}" />
|
||||
<ProgressBar
|
||||
Width="298"
|
||||
Height="50"
|
||||
IsIndeterminate="{Binding IsProgressBarIndeterminate}"
|
||||
Orientation="Horizontal"
|
||||
Value="{Binding ProgressBarValue}" />
|
||||
</Border>
|
||||
<Label Content="{Binding ProgressBarDetails}" HorizontalAlignment="Right"/>
|
||||
<Label HorizontalAlignment="Right" Content="{Binding ProgressBarDetails}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
|
@ -136,23 +142,24 @@
|
|||
</StackPanel>
|
||||
<DataGrid
|
||||
MaxHeight="410"
|
||||
CanUserSortColumns="False"
|
||||
CanUserResizeColumns="False"
|
||||
CanUserReorderColumns="False"
|
||||
AreRowDetailsFrozen="True"
|
||||
HeadersVisibility="None"
|
||||
AutoGenerateColumns="False"
|
||||
VerticalScrollBarVisibility="Visible"
|
||||
CanUserReorderColumns="False"
|
||||
CanUserResizeColumns="False"
|
||||
CanUserSortColumns="False"
|
||||
HeadersVisibility="None"
|
||||
IsReadOnly="False"
|
||||
ItemsSource="{Binding AudioFiles}"
|
||||
SelectionMode="Extended"
|
||||
ItemsSource="{Binding AudioFiles}">
|
||||
VerticalScrollBarVisibility="Visible">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Width="36">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox IsChecked="{Binding IsSelected, Mode=TwoWay}"
|
||||
<CheckBox
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
VerticalAlignment="Center"
|
||||
IsChecked="{Binding IsSelected, Mode=TwoWay}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
@ -167,14 +174,14 @@
|
|||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="vm:AudioPlayerViewModel">
|
||||
<c:AudioPlayerControl
|
||||
Margin="0 0 16 0"
|
||||
Margin="0,0,16,0"
|
||||
CurrentDuration="{Binding CurrentDuration}"
|
||||
TotalDuration="{Binding TotalDuration}"
|
||||
PlayCommand="{Binding PlayCommand}"
|
||||
StopCommand="{Binding StopCommand}"
|
||||
IsPlaying="{Binding IsPlaying}"
|
||||
PlayCommand="{Binding PlayCommand}"
|
||||
PlaybackState="{Binding PlaybackState}"
|
||||
Progress="{Binding Progress}" />
|
||||
Progress="{Binding Progress}"
|
||||
StopCommand="{Binding StopCommand}"
|
||||
TotalDuration="{Binding TotalDuration}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"version": "1.0.0",
|
||||
"executable": "Plpext.exe",
|
||||
"iconFile": "Assets/plpext.png",
|
||||
"splashImage": "Assets/plpext.png"
|
||||
}
|
|
@ -9,34 +9,24 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plpext.Core", "..\Plpext.Co
|
|||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{CEC79B8A-12B4-4649-B859-08051B00FA96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CEC79B8A-12B4-4649-B859-08051B00FA96}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CEC79B8A-12B4-4649-B859-08051B00FA96}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{CEC79B8A-12B4-4649-B859-08051B00FA96}.Debug|x64.Build.0 = Debug|x64
|
||||
{CEC79B8A-12B4-4649-B859-08051B00FA96}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{CEC79B8A-12B4-4649-B859-08051B00FA96}.Debug|x86.Build.0 = Debug|x86
|
||||
{CEC79B8A-12B4-4649-B859-08051B00FA96}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CEC79B8A-12B4-4649-B859-08051B00FA96}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CEC79B8A-12B4-4649-B859-08051B00FA96}.Release|x64.ActiveCfg = Release|x64
|
||||
{CEC79B8A-12B4-4649-B859-08051B00FA96}.Release|x64.Build.0 = Release|x64
|
||||
{CEC79B8A-12B4-4649-B859-08051B00FA96}.Release|x86.ActiveCfg = Release|x86
|
||||
{CEC79B8A-12B4-4649-B859-08051B00FA96}.Release|x86.Build.0 = Release|x86
|
||||
{2A0B3CBC-C79F-4B19-93AE-BCEEE44BDAD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2A0B3CBC-C79F-4B19-93AE-BCEEE44BDAD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2A0B3CBC-C79F-4B19-93AE-BCEEE44BDAD2}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{2A0B3CBC-C79F-4B19-93AE-BCEEE44BDAD2}.Debug|x64.Build.0 = Debug|x64
|
||||
{2A0B3CBC-C79F-4B19-93AE-BCEEE44BDAD2}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{2A0B3CBC-C79F-4B19-93AE-BCEEE44BDAD2}.Debug|x86.Build.0 = Debug|x86
|
||||
{2A0B3CBC-C79F-4B19-93AE-BCEEE44BDAD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2A0B3CBC-C79F-4B19-93AE-BCEEE44BDAD2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2A0B3CBC-C79F-4B19-93AE-BCEEE44BDAD2}.Release|x64.ActiveCfg = Release|x64
|
||||
{2A0B3CBC-C79F-4B19-93AE-BCEEE44BDAD2}.Release|x64.Build.0 = Release|x64
|
||||
{2A0B3CBC-C79F-4B19-93AE-BCEEE44BDAD2}.Release|x86.ActiveCfg = Release|x86
|
||||
|
|
Loading…
Reference in a new issue