Skip to content

Commit

Permalink
2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kingsznhone committed Nov 16, 2023
1 parent e13c14a commit 57b2a15
Show file tree
Hide file tree
Showing 20 changed files with 395 additions and 323 deletions.
Binary file added Demo/dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Demo/light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified NCMDumpCLI/NCMDump.ico
Binary file not shown.
10 changes: 8 additions & 2 deletions NCMDumpCLI/NCMDumpCLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net7.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks>net8.0-windows10.0.19041.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<StartupObject>NCMDumpCLI</StartupObject>
<ApplicationIcon>NCMDump.ico</ApplicationIcon>
<PlatformTarget>x64</PlatformTarget>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Version>1.6.2</Version>
<Version>2.0.0</Version>
<Platforms>x64</Platforms>
</PropertyGroup>



<ItemGroup>
<Content Include="NCMDump.ico" />
</ItemGroup>
Expand All @@ -21,4 +23,8 @@
<ProjectReference Include="..\NCMDumpCore\NCMDumpCore.csproj" />
</ItemGroup>

<ItemGroup>
<Resource Include="ncmdump.png" />
</ItemGroup>

</Project>
5 changes: 3 additions & 2 deletions NCMDumpCLI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ public static void Main(string[] args)

Console.Write("Press Any Key to Exit...");
Console.ReadLine();
return;

async void WalkThrough(DirectoryInfo dir)
void WalkThrough(DirectoryInfo dir)
{
Console.WriteLine("DIR: " + dir.FullName);
foreach (DirectoryInfo d in dir.GetDirectories())
Expand All @@ -50,7 +51,7 @@ async void WalkThrough(DirectoryInfo dir)
foreach (FileInfo f in dir.EnumerateFiles())
{
Console.WriteLine("Converting : " + f.FullName);
if (await Core.ConvertAsync(f.FullName)) Console.WriteLine("...OK");
if (Core.Convert(f.FullName)) Console.WriteLine("...OK");
else Console.WriteLine("...Fail");
Console.WriteLine();
}
Expand Down
Binary file modified NCMDumpCLI/ncmdump.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions NCMDumpCore/MetaInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@ namespace NCMDumpCore
{
public class MetaInfo
{
public int musicId { get; set; }
public string musicId { get; set; }
public string musicName { get; set; }
public List<List<JsonElement>> artist { get; set; }
public int albumId { get; set; }
public string albumId { get; set; }
public string album { get; set; }
public JsonElement albumPicDocId { get; set; }
public string albumPic { get; set; }
public int bitrate { get; set; }
public string mp3DocId { get; set; }
public int duration { get; set; }
public int mvId { get; set; }
public string mvId { get; set; }
public List<string> alias { get; set; }
public List<string> transNames { get; set; }
public string format { get; set; }
public JsonElement fee { get; set; }
public Dictionary<string, int> privilege { get; set; }
}
}
5 changes: 3 additions & 2 deletions NCMDumpCore/NCMDumpCore.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0;</TargetFrameworks>
<TargetFrameworks>net8.0;</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<VersionPrefix>1.6.2</VersionPrefix>
<VersionPrefix>1.7.0</VersionPrefix>
<AssemblyVersion></AssemblyVersion>
<FileVersion></FileVersion>
<Platforms>x64</Platforms>
<OutputType>Library</OutputType>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 0 additions & 4 deletions NCMDumpCore/RC4_NCM.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
namespace NCMDumpCore
{
/// <summary>
/// In Cloud Music. There is a modified RC4 encryptor.
/// Not standard RC4 algorithm.
/// </summary>
public class RC4_NCM
{
private byte[] Keybox;
Expand Down
8 changes: 4 additions & 4 deletions NCMDumpGUI/App.xaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Application x:Class="NCMDumpGUI.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml" />
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml" />
<ui:ThemesDictionary Theme="Dark" />
<ui:ControlsDictionary />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Expand Down
36 changes: 32 additions & 4 deletions NCMDumpGUI/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,39 @@
using System.Windows;
using Microsoft.Extensions.DependencyInjection;
using NCMDumpCore;
using System;
using System.Windows;

namespace NCMDumpGUI
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
private IServiceProvider _serviceProvider;

protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
var services = new ServiceCollection();
ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider();
var mainWindow = _serviceProvider.GetRequiredService<MainWindow>();
mainWindow.Show();
}

private void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<NCMDump>();
services.AddSingleton<MainWindowViewModel>();
services.AddSingleton<MainWindow>();
}

protected override void OnExit(ExitEventArgs e)
{
if (_serviceProvider is IDisposable disposable)
{
disposable.Dispose();
}

base.OnExit(e);
}
}
}
190 changes: 106 additions & 84 deletions NCMDumpGUI/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,108 +1,130 @@
<hc:BlurWindow x:Class="NCMDumpGUI.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
<ui:FluentWindow x:Class="NCMDumpGUI.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
BorderThickness ="0"
Style="{StaticResource WindowBlur}"
Title="NCMDumpGUI"
Height="480" Width="720"
Icon="/NCMDump.png"
MinWidth="720" MinHeight="480"
ResizeMode="CanResize"
WindowStartupLocation="CenterScreen"
AllowDrop="True"
Closed="Window_Closed">
Closed="Window_Closed"
ExtendsContentIntoTitleBar="True"
WindowBackdropType="Acrylic">

<hc:BlurWindow.Resources>
<Style x:Key="customLV" TargetType="{x:Type ListView}" BasedOn="{StaticResource ListViewBaseStyle}">
<Setter Property="hc:GridViewAttach.ColumnHeaderHeight" Value="30" />
<Setter Property="ItemContainerStyle" Value="{DynamicResource CustomItem}" />
</Style>

<Style x:Key="CustomItem" TargetType="ListViewItem">
<Setter Property="Background" Value="{DynamicResource RegionBrush}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}" />
<Setter Property="FontSize" Value="12" />
<Setter Property="SnapsToDevicePixels" Value="true" />
<Setter Property="Padding" Value="6,2" />
<Setter Property="MinHeight" Value="24" />
<Setter Property="Margin" Value="0,0,0,2" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListViewItem">

<Border CornerRadius="4" x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
<GridViewRowPresenter Content="{TemplateBinding Content}" Columns="{TemplateBinding GridView.ColumnCollection}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<ui:FluentWindow.Resources>
<Style x:Key="FileStatusTextStyle" TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding FileStatus}" Value="Await">
<Setter Property="Background" Value="AliceBlue"></Setter>
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
</DataTrigger>
<DataTrigger Binding="{Binding FileStatus}" Value="Success">
<Setter Property="Background" Value="PaleGreen"></Setter>
<Setter Property="Foreground" Value="Green" />
</DataTrigger>
<DataTrigger Binding="{Binding FileStatus}" Value="Failed">
<Setter Property="Background" Value="PaleVioletRed"></Setter>
<Setter Property="Foreground" Value="Red" />
</DataTrigger>

<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" Value="{DynamicResource DarkDefaultBrush}" />
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource TextIconBrush}" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="true" />
<Condition Property="Selector.IsSelectionActive" Value="false" />
</MultiTrigger.Conditions>
<Setter Property="Background" Value="{DynamicResource DarkDefaultBrush}" />
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}" />
</MultiTrigger>
<Trigger Property="GridView.ColumnCollection" Value="{x:Null}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListViewItem">
<Border CornerRadius="4" x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</hc:BlurWindow.Resources>
</ui:FluentWindow.Resources>

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="6*" />
<RowDefinition Height="40" />
<RowDefinition Height="75" />
<RowDefinition Height="32" />
<RowDefinition Height="*" />
<RowDefinition Height="60" />
<RowDefinition Height="60" />
</Grid.RowDefinitions>

<ListView Style="{DynamicResource customLV}" Background="Transparent" x:Name="WorkingList" ItemsSource="{Binding NCMCollection}" Grid.Row="0" SizeChanged="ListView_SizeChanged" AllowDrop="True" Drop="WorkingList_Drop" Margin="20,20,20,20">
<ListView.View>
<GridView>
<GridViewColumn Header="File" DisplayMemberBinding="{Binding FilePath}" />
<GridViewColumn Header="Status" DisplayMemberBinding="{Binding FileStatus}" />
<GridViewColumn Header="Elapsed" DisplayMemberBinding="{Binding Elapsedms}" />
</GridView>
</ListView.View>
</ListView>
<CheckBox x:Name="Check_DeleteNCM" IsChecked="{Binding WillDeleteNCM}" Content="Delete .NCM file when done" HorizontalAlignment="Right" Margin="0,0,20,0" Grid.Row="1" FontSize="14" VerticalAlignment="Stretch" />
<ui:TitleBar
x:Name="TitleBar"
Title="{Binding ApplicationTitle}"
Grid.Row="0">
<ui:TitleBar.Icon>
<ui:ImageIcon Source="pack://application:,,,/ncmdump.png" />
</ui:TitleBar.Icon>
</ui:TitleBar>

<ui:DataGrid x:Name="WorkingList"
ItemsSource="{Binding NCMCollection}"
AutoGenerateColumns="False" Grid.Row="1" Margin="24,24,24,0"
IsSynchronizedWithCurrentItem="True"
IsReadOnly="True"
AllowDrop="True"
SizeChanged="DataGrid_SizeChanged"
Drop="WorkingList_Drop"
Background="#00000000">
<ui:DataGrid.Columns>
<DataGridTemplateColumn>
<DataGridTemplateColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="File Path" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="16,0,0,0" />
</DataTemplate>
</DataGridTemplateColumn.HeaderTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding FilePath}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="16,0,0,0" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

<DataGridTemplateColumn>
<DataGridTemplateColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="Status" HorizontalAlignment="Center" VerticalAlignment="Center" />
</DataTemplate>
</DataGridTemplateColumn.HeaderTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding FileStatus}"
Style="{DynamicResource FileStatusTextStyle}"
HorizontalAlignment="Center" VerticalAlignment="Center" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</ui:DataGrid.Columns>
</ui:DataGrid>

<ui:Button Name="Btn_Theme" Content="Light" Icon="{ui:SymbolIcon Lightbulb24}"
Width="120" Margin="24,0,0,0" Grid.Row="2"
HorizontalAlignment="Left" VerticalAlignment="Center"
Command="{Binding ThemeCommand}" />

<CheckBox x:Name="Check_DeleteNCM"
IsChecked="{Binding WillDeleteNCM}"
Content="Delete .NCM file when done"
Margin="0,0,24,0"
Grid.Row="2"
FontSize="14"
VerticalAlignment="Center"
HorizontalAlignment="Right" />

<ui:Button x:Name="StartButton" Content="Convert" FontSize="14"
Width="120" Margin="0,0,24,24" Grid.Row="3"
HorizontalAlignment="Right" VerticalAlignment="Bottom"
Appearance="Success"
Command="{Binding ConvertCommand}" />

<ui:Button x:Name="SelectFileButton" Content="Select File" FontSize="14"
Width="120" Margin="0,0,152,24" Grid.Row="3"
HorizontalAlignment="Right" VerticalAlignment="Bottom"
Appearance="Primary"
Command="{Binding AddFileCommand}" />

<ui:Button x:Name="SelectFolderButton" Content="Select Folder" FontSize="14"
Width="120" Margin="0,0,280,24" Grid.Row="3"
HorizontalAlignment="Right" VerticalAlignment="Bottom"
Appearance="Primary"
Command="{Binding AddFolderCommand}" />

<Button x:Name="StartButton" Content="Convert" HorizontalAlignment="Right" Margin="0,0,20,20" Click="StartButton_Click" Grid.Row="2" Style="{StaticResource ButtonPrimary}" VerticalAlignment="Bottom" Height="35" Width="120" FontSize="14" />
<Button x:Name="SelectFileButton" Content="Select File" HorizontalAlignment="Right" Click="SelectFileButton_Click" Grid.Row="2" Style="{StaticResource ButtonInfo}" VerticalAlignment="Bottom" Height="35" Width="120" Margin="0,0,160,20" FontSize="14" />
<Button x:Name="SelectFolderButton" Content="Select Folder" HorizontalAlignment="Right" Click="SelectFolderButton_Click" Grid.Row="2" Style="{StaticResource ButtonInfo}" VerticalAlignment="Bottom" Height="35" Width="120" Margin="0,0,300,20" FontSize="14" />
<Button x:Name="ClearButton" Content="Clear" HorizontalAlignment="Left" Click="ClearButton_Click" Grid.Row="2" Style="{StaticResource ButtonDanger}" VerticalAlignment="Bottom" Height="35" Width="120" Margin="20,0,0,20" FontSize="14" />
<ui:Button x:Name="ClearButton" Content="Clear" FontSize="14"
Width="120" Margin="24,0,0,24" Grid.Row="3"
HorizontalAlignment="Left" VerticalAlignment="Bottom"
Appearance="Danger"
Command="{Binding ClearCommand}" />
</Grid>
</hc:BlurWindow>
</ui:FluentWindow>
Loading

0 comments on commit 57b2a15

Please sign in to comment.