Skip to content

Commit 3967ea5

Browse files
committed
beta2 release
1 parent f2f2255 commit 3967ea5

11 files changed

+141
-264
lines changed

WalkmanManager.sln.DotSettings.user

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
23
<s:Int64 x:Key="/Default/CodeStyle/Naming/CSharpAutoNaming/AutoNamingCompletedVersion/@EntryValue">2</s:Int64>
34

45
<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpAutoNaming/IsNamingAutoDetectionCompleted/@EntryValue">True</s:Boolean>

WalkmanManager/Dialogs/DlgCloudMusicLogin.xaml.vb

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
End Get
2323
Set
2424
TextBoxPassword.Password = Value
25+
ChkRememberPwd.IsChecked = True
2526
End Set
2627
End Property
2728

+34-26
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,47 @@
1-
<UserControl x:Class="DlgConvertNcm"
1+
<UserControl
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
66
xmlns:mD="http://materialdesigninxaml.net/winfx/xaml/themes"
77
xmlns:local="clr-namespace:WalkmanManager"
8+
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" x:Class="DlgConvertNcm"
89
mc:Ignorable="d"
9-
d:DesignHeight="450" Width="800" Background="White">
10-
<Grid>
11-
<mD:ColorZone Height="40" Mode="PrimaryMid">
12-
<Grid>
13-
<Label HorizontalAlignment="Left" VerticalContentAlignment="Center" Foreground="White">转换网易云加密音乐</Label>
14-
<Button x:Name="ButtonClose" HorizontalAlignment="Right" Height="Auto" mD:ShadowAssist.ShadowDepth="Depth0">
15-
<mD:PackIcon Kind="Close"/>
16-
</Button>
17-
<Button HorizontalAlignment="Right" Height="Auto" mD:ShadowAssist.ShadowDepth="Depth0" Margin="0,0,48,0">
18-
<mD:PackIcon Kind="Minus"/>
19-
</Button>
20-
</Grid>
21-
</mD:ColorZone>
22-
<Grid Margin="0,40,0,0">
23-
<mD:ColorZone Height="50" Background="AntiqueWhite" BorderThickness="0,0,0,1" BorderBrush="BurlyWood" mD:ShadowAssist.ShadowDepth="Depth1">
24-
<Grid Margin="15,0,0,0">
25-
<ProgressBar x:Name="ProgressBarWorking" Style="{DynamicResource MaterialDesignCircularProgressBar}" IsIndeterminate="True" HorizontalAlignment="Left"/>
26-
<mD:PackIcon Visibility="Hidden" x:Name="IconCheck" Kind="CheckCircle" Width="25" Height="25" Margin="-1,11,0,0"></mD:PackIcon>
27-
<Label Margin="25,0,0,0" VerticalContentAlignment="Center">正在查找加密文件</Label>
28-
<Button IsEnabled="False" Style="{DynamicResource MaterialDesignFlatButton}" HorizontalAlignment="Right" Margin="0,8,10,9" Width="90">转换</Button>
10+
Height="450" Width="800" BorderThickness="1" BorderBrush="#FFC1C1C1"
11+
WindowChrome.IsHitTestVisibleInChrome="True">
12+
13+
<i:Interaction.Behaviors>
14+
<ei:MouseDragElementBehavior ConstrainToParentBounds="True"/>
15+
</i:Interaction.Behaviors>
16+
<Border Background="White" mD:ShadowAssist.ShadowDepth="Depth3" CornerRadius="7">
17+
<Grid>
18+
<mD:ColorZone x:Name="TitleBar" Height="40" Mode="PrimaryMid">
19+
<Grid>
20+
<Label HorizontalAlignment="Left" VerticalContentAlignment="Center" Foreground="White" Content="转换网易云加密音乐"/>
21+
<Button x:Name="ButtonClose" HorizontalAlignment="Right" Height="Auto" mD:ShadowAssist.ShadowDepth="Depth0">
22+
<mD:PackIcon Kind="Close"/>
23+
</Button>
24+
<Button x:Name="ButtonMinimize" HorizontalAlignment="Right" Height="Auto" mD:ShadowAssist.ShadowDepth="Depth0" Margin="0,0,48,0">
25+
<mD:PackIcon Kind="Minus"/>
26+
</Button>
2927
</Grid>
3028
</mD:ColorZone>
29+
<Grid Margin="0,40,0,0">
30+
<mD:ColorZone Height="50" Background="AntiqueWhite" BorderThickness="0,0,0,1" BorderBrush="BurlyWood" mD:ShadowAssist.ShadowDepth="Depth1">
31+
<Grid Margin="15,0,0,0">
32+
<ProgressBar x:Name="ProgressBarWorking" Style="{DynamicResource MaterialDesignCircularProgressBar}" IsIndeterminate="True" HorizontalAlignment="Left"/>
33+
<mD:PackIcon Visibility="Hidden" x:Name="IconCheck" Kind="CheckCircle" Width="25" Height="25" Margin="-1,11,0,0"/>
34+
<Label x:Name="LabelStatus" Margin="25,0,0,0" VerticalContentAlignment="Center" Content="正在查找加密文件"/>
35+
<Button x:Name="ButtonDump" IsEnabled="False" Style="{DynamicResource MaterialDesignFlatButton}" HorizontalAlignment="Right" Margin="0,8,10,9" Width="90" Content="转换"/>
36+
</Grid>
37+
</mD:ColorZone>
3138

32-
<Grid Margin="0,55,0,0">
33-
<ScrollViewer>
34-
<StackPanel x:Name="StackPanelFiles"/>
35-
</ScrollViewer>
39+
<Grid Margin="0,55,0,10">
40+
<ScrollViewer>
41+
<StackPanel x:Name="StackPanelFiles"/>
42+
</ScrollViewer>
43+
</Grid>
3644
</Grid>
3745
</Grid>
38-
</Grid>
46+
</Border>
3947
</UserControl>
+45-3
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,62 @@
11
Public Class DlgConvertNcm
2-
Public MustOverride Sub Close Handles ButtonClose.Click
2+
Public Event Close
3+
Public Event Minimize
4+
Private _flgDrag As Boolean = False
5+
Private _oldPoint As Point
6+
Private SongLibPath As String
37

4-
Private async Sub DlgConvertNcm_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
8+
Public Sub New(songPath As String)
9+
10+
' This call is required by the designer.
11+
InitializeComponent()
12+
13+
' Add any initialization after the InitializeComponent() call.
14+
SongLibPath = songPath
15+
End Sub
16+
17+
Public Sub Close_Click() Handles ButtonClose.Click
18+
RaiseEvent Close()
19+
End Sub
20+
21+
Public Async Sub Init()
522
Dim files As List(Of String)
623
files = Await Task.Run(AddressOf SearchNcm)
724
For Each f In files
825
Dim itm As New NcmItem(f)
926
StackPanelFiles.Children.Add(itm)
1027
Next
28+
IconCheck.Visibility = Visibility.Visible
29+
ProgressBarWorking.Visibility = Visibility.Hidden
30+
ButtonDump.IsEnabled = True
31+
LabelStatus.Content = "找到 " & files.Count & " 个加密文件"
1132
End Sub
1233

1334
Private Function SearchNcm() As List(Of String)
1435
Dim files As New List(Of String)
15-
For each f In My.Computer.FileSystem.GetFiles("", FileIO.SearchOption.SearchAllSubDirectories, "*.ncm")
36+
For Each f In My.Computer.FileSystem.GetFiles(SongLibPath, FileIO.SearchOption.SearchAllSubDirectories, "*.ncm")
1637
files.Add(f)
1738
Next
1839
Return files
1940
End Function
41+
42+
Private Sub ButtonMinimize_Click(sender As Object, e As RoutedEventArgs) Handles ButtonMinimize.Click
43+
RaiseEvent Minimize
44+
End Sub
45+
46+
Public Sub Dispose()
47+
For Each itm As NcmItem In StackPanelFiles.Children
48+
itm.Dispose()
49+
Next
50+
End Sub
51+
52+
Private Async Sub ButtonDump_Click(sender As Object, e As RoutedEventArgs) Handles ButtonDump.Click
53+
ButtonDump.IsEnabled = False
54+
LabelStatus.Content = "正在转换..."
55+
ProgressBarWorking.Visibility = Visibility.Visible
56+
IconCheck.Visibility = Visibility.Hidden
57+
For Each itm As NcmItem In StackPanelFiles.Children
58+
Await itm.Dump(SongLibPath)
59+
My.Computer.FileSystem.DeleteFile(itm._filePath)
60+
Next
61+
End Sub
2062
End Class

WalkmanManager/MainWindow.xaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
</Grid>
4343
</mD:ColorZone>
4444
<mD:DialogHost x:Name="DlgWindowRoot" Identifier="window-root" Background="White" Margin="0,35,0,0">
45-
<Grid>
45+
<Grid x:Name="GridRoot">
4646
<mD:ColorZone Mode="Light" mD:ShadowAssist.ShadowDepth="Depth3" Height="50"
4747
Background="WhiteSmoke">
4848
<Grid>
@@ -69,7 +69,7 @@
6969
</ListBox>
7070
</Grid>
7171
</mD:ColorZone>
72-
<Grid Margin="0,50,0,0" x:Name="GridLocal" Visibility="Visible" d:IsHidden="True">
72+
<Grid Margin="0,50,0,0" x:Name="GridLocal" Visibility="Visible">
7373
<mD:DialogHost x:Name="DlgLocal" Margin="0,10,0,0">
7474
<Grid>
7575
<Grid x:Name="LstLocalSidebar" Width="220" HorizontalAlignment="Left">
@@ -150,8 +150,8 @@
150150
</Grid>
151151
</mD:DialogHost>
152152
</Grid>
153-
<Grid x:Name="GridCloudMusic" Margin="0,55,0,0" d:IsHidden="True">
154-
<!-- Visibility="Hidden"-->
153+
<Grid x:Name="GridCloudMusic" Margin="0,55,0,0" d:IsHidden="True" Visibility="Hidden">
154+
155155
<mD:DialogHost x:Name="DlgCloudMusic">
156156
<Grid>
157157
<Border BorderThickness="0,0,1,1" BorderBrush="LightGray" HorizontalAlignment="Left" Width="270" Height="70"
@@ -233,7 +233,7 @@
233233
</mD:DialogHost>
234234
</Grid>
235235

236-
<Grid x:Name="GridRemote" Margin="0,55,0,0" d:IsHidden="True">
236+
<Grid x:Name="GridRemote" Visibility="Hidden" Margin="0,55,0,0" d:IsHidden="True">
237237
<Grid Margin="0,0,0,95">
238238
</Grid>
239239
<mD:ColorZone VerticalAlignment="Top" Margin="10,10,10,0" Height="70" CornerRadius="10"

WalkmanManager/MainWindow.xaml.vb

+29
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Class MainWindow
1818
Dim _flgSyncStop As Boolean
1919
Dim _flgUSBRefreshPause As Boolean = False
2020
Dim _encryptKey As String
21+
Dim _toolWindowConvertNcm As DlgConvertNcm
2122

2223
Private Sub czTitle_MouseLeftButtonDown(sender As Object, e As MouseButtonEventArgs) _
2324
Handles CzTitle.MouseLeftButtonDown
@@ -835,6 +836,9 @@ Complete:
835836
Dispatcher.Invoke(Sub()
836837
ProgressBarSyncSub.Maximum = sender.TotalLength
837838
ProgressBarSyncSub.Value = sender.CopiedLength
839+
TextBoxTotal.Text = sender.TotalLength
840+
TextBoxComplete.Text = sender.CopiedLength
841+
TextBoxBlock.Text = sender.ChunkSize
838842
End Sub)
839843
End Sub
840844

@@ -926,4 +930,29 @@ Complete:
926930
Catch
927931
End Try
928932
End Sub
933+
934+
Private Sub BtnConvertNcm_Click(sender As Object, e As RoutedEventArgs) Handles BtnConvertNcm.Click
935+
If IsNothing(_toolWindowConvertNcm) Then
936+
_toolWindowConvertNcm = New DlgConvertNcm(GetSetting("song_dir"))
937+
_toolWindowConvertNcm.HorizontalAlignment = HorizontalAlignment.Center
938+
_toolWindowConvertNcm.VerticalAlignment = VerticalAlignment.Center
939+
AddHandler _toolWindowConvertNcm.Close, AddressOf dlgConvertNcm_Close
940+
AddHandler _toolWindowConvertNcm.Minimize, AddressOf dlgConvertNcm_Minimize
941+
942+
GridRoot.Children.Add(_toolWindowConvertNcm)
943+
_toolWindowConvertNcm.Init()
944+
Else
945+
_toolWindowConvertNcm.Visibility = Visibility.Visible
946+
End If
947+
End Sub
948+
949+
Private Sub dlgConvertNcm_Minimize()
950+
_toolWindowConvertNcm.Visibility = Visibility.Collapsed
951+
End Sub
952+
953+
Private Sub dlgConvertNcm_Close()
954+
GridRoot.Children.Remove(_toolWindowConvertNcm)
955+
_toolWindowConvertNcm.dispose
956+
_toolWindowConvertNcm = Nothing
957+
End Sub
929958
End Class

WalkmanManager/UserControls/NcmItem.xaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<Label HorizontalAlignment="Left" VerticalContentAlignment="Center">
1313
<mD:PackIcon x:Name="IconStatus" Kind="clock"/>
1414
</Label>
15-
<Label x:Name="LabelFilename" HorizontalAlignment="Left" Margin="26,0,0,0"/>
15+
<Label x:Name="LabelFilename" HorizontalAlignment="Left" VerticalContentAlignment="Center" Margin="26,0,0,0"/>
1616
</Grid>
1717
</mD:ColorZone>
1818
</UserControl>
+23-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
Imports libNcmDump
1+
Imports System.ComponentModel
2+
Imports libNcmDump
23

34
Public Class NcmItem
4-
Dim _filePath = ""
5+
Public _filePath = ""
56
Dim _crypto As libNcmDump.NeteaseCrypto
67

78
Public enum Status
@@ -16,7 +17,7 @@ Public Class NcmItem
1617
InitializeComponent()
1718

1819
' Add any initialization after the InitializeComponent() call.
19-
If Not My.Computer.FileSystem.DirectoryExists(filePath) Then
20+
If Not My.Computer.FileSystem.FileExists(filePath) Then
2021
Throw New IO.FileNotFoundException(filePath & " Not found")
2122
End If
2223
_filePath = filePath
@@ -25,7 +26,7 @@ Public Class NcmItem
2526
_crypto = New NeteaseCrypto(New IO.FileStream(filePath, IO.FileMode.Open))
2627
End Sub
2728

28-
Public sub SetStatus(s As Status)
29+
Public Sub SetStatus(s As Status)
2930
Select Case s
3031
Case Status.wait
3132
IconStatus.Kind = MaterialDesignThemes.Wpf.PackIconKind.Clock
@@ -34,10 +35,23 @@ Public Class NcmItem
3435
Case Status.done
3536
IconStatus.Kind = MaterialDesignThemes.Wpf.PackIconKind.Check
3637
End Select
37-
End sub
38-
39-
Public Sub Dump()
40-
_crypto.FileName = My.Computer.FileSystem.GetFileInfo(_filePath).NameWithoutExtention()
41-
_crypto.Dump()
4238
End Sub
39+
40+
Public Async Function Dump(dir As String) As Task
41+
SetStatus(Status.processing)
42+
Await Task.Run(Sub()
43+
_crypto.FileName = dir & "\" & My.Computer.FileSystem.GetFileInfo(_filePath).NameWithoutExtention()
44+
Try
45+
_crypto.Dump()
46+
Catch ex As Exception
47+
48+
End Try
49+
End Sub)
50+
SetStatus(Status.done)
51+
End Function
52+
53+
Public sub Dispose()
54+
_crypto.CloseFile
55+
_crypto = nothing
56+
End sub
4357
End Class

WalkmanManager/WalkmanManager.vbproj

+2
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@
147147
<Reference Include="MaterialDesignThemes.Wpf, Version=2.6.0.1366, Culture=neutral, processorArchitecture=MSIL">
148148
<HintPath>..\packages\MaterialDesignThemes.2.6.0-ci1366\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath>
149149
</Reference>
150+
<Reference Include="Microsoft.Expression.Interactions, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
150151
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
151152
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
152153
</Reference>
@@ -166,6 +167,7 @@
166167
<Reference Include="System.Drawing" />
167168
<Reference Include="System.Numerics" />
168169
<Reference Include="System.Windows.Forms" />
170+
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
169171
<Reference Include="System.Xml.Linq" />
170172
<Reference Include="System" />
171173
<Reference Include="System.Data" />

0 commit comments

Comments
 (0)