├── .gitattributes
├── .github
└── workflows
│ ├── codeql.yml
│ ├── dotnet-desktop.yml
│ └── dotnetcore.yml
├── .gitignore
├── .vscode
├── launch.json
├── settings.json
└── tasks.json
├── DebugConsole
├── DebugConsole.csproj
├── Program.cs
└── Properties
│ └── PublishProfiles
│ └── FolderProfile.pubxml
├── LICENSE
├── LemonApp.sln
├── LemonApp
├── App.xaml
├── App.xaml.cs
├── ContentPage
│ ├── FLGDIndexPage.xaml
│ ├── FLGDIndexPage.xaml.cs
│ ├── HomePage.xaml
│ ├── HomePage.xaml.cs
│ ├── MyFollowSingerList.xaml
│ ├── MyFollowSingerList.xaml.cs
│ ├── RadioIndexPage.xaml
│ ├── RadioIndexPage.xaml.cs
│ ├── SingerIndexPage.xaml
│ ├── SingerIndexPage.xaml.cs
│ ├── TopPage.xaml
│ ├── TopPage.xaml.cs
│ ├── TranslationAir.xaml
│ └── TranslationAir.xaml.cs
├── ControlItems
│ ├── AudioVisualizerRound.cs
│ ├── BottomTick.xaml
│ ├── BottomTick.xaml.cs
│ ├── CannotPlay.xaml
│ ├── CannotPlay.xaml.cs
│ ├── DataItem.xaml
│ ├── DataItem.xaml.cs
│ ├── DownloadItem.xaml
│ ├── DownloadItem.xaml.cs
│ ├── FLGDIndexItem.xaml
│ ├── FLGDIndexItem.xaml.cs
│ ├── HotKeyChooser.xaml
│ ├── HotKeyChooser.xaml.cs
│ ├── ImageForceView.xaml
│ ├── ImageForceView.xaml.cs
│ ├── LyricView.xaml
│ ├── LyricView.xaml.cs
│ ├── MDButton.xaml
│ ├── MDButton.xaml.cs
│ ├── MVItem.xaml
│ ├── MVItem.xaml.cs
│ ├── MainMeumItem.xaml
│ ├── MainMeumItem.xaml.cs
│ ├── MeumItem.xaml
│ ├── MeumItem.xaml.cs
│ ├── MusicListView.xaml
│ ├── MusicListView.xaml.cs
│ ├── MyScrollViewer.cs
│ ├── PlControl.xaml
│ ├── PlControl.xaml.cs
│ ├── PlayDLItem.xaml
│ ├── PlayDLItem.xaml.cs
│ ├── RadioItem.xaml
│ ├── RadioItem.xaml.cs
│ ├── Ran.cs
│ ├── RbBox.xaml
│ ├── RbBox.xaml.cs
│ ├── SingerItem.xaml
│ ├── SingerItem.xaml.cs
│ ├── SingerPage.xaml
│ ├── SingerPage.xaml.cs
│ ├── SkinControl.xaml
│ ├── SkinControl.xaml.cs
│ ├── TitlePageBtn.xaml
│ ├── TitlePageBtn.xaml.cs
│ ├── TopControl.xaml
│ ├── TopControl.xaml.cs
│ ├── TwMessageBox.xaml
│ ├── TwMessageBox.xaml.cs
│ ├── UpdateBox.xaml
│ └── UpdateBox.xaml.cs
├── Dll
│ ├── Microsoft.WindowsAPICodePack.Shell.dll
│ └── Microsoft.WindowsAPICodePack.dll
├── DwmAnimation.cs
├── LemonApp.csproj
├── LemonApp.sln
├── LierdaCracker.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── Properties
│ ├── PublishProfiles
│ │ ├── FolderProfile.pubxml
│ │ └── FolderProfilex86.pubxml
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ └── app.manifest
├── Resources
│ ├── Icons.xaml
│ ├── SCDictionary.xaml
│ ├── app.manifest
│ ├── icon.ico
│ ├── left.ico
│ ├── pause.ico
│ ├── play.ico
│ └── right.ico
├── Theme
│ ├── LemonApp.Theme.Dtpp.dll
│ ├── LemonApp.Theme.FerrisWheel.dll
│ ├── LemonApp.Theme.TechDMusic.dll
│ ├── LemonApp.Theme.TheFirstSnow.dll
│ ├── LemonApp.Theme.YeStarLight.dll
│ └── LemonApp.Theme.dll
├── Toast.xaml
├── Toast.xaml.cs
├── Window
│ ├── IntroWindow.xaml
│ ├── IntroWindow.xaml.cs
│ ├── LoadingWindow.xaml
│ ├── LoadingWindow.xaml.cs
│ ├── LoginNetease.xaml
│ ├── LoginNetease.xaml.cs
│ ├── LoginWindow.xaml
│ ├── LoginWindow.xaml.cs
│ ├── LyricBar.xaml
│ ├── LyricBar.xaml.cs
│ ├── MVWindow.xaml
│ ├── MVWindow.xaml.cs
│ ├── MiniPlayer.xaml
│ ├── MiniPlayer.xaml.cs
│ ├── TransAirWindow.xaml
│ └── TransAirWindow.xaml.cs
└── WindowBlur.cs
├── LemonLib
├── Dll
│ └── Bass.Net.dll
├── Helpers
│ ├── HttpDownloadHelper.cs
│ ├── HttpHelper.cs
│ ├── ImageCacheHelper.cs
│ ├── ImageHelper.cs
│ ├── InfoHelper.cs
│ ├── MsgHelper.cs
│ ├── MyToolBarClient.cs
│ ├── RomajiHelper.cs
│ ├── SMTCCreator.cs
│ ├── TextHelper.cs
│ ├── TranslateAirHelper.cs
│ ├── UIHelper.cs
│ └── lmExtension.cs
├── LemonLib.csproj
├── Main.cs
├── MusicLib.cs
├── MusicPlayer.cs
├── Properties
│ ├── PublishProfiles
│ │ └── FolderProfile.pubxml
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── Resources
│ ├── bass.dll
│ ├── bass_fx.dll
│ ├── bass_fx_x86.dll
│ └── bass_x86.dll
├── Settings.cs
├── bassenc.dll
└── lame.exe
├── README.md
└── global.json
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.github/workflows/codeql.yml:
--------------------------------------------------------------------------------
1 | # For most projects, this workflow file will not need changing; you simply need
2 | # to commit it to your repository.
3 | #
4 | # You may wish to alter this file to override the set of languages analyzed,
5 | # or to provide custom queries or build logic.
6 | #
7 | # ******** NOTE ********
8 | # We have attempted to detect the languages in your repository. Please check
9 | # the `language` matrix defined below to confirm you have the correct set of
10 | # supported CodeQL languages.
11 | #
12 | name: "CodeQL"
13 |
14 | on:
15 | push:
16 | branches: [ "master" ]
17 | pull_request:
18 | # The branches below must be a subset of the branches above
19 | branches: [ "master" ]
20 | schedule:
21 | - cron: '39 3 * * 3'
22 |
23 | jobs:
24 | analyze:
25 | name: Analyze
26 | # Runner size impacts CodeQL analysis time. To learn more, please see:
27 | # - https://gh.io/recommended-hardware-resources-for-running-codeql
28 | # - https://gh.io/supported-runners-and-hardware-resources
29 | # - https://gh.io/using-larger-runners
30 | # Consider using larger runners for possible analysis time improvements.
31 | runs-on: windows-latest
32 | timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
33 | permissions:
34 | actions: read
35 | contents: read
36 | security-events: write
37 |
38 | strategy:
39 | fail-fast: false
40 | matrix:
41 | language: [ 'csharp' ]
42 | # CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
43 | # Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
44 | # Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
45 | # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
46 |
47 | steps:
48 | - name: Checkout repository
49 | uses: actions/checkout@v3
50 |
51 | # Initializes the CodeQL tools for scanning.
52 | - name: Initialize CodeQL
53 | uses: github/codeql-action/init@v2
54 | with:
55 | languages: ${{ matrix.language }}
56 | # If you wish to specify custom queries, you can do so here or in a config file.
57 | # By default, queries listed here will override any specified in a config file.
58 | # Prefix the list here with "+" to use these queries and those in the config file.
59 |
60 | # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
61 | # queries: security-extended,security-and-quality
62 |
63 |
64 | # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
65 | # If this step fails, then you should remove it and run the build manually (see below)
66 | - name: Autobuild
67 | uses: github/codeql-action/autobuild@v2
68 |
69 | # ℹ️ Command-line programs to run using the OS shell.
70 | # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
71 |
72 | # If the Autobuild fails above, remove it and uncomment the following three lines.
73 | # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
74 |
75 | # - run: |
76 | # echo "Run, Build Application using script"
77 | # ./location_of_script_within_repo/buildscript.sh
78 |
79 | - name: Perform CodeQL Analysis
80 | uses: github/codeql-action/analyze@v2
81 | with:
82 | category: "/language:${{matrix.language}}"
83 |
--------------------------------------------------------------------------------
/.github/workflows/dotnet-desktop.yml:
--------------------------------------------------------------------------------
1 | name: Publish Exe Files
2 |
3 | on:
4 | push:
5 | branches: [ "master" ]
6 | pull_request:
7 | branches: [ "master" ]
8 |
9 | jobs:
10 |
11 | build:
12 | runs-on: windows-latest
13 | env:
14 | Solution_Name: LemonApp.sln # Replace with your solution name, i.e. MyWpfApp.sln.
15 | PublishFile: LemonApp\Properties\PublishProfiles\FolderProfile.pubxml
16 | PublishFilex86: LemonApp\Properties\PublishProfiles\FolderProfilex86.pubxml
17 | PublishPath: LemonApp\bin\Publish\
18 |
19 | steps:
20 | - name: Checkout
21 | uses: actions/checkout@v4
22 | with:
23 | fetch-depth: 0
24 |
25 | # Install the .NET Core workload
26 | - name: Install .NET Core
27 | uses: actions/setup-dotnet@v4
28 | with:
29 | dotnet-version: 8.0.x
30 |
31 | # Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
32 | - name: Setup MSBuild.exe
33 | uses: microsoft/setup-msbuild@v2
34 |
35 | # Restore the application to populate the obj folder with RuntimeIdentifiers
36 | - name: Restore
37 | run: dotnet restore
38 |
39 | - name: Publishx64
40 | run: dotnet publish -p:PublishProfile=${{env.PublishFile}}
41 |
42 | - name: Publishx86
43 | run: dotnet publish -p:PublishProfile=${{env.PublishFilex86}}
44 |
45 | - name: Upload build artifacts
46 | uses: actions/upload-artifact@v3
47 | with:
48 | name: Release win-x64
49 | path: ${{env.PublishPath}}\x64
50 |
51 | - name: Upload build artifacts x86
52 | uses: actions/upload-artifact@v3
53 | with:
54 | name: Release win-x86
55 | path: ${{env.PublishPath}}\x86
56 |
57 |
--------------------------------------------------------------------------------
/.github/workflows/dotnetcore.yml:
--------------------------------------------------------------------------------
1 | name: .NET Core
2 |
3 | on: [push]
4 |
5 | jobs:
6 | build:
7 |
8 | runs-on: windows-latest
9 |
10 | steps:
11 | - uses: actions/checkout@v1
12 | - name: Setup .NET Core
13 | uses: actions/setup-dotnet@v1
14 | with:
15 | dotnet-version: 6.0.101
16 | - name: Build with dotnet
17 | run: dotnet build --configuration Release
18 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.2.0",
3 | "configurations": [
4 | {
5 | // Use IntelliSense to find out which attributes exist for C# debugging
6 | // Use hover for the description of the existing attributes
7 | // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
8 | "name": ".NET Core Launch (console)",
9 | "type": "coreclr",
10 | "request": "launch",
11 | "preLaunchTask": "build",
12 | // If you have changed target frameworks, make sure to update the program path.
13 | "program": "${workspaceFolder}/LemonApp/bin/Debug/net6.0-windows/LemonApp.dll",
14 | "args": [],
15 | "cwd": "${workspaceFolder}/LemonApp",
16 | // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
17 | "console": "internalConsole",
18 | "stopAtEntry": false
19 | },
20 | {
21 | "name": ".NET Core Attach",
22 | "type": "coreclr",
23 | "request": "attach"
24 | }
25 | ]
26 | }
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "dotnetAcquisitionExtension.existingDotnetPath": [
3 | {
4 | "extensionId": "ms-dotnettools.csharp",
5 | "path": "C:\\Program Files\\dotnet\\dotnet.exe"
6 | },
7 | {
8 | "extensionId": "ms-dotnettools.csdevkit",
9 | "path": "C:\\Program Files\\dotnet\\dotnet.exe"
10 | }
11 | ],
12 | "dotnet.defaultSolution": "LemonApp.sln"
13 | }
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "tasks": [
4 | {
5 | "label": "build",
6 | "command": "dotnet",
7 | "type": "process",
8 | "args": [
9 | "build",
10 | "${workspaceFolder}/LemonApp/LemonApp.csproj",
11 | "/property:GenerateFullPaths=true",
12 | "/consoleloggerparameters:NoSummary"
13 | ],
14 | "problemMatcher": "$msCompile"
15 | },
16 | {
17 | "label": "publish",
18 | "command": "dotnet",
19 | "type": "process",
20 | "args": [
21 | "publish",
22 | "${workspaceFolder}/LemonApp/LemonApp.csproj",
23 | "/property:GenerateFullPaths=true",
24 | "/consoleloggerparameters:NoSummary"
25 | ],
26 | "problemMatcher": "$msCompile"
27 | },
28 | {
29 | "label": "watch",
30 | "command": "dotnet",
31 | "type": "process",
32 | "args": [
33 | "watch",
34 | "run",
35 | "--project",
36 | "${workspaceFolder}/LemonApp/LemonApp.csproj"
37 | ],
38 | "problemMatcher": "$msCompile"
39 | }
40 | ]
41 | }
--------------------------------------------------------------------------------
/DebugConsole/DebugConsole.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net6.0-windows10.0.17763.0
6 | DebugConsole.Program
7 | TwilightLemon
8 |
9 |
10 |
11 | true
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/DebugConsole/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.IO.Pipes;
4 | using System.Net;
5 | using System.Net.Sockets;
6 | using System.Runtime.Serialization.Json;
7 | using System.Text;
8 | using System.Threading;
9 |
10 | ///
11 | /// 调试模式 Alt+C
12 | ///
13 | namespace DebugConsole
14 | {
15 | class Program
16 | {
17 | static Socket socket;
18 | static void Main(string[] args)
19 | {
20 | Console.Title = "LemonApp Debug Console";
21 | Console.WriteLine("Hello World!");
22 | Console.ForegroundColor = ConsoleColor.Green;
23 | Console.WriteLine("LemonApp Debug Console");
24 | Console.ForegroundColor = ConsoleColor.Red;
25 | Console.WriteLine("[Developer Mode Alt+C]");
26 | Console.ForegroundColor = ConsoleColor.Yellow;
27 | Console.WriteLine("127.0.0.1:3239");
28 | Console.WriteLine("Powered by TwilightLemon");
29 | Console.ForegroundColor = ConsoleColor.White;
30 |
31 |
32 | Start();
33 | }
34 | private static void Start() {
35 | socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
36 | socket.Bind(new IPEndPoint(IPAddress.Parse("127.0.0.1"), 3239));
37 | socket.Listen(100);
38 | //接收客户端的 Socket请求
39 | socket.BeginAccept(OnAccept, socket);
40 |
41 | while (true)
42 | Console.ReadLine();
43 | }
44 | public static object JsonToObject(string jsonString, object obj)
45 | {
46 | DataContractJsonSerializer serializer = new DataContractJsonSerializer(obj.GetType());
47 | MemoryStream mStream = new MemoryStream(Encoding.UTF8.GetBytes(jsonString));
48 | return serializer.ReadObject(mStream);
49 | }
50 | private static void OnAccept(IAsyncResult async)
51 | {
52 | var serverSocket = async.AsyncState as Socket;
53 | //获取到客户端的socket
54 | Socket clientSocket = null;
55 | try
56 | {
57 | clientSocket = serverSocket.EndAccept(async);
58 | }
59 | catch {
60 | Console.ForegroundColor = ConsoleColor.Red;
61 | Console.WriteLine("Service Shutdown and restarting.");
62 | Console.ForegroundColor = ConsoleColor.White;
63 | socket.Close();
64 | socket.Dispose();
65 | Start();
66 | return;
67 | }
68 | var bytes = new byte[10000];
69 | //获取socket的内容
70 | var len = clientSocket.Receive(bytes);
71 | //将 bytes[] 转换 string
72 | var request = Encoding.UTF8.GetString(bytes, 0, len);
73 | try
74 | {
75 | DebugData dt = new DebugData();
76 | dt= (DebugData)JsonToObject(request, dt);
77 | Console.ForegroundColor = dt.color switch {
78 | "blue"=>ConsoleColor.Blue,
79 | "red"=>ConsoleColor.Red,
80 | "yellow"=>ConsoleColor.Yellow,
81 | _=>ConsoleColor.White
82 | };
83 | Console.WriteLine(dt.title);
84 | Console.ForegroundColor = ConsoleColor.White;
85 | Console.WriteLine(dt.data);
86 | }
87 | catch {
88 | Console.ForegroundColor = ConsoleColor.White;
89 | Console.WriteLine(request);
90 | }
91 | socket.Listen(100);
92 | //接收客户端的 Socket请求
93 | socket.BeginAccept(OnAccept, socket);
94 | }
95 | }
96 |
97 | public class DebugData {
98 | ///
99 | /// blue red yellow
100 | ///
101 | public string color = "";
102 | public string title = "";
103 | public string data = "";
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/DebugConsole/Properties/PublishProfiles/FolderProfile.pubxml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 | Release
8 | Any CPU
9 | bin\Release\net6.0-windows\win-x64\publish\
10 | FileSystem
11 | <_TargetId>Folder
12 | net6.0-windows
13 | win-x64
14 | false
15 | true
16 | true
17 |
18 |
--------------------------------------------------------------------------------
/LemonApp.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29424.173
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LemonApp", "LemonApp\LemonApp.csproj", "{46FF122B-202F-4F60-BB4E-2983C3C1221A}"
7 | EndProject
8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LemonLib", "LemonLib\LemonLib.csproj", "{D9E28A60-192E-4F24-A676-C23DEAFC0BB5}"
9 | EndProject
10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DebugConsole", "DebugConsole\DebugConsole.csproj", "{CDDBF873-10A1-432B-A148-D37F8CA11CA0}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Release|Any CPU = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {46FF122B-202F-4F60-BB4E-2983C3C1221A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {46FF122B-202F-4F60-BB4E-2983C3C1221A}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {46FF122B-202F-4F60-BB4E-2983C3C1221A}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {46FF122B-202F-4F60-BB4E-2983C3C1221A}.Release|Any CPU.Build.0 = Release|Any CPU
22 | {D9E28A60-192E-4F24-A676-C23DEAFC0BB5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {D9E28A60-192E-4F24-A676-C23DEAFC0BB5}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {D9E28A60-192E-4F24-A676-C23DEAFC0BB5}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {D9E28A60-192E-4F24-A676-C23DEAFC0BB5}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {CDDBF873-10A1-432B-A148-D37F8CA11CA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {CDDBF873-10A1-432B-A148-D37F8CA11CA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {CDDBF873-10A1-432B-A148-D37F8CA11CA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {CDDBF873-10A1-432B-A148-D37F8CA11CA0}.Release|Any CPU.Build.0 = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | GlobalSection(ExtensibilityGlobals) = postSolution
35 | SolutionGuid = {9B6CCAEA-DF18-43CB-8AEA-DFFBE0331C9F}
36 | EndGlobalSection
37 | EndGlobal
38 |
--------------------------------------------------------------------------------
/LemonApp/App.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
16 |
17 |
22 |
23 | 10,10,10,10
24 | 4
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/LemonApp/ContentPage/FLGDIndexPage.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/LemonApp/ContentPage/HomePage.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/LemonApp/ContentPage/HomePage.xaml.cs:
--------------------------------------------------------------------------------
1 | using LemonLib;
2 | using System.Threading.Tasks;
3 | using System.Windows;
4 | using System.Windows.Controls;
5 | using System.Windows.Input;
6 | using static LemonLib.InfoHelper;
7 |
8 | namespace LemonApp.ContentPage
9 | {
10 | ///
11 | /// HomePage.xaml 的交互逻辑
12 | ///
13 | public partial class HomePage : UserControl
14 | {
15 | private MainWindow mw;
16 | public HomePage(MainWindow Context)
17 | {
18 | InitializeComponent();
19 | mw = Context;
20 | SizeChanged += delegate
21 | {
22 | mw.WidthUI(HomePage_GFGD, HomePage_GFGD.ActualWidth - 12);
23 | mw.WidthUI(HomePage_Gdtj, HomePage_Gdtj.ActualWidth - 12);
24 | };
25 | }
26 |
27 | public async void LoadHomePage()
28 | {
29 | //---------加载主页HomePage----动画加持--
30 | mw.OpenLoading();
31 | sv.Visibility = Visibility.Hidden;
32 | var data = await MusicLib.GetHomePageData();
33 | //--Top Focus--------
34 | HomePage_IFV.Update(data.focus, mw);
35 | HomePage_GFGD.Children.Clear();
36 | //--官方歌单----------
37 | foreach (var a in data.GFdata)
38 | {
39 | var k = new FLGDIndexItem(a) { Width = 175, Height = 175, Margin = new Thickness(10, 0, 10, 20) };
40 | k.StarEvent += async (sx) =>
41 | {
42 | await MusicLib.AddGDILikeAsync(sx.data.ID);
43 | Toast.Send("收藏成功");
44 | };
45 | k.ImMouseDown += mw.FxGDMouseDown;
46 | HomePage_GFGD.Children.Add(k);
47 | }
48 | mw.WidthUI(HomePage_GFGD, HomePage_GFGD.ActualWidth - 12);
49 | //--歌单推荐----------
50 | HomePage_Gdtj.Children.Clear();
51 | foreach (var a in data.Gdata)
52 | {
53 | var k = new FLGDIndexItem(a) { Width = 175, Height = 175, Margin = new Thickness(10, 0, 10, 20) };
54 | k.StarEvent += async (sx) =>
55 | {
56 | await MusicLib.AddGDILikeAsync(sx.data.ID);
57 | Toast.Send("收藏成功");
58 | };
59 | k.ImMouseDown += mw.FxGDMouseDown;
60 | HomePage_Gdtj.Children.Add(k);
61 | }
62 | mw.WidthUI(HomePage_Gdtj, HomePage_Gdtj.ActualWidth - 12);
63 | //--新歌首发----------
64 | HomePage_Nm.Children.Clear();
65 | foreach (var a in data.NewMusic)
66 | {
67 | var k = new PlayDLItem(a, true) { Margin = new Thickness(10, 0, 10, 20) };
68 | k.Tag = a;
69 | k.MouseDown += (object s, MouseButtonEventArgs es) =>
70 | {
71 | var sx = s as PlayDLItem;
72 | Music dt = sx.Tag as Music;
73 | mw.AddPlayDl_CR(new DataItem(dt));
74 | mw.PlayMusic(dt);
75 | };
76 | HomePage_Nm.Children.Add(k);
77 | if (HomePage_Nm.Children.Count == 28)
78 | break;
79 | }
80 | //------------------
81 | mw.CloseLoading();
82 | await Task.Delay(200);
83 | sv.Visibility = Visibility.Visible;
84 | mw.ContentAnimation(sv);
85 | }
86 |
87 | private void page_Loaded(object sender, RoutedEventArgs e)
88 | {
89 | LoadHomePage();
90 | }
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/LemonApp/ContentPage/MyFollowSingerList.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/LemonApp/ContentPage/MyFollowSingerList.xaml.cs:
--------------------------------------------------------------------------------
1 | using LemonLib;
2 | using System.Threading.Tasks;
3 | using System.Windows;
4 | using System.Windows.Controls;
5 |
6 | namespace LemonApp
7 | {
8 | ///
9 | /// MyFollowSingerList.xaml 的交互逻辑
10 | ///
11 | public partial class MyFollowSingerList : UserControl
12 | {
13 | private MainWindow mw;
14 | public MyFollowSingerList(MainWindow m)
15 | {
16 | InitializeComponent();
17 | mw = m;
18 | SizeChanged += delegate
19 | {
20 | mw.WidthUI(ItemsList);
21 | };
22 | Loaded += delegate
23 | {
24 | GetSingerList();
25 | };
26 | }
27 | public async void GetSingerList(int cur_page = 1)
28 | {
29 | if (cur_page == 1)
30 | ItemsList.Opacity = 0;
31 | mw.OpenLoading();
32 | ixSingerList = cur_page;
33 | var data = await MusicLib.GetSingerIFollowListAsync(cur_page);
34 | if (cur_page == 1)
35 | {
36 | ItemsList.Children.Clear();
37 | }
38 | foreach (var d in data)
39 | {
40 | var sinx = new SingerItem(d) { Margin = new Thickness(12, 0, 12, 20) };
41 | sinx.im.MouseDown += delegate
42 | {
43 | mw.GetSinger(sinx);
44 | };
45 | ItemsList.Children.Add(sinx);
46 | }
47 | mw.WidthUI(ItemsList);
48 | mw.CloseLoading();
49 | if (cur_page == 1)
50 | {
51 | await Task.Yield();
52 | ItemsList.Opacity = 1;
53 | mw.ContentAnimation(ItemsList, new Thickness(0, 50, 0, 0));
54 | }
55 | }
56 | private int ixSingerList = 1;
57 | private void SingerPage_sv_ScrollChanged(object sender, ScrollChangedEventArgs e)
58 | {
59 | if (sv.IsVerticalScrollBarAtButtom())
60 | {
61 | ixSingerList++;
62 | GetSingerList(ixSingerList);
63 | }
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/LemonApp/ContentPage/RadioIndexPage.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/LemonApp/ContentPage/RadioIndexPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using LemonLib;
2 | using System.Collections.Generic;
3 | using System.Threading.Tasks;
4 | using System.Windows;
5 | using System.Windows.Controls;
6 | using System.Windows.Input;
7 | using static LemonLib.InfoHelper;
8 |
9 | namespace LemonApp.ContentPage
10 | {
11 | ///
12 | /// RadioIndexPage.xaml 的交互逻辑
13 | ///
14 | public partial class RadioIndexPage : UserControl
15 | {
16 | private MainWindow mw;
17 | public RadioIndexPage(MainWindow m)
18 | {
19 | InitializeComponent();
20 | mw = m;
21 | SizeChanged += delegate
22 | {
23 | mw.WidthUI(RadioItemsList);
24 | };
25 | }
26 | Dictionary Radiodata;
27 | private async void Load()
28 | {
29 | Radiodata = await MusicLib.GetRadioList();
30 | foreach (var list in Radiodata)
31 | {
32 | RbBox r = new RbBox();
33 | r.ContentText = list.Key;
34 | r.Margin = new Thickness(20, 0, 0, 0);
35 | r.Checked += RadioPageChecked;
36 | RadioIndexList.Children.Add(r);
37 | }
38 | RbBox first = RadioIndexList.Children[0] as RbBox;
39 | first.Check(true);
40 | RadioPageChecked(first);
41 | }
42 | private RbBox RadioPage_RbLast = null;
43 | private async void RadioPageChecked(RbBox sender)
44 | {
45 | RadioItemsList.Opacity = 0;
46 | if (sender != null)
47 | {
48 | mw.OpenLoading();
49 | if (RadioPage_RbLast != null)
50 | RadioPage_RbLast.Check(false);
51 | RadioPage_RbLast = sender;
52 | RadioItemsList.Children.Clear();
53 | List dat = Radiodata[sender.ContentText].Items;
54 | foreach (var d in dat)
55 | {
56 | RadioItem a = new RadioItem(d) { Margin = new Thickness(12, 0, 12, 20) };
57 | a.im.MouseDown += delegate { mw.GetRadio(a, null); };
58 | a.Width = RadioItemsList.ActualWidth / 5;
59 | RadioItemsList.Children.Add(a);
60 | }
61 | mw.WidthUI(RadioItemsList);
62 | mw.CloseLoading();
63 | await Task.Yield();
64 | RadioItemsList.Opacity = 1;
65 | mw.ContentAnimation(RadioItemsList);
66 | }
67 | }
68 |
69 | private void UserControl_Loaded(object sender, RoutedEventArgs e)
70 | {
71 | Load();
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/LemonApp/ContentPage/TopPage.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/LemonApp/ContentPage/TopPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using LemonLib;
2 | using System.Threading.Tasks;
3 | using System.Windows;
4 | using System.Windows.Controls;
5 |
6 | namespace LemonApp.ContentPage
7 | {
8 | ///
9 | /// TopPage.xaml 的交互逻辑
10 | ///
11 | public partial class TopPage : UserControl
12 | {
13 | private MainWindow mw;
14 | public TopPage(MainWindow Context)
15 | {
16 | InitializeComponent();
17 | mw = Context;
18 | SizeChanged += delegate
19 | {
20 | mw.WidthUI(topIndexList);
21 | };
22 | }
23 | public async void LoadTopData()
24 | {
25 | mw.OpenLoading();
26 | var dt = await MusicLib.GetTopIndexAsync();
27 | topIndexList.Opacity = 0;
28 | topIndexList.Children.Clear();
29 | foreach (var d in dt)
30 | {
31 | var top = new TopControl(d);
32 | top.t.MouseDown += delegate
33 | {
34 | mw.GetTopItems(top);
35 | };
36 | top.Margin = new Thickness(10, 0, 10, 20);
37 | topIndexList.Children.Add(top);
38 | }
39 | await Task.Yield();
40 | mw.CloseLoading();
41 | mw.WidthUI(topIndexList);
42 | topIndexList.Opacity = 1;
43 | mw.ContentAnimation(topIndexList);
44 | }
45 | private void UserControl_Loaded(object sender, RoutedEventArgs e)
46 | {
47 | LoadTopData();
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/LemonApp/ContentPage/TranslationAir.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/LemonApp/ContentPage/TranslationAir.xaml.cs:
--------------------------------------------------------------------------------
1 | using LemonLib;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Shapes;
15 |
16 | namespace LemonApp
17 | {
18 | ///
19 | /// TranslationAir.xaml 的交互逻辑
20 | ///
21 | public partial class TranslationAir : UserControl
22 | {
23 | public TranslationAir()
24 | {
25 | InitializeComponent();
26 | this.Loaded += delegate {
27 | mp.MediaEnded += delegate{ mp.Close(); };
28 | };
29 | }
30 | private async void MDButton_MouseDown(object sender, MouseButtonEventArgs e)
31 | {
32 | if (!String.IsNullOrEmpty(text.Text))
33 | {
34 | result.Text = "";
35 | result.Text = await TranslateAirHelper.GetSug(text.Text);
36 | }
37 | }
38 | MediaPlayer mp = new MediaPlayer();
39 | private async void SpeechButton_MouseDown(object sender, MouseButtonEventArgs e)
40 | {
41 | if (!String.IsNullOrEmpty(text.Text)) {
42 | string path = await TranslateAirHelper.Speech(text.Text);
43 | mp.Open(new Uri(path, UriKind.Absolute));
44 | mp.Play();
45 | }
46 | }
47 | public void UpdateText(string tx) {
48 | text.Text = tx;
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/BottomTick.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/BottomTick.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 | using System.Windows.Input;
4 | using System.Windows.Media;
5 |
6 | namespace LemonApp
7 | {
8 | ///
9 | /// BottomTick.xaml 的交互逻辑
10 | ///
11 | public partial class BottomTick : UserControl
12 | {
13 | public BottomTick()
14 | {
15 | InitializeComponent();
16 | if (BtD.LastBt == null)
17 | BtD.LastBt = this;
18 | }
19 | private bool isChecked = false;
20 | public bool IsChecked
21 | {
22 | get => isChecked; set
23 | {
24 | isChecked = value;
25 | Check(isChecked);
26 | }
27 | }
28 | private bool hasBg = false;
29 | public bool HasBg
30 | {
31 | get => hasBg; set
32 | {
33 | hasBg = value;
34 | if (!isChecked)
35 | {
36 | if (hasBg)
37 | tb.Foreground = new SolidColorBrush(Colors.White);
38 | else tb.SetResourceReference(ForegroundProperty, "ResuColorBrush");
39 | }
40 | }
41 | }
42 | public string Text { get => tb.Text; set => tb.Text = value; }
43 | private void UserControl_MouseEnter(object sender, MouseEventArgs e)
44 | {
45 | tb.SetResourceReference(ForegroundProperty, "ThemeColor");
46 | }
47 |
48 | private void UserControl_MouseLeave(object sender, MouseEventArgs e)
49 | {
50 | if (!IsChecked)
51 | {
52 | if (hasBg)
53 | tb.Foreground = new SolidColorBrush(Colors.White);
54 | else tb.SetResourceReference(ForegroundProperty, "ResuColorBrush");
55 | }
56 | }
57 |
58 | private void UserControl_MouseDown(object sender, MouseButtonEventArgs e)
59 | {
60 | BtD.LastBt?.Check(false);
61 | Check(true);
62 | BtD.LastBt = this;
63 | }
64 |
65 | public void Check(bool h)
66 | {
67 | if (h)
68 | {
69 | tb.SetResourceReference(ForegroundProperty, "ThemeColor");
70 | bt.Visibility = Visibility.Visible;
71 | }
72 | else
73 | {
74 | if (hasBg)
75 | tb.Foreground = new SolidColorBrush(Colors.White);
76 | else tb.SetResourceReference(ForegroundProperty, "ResuColorBrush");
77 | bt.Visibility = Visibility.Collapsed;
78 | }
79 | isChecked = h;
80 | }
81 | }
82 | public class BtD
83 | {
84 | public static BottomTick LastBt;
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/CannotPlay.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/CannotPlay.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.Windows;
3 | using System.Windows.Input;
4 |
5 | namespace LemonApp
6 | {
7 | ///
8 | /// CannotPlay.xaml 的交互逻辑
9 | ///
10 | public partial class CannotPlay : Window
11 | {
12 | public CannotPlay()
13 | {
14 | InitializeComponent();
15 | }
16 |
17 | private void Border_MouseDown(object sender, MouseButtonEventArgs e)
18 | {
19 | Close();
20 | }
21 |
22 | private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
23 | {
24 | if (e.LeftButton == MouseButtonState.Pressed)
25 | DragMove();
26 | }
27 |
28 | private void Run_MouseDown(object sender, MouseButtonEventArgs e)
29 | {
30 | Process.Start("https://github.com/TwilightLemon/Lemon-App/issues");
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/DataItem.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/DownloadItem.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/DownloadItem.xaml.cs:
--------------------------------------------------------------------------------
1 | using LemonLib;
2 | using System.Windows;
3 | using System.Windows.Controls;
4 | using static LemonLib.InfoHelper;
5 |
6 | namespace LemonApp
7 | {
8 | ///
9 | /// DownloadItem.xaml 的交互逻辑
10 | ///
11 | public partial class DownloadItem : UserControl
12 | {
13 | public delegate void en(DownloadItem s);
14 | public event en Delete;
15 | public event en Finished;
16 | public bool finished = false;
17 | private int index = 0;
18 | public DownloadItem(Music m, string downloadpath, int id)
19 | {
20 | InitializeComponent();
21 | MData = m;
22 | path = downloadpath;
23 | MouseEnter += UserControl_MouseEnter;
24 | MouseLeave += UserControl_MouseLeave;
25 | index = id;
26 | Load();
27 | }
28 | private void Load()
29 | {
30 | tb.Text = MData.MusicName + " - " + MData.SingerText;
31 | d = new HttpDownloadHelper(MData, path);
32 | d.ProgressChanged += (pro) =>
33 | {
34 | Dispatcher.Invoke(() =>
35 | {
36 | Pb.Value = pro;
37 | zt.Text = pro + "%";
38 | });
39 | };
40 | d.Finished += async () =>
41 | {
42 | if (Settings.USettings.DownloadWithLyric)
43 | {
44 | try
45 | {
46 | await MusicLib.GetLyric(MData.MusicID, path+ ".lrc");
47 | }
48 | catch { }
49 | }
50 |
51 | Dispatcher.Invoke(() =>
52 | {
53 | Finished(this);
54 | finished = true;
55 | zt.Text = "已完成";
56 | });
57 | };
58 | d.GetSize += (s) =>
59 | {
60 | Dispatcher.Invoke(() =>
61 | {
62 | size.Text = s;
63 | });
64 | };
65 | d.Fail += () =>
66 | {
67 | Dispatcher.Invoke(() =>
68 | {
69 | Finished(this);
70 | finished = true;
71 | zt.Text = "找不到下载源";
72 | });
73 | };
74 | if (index == 0)
75 | d.Download();
76 | }
77 | public HttpDownloadHelper d;
78 | public Music MData;
79 | public string path;
80 |
81 | private void Pb_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
82 | {
83 | if (zt.Text != "等待下载")
84 | {
85 | if (d.Downloading)
86 | {
87 | d.Pause();
88 | zt.Text = "已暂停";
89 | }
90 | else
91 | {
92 | d.Start();
93 | zt.Text = "已开始";
94 | }
95 | }
96 | }
97 |
98 | private void UserControl_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
99 | {
100 | DeleteBtn.Visibility = Visibility.Visible;
101 | }
102 |
103 | private void UserControl_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
104 | {
105 | DeleteBtn.Visibility = Visibility.Collapsed;
106 | }
107 |
108 | private void DeleteBtn_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
109 | {
110 | Finished(this);
111 | Delete(this);
112 | }
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/FLGDIndexItem.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/HotKeyChooser.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/HotKeyChooser.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 | using System.Windows.Input;
3 |
4 | namespace LemonApp
5 | {
6 | ///
7 | /// HotKeyChooser.xaml 的交互逻辑
8 | ///
9 | public partial class HotKeyChooser : UserControl
10 | {
11 | public HotKeyChooser()
12 | {
13 | InitializeComponent();
14 | }
15 | public int KeyId { get; set; }
16 | public Key key
17 | {
18 | get => (Key)tKey.Tag;
19 | set
20 | {
21 | tKey.Tag = value;
22 | tKey.Text = value.ToString();
23 | }
24 | }
25 | public int MainKey
26 | {
27 | get
28 | {
29 | return int.Parse((mainKey.SelectedItem as ComboBoxItem).Uid);
30 | }
31 | }
32 | public int index { get => mainKey.SelectedIndex; set => mainKey.SelectedIndex = value; }
33 | public string desc { get => des.Text; set => des.Text = value; }
34 | private void TextBox_KeyDown(object sender, KeyEventArgs e)
35 | {
36 | TextBox textBox = sender as TextBox;
37 | textBox.Text = e.Key.ToString();
38 | textBox.Tag = e.Key;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/LyricView.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/MDButton.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/MDButton.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 | using System.Windows.Input;
4 | using System.Windows.Media;
5 |
6 | namespace LemonApp
7 | {
8 | ///
9 | /// MDButton.xaml 的交互逻辑
10 | ///
11 | public partial class MDButton : UserControl
12 | {
13 | public MDButton()
14 | {
15 | InitializeComponent();
16 | theme = 0;
17 | }
18 | private int theme = 0;
19 | public int Theme
20 | {
21 | get => theme; set
22 | {
23 | theme = value;
24 | if (theme == 0)
25 | {
26 | bd.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#19000000"));
27 | tb.SetResourceReference(ForegroundProperty, "ResuColorBrush");
28 | }
29 | else if (theme == 1)
30 | {
31 | bd.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#19FFFFFF"));
32 | tb.Foreground = new SolidColorBrush(Colors.White);
33 | }
34 | else if (theme == 2)
35 | {
36 | bd.SetResourceReference(BackgroundProperty, "ThemeColor");
37 | tb.Foreground = new SolidColorBrush(Colors.White);
38 | }
39 | }
40 | }
41 | public string TName { get => tb.Text; set => tb.Text = value; }
42 | public CornerRadius cr { get => bd.CornerRadius; set => bd.CornerRadius = value; }
43 | public Geometry pData
44 | {
45 | get => p.Data; set
46 | {
47 | p.Data = value;
48 | if (value == null)
49 | tb.Margin = new Thickness(10, 0, 10, 0);
50 | else tb.Margin = new Thickness(30, 0, 0, 0);
51 | }
52 | }
53 | private void UserControl_MouseEnter(object sender, MouseEventArgs e)
54 | {
55 | cg.Visibility = Visibility.Visible;
56 | }
57 |
58 | private void UserControl_MouseLeave(object sender, MouseEventArgs e)
59 | {
60 | cg.Visibility = Visibility.Collapsed;
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/MVItem.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/MVItem.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 | using System.Windows.Media;
3 | using static LemonLib.InfoHelper;
4 |
5 | namespace LemonApp
6 | {
7 | ///
8 | /// MVItem.xaml 的交互逻辑
9 | ///
10 | public partial class MVItem : UserControl
11 | {
12 | public MVItem()
13 | {
14 | InitializeComponent();
15 | RenderOptions.SetBitmapScalingMode(this, BitmapScalingMode.LowQuality);
16 | }
17 | private MVData mData;
18 | public MVData Data
19 | {
20 | get => mData; set
21 | {
22 | mData = value;
23 | Update();
24 | }
25 | }
26 | private async void Update()
27 | {
28 | img.Background = new ImageBrush(await LemonLib.ImageCacheHelper.GetImageByUrl(mData.img, new int[2] { 150, 200 }));
29 | tit.Text = mData.name;
30 | bfCount.Text = mData.lstCount;
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/MainMeumItem.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/MainMeumItem.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 | using System.Windows.Media;
4 |
5 | namespace LemonApp.ControlItems
6 | {
7 | ///
8 | /// MainMeumItem.xaml 的交互逻辑
9 | ///
10 | public partial class MainMeumItem : UserControl
11 | {
12 | public MainMeumItem()
13 | {
14 | InitializeComponent();
15 | MouseEnter += delegate
16 | {
17 | FocusMask.Visibility = Visibility.Visible;
18 | };
19 | MouseLeave += delegate
20 | {
21 | if (!_hasChecked)
22 | FocusMask.Visibility = Visibility.Collapsed;
23 | };
24 | }
25 |
26 | public bool isWorking
27 | {
28 | get => Working.Visibility == Visibility.Visible;
29 | set => Working.Visibility = value ? Visibility.Visible : Visibility.Collapsed;
30 | }
31 | bool _hasChecked = false;
32 | public bool HasChecked
33 | {
34 | get => _hasChecked;
35 | set
36 | {
37 | _hasChecked = value;
38 | if (value)
39 | {
40 | FocusMask.Visibility = Visibility.Visible;
41 | //titBtn.SetResourceReference(ForegroundProperty, "ThemeColor");
42 | }
43 | else
44 | {
45 | FocusMask.Visibility = Visibility.Collapsed;
46 | // titBtn.SetResourceReference(ForegroundProperty, "ResuTextColor");
47 | }
48 | }
49 | }
50 | public Geometry PathData { get => path.Data; set => path.Data = value; }
51 | public string TitleContent { get => titBtn.Text; set => titBtn.Text = value; }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/MeumItem.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/MeumItem.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 | using System.Windows.Media;
3 |
4 | namespace LemonApp
5 | {
6 | ///
7 | /// MeumItem.xaml 的交互逻辑
8 | ///
9 | public partial class MeumItem : UserControl
10 | {
11 | public MeumItem()
12 | {
13 | InitializeComponent();
14 | }
15 | public string Text { get => tb.Text; set => tb.Text = value; }
16 | public Geometry Icon { get => icon.Data; set => icon.Data = value; }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/MyScrollViewer.cs:
--------------------------------------------------------------------------------
1 | using LemonLib;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Diagnostics;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Input;
8 | using System.Windows.Media.Animation;
9 |
10 | namespace LemonApp
11 | {
12 | ///
13 | /// 全局ScrollViewer 行为 滚动
14 | ///
15 | public class MyScrollViewer : ScrollViewer
16 | {
17 | public MyScrollViewer()
18 | {
19 | this.FocusVisualStyle = null;
20 | this.PreviewMouseUp += MyScrollView_PreviewMouseUp;
21 | this.PanningMode= PanningMode.VerticalOnly;
22 | this.SnapsToDevicePixels = true;
23 | }
24 |
25 | private void MyScrollView_PreviewMouseUp(object sender, MouseButtonEventArgs e)
26 | {
27 | //响应鼠标操作: 手动滑动滚动条的时候更新位置
28 | LastLocation = VerticalOffset;
29 | }
30 |
31 | public double LastLocation = 0;
32 | public new void ScrollToVerticalOffset(double offset)
33 | {
34 | if (Settings.USettings.Animation_Scroll)
35 | {
36 | AnimateScroll(offset);
37 | LastLocation = offset;
38 | }
39 | else
40 | {
41 | base.ScrollToVerticalOffset(offset);
42 | }
43 | }
44 | protected override void OnMouseWheel(MouseWheelEventArgs e)
45 | {
46 | if (Settings.USettings.Animation_Scroll)
47 | {
48 | double newOffset = LastLocation - e.Delta;
49 | base.ScrollToVerticalOffset(LastLocation);
50 | if (newOffset < 0)
51 | newOffset = 0;
52 | if (newOffset > ScrollableHeight)
53 | newOffset = ScrollableHeight;
54 | AnimateScroll(newOffset);
55 | LastLocation = newOffset;
56 | e.Handled = true;
57 | }
58 | else base.OnMouseWheel(e);
59 | }
60 |
61 | private void AnimateScroll(double ToValue)
62 | {
63 | BeginAnimation(UIHelper.ScrollViewerBehavior.VerticalOffsetProperty, null);
64 | DoubleAnimation Animation = new DoubleAnimation();
65 | Animation.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut };
66 | Animation.From = VerticalOffset;
67 | Animation.To = ToValue;
68 | Animation.Duration = TimeSpan.FromMilliseconds(300);
69 | //Timeline.SetDesiredFrameRate(Animation, 40);
70 | BeginAnimation(UIHelper.ScrollViewerBehavior.VerticalOffsetProperty, Animation);
71 | }
72 | }
73 | }
--------------------------------------------------------------------------------
/LemonApp/ControlItems/PlControl.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/PlControl.xaml.cs:
--------------------------------------------------------------------------------
1 | using LemonLib;
2 | using System;
3 | using System.Windows.Controls;
4 | using System.Windows.Input;
5 | using System.Windows.Media;
6 | using System.Windows.Media.Imaging;
7 | using System.Windows.Shapes;
8 | using static LemonLib.InfoHelper;
9 |
10 | namespace LemonApp
11 | {
12 | ///
13 | /// PlControl.xaml 的交互逻辑
14 | ///
15 | public partial class PlControl : UserControl
16 | {
17 | public MusicPL data;
18 | public bool couldpraise = true;
19 | public PlControl(MusicPL dt)
20 | {
21 | InitializeComponent();
22 | RenderOptions.SetBitmapScalingMode(this, BitmapScalingMode.LowQuality);
23 | data = dt;
24 | Image.Background = new ImageBrush(new BitmapImage(new Uri(dt.img)));
25 | name.Text = dt.name;
26 | Te.Text = dt.text;
27 | time.Text = dt.time;
28 | ztb.Text = dt.like;
29 | if (dt.ispraise) zp.SetResourceReference(Shape.FillProperty, "ThemeColor");
30 | Loaded += delegate { Height = a.ActualHeight + 35; };
31 | }
32 |
33 | private async void Border_MouseDown(object sender, MouseButtonEventArgs e)
34 | {
35 | if (couldpraise)
36 | if (data.ispraise)
37 | {
38 | zp.SetResourceReference(Shape.FillProperty, "PlayDLPage_Font_Low");
39 | ztb.Text = (int.Parse(data.like) - 1).ToString();
40 | data.like = ztb.Text;
41 | Console.WriteLine(await MusicLib.PraiseMusicPLAsync(Settings.USettings.Playing.MusicID, data));
42 | }
43 | else
44 | {
45 | zp.SetResourceReference(Shape.FillProperty, "ThemeColor");
46 | ztb.Text = (int.Parse(data.like) + 1).ToString();
47 | data.like = ztb.Text;
48 | Console.WriteLine(await MusicLib.PraiseMusicPLAsync(Settings.USettings.Playing.MusicID, data));
49 | }
50 | }
51 |
52 | private void UserControl_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
53 | {
54 | Height = cons.ActualHeight + 72;
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/PlayDLItem.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/PlayDLItem.xaml.cs:
--------------------------------------------------------------------------------
1 | using LemonLib;
2 | using System;
3 | using System.Windows;
4 | using System.Windows.Controls;
5 | using System.Windows.Media;
6 | using static LemonLib.InfoHelper;
7 |
8 | namespace LemonApp
9 | {
10 | ///
11 | /// PlayDLItem.xaml 的交互逻辑
12 | ///
13 | public partial class PlayDLItem : UserControl
14 | {
15 | public Music Data;
16 | public PlayDLItem(Music m)
17 | {
18 | InitializeComponent();
19 | Data = m;
20 | SingerName.Text = m.SingerText;
21 | MusicName.Text = m.MusicName;
22 | Width = 300;
23 | var DeleteBtn = new TitlePageBtn() { Visibility = Visibility.Collapsed, Pathness = new Thickness(0), Height = 15, Width = 15, HorizontalAlignment = HorizontalAlignment.Right, Margin = new Thickness(0, 0, 20, 0), PathData = Geometry.Parse("M880,240L704,240 704,176C704,123.2,660.8,80,608,80L416,80C363.2,80,320,123.2,320,176L320,240 144,240C126.4,240 112,254.4 112,272 112,289.6 126.4,304 144,304L192,304 192,816C192,886.4,249.6,944,320,944L704,944C774.4,944,832,886.4,832,816L832,304 880,304C897.6,304 912,289.6 912,272 912,254.4 897.6,240 880,240z M384,176C384,158.4,398.4,144,416,144L608,144C625.6,144,640,158.4,640,176L640,240 384,240 384,176z M768,816C768,851.2,739.2,880,704,880L320,880C284.8,880,256,851.2,256,816L256,304 768,304 768,816z M416 432c-17.6 0-32 14.4-32 32v256c0 17.6 14.4 32 32 32s32-14.4 32-32V464c0-17.6-14.4-32-32-32zM608 432c-17.6 0-32 14.4-32 32v256c0 17.6 14.4 32 32 32s32-14.4 32-32V464c0-17.6-14.4-32-32-32z") };
24 | DeleteBtn.MouseDown += delegate
25 | {
26 | Delete(this);
27 | };
28 | grid.Children.Add(DeleteBtn);
29 | MouseEnter += delegate
30 | {
31 | if (AppConstants.TouchDown) return;
32 | DeleteBtn.Visibility = Visibility.Visible;
33 | };
34 | MouseLeave += delegate
35 | {
36 | DeleteBtn.Visibility = Visibility.Collapsed;
37 | };
38 | }
39 | public static Action Delete;
40 | public PlayDLItem(Music m, bool NeedImg)
41 | {
42 | InitializeComponent();
43 | RenderOptions.SetBitmapScalingMode(this, BitmapScalingMode.LowQuality);
44 | Loaded += async delegate
45 | {
46 | if (NeedImg)
47 | {
48 | img.Visibility = Visibility.Visible;
49 | SingerName.Margin = new Thickness(66, 32, 10, 0);
50 | MusicName.Margin = new Thickness(66, 12, 10, 0);
51 | img.Background = new ImageBrush(await ImageCacheHelper.GetImageByUrl(await MusicLib.GetCoverImgUrl(Data), new int[2] { 100, 100 }));
52 | }
53 | };
54 | Data = m;
55 | SingerName.Text = m.SingerText;
56 | MusicName.Text = m.MusicName;
57 | }
58 | public void p(bool isp)
59 | {
60 | PD.LastPD.v(false);
61 | v(isp);
62 | }
63 | public bool pv;
64 | private void v(bool isp)
65 | {
66 | pv = isp;
67 | if (isp)
68 | {
69 | bk.Visibility = Visibility.Visible;
70 | MusicName.SetResourceReference(ForegroundProperty, "ThemeColor");
71 | SingerName.SetResourceReference(ForegroundProperty, "ThemeColor");
72 |
73 | }
74 | else
75 | {
76 | bk.Visibility = Visibility.Collapsed;
77 | MusicName.SetResourceReference(ForegroundProperty, "PlayDLPage_Font_Most");
78 | SingerName.SetResourceReference(ForegroundProperty, "PlayDLPage_Font_Low");
79 | }
80 | PD.LastPD = this;
81 | }
82 | }
83 |
84 | public class PD
85 | {
86 | public static PlayDLItem LastPD = new PlayDLItem(new Music());
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/RadioItem.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/RadioItem.xaml.cs:
--------------------------------------------------------------------------------
1 | using LemonLib;
2 | using System.Windows;
3 | using System.Windows.Controls;
4 | using System.Windows.Media;
5 | using static LemonLib.InfoHelper;
6 |
7 | namespace LemonApp
8 | {
9 | ///
10 | /// RadioItem.xaml 的交互逻辑
11 | ///
12 | public partial class RadioItem : UserControl
13 | {
14 | public MusicRadioListItem data = new MusicRadioListItem();
15 | public RadioItem(MusicRadioListItem da)
16 | {
17 | InitializeComponent();
18 | RenderOptions.SetBitmapScalingMode(this, BitmapScalingMode.LowQuality);
19 | data = da;
20 | this.name.Text = data.Name;
21 | Loaded += async delegate
22 | {
23 | Height = ActualWidth + 40;
24 | listenCount.Text = data.lstCount.IntToWn();
25 | im.Background = new ImageBrush(await ImageCacheHelper.GetImageByUrl(data.Photo, new int[2] { 200, 200 }));
26 | };
27 | MouseEnter += delegate
28 | {
29 | AddToQGT.Visibility = Visibility.Visible;
30 | };
31 | MouseLeave += delegate
32 | {
33 | AddToQGT.Visibility = Visibility.Collapsed;
34 | };
35 | AddToQGT.MouseDown += delegate
36 | {
37 | UIHelper.GetAncestor(this).AddToQGT(new InfoHelper.QuickGoToData()
38 | {
39 | type = "Radio",
40 | id = data.ID,
41 | name = data.Name,
42 | imgurl = data.Photo
43 | });
44 | };
45 | }
46 | public RadioItem(string ID)
47 | {
48 | data.ID = ID;
49 | }
50 |
51 | private void UserControl_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
52 | {
53 | Height = Height = ActualWidth + 40;
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/Ran.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Documents;
2 |
3 | namespace LemonApp
4 | {
5 | public class Ran : Run
6 | {
7 | public object data { get; set; }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/RbBox.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/RbBox.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 | using System.Windows.Input;
3 | using System.Windows.Media;
4 |
5 | namespace LemonApp
6 | {
7 | ///
8 | /// RbBox.xaml 的交互逻辑
9 | ///
10 | public partial class RbBox : UserControl
11 | {
12 | public RbBox()
13 | {
14 | InitializeComponent();
15 | }
16 | public delegate void Cked(RbBox sender);
17 | public event Cked Checked;
18 | public string ContentText
19 | {
20 | get => tb.Text;
21 | set => tb.Text = value;
22 | }
23 | public bool IsChecked = false;
24 | public string Data { get; set; } = "";
25 | private void Border_MouseEnter(object sender, MouseEventArgs e)
26 | {
27 | if (!IsChecked)
28 | tb.SetResourceReference(ForegroundProperty, "ThemeColor");
29 | }
30 |
31 | private void Bg_MouseLeave(object sender, MouseEventArgs e)
32 | {
33 | if (!IsChecked)
34 | tb.SetResourceReference(ForegroundProperty, "ResuColorBrush");
35 | }
36 | public void Check(bool set)
37 | {
38 | if (set)
39 | {
40 | IsChecked = true;
41 | bg.SetResourceReference(BackgroundProperty, "ThemeColor");
42 | tb.Foreground = new SolidColorBrush(Colors.White);
43 | }
44 | else
45 | {
46 | IsChecked = false;
47 | bg.Background = new SolidColorBrush(Colors.Transparent);
48 | tb.SetResourceReference(ForegroundProperty, "ResuColorBrush");
49 | }
50 | }
51 |
52 | private void Bg_MouseDown(object sender, MouseButtonEventArgs e)
53 | {
54 | if (IsChecked)
55 | {
56 | IsChecked = false;
57 | bg.Background = new SolidColorBrush(Colors.Transparent);
58 | tb.SetResourceReference(ForegroundProperty, "ResuColorBrush");
59 | }
60 | else
61 | {
62 | IsChecked = true;
63 | bg.SetResourceReference(BackgroundProperty, "ThemeColor");
64 | tb.Foreground = new SolidColorBrush(Colors.White);
65 | }
66 | Checked(this);
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/SingerItem.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/SingerItem.xaml.cs:
--------------------------------------------------------------------------------
1 | using LemonLib;
2 | using System;
3 | using System.Windows;
4 | using System.Windows.Controls;
5 | using System.Windows.Media;
6 | using static LemonLib.InfoHelper;
7 |
8 | namespace LemonApp
9 | {
10 | ///
11 | /// SingerItem.xaml 的交互逻辑
12 | ///
13 | public partial class SingerItem : UserControl
14 | {
15 | public MusicSinger data { get; set; }
16 | public SingerItem(MusicSinger dt)
17 | {
18 | InitializeComponent();
19 | RenderOptions.SetBitmapScalingMode(this, BitmapScalingMode.LowQuality);
20 | data = dt;
21 | name.Text = dt.Name;
22 | Loaded += async delegate
23 | {
24 | Height = Height = ActualWidth + 45;
25 | try
26 | {
27 | im.Background = new ImageBrush(await ImageCacheHelper.GetImageByUrl(dt.Photo, new int[2] { 250, 250 }));
28 | }
29 | catch
30 | {
31 | im.Background = new ImageBrush(await ImageCacheHelper.GetImageByUrl("https://y.gtimg.cn/mediastyle/global/img/singer_300.png?max_age=31536000", new int[2] { 250, 250 }));
32 | }
33 | };
34 | MouseEnter += delegate
35 | {
36 | AddToQGT.Visibility = Visibility.Visible;
37 | };
38 | MouseLeave += delegate
39 | {
40 | AddToQGT.Visibility = Visibility.Collapsed;
41 | };
42 | AddToQGT.MouseDown += delegate
43 | {
44 | UIHelper.GetAncestor(this).AddToQGT(new InfoHelper.QuickGoToData()
45 | {
46 | type = "Singer",
47 | id = data.Mid,
48 | name = data.Name,
49 | imgurl = data.Photo
50 | });
51 | };
52 | }
53 | public MusicSinger mData
54 | {
55 | get => data; set
56 | {
57 | data = value;
58 | new Action(async () =>
59 | {
60 | try
61 | {
62 | im.Background = new ImageBrush(await ImageCacheHelper.GetImageByUrl(data.Photo, new int[2] { 250, 250 }));
63 | }
64 | catch
65 | {
66 | im.Background = new ImageBrush(await ImageCacheHelper.GetImageByUrl("https://y.gtimg.cn/mediastyle/global/img/singer_300.png?max_age=31536000", new int[2] { 250, 250 }));
67 | }
68 | })();
69 | }
70 | }
71 | public SingerItem()
72 | {
73 | InitializeComponent();
74 | }
75 |
76 | private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
77 | {
78 | Height = Height = ActualWidth + 45;
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/SkinControl.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/SkinControl.xaml.cs:
--------------------------------------------------------------------------------
1 | using LemonLib;
2 | using System;
3 | using System.Windows.Controls;
4 | using System.Windows.Media;
5 | using System.Windows.Media.Imaging;
6 |
7 | namespace LemonApp
8 | {
9 | ///
10 | /// SkinControl.xaml 的交互逻辑
11 | ///
12 | public partial class SkinControl : UserControl
13 | {
14 | public string imgurl;
15 | public Color theme;
16 | public string txtColor;
17 | public SkinControl(string imgurl, string name, Color themecolor)
18 | {
19 | InitializeComponent();
20 | this.imgurl = imgurl;
21 | theme = themecolor;
22 | if (imgurl == "-2")
23 | img.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF2D2D30"));
24 | else if (imgurl == "-3")
25 | img.Background = new SolidColorBrush(Color.FromArgb(255, 240, 240, 240));
26 | else if (imgurl != "-1")
27 | img.Background = new ImageBrush(new BitmapImage(new Uri(System.IO.Path.Combine(Settings.USettings.MusicCachePath , "Skin" , imgurl + ".jpg"), UriKind.Absolute)));
28 | this.name.Text = name;
29 | }
30 | public SkinControl(string name, Brush image, Color themecolor)
31 | {
32 | InitializeComponent();
33 | this.name.Text = name;
34 | img.Background = image;
35 | theme = themecolor;
36 | }
37 |
38 | private void UserControl_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
39 | {
40 | Height = Width - 50;
41 | img.Height = Height - 30;
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/TitlePageBtn.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/TitlePageBtn.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 | using System.Windows.Input;
4 | using System.Windows.Media;
5 | using System.Windows.Shapes;
6 |
7 | namespace LemonApp
8 | {
9 | ///
10 | /// TitlePageBtn.xaml 的交互逻辑
11 | ///
12 | public partial class TitlePageBtn : UserControl
13 | {
14 | public TitlePageBtn()
15 | {
16 | InitializeComponent();
17 | }
18 | public Brush ColorDx
19 | {
20 | get => path.Fill; set
21 | {
22 | path.Fill = value;
23 | if (value == null)
24 | {
25 | path.SetResourceReference(Shape.FillProperty, "ResuColorBrush");
26 | }
27 | }
28 | }
29 | public Geometry PathData { get => path.Data; set => path.Data = value; }
30 | public Thickness Pathness { get => path.Margin; set => path.Margin = value; }
31 |
32 | private void UserControl_MouseEnter(object sender, MouseEventArgs e)
33 | {
34 | Mask.Visibility = Visibility.Visible;
35 | }
36 |
37 | private void UserControl_MouseLeave(object sender, MouseEventArgs e)
38 | {
39 | Mask.Visibility = Visibility.Collapsed;
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/TopControl.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/TopControl.xaml.cs:
--------------------------------------------------------------------------------
1 | using LemonLib;
2 | using System.Windows;
3 | using System.Windows.Controls;
4 | using System.Windows.Media;
5 | using static LemonLib.InfoHelper;
6 |
7 | namespace LemonApp
8 | {
9 | ///
10 | /// TopControl.xaml 的交互逻辑
11 | ///
12 | public partial class TopControl : UserControl
13 | {
14 | public MusicTop Data;
15 | public TopControl(MusicTop mp)
16 | {
17 | InitializeComponent();
18 | RenderOptions.SetBitmapScalingMode(this, BitmapScalingMode.LowQuality);
19 | Loaded += TopControl_Loaded;
20 | Data = mp;
21 | }
22 |
23 | private async void TopControl_Loaded(object sender, RoutedEventArgs e)
24 | {
25 | im.Background = new ImageBrush(await ImageCacheHelper.GetImageByUrl(Data.Photo, new int[2] { 127, 127 }));
26 | title.Text = Data.Name;
27 | c1.Text = Data.content[0];
28 | c2.Text = Data.content[1];
29 | c3.Text = Data.content[2];
30 | MouseEnter += delegate
31 | {
32 | AddToQGT.Visibility = Visibility.Visible;
33 | };
34 | MouseLeave += delegate
35 | {
36 | AddToQGT.Visibility = Visibility.Collapsed;
37 | };
38 | AddToQGT.MouseDown += delegate
39 | {
40 | UIHelper.GetAncestor(this).AddToQGT(new InfoHelper.QuickGoToData()
41 | {
42 | type = "TopList",
43 | id = Data.ID,
44 | name = Data.Name,
45 | imgurl = Data.Photo
46 | });
47 | };
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/LemonApp/ControlItems/TwMessageBox.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/TwMessageBox.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using System.Windows;
4 | using System.Windows.Input;
5 | using System.Windows.Media;
6 |
7 | namespace LemonApp
8 | {
9 | ///
10 | /// TwMessageBox.xaml 的交互逻辑
11 | ///
12 | public partial class TwMessageBox : Window
13 | {
14 | public static bool Show(string tb)
15 | {
16 | return (bool)new TwMessageBox(tb).ShowDialog();
17 | }
18 |
19 |
20 | public TwMessageBox(string tb)
21 | {
22 | InitializeComponent();
23 | title.Text = tb;
24 | }
25 | private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
26 | {
27 | if (e.LeftButton == MouseButtonState.Pressed)
28 | DragMove();
29 | }
30 | private void Border_MouseDown(object sender, MouseButtonEventArgs e)
31 | {
32 | DialogResult = false;
33 | Close();
34 | }
35 | private void Border_MouseDown_1(object sender, MouseButtonEventArgs e)
36 | {
37 | DialogResult = true;
38 | Close();
39 | }
40 |
41 | private void Window_Loaded(object sender, RoutedEventArgs e)
42 | {
43 | Background = null;
44 | WdBorder.BorderBrush = new SolidColorBrush(Color.FromRgb(180, 180, 180));
45 | title.Foreground = new SolidColorBrush(Color.FromRgb(75, 75, 75));
46 | candle.Theme = 0;
47 | WindowAccentCompositor wac = new WindowAccentCompositor(this, false, (c) =>
48 | {
49 | c.A = 255;
50 | Background = new SolidColorBrush(c);
51 | });
52 | wac.Color = App.BaseApp.ThemeColor == 0 ?
53 | Color.FromArgb(200, 255, 255, 255) :
54 | Color.FromArgb(200, 0, 0, 0);
55 | wac.IsEnabled = true;
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/LemonApp/ControlItems/UpdateBox.xaml.cs:
--------------------------------------------------------------------------------
1 | using LemonLib;
2 | using System;
3 | using System.Diagnostics;
4 | using System.IO;
5 | using System.IO.Compression;
6 | using System.Net;
7 | using System.Net.Http;
8 | using System.Threading.Tasks;
9 | using System.Windows;
10 | using System.Windows.Input;
11 |
12 | namespace LemonApp
13 | {
14 | ///
15 | /// MyMessageBox.xaml 的交互逻辑
16 | ///
17 | public partial class UpdateBox : Window
18 | {
19 | string _url;
20 | public UpdateBox(string ver, string des, string url)
21 | {
22 | InitializeComponent();
23 | _url = url;
24 | con.Text = "最新版:" + ver + "\r\n" +
25 | des.Replace("#", "\r\n#");
26 | }
27 |
28 | private void CloseBtn_MouseDown(object sender, MouseButtonEventArgs e)
29 | {
30 | Close();
31 | }
32 |
33 | private async void Border_MouseDown(object sender, MouseButtonEventArgs e)
34 | {
35 | con.Visibility = Visibility.Collapsed;
36 | btn.Visibility = Visibility.Collapsed;
37 | pro.Visibility = Visibility.Visible;
38 | tb.Text = "下载升级包中...";
39 | Height = 210;
40 | var xpath = Settings.USettings.DataCachePath + "win-release.zip";
41 | using var hc = new HttpClient(HttpHelper.GetSta());
42 | hc.DefaultRequestHeaders.TryAddWithoutValidation("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\"");
43 | hc.DefaultRequestHeaders.TryAddWithoutValidation("accept-language", "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6");
44 | hc.DefaultRequestHeaders.TryAddWithoutValidation("cache-control", "no-cache");
45 | hc.DefaultRequestHeaders.TryAddWithoutValidation("pragma", "no-cache");
46 | hc.DefaultRequestHeaders.TryAddWithoutValidation("sec-fetch-dest", "document");
47 | hc.DefaultRequestHeaders.TryAddWithoutValidation("sec-fetch-mode", "navigate");
48 | hc.DefaultRequestHeaders.TryAddWithoutValidation("sec-fetch-site", "none");
49 | hc.DefaultRequestHeaders.TryAddWithoutValidation("sec-fetch-user", "?1");
50 | hc.DefaultRequestHeaders.TryAddWithoutValidation("upgrade-insecure-requests", "1");
51 | hc.DefaultRequestHeaders.TryAddWithoutValidation("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36 Edg/84.0.522.44");
52 | tb.Text = "连接至服务器...";
53 | var response = await hc.GetAsync(_url);
54 | using Stream st = await response.Content.ReadAsStreamAsync();
55 | var length = (long)response.Content.Headers.ContentLength;
56 | int total = 0;
57 | using (var filestream = new FileStream(xpath, FileMode.Create, FileAccess.ReadWrite))
58 | {
59 | byte[] bArry = new byte[409600];
60 | int size = await st.ReadAsync(bArry);
61 | total += size;
62 | while (size > 0)
63 | {
64 | await filestream.WriteAsync(bArry.AsMemory(0, size));
65 | size = await st.ReadAsync(bArry);
66 | total += size;
67 | int process = (int)(total * 100 / length);
68 | pro.Value = process;
69 | }
70 | filestream.Close();
71 | }
72 | st.Close();
73 | //Finished
74 | tb.Text = "下载完成,解压升级包...";
75 | string file = Settings.USettings.DataCachePath + "win-release.exe";
76 | await Task.Run(() =>
77 | {
78 | ZipFile.ExtractToDirectory(xpath, Settings.USettings.DataCachePath, true);
79 | });
80 | tb.Text = "完成";
81 | Process.Start("explorer.exe", Settings.USettings.DataCachePath + "win-release.exe");
82 | }
83 |
84 | private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
85 | {
86 | if (e.LeftButton == MouseButtonState.Pressed)
87 | DragMove();
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/LemonApp/Dll/Microsoft.WindowsAPICodePack.Shell.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LemonCodeTeam/Lemon-App/132757389584c92ee79004a8b26fbc1400b2ea4d/LemonApp/Dll/Microsoft.WindowsAPICodePack.Shell.dll
--------------------------------------------------------------------------------
/LemonApp/Dll/Microsoft.WindowsAPICodePack.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LemonCodeTeam/Lemon-App/132757389584c92ee79004a8b26fbc1400b2ea4d/LemonApp/Dll/Microsoft.WindowsAPICodePack.dll
--------------------------------------------------------------------------------
/LemonApp/DwmAnimation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.InteropServices;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows.Interop;
8 | using System.Windows;
9 | using System.Windows.Threading;
10 | using System.Reflection;
11 |
12 | namespace LemonApp;
13 |
14 | public static class DwmAnimation
15 | {
16 |
17 | public static bool GetEnableDwmAnimation(DependencyObject obj)
18 | {
19 | return (bool)obj.GetValue(EnableDwmAnimationProperty);
20 | }
21 |
22 | public static void SetEnableDwmAnimation(DependencyObject obj, bool value)
23 | {
24 | obj.SetValue(EnableDwmAnimationProperty, value);
25 | }
26 |
27 | public static readonly DependencyProperty EnableDwmAnimationProperty =
28 | DependencyProperty.RegisterAttached("EnableDwmAnimation",
29 | typeof(bool), typeof(DwmAnimation),
30 | new PropertyMetadata(false,OnEnableDwmAnimationChanged));
31 |
32 | public static void OnEnableDwmAnimationChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
33 | {
34 | if (d is Window window)
35 | {
36 | if ((bool)e.NewValue)
37 | {
38 | if (window.IsLoaded)
39 | {
40 | EnableDwmAnimation(window);
41 | }
42 | else
43 | {
44 | window.SourceInitialized += Window_SourceInitialized;
45 | }
46 | }
47 | }
48 | }
49 |
50 | private static void Window_SourceInitialized(object? sender, EventArgs e)
51 | {
52 | if(sender is Window w)
53 | {
54 | EnableDwmAnimation(w);
55 | w.SourceInitialized -= Window_SourceInitialized;
56 | }
57 | }
58 |
59 | [DllImport("user32.dll", EntryPoint = "SetWindowLong")]
60 | private static extern int SetWindowLong32(HandleRef hWnd, int nIndex, int dwNewLong);
61 |
62 | [DllImport("user32.dll", EntryPoint = "SetWindowLongPtr")]
63 | private static extern IntPtr SetWindowLongPtr64(HandleRef hWnd, int nIndex, IntPtr dwNewLong);
64 |
65 | public const int GWL_STYLE = -16;
66 | public const long WS_CAPTION = 0x00C00000L,
67 | WS_MAXIMIZEBOX = 0x00010000L,
68 | WS_MINIMIZEBOX = 0x00020000L,
69 | WS_THICKFRAME = 0x00040000L,
70 | WS_OVERLAPPED= 0x00000000L,
71 | WS_SYSMENU= 0x00080000L,
72 | WS_BORDER= 0x00800000L;
73 |
74 | public static IntPtr SetWindowLongPtr(HandleRef hWnd, int nIndex, IntPtr dwNewLong)
75 | => IntPtr.Size == 8
76 | ? SetWindowLongPtr64(hWnd, nIndex, dwNewLong)
77 | : new IntPtr(SetWindowLong32(hWnd, nIndex, dwNewLong.ToInt32()));
78 | public static void EnableDwmAnimation(Window w)
79 | {
80 | var myHWND = new WindowInteropHelper(w).Handle;
81 | IntPtr myStyle = new(WS_CAPTION|WS_THICKFRAME|WS_MAXIMIZEBOX|WS_MINIMIZEBOX);
82 | if (w.ResizeMode == ResizeMode.NoResize||w.ResizeMode==ResizeMode.CanMinimize)
83 | {
84 | myStyle = new(WS_CAPTION | WS_MINIMIZEBOX);
85 | }
86 | SetWindowLongPtr(new HandleRef(null, myHWND), GWL_STYLE, myStyle);
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/LemonApp/LemonApp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net6.0-windows10.0.17763.0
6 | true
7 | true
8 | Resources\icon.ico
9 | Properties\app.manifest
10 | LemonApp.App
11 | LemonApp
12 | LemonApp
13 | 1.2.9.7
14 | TwilightLemon
15 |
16 |
17 |
18 | True
19 | AnyCPU
20 |
21 |
22 |
23 | True
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | Theme\LemonApp.Theme.dll
43 |
44 |
45 | Theme\LemonApp.Theme.Dtpp.dll
46 |
47 |
48 | Theme\LemonApp.Theme.FerrisWheel.dll
49 |
50 |
51 | Theme\LemonApp.Theme.TechDMusic.dll
52 |
53 |
54 | Theme\LemonApp.Theme.TheFirstSnow.dll
55 |
56 |
57 | Theme\LemonApp.Theme.YeStarLight.dll
58 |
59 |
60 | Dll\Microsoft.WindowsAPICodePack.dll
61 |
62 |
63 | Dll\Microsoft.WindowsAPICodePack.Shell.dll
64 |
65 |
66 |
67 |
68 |
69 | True
70 | True
71 | Resources.resx
72 |
73 |
74 |
75 |
76 |
77 | ResXFileCodeGenerator
78 | Resources.Designer.cs
79 |
80 |
81 |
--------------------------------------------------------------------------------
/LemonApp/LemonApp.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.5.002.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LemonApp", "LemonApp.csproj", "{09510ED2-D265-4EB0-B3B8-F94DE98B8251}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {09510ED2-D265-4EB0-B3B8-F94DE98B8251}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {09510ED2-D265-4EB0-B3B8-F94DE98B8251}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {09510ED2-D265-4EB0-B3B8-F94DE98B8251}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {09510ED2-D265-4EB0-B3B8-F94DE98B8251}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {01FAD714-B0F5-441C-AF06-53BB726FBC4A}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/LemonApp/LierdaCracker.cs:
--------------------------------------------------------------------------------
1 | using LemonLib;
2 | using Microsoft.Win32;
3 | using System;
4 | using System.Diagnostics;
5 | using System.Runtime.InteropServices;
6 | using System.Threading;
7 | using System.Threading.Tasks;
8 |
9 | namespace Lierda.WPFHelper
10 | {
11 | public class LierdaCracker
12 | {
13 | private void SetDate()
14 | {
15 | CreateKey();
16 | RegistryKey expr_0B = Registry.CurrentUser;
17 | RegistryKey expr_17 = expr_0B.OpenSubKey("SOFTWARE\\DevExpress\\Components", true);
18 | expr_17.GetValue("LastAboutShowedTime");
19 | string value = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss");
20 | expr_17.SetValue("LastAboutShowedTime", value);
21 | expr_0B.Dispose();
22 | }
23 |
24 | [DllImport("kernel32.dll")]
25 | private static extern bool SetProcessWorkingSetSize(IntPtr proc, int min, int max);
26 |
27 | private void FlushMemory()
28 | {
29 | GC.Collect();
30 | GC.WaitForPendingFinalizers();
31 | if (Environment.OSVersion.Platform == PlatformID.Win32NT)
32 | SetProcessWorkingSetSize(Process.GetCurrentProcess().Handle, -1, -1);
33 | }
34 |
35 | private void CreateKey()
36 | {
37 | RegistryKey currentUser = Registry.CurrentUser;
38 | if (currentUser.OpenSubKey("SOFTWARE\\DevExpress\\Components", true) == null)
39 | {
40 | RegistryKey expr_1F = currentUser.CreateSubKey("SOFTWARE\\DevExpress\\Components");
41 | expr_1F.CreateSubKey("LastAboutShowedTime").SetValue("LastAboutShowedTime", DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss"));
42 | expr_1F.CreateSubKey("DisableSmartTag").SetValue("LastAboutShowedTime", false);
43 | expr_1F.CreateSubKey("SmartTagWidth").SetValue("LastAboutShowedTime", 350);
44 | }
45 | currentUser.Dispose();
46 | }
47 | public void Cracker(int sleepSpan = 50)
48 | {
49 | _ = Task.Factory.StartNew(delegate
50 | {
51 | while (true)
52 | {
53 | try
54 | {
55 | if (Settings.USettings.MemoryFlush)
56 | {
57 | SetDate();
58 | FlushMemory();
59 | }
60 | Thread.Sleep(TimeSpan.FromSeconds((double)sleepSpan));
61 | }
62 | catch { }
63 | }
64 | });
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/LemonApp/Properties/PublishProfiles/FolderProfile.pubxml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 | Release
8 | Any CPU
9 | bin\Publish\x64\
10 | FileSystem
11 | <_TargetId>Folder
12 | net6.0-windows10.0.17763.0
13 | win-x64
14 | false
15 | false
16 | true
17 |
18 |
--------------------------------------------------------------------------------
/LemonApp/Properties/PublishProfiles/FolderProfilex86.pubxml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 | Release
8 | Any CPU
9 | bin\Publish\x86\
10 | FileSystem
11 | <_TargetId>Folder
12 | net6.0-windows10.0.17763.0
13 | win-x86
14 | false
15 | false
16 | true
17 |
18 |
--------------------------------------------------------------------------------
/LemonApp/Properties/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
51 |
58 |
59 |
60 |
61 |
62 |
70 |
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/LemonApp/Resources/Icons.xaml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/LemonApp/Resources/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
48 |
55 |
56 |
70 |
--------------------------------------------------------------------------------
/LemonApp/Resources/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LemonCodeTeam/Lemon-App/132757389584c92ee79004a8b26fbc1400b2ea4d/LemonApp/Resources/icon.ico
--------------------------------------------------------------------------------
/LemonApp/Resources/left.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LemonCodeTeam/Lemon-App/132757389584c92ee79004a8b26fbc1400b2ea4d/LemonApp/Resources/left.ico
--------------------------------------------------------------------------------
/LemonApp/Resources/pause.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LemonCodeTeam/Lemon-App/132757389584c92ee79004a8b26fbc1400b2ea4d/LemonApp/Resources/pause.ico
--------------------------------------------------------------------------------
/LemonApp/Resources/play.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LemonCodeTeam/Lemon-App/132757389584c92ee79004a8b26fbc1400b2ea4d/LemonApp/Resources/play.ico
--------------------------------------------------------------------------------
/LemonApp/Resources/right.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LemonCodeTeam/Lemon-App/132757389584c92ee79004a8b26fbc1400b2ea4d/LemonApp/Resources/right.ico
--------------------------------------------------------------------------------
/LemonApp/Theme/LemonApp.Theme.Dtpp.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LemonCodeTeam/Lemon-App/132757389584c92ee79004a8b26fbc1400b2ea4d/LemonApp/Theme/LemonApp.Theme.Dtpp.dll
--------------------------------------------------------------------------------
/LemonApp/Theme/LemonApp.Theme.FerrisWheel.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LemonCodeTeam/Lemon-App/132757389584c92ee79004a8b26fbc1400b2ea4d/LemonApp/Theme/LemonApp.Theme.FerrisWheel.dll
--------------------------------------------------------------------------------
/LemonApp/Theme/LemonApp.Theme.TechDMusic.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LemonCodeTeam/Lemon-App/132757389584c92ee79004a8b26fbc1400b2ea4d/LemonApp/Theme/LemonApp.Theme.TechDMusic.dll
--------------------------------------------------------------------------------
/LemonApp/Theme/LemonApp.Theme.TheFirstSnow.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LemonCodeTeam/Lemon-App/132757389584c92ee79004a8b26fbc1400b2ea4d/LemonApp/Theme/LemonApp.Theme.TheFirstSnow.dll
--------------------------------------------------------------------------------
/LemonApp/Theme/LemonApp.Theme.YeStarLight.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LemonCodeTeam/Lemon-App/132757389584c92ee79004a8b26fbc1400b2ea4d/LemonApp/Theme/LemonApp.Theme.YeStarLight.dll
--------------------------------------------------------------------------------
/LemonApp/Theme/LemonApp.Theme.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LemonCodeTeam/Lemon-App/132757389584c92ee79004a8b26fbc1400b2ea4d/LemonApp/Theme/LemonApp.Theme.dll
--------------------------------------------------------------------------------
/LemonApp/Toast.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/LemonApp/Toast.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using System.Threading.Tasks;
4 | using System.Windows;
5 | using System.Windows.Input;
6 | using System.Windows.Interop;
7 | using System.Windows.Media.Animation;
8 | using static LemonLib.WindowStyles;
9 |
10 | namespace LemonApp
11 | {
12 | ///
13 | /// 发送一个Toast通知 或作为桌面歌词
14 | ///
15 | public partial class Toast : Window
16 | {
17 | public Toast(string text)
18 | {
19 | InitializeComponent();
20 | Opacity = 0;
21 | tb.Text = text;
22 | Loaded += async delegate
23 | {
24 | if (tb.Text.Contains("\r\n"))
25 | Height = 90;
26 | Width = SystemParameters.WorkArea.Width;
27 | Left = 0;
28 | Top = SystemParameters.WorkArea.Height - Height + 10;
29 | BeginAnimation(OpacityProperty, new DoubleAnimation(0.5, 1, TimeSpan.FromMilliseconds(300)));
30 | await Task.Delay(3000);
31 | BeginAnimation(OpacityProperty, new DoubleAnimation(1, 0, TimeSpan.FromMilliseconds(2000)));
32 | await Task.Delay(2500);
33 | Close();
34 | };
35 | }
36 | public static void Send(string text)
37 | {
38 | new Toast(text).Show();
39 | }
40 | public Toast(string text, bool staylonger)
41 | {
42 | InitializeComponent();
43 | tb.Text = text;
44 | Loaded += delegate
45 | {
46 | if (tb.Text.Contains("\r\n"))
47 | Height = 90;
48 | if (text == "") Opacity = 0;
49 | Width = SystemParameters.WorkArea.Width;
50 | Left = 0;
51 | Top = SystemParameters.WorkArea.Height - Height - 30;
52 | };
53 | Show();
54 | }
55 | public void Update(string Text)
56 | {
57 | tb.Text = Text;
58 | if (tb.Text.Contains("\r\n"))
59 | Height = 90;
60 | else Height = 45;
61 | if (Text == "") Opacity = 0;
62 | else Opacity = 1;
63 | }
64 |
65 | private void Window_MouseDoubleClick(object sender, MouseButtonEventArgs e)
66 | {
67 | Width = SystemParameters.WorkArea.Width;
68 | Left = 0;
69 | Top = SystemParameters.WorkArea.Height - Height - 30;
70 | }
71 |
72 | private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
73 | {
74 | if (e.LeftButton == MouseButtonState.Pressed)
75 | DragMove();
76 | }
77 |
78 | private void Window_Loaded(object sender, RoutedEventArgs e)
79 | {
80 | WindowInteropHelper wndHelper = new WindowInteropHelper(this);
81 | int exStyle = (int)GetWindowLong(wndHelper.Handle, (int)GetWindowLongFields.GWL_EXSTYLE);
82 | exStyle |= (int)ExtendedWindowStyles.WS_EX_TOOLWINDOW;
83 | SetWindowLong(wndHelper.Handle, (int)GetWindowLongFields.GWL_EXSTYLE, (IntPtr)exStyle);
84 | }
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/LemonApp/Window/IntroWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/LemonApp/Window/IntroWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using LemonLib;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Shapes;
15 |
16 | namespace LemonApp
17 | {
18 | ///
19 | /// IntroWindow.xaml 的交互逻辑
20 | ///
21 | public partial class IntroWindow : Window
22 | {
23 | public IntroWindow()
24 | {
25 | InitializeComponent();
26 | }
27 | public delegate void Finished();
28 | public event Finished FinishedEvent;
29 | private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
30 | {
31 | if (e.LeftButton == MouseButtonState.Pressed)
32 | DragMove();
33 | }
34 | bool mod = true;//true : qq false : wy
35 | private void IntoGDPage_CloseBtn_MouseDown(object sender, MouseButtonEventArgs e)
36 | {
37 | Close();
38 | }
39 | private void IntoGDPage_qqmod_MouseDown(object sender, MouseButtonEventArgs e)
40 | {
41 | if (!mod)
42 | {
43 | mod = true;
44 | QPath_Bg.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFF8C913"));
45 | QPath_Ic.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF02B053"));
46 | IntoGDPage_wymod.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFB2B2B2"));
47 | }
48 | }
49 |
50 | private void IntoGDPage_wymod_MouseDown(object sender, MouseButtonEventArgs e)
51 | {
52 | if (mod)
53 | {
54 | mod = false;
55 | QPath_Bg.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFF1F1F1"));
56 | QPath_Ic.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFB2B2B2"));
57 | IntoGDPage_wymod.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFE72D2C"));
58 | }
59 | }
60 | private async void IntoGDPage_DrBtn_MouseDown(object sender, MouseButtonEventArgs e)
61 | {
62 | if (mod)
63 | {
64 | await MusicLib.AddGDILikeAsync(IntoGDPage_id.Text);
65 | TwMessageBox.Show("添加成功");
66 | FinishedEvent();
67 | Close();
68 | }
69 | else
70 | {
71 | IntoGDPage_main.Visibility = Visibility.Collapsed;
72 | IntoGDPage_loading.Visibility = Visibility.Visible;
73 | await MusicLib.GetGDbyWYAsync(IntoGDPage_id.Text,
74 | (count) => { IntoGDPage_ps_jd.Maximum = count; },
75 | (i, title) => { IntoGDPage_ps_jd.Value = i; IntoGDPage_ps_name.Text = title; },
76 | () =>
77 | {
78 | FinishedEvent();
79 | Close();
80 | }); ;
81 | }
82 | }
83 |
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/LemonApp/Window/LoadingWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/LemonApp/Window/LoadingWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace LemonApp
4 | {
5 | ///
6 | /// LoadingWindow.xaml 的交互逻辑
7 | ///
8 | public partial class LoadingWindow : Window
9 | {
10 | public LoadingWindow(int maxValue)
11 | {
12 | InitializeComponent();
13 | jd.Maximum = maxValue;
14 | }
15 | public void Update(string text,int value)
16 | {
17 | SignText.Text = text;
18 | jd.Value = value;
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/LemonApp/Window/LoginNetease.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/LemonApp/Window/LoginNetease.xaml.cs:
--------------------------------------------------------------------------------
1 | using LemonLib;
2 | using Microsoft.Web.WebView2.Core;
3 | using System;
4 | using System.Diagnostics;
5 | using System.Runtime.InteropServices;
6 | using System.Security.Policy;
7 | using System.Text.RegularExpressions;
8 | using System.Windows;
9 | using System.Windows.Controls;
10 | using System.Windows.Input;
11 | using static LemonLib.InfoHelper;
12 |
13 | namespace LemonApp
14 | {
15 | ///
16 | /// LoginNetease.xaml 的交互逻辑
17 | ///
18 | public partial class LoginNetease : Window
19 | {
20 | private Action LoginCallBack;
21 | ///
22 | /// Log in Netease
23 | ///
24 | /// string cookie,string NeteaseId
25 | public LoginNetease(Action loginCallBack)
26 | {
27 | InitializeComponent();
28 | LoginCallBack = loginCallBack;
29 | }
30 |
31 | private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
32 | {
33 | if(e.LeftButton==MouseButtonState.Pressed)
34 | DragMove();
35 | }
36 |
37 | private async void Window_Loaded(object sender, RoutedEventArgs e)
38 | {
39 | string core = null;
40 | try
41 | {
42 | core=CoreWebView2Environment.GetAvailableBrowserVersionString();
43 | }
44 | catch { }
45 | if(string.IsNullOrEmpty(core))
46 | {
47 | if(TwMessageBox.Show("没有检测到WebView2 Runtime 现在安装吗?")) {
48 | Process.Start("explorer","https://developer.microsoft.com/zh-cn/microsoft-edge/webview2/");
49 | }
50 | Close();
51 | return;
52 | }
53 | var webView2Environment = await CoreWebView2Environment.CreateAsync(null, Settings.USettings.DataCachePath);
54 | await wb.EnsureCoreWebView2Async(webView2Environment);
55 | wb.CoreWebView2.CookieManager.DeleteAllCookies();
56 | wb.CoreWebView2.FrameNavigationCompleted += CoreWebView2_FrameNavigationCompleted;
57 | wb.CoreWebView2.Navigate("https://music.163.com/#/my/");
58 | }
59 |
60 | private async void CoreWebView2_FrameNavigationCompleted(object sender, CoreWebView2NavigationCompletedEventArgs e)
61 | {
62 | string html = await wb.CoreWebView2.ExecuteScriptAsync("document.body.innerHTML");
63 | var regex = Regex.Match(html, @"(?<=/user/home\?id=)\d+");
64 | if (regex.Success)
65 | {
66 | string cookie = "";
67 | var a = await wb.CoreWebView2.CookieManager.GetCookiesAsync("https://music.163.com");
68 | foreach (var item in a)
69 | {
70 | cookie += item.Name + "=" + item.Value + ";";
71 | }
72 | //去除首尾的双引号:
73 | cookie = cookie[..^1];
74 | Console.WriteLine(cookie);
75 | //用正则表达式提取用户ID:/user/home?id=323840418"
76 | string id = regex.Value;
77 | LoginCallBack(cookie, id);
78 | Close();
79 | }
80 | }
81 |
82 | private void CloseBtn_MouseDown(object sender, MouseButtonEventArgs e)
83 | {
84 | this.Close();
85 | }
86 |
87 | private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
88 | {
89 | //释放WebView2
90 | wb.CoreWebView2.FrameNavigationCompleted -= CoreWebView2_FrameNavigationCompleted;
91 | wb.CoreWebView2.Stop();
92 | wb.Dispose();
93 | }
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/LemonApp/Window/LoginWindow.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/LemonApp/Window/LyricBar.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using LemonLib;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Shapes;
15 | using System.Windows.Interop;
16 | using static LemonLib.WindowStyles;
17 | using System.Windows.Forms;
18 |
19 | namespace LemonApp
20 | {
21 | ///
22 | /// LyricBar.xaml 的交互逻辑
23 | ///
24 | public partial class LyricBar : Window
25 | {
26 | public LyricBar()
27 | {
28 | InitializeComponent();
29 | Closing += delegate {
30 | t.Stop();
31 | AppBarFunctions.SetAppBar(this, ABEdge.None);
32 | };
33 | }
34 | public int LyricFontSize {
35 | get => (int)text.FontSize;
36 | set { int v=value; text.FontSize = v; Height = value+8; }
37 | }
38 | public void SetMusicInfo(string str)
39 | {
40 | MusicInfo.Text = str+"✨";
41 | }
42 | public void Update(string txt) {
43 | text.Text = txt.Replace("\r\n"," ");
44 | }
45 | private WindowAccentCompositor wac = null;
46 | private Timer t = new();
47 | private void Window_Loaded(object sender, RoutedEventArgs e)
48 | {
49 | AppBarFunctions.SetAppBar(this, ABEdge.Top);
50 |
51 | WindowInteropHelper wndHelper = new WindowInteropHelper(this);
52 | int exStyle = (int)GetWindowLong(wndHelper.Handle, (int)GetWindowLongFields.GWL_EXSTYLE);
53 | exStyle |= (int)ExtendedWindowStyles.WS_EX_TOOLWINDOW;
54 | SetWindowLong(wndHelper.Handle, (int)GetWindowLongFields.GWL_EXSTYLE, (IntPtr)exStyle);
55 |
56 |
57 | wac = new WindowAccentCompositor(this,true, (c) =>
58 | {
59 | c.A = 255;
60 | Background = new SolidColorBrush(c);
61 | });
62 | wac.Color = App.BaseApp.ThemeColor == 0 ?
63 | Color.FromArgb(180, 255, 255, 255) :
64 | Color.FromArgb(180, 0, 0, 0);
65 | wac.IsEnabled = true;
66 |
67 | t.Interval = 500;
68 | t.Tick += T_Tick;
69 | t.Start();
70 | }
71 |
72 | private IntPtr LockedMaxWindow =IntPtr.Zero;
73 | private void T_Tick(object sender, EventArgs e)
74 | {
75 | var fore = WindowHelper.GetForegroundwindow();
76 | if (fore.IsZoomedWindow()&&LockedMaxWindow==IntPtr.Zero)
77 | {
78 | LockedMaxWindow = fore;
79 | UpdataWindowBlurMode(App.BaseApp.ThemeColor == 1, 240);
80 | }
81 |
82 | if (!LockedMaxWindow.IsZoomedWindow())
83 | {
84 | LockedMaxWindow = IntPtr.Zero;
85 | UpdataWindowBlurMode(App.BaseApp.ThemeColor == 1, 180);
86 | }
87 | }
88 | public void UpdataWindowBlurMode(bool darkmode,byte opacity=180) {
89 | wac.Color = App.BaseApp.ThemeColor == 0 ?
90 | Color.FromArgb(opacity, 255, 255, 255) :
91 | Color.FromArgb(opacity, 0, 0, 0);
92 | wac.DarkMode = darkmode;
93 | wac.IsEnabled= true;
94 | }
95 | public Action PlayLast,Play,PlayNext,PopOutEvent;
96 | private void PlayControl_PlayLast(object sender, TouchEventArgs e)
97 | {
98 | PlayLast?.Invoke();
99 | }
100 |
101 | private void PopOut_MouseDown(object sender, MouseButtonEventArgs e)
102 | {
103 | PopOutEvent?.Invoke();
104 | }
105 |
106 | private void PlayBtn_TouchDown(object sender, TouchEventArgs e)
107 | {
108 | Play?.Invoke();
109 | }
110 |
111 | private void PlayControl_PlayNext(object sender, TouchEventArgs e)
112 | {
113 | PlayNext?.Invoke();
114 | }
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/LemonApp/Window/MiniPlayer.xaml.cs:
--------------------------------------------------------------------------------
1 | using LemonLib;
2 | using System.Windows;
3 | using System.Windows.Input;
4 | using System.Windows.Media;
5 |
6 | namespace LemonApp
7 | {
8 | ///
9 | /// MiniPlayer.xaml 的交互逻辑
10 | ///
11 | public partial class MiniPlayer : Window
12 | {
13 | private MainWindow mw;
14 | public MiniPlayer(MainWindow m)
15 | {
16 | InitializeComponent();
17 | Loaded += MiniPlayer_Loaded;
18 | Closing += MiniPlayer_Closing;
19 | mw = m;
20 | jd.PreviewMouseDown += mw.Jd_PreviewMouseDown;
21 | jd.PreviewMouseUp += mw.Jd_PreviewMouseUp;
22 | jd.ValueChanged += mw.Jd_ValueChanged;
23 | RenderOptions.SetBitmapScalingMode(img, BitmapScalingMode.Fant);
24 | }
25 |
26 | private void MiniPlayer_Closing(object sender, System.ComponentModel.CancelEventArgs e)
27 | {
28 | Hide();
29 | Settings.USettings.IsMiniOpen = false;
30 | e.Cancel = true;
31 | }
32 |
33 | private void MiniPlayer_Loaded(object sender, RoutedEventArgs e)
34 | {
35 | WindowAccentCompositor wac = new WindowAccentCompositor(this, false, (c) =>
36 | {
37 | c.A = 255;
38 | Background = new SolidColorBrush(c);
39 | });
40 | wac.Color = App.BaseApp.ThemeColor == 0 ?
41 | Color.FromArgb(200, 255, 255, 255) :
42 | Color.FromArgb(200, 0, 0, 0);
43 | wac.IsEnabled = true;
44 | }
45 |
46 | private void likeBtn_MouseDown(object sender, MouseButtonEventArgs e)
47 | {
48 | mw.likeBtn_MouseDown(sender, e);
49 | }
50 |
51 | private void LastBtnDown(object sender, MouseButtonEventArgs e)
52 | {
53 | mw.PlayControl_PlayLast(sender, e);
54 | }
55 |
56 | private void NextBtnDown(object sender, MouseButtonEventArgs e)
57 | {
58 | mw.PlayControl_PlayNext(sender, e);
59 | }
60 |
61 | private void PlayBtnDown(object sender, MouseButtonEventArgs e)
62 | {
63 | mw.PlayBtn_MouseDown(sender, e);
64 | }
65 |
66 | private void Window_MouseEnter(object sender, MouseEventArgs e)
67 | {
68 | CloseBtn.Visibility = Visibility.Visible;
69 | }
70 |
71 | private void Window_MouseLeave(object sender, MouseEventArgs e)
72 | {
73 | CloseBtn.Visibility = Visibility.Collapsed;
74 | }
75 |
76 | private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
77 | {
78 | if (e.LeftButton == MouseButtonState.Pressed)
79 | DragMove();
80 | }
81 |
82 | private void CloseBtn_MouseDown(object sender, MouseButtonEventArgs e)
83 | {
84 | Hide();
85 | Settings.USettings.IsMiniOpen = false;
86 | }
87 |
88 | private void XHBtn_MouseDown(object sender, MouseButtonEventArgs e)
89 | {
90 | mw.XHBtn_MouseDown(sender, e);
91 | }
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/LemonApp/Window/TransAirWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/LemonApp/Window/TransAirWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Animation;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Shapes;
15 |
16 | namespace LemonApp
17 | {
18 | ///
19 | /// TransAirWindow.xaml 的交互逻辑
20 | ///
21 | public partial class TransAirWindow : Window
22 | {
23 | public TransAirWindow()
24 | {
25 | InitializeComponent();Width = 0;
26 | }
27 |
28 | private void Window_Loaded(object sender, RoutedEventArgs e)
29 | {
30 | (Resources["Open"] as Storyboard).Begin();
31 | WindowAccentCompositor wac = new WindowAccentCompositor(this, true, (c) =>
32 | {
33 | c.A = 255;
34 | Background = new SolidColorBrush(c);
35 | });
36 | wac.Color = App.BaseApp.ThemeColor == 0 ?
37 | Color.FromArgb(200, 255, 255, 255) :
38 | Color.FromArgb(200, 0, 0, 0);
39 | wac.IsEnabled = true;
40 | }
41 |
42 | private void TranslationPage_CloseBtn_MouseDown(object sender, MouseButtonEventArgs e)
43 | {
44 | (Resources["Close"] as Storyboard).Begin();
45 | }
46 |
47 | private void Storyboard_Completed(object sender, EventArgs e)
48 | {
49 | Close();
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/LemonLib/Dll/Bass.Net.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LemonCodeTeam/Lemon-App/132757389584c92ee79004a8b26fbc1400b2ea4d/LemonLib/Dll/Bass.Net.dll
--------------------------------------------------------------------------------
/LemonLib/Helpers/HttpDownloadHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Net;
4 | using System.Net.Http;
5 | using System.Runtime.InteropServices;
6 | using System.Threading.Tasks;
7 | using System.Windows.Markup;
8 | using Un4seen.Bass;
9 | using static LemonLib.InfoHelper;
10 |
11 | namespace LemonLib
12 | {
13 | public class HttpDownloadHelper
14 | {
15 | private Music mData;
16 | private string Path = "";
17 | public bool Downloading = true;
18 | private int Progress = 0;
19 |
20 | public delegate void Pr(int pr);
21 | public event Pr ProgressChanged;
22 | public delegate void finish();
23 | public event finish Finished;
24 | public event finish Fail;
25 | public delegate void x(string z);
26 | public event x GetSize;
27 | public HttpDownloadHelper(Music data, string pa)
28 | {
29 | mData = data;
30 | Path = pa;
31 | }
32 | public async void Download()
33 | {
34 | await Task.Run(async () =>
35 | {
36 | var PQ = Settings.USettings.PreferQuality_Download;
37 | MusicQuality ava = PQ == mData.Quality ? PQ : (PQ < mData.Quality ? mData.Quality : PQ);
38 | var Url = await MusicLib.GetUrlAsync(mData,ava);
39 | Path += MusicLib.QualityMatcher(Url.Quality)[0];
40 | if (Url != null)
41 | {
42 | Console.WriteLine(Path + " " + Downloading + "\r\n" + Url.Url);
43 | using var hc=new HttpClient(new SocketsHttpHandler(){KeepAlivePingPolicy=HttpKeepAlivePingPolicy.WithActiveRequests});
44 |
45 | hc.DefaultRequestHeaders.Accept.TryParseAdd("text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9");
46 | hc.DefaultRequestHeaders.AcceptLanguage.TryParseAdd("zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6");
47 | hc.DefaultRequestHeaders.Add("Upgrade-Insecure-Requests", "1");
48 | hc.DefaultRequestHeaders.UserAgent.TryParseAdd("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.66 Safari/537.36 Edg/80.0.361.40");
49 |
50 | var myrp = await hc.GetAsync(Url.Url,HttpCompletionOption.ResponseHeadersRead);
51 | Console.WriteLine(myrp.StatusCode.ToString());
52 | var totalBytes = (long)myrp.Content.Headers.ContentLength;
53 | GetSize(Getsize(totalBytes));
54 | Stream st = await myrp.Content.ReadAsStreamAsync();
55 | Stream so = new FileStream(Path, FileMode.Create);
56 | long totalDownloadedByte = 0;
57 | byte[] by = new byte[1048576];
58 | int osize = await st.ReadAsync(by, 0, by.Length);
59 | while (osize > 0)
60 | {
61 | if (stop) break;
62 | if (Downloading)
63 | {
64 | totalDownloadedByte = osize + totalDownloadedByte;
65 | await so.WriteAsync(by, 0, osize);
66 | osize = await st.ReadAsync(by, 0, by.Length);
67 | Progress = (int)(totalDownloadedByte / totalBytes * 100);
68 | ProgressChanged(Progress);
69 | Console.WriteLine("downloading:" + Progress);
70 | }
71 | }
72 | st.Close();
73 | so.Close();
74 | if (!stop) Finished();
75 | }
76 | else Fail();
77 | });
78 | }
79 | public void Pause()
80 | {
81 | Downloading = false;
82 | Console.WriteLine("下载暂停");
83 | }
84 | public void Start()
85 | {
86 | Downloading = true;
87 | Console.WriteLine("Start.");
88 | }
89 | public bool stop = false;
90 | public void Stop()
91 | {
92 | stop = true;
93 | }
94 | private string Getsize(double size)
95 | {
96 | string[] units = new string[] { "B", "KB", "MB", "GB", "TB", "PB" };
97 | double mod = 1024.0;
98 | int i = 0;
99 | while (size >= mod)
100 | {
101 | size /= mod;
102 | i++;
103 | }
104 | return size.ToString("0.00") + units[i];
105 | }
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/LemonLib/Helpers/ImageCacheHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Drawing.Drawing2D;
4 | using System.Drawing.Imaging;
5 | using System.IO;
6 | using System.Net;
7 | using System.Net.Http;
8 | using System.Runtime.CompilerServices;
9 | using System.Threading.Tasks;
10 | using System.Windows.Media.Imaging;
11 |
12 | namespace LemonLib
13 | {
14 | ///
15 | /// 图像的三级缓存 MemoryCache->FileCache->Internet
16 | ///
17 | public class ImageCacheHelper
18 | {
19 | private static ConditionalWeakTable MemoryCache = new();
20 | ///
21 | /// 图像的三级缓存 从URL中获取图像
22 | ///
23 | /// 链接
24 | /// 高Height,宽Width
25 | ///
26 | public static async Task GetImageByUrl(string url, int[] DecodePixel = null)
27 | {
28 | try
29 | {
30 | url += DecodePixel != null ? "#" + string.Join(",", DecodePixel) : "";
31 | //signed by HashCode, swifter than MD5.
32 | string id = url.GetHashCode().ToString();
33 | MainClass.DebugCallBack("IMAGE GETER",url);
34 | //Get from MemoryCache
35 | if (MemoryCache.TryGetValue(id, out BitmapImage bi))
36 | return bi;
37 | //Get from FileCache
38 | BitmapImage bf = GetImageFromFile(url);
39 | if (bf != null)
40 | {
41 | MemoryCache.Add(id, bf);
42 | return bf;
43 | }
44 | //Get from Internet
45 | return await GetImageFromInternet(url, DecodePixel);
46 | }
47 | catch(Exception e)
48 | {
49 | MainClass.DebugCallBack("IMAGE ERROR",e.StackTrace+"\r\n"+e.ToString());
50 | return null;
51 | }
52 | }
53 | private static BitmapImage GetImageFromFile(string url)
54 | {
55 | //id signed by MD5 for long-time use
56 | string file = Path.Combine(Settings.USettings.MusicCachePath, "Image", TextHelper.MD5.EncryptToMD5string(url)+ ".jpg");
57 | if (File.Exists(file))
58 | return GetBitMapImageFromFile(file);
59 | else return null;
60 | }
61 | private static BitmapImage GetBitMapImageFromFile(string file)
62 | {
63 | using FileStream sr = File.OpenRead(file);
64 | BitmapImage bi = new BitmapImage();
65 | bi.BeginInit();
66 | bi.CacheOption = BitmapCacheOption.OnLoad;
67 | bi.StreamSource = sr;
68 | bi.EndInit();
69 | bi.Freeze();
70 | return bi;
71 | }
72 | private static async Task GetImageFromInternet(string url, int[] DecodePixel)
73 | {
74 | string file = Path.Combine(Settings.USettings.MusicCachePath, "Image", TextHelper.MD5.EncryptToMD5string(url) + ".jpg");
75 | if (DecodePixel != null)
76 | {
77 | Image img = Image.FromStream(await(await new HttpClient().GetAsync(url)).Content.ReadAsStreamAsync());
78 | Bitmap bitmap = new Bitmap(DecodePixel[1], DecodePixel[0]);
79 | Graphics g = Graphics.FromImage(bitmap);
80 | g.InterpolationMode = InterpolationMode.HighQualityBicubic;
81 | g.DrawImage(img, 0, 0, bitmap.Width, bitmap.Height);
82 | g.Dispose();
83 | bitmap.Save(file, ImageFormat.Jpeg);
84 | bitmap.Dispose();
85 | img.Dispose();
86 | }
87 | else
88 | {
89 | await HttpHelper.HttpDownloadFileAsync(url, file);
90 | }
91 | BitmapImage bi = GetBitMapImageFromFile(file);
92 | return bi;
93 | }
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/LemonLib/Helpers/MsgHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO.Pipes;
3 | using System.IO;
4 | using System.Runtime.InteropServices;
5 | using System.Security.Principal;
6 | using System.Text;
7 |
8 | namespace LemonLib
9 | {
10 | ///
11 | /// 使用WinAPI SENDMESSAGE 实现单实例呼唤
12 | ///
13 | public class MsgHelper
14 | {
15 | public const int WM_COPYDATA = 0x004A;
16 | public const string SEND_SHOW = "SEND_SHOW";
17 | public const string SEND_LAST = "SEND_LAST",
18 | SEND_PAUSE = "SEND_PAUSE",
19 | SEND_NEXT = "SEND_NEXT";
20 |
21 | public struct COPYDATASTRUCT
22 | {
23 | public IntPtr dwData;
24 | public int cData;
25 | [MarshalAs(UnmanagedType.LPStr)]
26 | public string lpData;
27 | }
28 |
29 | [DllImport("User32.dll", EntryPoint = "FindWindow")]
30 | public extern static IntPtr FindWindow(string lpClassName, string lpWindowName);
31 |
32 | [DllImport("User32.dll")]
33 | public static extern int SendMessage(int hwnd, int msg, int wParam, ref COPYDATASTRUCT IParam);
34 |
35 | public static async void SendMsg(String strSent, int WindowHandle = 0)
36 | {
37 | int WINDOW_HANDLE = WindowHandle == 0 ? (await Settings.ReadHandleAsync()).WINDOW_HANDLE : WindowHandle;
38 | if (WINDOW_HANDLE != 0)
39 | {
40 | byte[] arr = Encoding.Default.GetBytes(strSent);
41 | int len = arr.Length;
42 | COPYDATASTRUCT cdata;
43 | cdata.dwData = (IntPtr)100;
44 | cdata.lpData = strSent;
45 | cdata.cData = len + 1;
46 | SendMessage(WINDOW_HANDLE, WM_COPYDATA, 0, ref cdata);
47 | }
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/LemonLib/Helpers/MyToolBarClient.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Net.Sockets;
5 | using System.Text;
6 | using System.Threading;
7 | using System.Threading.Tasks;
8 |
9 | namespace LemonLib.Helpers
10 | {
11 | public class MyToolBarClient:IDisposable
12 | {
13 | public static bool DetectIsCreated()
14 | {
15 | bool success = false;
16 | Mutex mutex = new Mutex(false, "MyToolBar.Plugin.BasicPackage//LemonAppMusicServier", out success);
17 | return !success;
18 | }
19 |
20 | public TcpClient tcpClient;
21 | public MyToolBarClient()
22 | {
23 | tcpClient = new TcpClient("localhost",12587);
24 | }
25 | public async Task SendMsgAsync(string message)
26 | {
27 | message += '\n';
28 | if (!tcpClient.Connected) return;
29 | byte[] data = Encoding.UTF8.GetBytes(message);
30 | var stream=tcpClient.GetStream();
31 | await stream.WriteAsync(data);
32 | await stream.FlushAsync();
33 | }
34 |
35 | public void Dispose()
36 | {
37 | tcpClient.Dispose();
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/LemonLib/Helpers/RomajiHelper.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json.Linq;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Web;
8 | using System.Xml;
9 |
10 | namespace LemonLib
11 | {
12 | public class RomajiHelper
13 | {
14 | public static async Task> GetRomaji(string text) {
15 | string data = await HttpHelper.PostWebSiteEzlang("https://www.ezlang.net/ajax/tool_data.php","txt="+HttpUtility.UrlDecode(text.ToString())+ "&sn=romaji");
16 | MainClass.DebugCallBack(data,"Lyric");
17 | List vs = new List();
18 | string xml = JArray.Parse(data)[1].ToString();
19 | string doc =""+ xml+"
";
20 | XmlDocument xd = new();
21 | xd.LoadXml(doc);
22 | var root = xd.SelectSingleNode("List");
23 | foreach (XmlElement div in root)
24 | {
25 | string line = "";
26 | var spans = div.SelectNodes("span");
27 | foreach (XmlElement span in spans)
28 | {
29 | if (span.InnerXml.Contains("ruby"))
30 | {
31 | var d = span.SelectSingleNode("ruby").SelectSingleNode("rt").InnerText;
32 | line += " " + d;
33 | }
34 | }
35 | vs.Add(line);
36 | }
37 | return vs;
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/LemonLib/Helpers/SMTCCreator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Windows.Media;
3 | using Windows.Storage.Streams;
4 |
5 | namespace LemonLib
6 | {
7 | public enum SMTCMediaStatus
8 | {
9 | Playing,
10 | Paused,
11 | Stopped
12 | }
13 | public class SMTCUpdater
14 | {
15 | private readonly SystemMediaTransportControlsDisplayUpdater _updater;
16 | public SMTCUpdater(SystemMediaTransportControlsDisplayUpdater Updater,string AppMediaId)
17 | {
18 | _updater= Updater;
19 | _updater.AppMediaId = AppMediaId;
20 | _updater.Type= MediaPlaybackType.Music;
21 | }
22 | public SMTCUpdater SetTitle(string title)
23 | {
24 | _updater.MusicProperties.Title = title;
25 | return this;
26 | }
27 | public SMTCUpdater SetAlbumTitle(string albumTitle)
28 | {
29 | _updater.MusicProperties.AlbumTitle = albumTitle;
30 | return this;
31 | }
32 | public SMTCUpdater SetArtist(string artist)
33 | {
34 | _updater.MusicProperties.Artist = artist;
35 | return this;
36 | }
37 | public SMTCUpdater SetThumbnail(string ImgUrl)
38 | {
39 | _updater.Thumbnail = RandomAccessStreamReference.CreateFromUri(new Uri(ImgUrl));
40 | return this;
41 | }
42 | public void Update()=>_updater.Update();
43 | }
44 | public class SMTCCreator:IDisposable
45 | {
46 | private readonly Windows.Media.Playback.MediaPlayer _player = new();
47 | private readonly SystemMediaTransportControls _smtc;
48 | private readonly SMTCUpdater _updater;
49 | public SMTCCreator(string MediaId)
50 | {
51 | //先禁用系统播放器的命令
52 | _player.CommandManager.IsEnabled = false;
53 | //直接创建SystemMediaTransportControls对象被平台限制,神奇的是MediaPlayer对象可以创建该NativeObject
54 | _smtc = _player.SystemMediaTransportControls;
55 | _updater=new SMTCUpdater(_smtc.DisplayUpdater, MediaId);
56 |
57 | //启用状态
58 | _smtc.IsEnabled = true;
59 | _smtc.IsPlayEnabled = true;
60 | _smtc.IsPauseEnabled = true;
61 | _smtc.IsNextEnabled = true;
62 | _smtc.IsPreviousEnabled = true;
63 | //响应系统播放器的命令
64 | _smtc.ButtonPressed += _smtc_ButtonPressed;
65 | }
66 | public void Dispose()
67 | {
68 | _smtc.IsEnabled = false;
69 | _player.Dispose();
70 | }
71 | public SMTCUpdater Info { get => _updater; }
72 | public event EventHandler PlayOrPause, Previous, Next;
73 | public void SetMediaStatus(SMTCMediaStatus status)
74 | {
75 | _smtc.PlaybackStatus = status switch
76 | {
77 | SMTCMediaStatus.Playing => MediaPlaybackStatus.Playing,
78 | SMTCMediaStatus.Paused => MediaPlaybackStatus.Paused,
79 | SMTCMediaStatus.Stopped => MediaPlaybackStatus.Stopped,
80 | _ => throw new NotImplementedException(),
81 | };
82 | }
83 |
84 |
85 | private void _smtc_ButtonPressed(SystemMediaTransportControls sender, SystemMediaTransportControlsButtonPressedEventArgs args)
86 | {
87 | switch(args.Button)
88 | {
89 | case SystemMediaTransportControlsButton.Play:
90 | PlayOrPause?.Invoke(this, EventArgs.Empty);
91 | break;
92 | case SystemMediaTransportControlsButton.Pause:
93 | PlayOrPause?.Invoke(this, EventArgs.Empty);
94 | break;
95 | case SystemMediaTransportControlsButton.Next:
96 | Next?.Invoke(this, EventArgs.Empty);
97 | break;
98 | case SystemMediaTransportControlsButton.Previous:
99 | Previous?.Invoke(this, EventArgs.Empty);
100 | break;
101 | }
102 | }
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/LemonLib/Helpers/TranslateAirHelper.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json.Linq;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Net;
7 | using System.Net.Http;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 | using System.Web;
11 |
12 | namespace LemonLib
13 | {
14 | public class TranslateAirHelper
15 | {
16 | public static async Task GetLang(string text) {
17 | string json = await HttpHelper.PostWeb("https://fanyi.baidu.com/langdetect", "query=" + HttpUtility.UrlEncode(text), HttpHelper.GetWebHeader_BaiduFY());
18 | JObject obj = JObject.Parse(json);
19 | return obj["lan"].ToString();
20 | }
21 |
22 | public static async Task GetSug(string text)
23 | {
24 | string json = await HttpHelper.PostWeb("https://fanyi.baidu.com/sug", "kw=" + HttpUtility.UrlEncode(text), HttpHelper.GetWebHeader_BaiduFY());
25 | JObject obj = JObject.Parse(json);
26 | StringBuilder sb = new StringBuilder();
27 | foreach (var j in obj["data"]) {
28 | sb.Append(j["k"] + "\r\n");
29 | sb.Append(j["v"] + "\r\n");
30 | }
31 | return sb.ToString();
32 | }
33 | public static async Task Speech(string text)
34 | {
35 | var url = $"https://dict.youdao.com/dictvoice?audio={HttpUtility.UrlEncode(text)}&le={(await GetLang(text)).Replace("jp","ja")}";
36 | MainClass.DebugCallBack(url,"blue");
37 | string path =Path.Combine(Settings.USettings.MusicCachePath ,"ta.mp3");
38 | await HttpDownloadFileAsync(url, path);
39 | return path;
40 | }
41 | public static async Task HttpDownloadFileAsync(string url, string path)
42 | {
43 | using var hc = new HttpClient(new SocketsHttpHandler() { KeepAlivePingPolicy = HttpKeepAlivePingPolicy.WithActiveRequests });
44 | hc.DefaultRequestHeaders.TryAddWithoutValidation("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9");
45 | hc.DefaultRequestHeaders.TryAddWithoutValidation("AcceptLanguage","zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6");
46 | hc.DefaultRequestHeaders.Add("Upgrade-Insecure-Requests", "1");
47 | hc.DefaultRequestHeaders.Add("Referer", "https://fanyi.youdao.com/");
48 | hc.DefaultRequestHeaders.Host = "dict.youdao.com";
49 | hc.DefaultRequestHeaders.UserAgent.TryParseAdd("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.66 Safari/537.36 Edg/80.0.361.40");
50 | var myrp = await hc.GetAsync(url, HttpCompletionOption.ResponseHeadersRead);
51 | using Stream st = await myrp.Content.ReadAsStreamAsync();
52 | using (Stream stream = new FileStream(path, FileMode.Create, FileAccess.ReadWrite))
53 | {
54 | byte[] bArr = new byte[1024];
55 | int size = await st.ReadAsync(bArr, 0, bArr.Length);
56 | while (size > 0)
57 | {
58 | await stream.WriteAsync(bArr, 0, size);
59 | size = await st.ReadAsync(bArr, 0, bArr.Length);
60 | }
61 | stream.Close();
62 | }
63 | st.Close();
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/LemonLib/Helpers/lmExtension.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Reflection;
6 | using System.Runtime.Loader;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 |
10 | namespace LemonLib.Helpers
11 | {
12 | internal class lmExtension
13 | {
14 | public lmExtension(string file,string assemblyName, string methodName)
15 | {
16 | FilePath = file;
17 | AssemblyName = assemblyName;
18 | MethodName = methodName;
19 | }
20 | public void Load()
21 | {
22 | ExtensionDomain=new AssemblyLoadContext(AssemblyName,true);
23 | FileStream stream = new FileStream(FilePath, FileMode.Open, FileAccess.Read);
24 | ExtensionDomain.LoadFromStream(stream);
25 | ExAssembly = ExtensionDomain.Assemblies.First();
26 | AssemblyVersion = ExAssembly.GetName().Version;
27 | stream.Dispose();
28 | }
29 | private string FilePath { get; set; }
30 | private Assembly ExAssembly { get; set; }
31 | private AssemblyLoadContext ExtensionDomain { get; set; }
32 | public string AssemblyName { get; private set; }
33 | public Version AssemblyVersion { get; private set; }
34 | public string MethodName { get; private set; }
35 | public void Unload()
36 | {
37 | ExtensionDomain.Unload();
38 | }
39 | public object Invoke(object[] para)
40 | {
41 | return ExAssembly.GetType(AssemblyName).GetMethod(MethodName).Invoke(null, para);
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/LemonLib/LemonLib.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0-windows10.0.17763.0
5 | true
6 | Library
7 | 1.2.9.7
8 | TwilightLemon
9 |
10 |
11 |
12 | true
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | Dll\Bass.Net.dll
27 |
28 |
29 |
30 |
31 |
32 | True
33 | True
34 | Resources.resx
35 |
36 |
37 |
38 |
39 |
40 | ResXFileCodeGenerator
41 | Resources.Designer.cs
42 |
43 |
44 |
45 |
46 |
47 | Always
48 |
49 |
50 | Always
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/LemonLib/Main.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Threading.Tasks;
4 |
5 | namespace LemonLib
6 | {
7 | public class MainClass
8 | {
9 | ///
10 | /// API调试台
11 | ///
12 | static async Task Main()
13 | {
14 | await Settings.LoadUSettings("2728578956");
15 | var a = await MusicLib.GetUrlAsync(new InfoHelper.Music() { Source=InfoHelper.Platform.qq,MusicID= "0031h9zO4WH5Fn" },InfoHelper.MusicQuality.SQ);
16 | Console.WriteLine(a.Url);
17 | Console.ReadLine();
18 | }
19 | public static Action DebugCallBack = new Action((a,b) => {
20 | Console.WriteLine(a+": "+b);
21 | });
22 | #region #DEBUG 评论获取/点赞测试:
23 | /*
24 | await Settings.LoadUSettings("2728578956");
25 | List a = await MusicLib.GetPLByQQAsync("0034Ge6Q2b504d");
26 | int i = 0;
27 | foreach (var b in a)
28 | {
29 | Console.WriteLine($"[{i}] {b.text} Like:{b.like}");
30 | i++;
31 | }
32 | int index = int.Parse(Console.ReadLine());
33 | Console.WriteLine(await MusicLib.PraiseMusicPLAsync("0034Ge6Q2b504d", a[index]));
34 | Console.ReadLine();
35 | */
36 | #endregion
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/LemonLib/Properties/PublishProfiles/FolderProfile.pubxml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 | Release
8 | Any CPU
9 | bin\Release\net6.0-windows\publish\
10 | FileSystem
11 |
12 |
--------------------------------------------------------------------------------
/LemonLib/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace LemonLib.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// 返回此类使用的缓存的 ResourceManager 实例。
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LemonLib.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 重写当前线程的 CurrentUICulture 属性,对
51 | /// 使用此强类型资源类的所有资源查找执行重写。
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// 查找 System.Byte[] 类型的本地化资源。
65 | ///
66 | internal static byte[] bass {
67 | get {
68 | object obj = ResourceManager.GetObject("bass", resourceCulture);
69 | return ((byte[])(obj));
70 | }
71 | }
72 |
73 | ///
74 | /// 查找 System.Byte[] 类型的本地化资源。
75 | ///
76 | internal static byte[] bass_fx {
77 | get {
78 | object obj = ResourceManager.GetObject("bass_fx", resourceCulture);
79 | return ((byte[])(obj));
80 | }
81 | }
82 |
83 | ///
84 | /// 查找 System.Byte[] 类型的本地化资源。
85 | ///
86 | internal static byte[] bass_fx_x86 {
87 | get {
88 | object obj = ResourceManager.GetObject("bass_fx_x86", resourceCulture);
89 | return ((byte[])(obj));
90 | }
91 | }
92 |
93 | ///
94 | /// 查找 System.Byte[] 类型的本地化资源。
95 | ///
96 | internal static byte[] bass_x86 {
97 | get {
98 | object obj = ResourceManager.GetObject("bass_x86", resourceCulture);
99 | return ((byte[])(obj));
100 | }
101 | }
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/LemonLib/Resources/bass.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LemonCodeTeam/Lemon-App/132757389584c92ee79004a8b26fbc1400b2ea4d/LemonLib/Resources/bass.dll
--------------------------------------------------------------------------------
/LemonLib/Resources/bass_fx.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LemonCodeTeam/Lemon-App/132757389584c92ee79004a8b26fbc1400b2ea4d/LemonLib/Resources/bass_fx.dll
--------------------------------------------------------------------------------
/LemonLib/Resources/bass_fx_x86.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LemonCodeTeam/Lemon-App/132757389584c92ee79004a8b26fbc1400b2ea4d/LemonLib/Resources/bass_fx_x86.dll
--------------------------------------------------------------------------------
/LemonLib/Resources/bass_x86.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LemonCodeTeam/Lemon-App/132757389584c92ee79004a8b26fbc1400b2ea4d/LemonLib/Resources/bass_x86.dll
--------------------------------------------------------------------------------
/LemonLib/bassenc.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LemonCodeTeam/Lemon-App/132757389584c92ee79004a8b26fbc1400b2ea4d/LemonLib/bassenc.dll
--------------------------------------------------------------------------------
/LemonLib/lame.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LemonCodeTeam/Lemon-App/132757389584c92ee79004a8b26fbc1400b2ea4d/LemonLib/lame.exe
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 本项目不再更新,请移步:[TwilightLemon/Lemon-App](https://github.com/TwilightLemon/Lemon-App)
2 | # Lemon App
3 | Lemon App 是一款基于QQ音乐的在线音乐播放器。
4 | 支持同步QQ音乐歌单及喜欢,更有排行榜、分类歌单、歌手、电台等功能 发现好音乐!
5 |
6 | #### Project
7 | [](https://github.com/LemonCodeTeam/Lemon-App/actions/workflows/codeql.yml)
8 | [](https://github.com/TwilightLemon/Lemon-App/blob/master/LICENSE)
9 | #### Release
10 | [](https://github.com/LemonCodeTeam/Lemon-App/actions/workflows/dotnet-desktop.yml)
11 | [](https://gitee.com/TwilightLemon/LemonAppDynamics/releases)
12 |
13 | ### UI界面
14 | 
15 | 
16 | 
17 | 
18 | 
19 |
20 | ### 运行环境
21 | win7~win11 x64
22 | powered by .NET 6 on WPF
23 | p.s. 32位平台请自行编译
24 |
25 | ### 软件版权
26 | 本应用由 [Twilight./Lemon(QQ:2728578956)](https://blog.twlmgatito.cn) 开发,转载和使用请保留原网址和版权信息
27 | 使用和传播请遵守GPL v3协议,详见LICENSE文件
28 |
29 | ### 免责声明
30 | 本应用中的歌曲和部分API来自QQ音乐和网易云音乐,音乐及歌词翻译版权分别归QQ音乐和网易云音乐所有。
31 | 本应用中的部分图标来自www.iconfont.cn.
32 | 本应用使用BASS.NET解码 PERSONAL-USE License.
33 |
34 | 登录即代表同意Lemon App通过你的QQ账号获取你在QQ音乐上的内容,
35 | 绑定网易云音乐账号即代表同意Lemon App通过你的网易云音乐账号获得你在网易云音乐上的内容,
36 | Lemon App只能通过 y.qq.com以及music.163.com网页端来获得你所登录QQ用户和绑定网易云音乐账号能获得的歌曲以及MV等资源。
37 | 本软件仅用于学习交流,禁止用于商业用途。
38 |
--------------------------------------------------------------------------------
/global.json:
--------------------------------------------------------------------------------
1 | {
2 | "sdk": {
3 | "rollForward": "latestMajor",
4 | "allowPrerelease": true
5 | }
6 | }
--------------------------------------------------------------------------------