Skip to content

Commit

Permalink
v1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
kingsznhone committed Mar 11, 2022
1 parent 48f68ab commit 938c90c
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 19 deletions.
2 changes: 1 addition & 1 deletion NCMDumpCLI/NCMDumpCLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<ApplicationIcon>NCMDumpCLI.ico</ApplicationIcon>
<PlatformTarget>x64</PlatformTarget>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Version>1.1.2</Version>
<Version>1.3.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 2 additions & 4 deletions NCMDumpCLI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ public static void Main(string[] args)
{
NCMDump Core = new();



if (args.Length == 0)
{
Console.WriteLine("Drag [*.ncm] file on exe to start");
Expand Down Expand Up @@ -42,7 +40,7 @@ public static void Main(string[] args)
Console.Write("Press Any Key to Exit...");
Console.ReadLine();

void WalkThrough(DirectoryInfo dir)
async void WalkThrough(DirectoryInfo dir)
{
Console.WriteLine("DIR: " + dir.FullName);
foreach (DirectoryInfo d in dir.GetDirectories())
Expand All @@ -52,7 +50,7 @@ void WalkThrough(DirectoryInfo dir)
foreach (FileInfo f in dir.EnumerateFiles())
{
Console.WriteLine("Converting : " + f.FullName);
if (Core.Convert(f.FullName)) Console.WriteLine("...OK");
if (await Core.ConvertAsync(f.FullName)) Console.WriteLine("...OK");
else Console.WriteLine("...Fail");
Console.WriteLine();
}
Expand Down
8 changes: 4 additions & 4 deletions NCMDumpCore/NCMDump.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,12 @@ private uint ReadUint32(MemoryStream ms)
return BitConverter.ToUInt32(buffer);
}

public async Task<bool> ConvertAsync(string path)
public bool Convert(string path)
{
return Convert(path);
return Task.Run(()=>ConvertAsync(path)).Result;
}

public bool Convert(string path)
public async Task<bool> ConvertAsync(string path)
{
if (!System.IO.File.Exists(path))
{
Expand All @@ -216,7 +216,7 @@ public bool Convert(string path)
}

//Read all bytes to ram.
var ms = new MemoryStream(System.IO.File.ReadAllBytes(path));
var ms = new MemoryStream(await System.IO.File.ReadAllBytesAsync(path));

//Verify Header
if (!ReadHeader(ref ms))
Expand Down
5 changes: 4 additions & 1 deletion NCMDumpCore/NCMDumpCore.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<VersionPrefix>1.3.0</VersionPrefix>
<AssemblyVersion></AssemblyVersion>
<FileVersion></FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion NCMDumpGUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Forms;
Expand Down Expand Up @@ -82,7 +83,7 @@ private async void StartButton_Click(object sender, RoutedEventArgs e)
{
if (NCMCollection[i].FileStatus == "Success") continue;

if (await core.ConvertAsync(NCMCollection[i].FilePath))
if (await Task.Run(()=>core.ConvertAsync(NCMCollection[i].FilePath)))
{
NCMCollection[i].FileStatus = "Success";
this.UpdateLayout();
Expand Down
2 changes: 1 addition & 1 deletion NCMDumpGUI/NCMDumpGUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<UseWPF>true</UseWPF>
<ApplicationIcon>NCMDumpCLI.ico</ApplicationIcon>
<UseWindowsForms>True</UseWindowsForms>
<Version>1.1.2</Version>
<Version>1.3.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# NCMDump.NET

Decipher .ncm file to mp3 || flac

# Changelog
## Changelog

### v1.3

Bug fix.

Async optimization.

### v1.2

Expand All @@ -15,21 +22,21 @@ Drag directory on executable support.

Bug fix


# Usage
## Usage

### CLI

Drag .ncm file or directory on .exe

### GUI

~~omission~~

## System Requirement

# System Requirement
### OS : Windows 10 10.0.19041.0 with .NET6 Runtime

### OS : Windows 10 10.0.19041.0 with .NET6

## Refrence

# Refrence
https://github.com/anonymous5l/ncmdump
<https://github.com/anonymous5l/ncmdump>

0 comments on commit 938c90c

Please sign in to comment.