From b3554cc9fd3f2786ce4ed6679085d51931d068ba Mon Sep 17 00:00:00 2001 From: Kyle Date: Sat, 16 Nov 2024 14:35:17 +0800 Subject: [PATCH] remove 2.X --- NetEaseMusic-DiscordRPC.sln | 6 - NetEaseMusic-DiscordRPC/App.config | 26 -- NetEaseMusic-DiscordRPC/AutoStart.cs | 81 ---- NetEaseMusic-DiscordRPC/MemoryUtil.cs | 134 ------- NetEaseMusic-DiscordRPC/NCM-DiscordRpc.nrproj | Bin 20610 -> 0 bytes .../NetEaseMusic-DiscordRPC.csproj | 131 ------- NetEaseMusic-DiscordRPC/Program.cs | 370 ------------------ .../Properties/AssemblyInfo.cs | 36 -- .../Properties/Resources.Designer.cs | 73 ---- .../Properties/Resources.resx | 124 ------ .../Properties/Settings.Designer.cs | 38 -- .../Properties/Settings.settings | 9 - NetEaseMusic-DiscordRPC/Resources/icon.ico | Bin 4286 -> 0 bytes NetEaseMusic-DiscordRPC/json.cs | 96 ----- NetEaseMusic-DiscordRPC/packages.config | 5 - NetEaseMusic-DiscordRPC/win32Api.cs | 178 --------- NetEaseMusic-DiscordRPC/windows.txt | 18 - offset/offset.json | 66 ---- 18 files changed, 1391 deletions(-) delete mode 100644 NetEaseMusic-DiscordRPC/App.config delete mode 100644 NetEaseMusic-DiscordRPC/AutoStart.cs delete mode 100644 NetEaseMusic-DiscordRPC/MemoryUtil.cs delete mode 100644 NetEaseMusic-DiscordRPC/NCM-DiscordRpc.nrproj delete mode 100644 NetEaseMusic-DiscordRPC/NetEaseMusic-DiscordRPC.csproj delete mode 100644 NetEaseMusic-DiscordRPC/Program.cs delete mode 100644 NetEaseMusic-DiscordRPC/Properties/AssemblyInfo.cs delete mode 100644 NetEaseMusic-DiscordRPC/Properties/Resources.Designer.cs delete mode 100644 NetEaseMusic-DiscordRPC/Properties/Resources.resx delete mode 100644 NetEaseMusic-DiscordRPC/Properties/Settings.Designer.cs delete mode 100644 NetEaseMusic-DiscordRPC/Properties/Settings.settings delete mode 100644 NetEaseMusic-DiscordRPC/Resources/icon.ico delete mode 100644 NetEaseMusic-DiscordRPC/json.cs delete mode 100644 NetEaseMusic-DiscordRPC/packages.config delete mode 100644 NetEaseMusic-DiscordRPC/win32Api.cs delete mode 100644 NetEaseMusic-DiscordRPC/windows.txt delete mode 100644 offset/offset.json diff --git a/NetEaseMusic-DiscordRPC.sln b/NetEaseMusic-DiscordRPC.sln index 6249cac..0d6d2ff 100644 --- a/NetEaseMusic-DiscordRPC.sln +++ b/NetEaseMusic-DiscordRPC.sln @@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.11.35327.3 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetEaseMusic-DiscordRPC", "NetEaseMusic-DiscordRPC\NetEaseMusic-DiscordRPC.csproj", "{8A5639C6-8083-4623-9234-D87878036C4E}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vanessa", "Vanessa\Vanessa.csproj", "{5B2859C2-BCDE-46C2-A113-13E48AB0A7B0}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscordRPC", "submodule\discord-rpc-csharp\DiscordRPC\DiscordRPC.csproj", "{D3E3FE4A-F603-493B-8AE0-A402A91C914F}" @@ -15,10 +13,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8A5639C6-8083-4623-9234-D87878036C4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8A5639C6-8083-4623-9234-D87878036C4E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8A5639C6-8083-4623-9234-D87878036C4E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8A5639C6-8083-4623-9234-D87878036C4E}.Release|Any CPU.Build.0 = Release|Any CPU {5B2859C2-BCDE-46C2-A113-13E48AB0A7B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5B2859C2-BCDE-46C2-A113-13E48AB0A7B0}.Debug|Any CPU.Build.0 = Debug|Any CPU {5B2859C2-BCDE-46C2-A113-13E48AB0A7B0}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/NetEaseMusic-DiscordRPC/App.config b/NetEaseMusic-DiscordRPC/App.config deleted file mode 100644 index c600cd7..0000000 --- a/NetEaseMusic-DiscordRPC/App.config +++ /dev/null @@ -1,26 +0,0 @@ - - - - -
- - - - - - - - - True - - - - - - - - - - - - diff --git a/NetEaseMusic-DiscordRPC/AutoStart.cs b/NetEaseMusic-DiscordRPC/AutoStart.cs deleted file mode 100644 index 6310fa8..0000000 --- a/NetEaseMusic-DiscordRPC/AutoStart.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.Reflection; -using Microsoft.Win32; - -namespace NetEaseMusic_DiscordRPC -{ - static class AutoStart - { - public static void Set() - { - try - { - // Open Base Key. - using var baseKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry64).OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true); - - if (baseKey == null) - { - // wtf? - Console.WriteLine(@"Cannot find HKCU\Software\Microsoft\Windows\CurrentVersion\Run"); - return; - } - - baseKey.SetValue("NCM-DiscordRpc", Assembly.GetEntryAssembly().Location); - Console.WriteLine("AutoStartup has been set."); - } - catch (Exception e) - { - Console.WriteLine($"Failed to set autostartup: {e.Message}"); - } - } - - public static void Remove() - { - try - { - // Open Base Key. - using var baseKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry64).OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true); - - if (baseKey == null) - { - // wtf? - Console.WriteLine(@"Cannot find HKCU\Software\Microsoft\Windows\CurrentVersion\Run"); - return; - } - - baseKey.DeleteValue("NCM-DiscordRpc", false); - Console.WriteLine("AutoStartup has been deleted."); - } - catch (Exception e) - { - Console.WriteLine($"Failed to set autostartup: {e.Message}"); - } - } - - public static bool Check() - { - try - { - // Open Base Key. - using var baseKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry64).OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true); - - if (baseKey == null) - { - // wtf? - Console.WriteLine(@"Cannot find HKCU\Software\Microsoft\Windows\CurrentVersion\Run"); - return false; - } - - var ace = baseKey.GetValue("NCM-DiscordRpc"); - var exe = Assembly.GetEntryAssembly().Location; - return exe.Equals(ace); - } - catch (Exception e) - { - Console.WriteLine($"Failed to set autostartup: {e.Message}"); - } - - return false; - } - } -} diff --git a/NetEaseMusic-DiscordRPC/MemoryUtil.cs b/NetEaseMusic-DiscordRPC/MemoryUtil.cs deleted file mode 100644 index 066e1f6..0000000 --- a/NetEaseMusic-DiscordRPC/MemoryUtil.cs +++ /dev/null @@ -1,134 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; - -namespace NetEaseMusic_DiscordRPC -{ - static class MemoryUtil - { - private static int ProcessId; - private static IntPtr EntryPoint; - private static IntPtr BaseAddress; - private static string Version; - - public static List Offsets; - - public static void LoadNetEaseMemory(int pid, ref double rate, ref double lens, ref string title, ref string album, ref string artists, ref string cover, ref string url, out bool extra) - { - extra = false; - - if (ProcessId != pid) - { - EntryPoint = OpenProcess(0x10, IntPtr.Zero, pid); - BaseAddress = IntPtr.Zero; - - using var process = Process.GetProcessById(pid); - - foreach (ProcessModule module in process.Modules) - { - if ("cloudmusic.dll".Equals(module.ModuleName)) - { - BaseAddress = module.BaseAddress; - break; - } - } - - Version = process.MainModule?.FileVersionInfo.ProductVersion; - } - - if (EntryPoint == IntPtr.Zero || BaseAddress == IntPtr.Zero || string.IsNullOrEmpty(Version)) - { - return; - } - - ProcessId = pid; - - var offset = Offsets.FirstOrDefault(x => x.Version == Version); - if (offset == null) - { - return; - } - - // create buffer - var buffer = new byte[64]; - - if (!ReadProcessMemory(EntryPoint, BaseAddress + offset.Offsets.Schedule, buffer, sizeof(double), IntPtr.Zero)) - { - Debug.Print($"Failed to load memory at 0x{(BaseAddress + offset.Offsets.Schedule).ToString("X")}"); - return; - } - var current = BitConverter.ToDouble(buffer, 0); - - if (!ReadProcessMemory(EntryPoint, BaseAddress + offset.Offsets.Length, buffer, sizeof(double), IntPtr.Zero)) - { - Debug.Print($"Failed to load memory at 0x{(BaseAddress + offset.Offsets.Length).ToString("X")}"); - return; - } - var length = BitConverter.ToDouble(buffer, 0); - - rate = current; - lens = length; - - if (offset.Offsets.CachePointer > 0) - { - try - { - // offset +8 (28 8f 0b050043 04 88) - // 28 8f 0b050043 04 88 31 00 39 00 39 00 38 00 36 00 39 00 36 00 34 00 34 00 33 00 5f 00 31 00 5f 00 38 00 34 00 33 00 35 00360039 00 36 00 31 00 37 00 33 00 00 - // op code - // cloudmusic.dll+709868: - // 7A1A985A - 0F82 68030000 - jb cloudmusic.dll + 709BC8 - // 7A1A9860 - 0FBA 25 284F547A 01 - bt[cloudmusic.dll + AA4F28],01 - // 7A1A9868 - 73 07 - jae cloudmusic.dll + 709871 << - // 7A1A986A - F3 A4 - repe movsb - // 7A1A986C - E9 17030000 - jmp cloudmusic.dll + 709B88 - if (!ReadProcessMemory(EntryPoint, BaseAddress + offset.Offsets.CachePointer, buffer, sizeof(uint), IntPtr.Zero)) - { - Debug.Print("Error read cache array pointer for %LocalAppData%/NetEase/CloudMusic/webdata/file"); - return; - } - - var add = BitConverter.ToUInt32(buffer, 0); - var ptr = new IntPtr(add); - if (!ReadProcessMemory(EntryPoint, ptr, buffer, int.MaxValue.ToString().Length * 2, IntPtr.Zero)) - { - Debug.Print("Error read pointer for %LocalAppData%/NetEase/CloudMusic/webdata/file"); - return; - } - - /* {tid}_{fid}_{data} */ - var id = Encoding.Unicode.GetString(buffer).Trim().Split('_')[0]; - - var sound = NetEaseCacheManager.GetSoundInfo(int.Parse(id)); - if (sound == null) - { - Debug.Print($"Sound {id} not found in cache"); - return; - } - - title = sound.Track.Name; - album = sound.Track.Album.Name; - artists = string.Join(", ", sound.Track.Artists.Select(x => x.Name)); - cover = sound.Track.Album.Cover; - lens = sound.Track.Duration * 0.001; - url = $"https://music.163.com/song?id={sound.Id}"; - extra = true; - } - catch (Exception e) - { - Debug.Print(e.ToString()); - } - } - } - - [DllImport("kernel32", SetLastError = true)] - static extern IntPtr OpenProcess(int dwDesiredAccess, IntPtr bInheritHandle, int dwProcessId); - - [DllImport("kernel32.dll", SetLastError = true)] - static extern bool ReadProcessMemory(IntPtr pHandle, IntPtr Address, byte[] Buffer, int Size, IntPtr NumberofBytesRead); - - } -} diff --git a/NetEaseMusic-DiscordRPC/NCM-DiscordRpc.nrproj b/NetEaseMusic-DiscordRPC/NCM-DiscordRpc.nrproj deleted file mode 100644 index 3cecf2a08d13f2fa7b56e8a616692172a26dc926..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20610 zcmeI4`%fE5636G~lkR`;-AcRCp@l#K8}1S$o(azo!Ygc6h=&bc%p=&u0o~tzcb{*U zo0*;&k7o?`!=6r-u|3oEuCA)C?&076dJ}C$_2?)%i8|4BbQ>K;oBX|we&?#L)l$Eg z+^9<+I?>zcuh9hWndr~apBPz--bCx%X+~GznT^`K>d|F%9JQi*Mjg95UmV4jqpJH~ zqK#-CxSyj1?zf>TK28~R!}n1}eCPcp8Y{$IhJ(Xs5zZP8{|PuHdCN)CjK1-G(|tdO z(+1yKj{9P|NfL_@>}qRSj>Tfv%ewS9rrUe$he0EAIQ%|8-}?(k9!I73fyY%tx=;#G z93G4JA$dG$tew?LF~k9Q~Ygx5K@^qpdNgT|u=UVMbk!5ncJy8MH^yy=KA~S7h_1n*r@d=p<|$ z)ywh|`al_|iD)vK%1F{ivLo`m?rDakrRu`{DDQjjXwG(!T6sH`Er!q2i=ufI?n1d1 zp?VC(Q*06D1ld>dCmA;ek4|G(7FPWt`|mp2-EqYtT?d(UCrhO)R7lNgD@8)da*AZ~ zR;$QVp;%pT)}t8KDAiy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iscordRPC/NetEaseMusic-DiscordRPC.csproj +++ /dev/null @@ -1,131 +0,0 @@ - - - - - Debug - AnyCPU - {8A5639C6-8083-4623-9234-D87878036C4E} - WinExe - NetEaseMusic_DiscordRPC - NCM-DiscordRpc - v4.8 - 512 - true - false - - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - true - - - x86 - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - 8.0 - - - x86 - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - Off - 8.0 - - - Resources\icon.ico - - - NetEaseMusic_DiscordRPC.Program - - - - ..\packages\DiscordRichPresence.1.1.3.18\lib\net45\DiscordRPC.dll - - - ..\packages\Newtonsoft.Json.13.0.2\lib\net45\Newtonsoft.Json.dll - - - - - - - - - - - - - - - - - - - - True - True - Resources.resx - - - True - True - Settings.settings - - - - - - - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - False - Microsoft .NET Framework 4.7.1 %28x86 和 x64%29 - true - - - False - .NET Framework 3.5 SP1 - false - - - - - Always - - - - \ No newline at end of file diff --git a/NetEaseMusic-DiscordRPC/Program.cs b/NetEaseMusic-DiscordRPC/Program.cs deleted file mode 100644 index 25ba189..0000000 --- a/NetEaseMusic-DiscordRPC/Program.cs +++ /dev/null @@ -1,370 +0,0 @@ -using DiscordRPC; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Threading; -using System.Threading.Tasks; -using System.Windows.Forms; -using Button = DiscordRPC.Button; - -namespace NetEaseMusic_DiscordRPC -{ - internal static class Program - { - private const string NeteaseAppId = "481562643958595594"; - private const string TencentAppId = "903485504899665990"; - - private static async Task Main() - { - // check run once - _ = new Mutex(true, "NetEase Cloud Music DiscordRPC", out var allow); - if (!allow) - { - MessageBox.Show("NetEase Cloud Music DiscordRPC is already running.", "Error", MessageBoxButtons.OK, - MessageBoxIcon.Error); - Environment.Exit(-1); - } - - // Auto Startup - if (Properties.Settings.Default.IsFirstTime) - { - AutoStart.Set(); - Properties.Settings.Default.IsFirstTime = false; - Properties.Settings.Default.Save(); - } - - await GetOffsetsAsync(); - - var neteaseRpc = new DiscordRpcClient(NeteaseAppId); - var tencentRpc = new DiscordRpcClient(TencentAppId); - neteaseRpc.Initialize(); - tencentRpc.Initialize(); - - if (!neteaseRpc.IsInitialized || !tencentRpc.IsInitialized) - { - MessageBox.Show("Failed to init rpc client.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - Environment.Exit(-1); - } - - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - - var notifyMenu = new ContextMenu(); - var exitButton = new MenuItem("Exit"); - var autoButton = new MenuItem("AutoStart" + " " + (AutoStart.Check() ? "√" : "✘")); - notifyMenu.MenuItems.Add(0, autoButton); - notifyMenu.MenuItems.Add(1, exitButton); - - var notifyIcon = new NotifyIcon() - { - BalloonTipIcon = ToolTipIcon.Info, - ContextMenu = notifyMenu, - Text = "NetEase Cloud Music DiscordRPC", - Icon = Properties.Resources.icon, - Visible = true, - }; - - exitButton.Click += (sender, args) => - { - notifyIcon.Visible = false; - Thread.Sleep(100); - Environment.Exit(0); - }; - autoButton.Click += (sender, args) => - { - var x = AutoStart.Check(); - if (x) - { - AutoStart.Remove(); - } - else - { - AutoStart.Set(); - } - - autoButton.Text = "AutoStart" + " " + (AutoStart.Check() ? "√" : "✘"); - }; - - _ = Task.Run(async () => await UpdateThread(neteaseRpc, tencentRpc)); - Application.Run(); - } - - private static async Task UpdateThread(DiscordRpcClient neteaseRpc, DiscordRpcClient tencentRpc) - { - var playerState = false; - var currentSong = string.Empty; - var currentSing = string.Empty; - var currentHash = string.Empty; - var currentImgX = string.Empty; - var currentKeyX = string.Empty; - var currentCurl = string.Empty; - var currentRate = 0.0; - var maxSongLens = 0.0; - var lastPlaying = -1; - - while (true) - { - try - { - var lastRate = currentRate; - var lastLens = maxSongLens; - var skipThis = false; - - if (!Win32Api.User32.GetWindowTitle("OrpheusBrowserHost", out var title, out var pid) && - !Win32Api.User32.GetWindowTitle("QQMusic_Daemon_Wnd", out title)) - { - Debug.Print($"player is not running"); - playerState = false; - goto update; - } - - // NetEase - if (pid > 0) - { - // load memory - var artists = string.Empty; - var album = string.Empty; - var cover = string.Empty; - var url = string.Empty; - MemoryUtil.LoadNetEaseMemory(pid, ref currentRate, ref maxSongLens, ref title, ref album, ref artists, - ref cover, ref url, out var extra); - - var diffRate = currentRate - lastRate; - - if (currentRate == 0.0 && maxSongLens == 0.0) - { - Debug.Print($"invalid? {currentRate} | {lastRate} | {diffRate}"); - playerState = false; - } - // magic hacks? //currentRate != 0.109 && - else if ((currentRate > 0.109 || currentRate == 0) && diffRate < 0.001 && diffRate >= 0 && - maxSongLens == lastLens) //currentRate.Equals(lastRate) - { - Debug.Print( - $"Music pause? {currentRate} | {lastRate} | {maxSongLens} | {lastLens} | {diffRate}"); - playerState = false; - } - else if (!playerState || !maxSongLens.Equals(lastLens)) - { - if (extra) - { - // force refresh if cache loaded - var hash = $"{title}-{artists}-{cover}"; - if (hash != currentHash) - { - skipThis = false; - } - - currentHash = hash; - - currentSong = title; - currentSing = artists; - - currentImgX = cover; - currentKeyX = album; - currentCurl = url; - } - else - { - var match = title.Replace("\r", "").Replace("\n", "").Replace(" - ", "\t").Split('\t'); - if (match.Length > 1) - { - currentSong = match[0]; - currentSing = match[1]; // like spotify - } - else - { - currentSong = title; - currentSing = string.Empty; - } - - currentImgX = "timg"; - currentKeyX = "Netease Cloud Music"; - currentCurl = "https://music.163.com/#/search/m/?s=" + currentSong; - } - - playerState = true; - } - // check - else if (Math.Abs(diffRate) < 1.0 && neteaseRpc.CurrentPresence != null) - { - // skip playing - Debug.Print($"Skip Rpc {currentRate} | {lastRate} | {Math.Abs(diffRate)}"); - skipThis = true; - } - } - // Tencent - else if (pid == 0) - { - // mark as playing and always update - playerState = true; - skipThis = false; - - // TODO - // soundId = QQMusic.dll+B661C8 - // soundLen = QQMusic.dll+B661DC - // soundInfo = ptr + 0x19B09528 - // https://y.qq.com/n/ryqq/songDetail/ - - var match = title.Replace(" - ", "\t").Split('\t'); - if (match.Length > 1) - { - currentSong = match[0]; - currentSing = match[1]; // like spotify - } - else - { - currentSong = title; - currentSing = string.Empty; - } - } - - Debug.Print($"playerState -> {playerState} | Equals {maxSongLens} | {lastLens}"); - - if (lastPlaying != pid) - { - // player changed - skipThis = false; - } - - lastPlaying = pid; - - update: - // update -#if DEBUG - if (!playerState) -#else - if (Win32Api.User32.IsFullscreenAppRunning() || Win32Api.User32.IsWhitelistAppRunning() || - !playerState) -#endif - { - Debug.Print( - $"Try clear Rpc {Win32Api.User32.IsFullscreenAppRunning()} | {Win32Api.User32.IsWhitelistAppRunning()}"); - if (neteaseRpc.CurrentPresence != null) - { - neteaseRpc.ClearPresence(); - Debug.Print("Clear netease rpc"); - } - - if (tencentRpc.CurrentPresence != null) - { - tencentRpc.ClearPresence(); - Debug.Print("Clear tencent rpc"); - } - - continue; - } - - if (skipThis) - // skip - { - continue; - } - - if (pid > 0) - { - tencentRpc.ClearPresence(); - neteaseRpc.SetPresence(new RichPresence - { - Details = $"🎵 {currentSong}", - State = $"🎤 {currentSing}", - - Timestamps = new Timestamps( - DateTime.UtcNow.Subtract(TimeSpan.FromSeconds(currentRate)), - DateTime.UtcNow.Subtract(TimeSpan.FromSeconds(currentRate)) - .Add(TimeSpan.FromSeconds(maxSongLens))), - - Assets = new Assets - { - LargeImageKey = currentImgX, - LargeImageText = currentKeyX, - SmallImageKey = "timg", - SmallImageText = "Netease Cloud Music", - }, - - Buttons = new[] - { - new Button - { - Label = "🎧 Listen", - Url = currentCurl, - // Url = "https://music.163.com/" - }, - }, - }); - } - else if (pid == 0) - { - neteaseRpc.ClearPresence(); - tencentRpc.SetPresence(new RichPresence - { - Details = $"🎵 {currentSong}", - State = $"🎤 {currentSing}", - - Assets = new Assets - { - LargeImageKey = "qimg", - LargeImageText = "QQMusic", - }, - }); - } - - Debug.Print("Update Rpc"); - } - catch (Exception e) - { - Console.WriteLine($"Exception while listening: {e}"); - } - finally - { - // 用户就喜欢超低内存占用 - // 但是实际上来说并没有什么卵用 - GC.Collect(); - GC.WaitForFullGCComplete(); - - await Task.Delay(TimeSpan.FromMilliseconds(200)); - } - } - } - - private static async Task GetOffsetsAsync() - { - retry: - try - { - using var client = new HttpClient() - { - Timeout = TimeSpan.FromMinutes(1), - }; - - client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); - - var response = - await client.GetAsync( - "https://github.com/Kxnrl/NetEase-Cloud-Music-DiscordRPC/raw/master/offset/offset.json"); - - response.EnsureSuccessStatusCode(); - - var json = await response.Content.ReadAsStringAsync(); - - MemoryUtil.Offsets = JsonConvert.DeserializeObject>(json); - } - catch (Exception e) - { - var r = MessageBox.Show(e.Message, "Failed to get offsets", MessageBoxButtons.RetryCancel, - MessageBoxIcon.Error); - if (r == DialogResult.Retry) - { - goto retry; - } - -#if !DEBUG - Environment.Exit(-1); -#endif - } - } - } -} \ No newline at end of file diff --git a/NetEaseMusic-DiscordRPC/Properties/AssemblyInfo.cs b/NetEaseMusic-DiscordRPC/Properties/AssemblyInfo.cs deleted file mode 100644 index 4313b37..0000000 --- a/NetEaseMusic-DiscordRPC/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// 有关程序集的一般信息由以下 -// 控制。更改这些特性值可修改 -// 与程序集关联的信息。 -[assembly: AssemblyTitle("Netease Music DiscordRpc")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("©2023 Kyle")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 会使此程序集中的类型 -//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 -//请将此类型的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("8a5639c6-8083-4623-9234-d87878036c4e")] - -// 程序集的版本信息由下列四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 -// 方法是按如下所示使用“*”: : -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.3.0")] -[assembly: AssemblyFileVersion("2.3.0")] diff --git a/NetEaseMusic-DiscordRPC/Properties/Resources.Designer.cs b/NetEaseMusic-DiscordRPC/Properties/Resources.Designer.cs deleted file mode 100644 index 10a9e20..0000000 --- a/NetEaseMusic-DiscordRPC/Properties/Resources.Designer.cs +++ /dev/null @@ -1,73 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 此代码由工具生成。 -// 运行时版本:4.0.30319.42000 -// -// 对此文件的更改可能会导致不正确的行为,并且如果 -// 重新生成代码,这些更改将会丢失。 -// -//------------------------------------------------------------------------------ - -namespace NetEaseMusic_DiscordRPC.Properties { - using System; - - - /// - /// 一个强类型的资源类,用于查找本地化的字符串等。 - /// - // 此类是由 StronglyTypedResourceBuilder - // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 - // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen - // (以 /str 作为命令选项),或重新生成 VS 项目。 - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// 返回此类使用的缓存的 ResourceManager 实例。 - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NetEaseMusic_DiscordRPC.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// 重写当前线程的 CurrentUICulture 属性 - /// 重写当前线程的 CurrentUICulture 属性。 - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// 查找类似于 (图标) 的 System.Drawing.Icon 类型的本地化资源。 - /// - internal static System.Drawing.Icon icon { - get { - object obj = ResourceManager.GetObject("icon", resourceCulture); - return ((System.Drawing.Icon)(obj)); - } - } - } -} diff --git a/NetEaseMusic-DiscordRPC/Properties/Resources.resx b/NetEaseMusic-DiscordRPC/Properties/Resources.resx deleted file mode 100644 index 95ac60c..0000000 --- a/NetEaseMusic-DiscordRPC/Properties/Resources.resx +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - ..\Resources\icon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - \ No newline at end of file diff --git a/NetEaseMusic-DiscordRPC/Properties/Settings.Designer.cs b/NetEaseMusic-DiscordRPC/Properties/Settings.Designer.cs deleted file mode 100644 index a37358c..0000000 --- a/NetEaseMusic-DiscordRPC/Properties/Settings.Designer.cs +++ /dev/null @@ -1,38 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 此代码由工具生成。 -// 运行时版本:4.0.30319.42000 -// -// 对此文件的更改可能会导致不正确的行为,并且如果 -// 重新生成代码,这些更改将会丢失。 -// -//------------------------------------------------------------------------------ - -namespace NetEaseMusic_DiscordRPC.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.7.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool IsFirstTime { - get { - return ((bool)(this["IsFirstTime"])); - } - set { - this["IsFirstTime"] = value; - } - } - } -} diff --git a/NetEaseMusic-DiscordRPC/Properties/Settings.settings b/NetEaseMusic-DiscordRPC/Properties/Settings.settings deleted file mode 100644 index c210a8a..0000000 --- a/NetEaseMusic-DiscordRPC/Properties/Settings.settings +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - True - - - \ No newline at end of file diff --git a/NetEaseMusic-DiscordRPC/Resources/icon.ico b/NetEaseMusic-DiscordRPC/Resources/icon.ico deleted file mode 100644 index 361964de3e35a4bd0c6035c5fccf801d9b8e0f45..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4286 zcmc(j{cDz07{~9qO-)W4&UJ1~k|zGH zUY+RQ*#j4%x2gu%x&kgibp-4jp`J03-Qf$Roe^J7p`D0xzvt1YbO3AsTslMTe$3I z-*QBp^Ss?L4{>jDRdYXa9(2}DxYUg1GRZoIjJN`lnyX0AS#yQwDR}Z7q7` zUGb?lP55{je%J9g>holMuV3bT-hju!+*Wf`ds^_h2HQbzU$lMb6idugj6dYBYHQfx zi=Hdl&#_Z|#Z7#vC;2n;^{rF2}r^gQX&$C~>Dtz_8I$}GI|55VLkN-vJ0{_e` zhFibKSN$rclJA)V-b3iG`h7)v7`^z$xZ@i0zZF}}+6n6T>a_SH;)53@w~)g;fm(bqeF>OY z&r9rA&W4zEDSFjR{Wgc3t|zD8gQYwuKAnAGbN2Wh&Zl&$<2CB|K0T<|;#{nU9d%&_ zSJM6L{RJPxa5%=^mGIY{yqM=^)=px48y>>bJ+D=wZ;|jFQZOgrx}AOMA=P$f%_HXY zwH@D@!;8p)@~k*CSB^2aHs-a^?39Sl8hY|5?{!aWE}Wvy`@nq++!D@_-AYQ^`CzEd*)Eh?Nwup^%~ z_J#W(GaK-G9RHg6L(G1iu`|TD*~gaIE_hvp-$Z`*kP~tzJe>jESK)gp`fhX;UwX!W zw=JiK-T_13o65zntlxp7{AWCe`>JRUQlC~|qs%PzcX!o3gCEtuQQVn!%7bRL`o0Gq z?-Fl6cf(e6inY_{BldsM9&zQu0cvs_o|DYPn{eFZZ9`pW`fud7dPkyMhPtZ$zDAle z%)t~K^@zT+jGy1iiN2N3VfP?=l>_-`1n+h>%7sL=x#g=T)%@R{_o`~7Gjj>-Ltt;f zR`;Ox-Olen(`TLwv)-(L$0M$q_VT=u-cj9jPX0aYTQLbkc$$+E#jLpg3+$Lb)kJuj OwT Artists { get; set; } - - /// - /// Duration in milliseconds - /// - [JsonProperty("duration")] - public uint Duration { get; set; } - } - - public class NetEaseSoundModel - { - [JsonProperty("track")] - public NetEaseTrackModel Track { get; set; } - - [JsonProperty("tid")] - public uint Id { get; set; } - } - - public static class NetEaseCacheManager - { - private static string[] Files = { "queue", "queue_backup", "history" }; - - public static NetEaseSoundModel GetSoundInfo(int tid) - { - foreach (var f in Files) - { - var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "NetEase", "CloudMusic", "webdata", "file", f); - if (!File.Exists(path)) - { - continue; - } - var data = File.ReadAllText(path, Encoding.UTF8); - var json = JsonConvert.DeserializeObject(data); - var find = json.SingleOrDefault(x => x.Id == tid); - if (find != null) - { - return find; - } - } - - return null; - } - } -} diff --git a/NetEaseMusic-DiscordRPC/packages.config b/NetEaseMusic-DiscordRPC/packages.config deleted file mode 100644 index 4843af4..0000000 --- a/NetEaseMusic-DiscordRPC/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/NetEaseMusic-DiscordRPC/win32Api.cs b/NetEaseMusic-DiscordRPC/win32Api.cs deleted file mode 100644 index 41e6a71..0000000 --- a/NetEaseMusic-DiscordRPC/win32Api.cs +++ /dev/null @@ -1,178 +0,0 @@ -using System; -using System.Diagnostics; -using System.IO; -using System.Runtime.InteropServices; -using System.Text; -using System.Windows.Forms; - -namespace NetEaseMusic_DiscordRPC.Win32Api -{ - public class User32 - { - [StructLayout(LayoutKind.Sequential)] - private struct RECT - { - public int Left; - public int Top; - public int Right; - public int Bottom; - } - - [DllImport("user32.dll")] - private static extern IntPtr GetForegroundWindow(); - - [DllImport("user32.dll")] - private static extern IntPtr GetDesktopWindow(); - - [DllImport("user32.dll")] - private static extern IntPtr GetShellWindow(); - - [DllImport("user32.dll", SetLastError = true)] - private static extern int GetWindowRect(IntPtr hwnd, out RECT rc); - - [DllImport("user32.dll", EntryPoint = "FindWindow")] - private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); - - private delegate bool EnumWindowsProc(IntPtr hWnd, int lParam); - - [DllImport("user32.dll")] - private static extern bool EnumWindows(EnumWindowsProc enumProc, IntPtr lParam); - - [DllImport("user32.dll")] - private static extern void GetClassName(IntPtr hwnd, StringBuilder sb, int nMaxCount); - - [DllImport("user32.dll", CharSet = CharSet.Unicode)] - private static extern int GetWindowText(IntPtr hWnd, StringBuilder strText, int maxCount); - - [DllImport("user32.dll", CharSet = CharSet.Unicode)] - private static extern int GetWindowTextLength(IntPtr hWnd); - - [DllImport("user32.dll")] - private static extern int GetWindowThreadProcessId(IntPtr handle, out int pid); - - private static string GetClassName(IntPtr hwnd) - { - var sb = new StringBuilder(256); - GetClassName(hwnd, sb, 256); - return sb.ToString(); - } - - private static string GetWindowTitle(IntPtr hwnd) - { - var length = GetWindowTextLength(hwnd); - var sb = new StringBuilder(256); - GetWindowText(hwnd, sb, length + 1); - return sb.ToString(); - } - - public static bool IsFullscreenAppRunning() - { - var desktopHandle = GetDesktopWindow(); - var shellHandle = GetShellWindow(); - var window = GetForegroundWindow(); - - if (window != IntPtr.Zero) - { - if (!(window.Equals(desktopHandle) || window.Equals(shellHandle))) - { - GetWindowRect(window, out var appBounds); - System.Drawing.Rectangle screenBounds = Screen.FromHandle(window).Bounds; - if ((appBounds.Bottom - appBounds.Top) == screenBounds.Height && (appBounds.Right - appBounds.Left) == screenBounds.Width) - { - // In full screen. - return true; - } - } - } - - return false; - } - - private static string window_name = null; - public static bool IsWhitelistAppRunning() - { - // VisualStudioAppManagement - // VSCodeCrashServiceWindow - // Valve001 - // UnrealWindow - // Rainbow Six - - if (!File.Exists(Application.StartupPath + "\\windows.txt")) - { - // Config file doesn't exits... - return false; - } - - using var sr = new StreamReader(Application.StartupPath + "\\windows.txt", Encoding.UTF8); - - while ((window_name = sr.ReadLine()) != null) - { - // TrimString - window_name = window_name.Trim(); - - if (window_name.StartsWith("//") || window_name.Length < 3) - { - // ignore comments or spacer - continue; - } - - if (window_name.EndsWith(".exe")) - { - return Process.GetProcessesByName(window_name.Replace(".exe", "")).Length > 0; - } - else - { - var window = FindWindow(window_name, null); - if (window != IntPtr.Zero) - { - Debug.WriteLine($"FindWindow {window_name}"); - return true; - } - } - } - - return false; - } - - public static bool GetWindowTitle(string match, out string text) - { - text = null; - - var handle = FindWindow(match, null); - - if (handle == IntPtr.Zero) - return false; - - text = GetWindowTitle(handle); - - return true; - } - - public static bool GetWindowTitle(string match, out string text, out int pid) - { - var title = string.Empty; - var processId = 0; - - EnumWindows - ( - delegate (IntPtr handle, int param) - { - var classname = GetClassName(handle); - - if (match.Equals(classname) && GetWindowThreadProcessId(handle, out var xpid) != 0 && xpid != 0) - { - title = GetWindowTitle(handle); - processId = xpid; - } - - return true; - }, - IntPtr.Zero - ); - - text = title; - pid = processId; - return !string.IsNullOrEmpty(title) && pid > 0; - } - } -} \ No newline at end of file diff --git a/NetEaseMusic-DiscordRPC/windows.txt b/NetEaseMusic-DiscordRPC/windows.txt deleted file mode 100644 index c9aca06..0000000 --- a/NetEaseMusic-DiscordRPC/windows.txt +++ /dev/null @@ -1,18 +0,0 @@ -// Visual Studio -VisualStudioAppManagement -devenv.exe - -// Visual Studio Code -Code.exe - -// SourceEngine Game -Valve001 - -// UnrealEngine Game -UnrealWindow - -// Unity3D Game -UnityWndClass - -// Shit Game -Rainbow Six \ No newline at end of file diff --git a/offset/offset.json b/offset/offset.json deleted file mode 100644 index 9648537..0000000 --- a/offset/offset.json +++ /dev/null @@ -1,66 +0,0 @@ -[ - { - "version": "2.7.1.198277", - "offsets": { "length": 9345688, "schedule": 9210616 } - }, - { - "version": "2.9.5.199424", - "offsets": { "length": 9958792, "schedule": 9789280 } - }, - { - "version": "2.9.6.199543", - "offsets": { "length": 10541176, "schedule": 9846704 } - }, - { - "version": "2.9.7.199711", - "offsets": { "length": 10591048, "schedule": 9895888 } - }, - { - "version": "2.9.8.199750", - "offsets": { "length": 10989816, "schedule": 10269480 } - }, - { - "version": "2.9.8.199759", - "offsets": { "length": 10989816, "schedule": 10269488 } - }, - { - "version": "2.9.9.199909", - "offsets": { "length": 11076056, "schedule": 10355536 } - }, - { - "version": "2.9.10.200061", - "offsets": { "length": 11092440, "schedule": 10371920 } - }, - { - "version": "2.10.2.200154", - "offsets": { "length": 11583864, "schedule": 10843496 } - }, - { - "version": "2.10.3.200198", - "offsets": { "length": 11443528, "schedule": 10720592 } - }, - { - "version": "2.10.5.200537", - "offsets": { "length": 11500936, "schedule": 10777928 } - }, - { - "version": "2.10.7.200791", - "offsets": { "length": 11689328, "schedule": 10962280 } - }, - { - "version": "2.10.8.200945", - "offsets": { "length": 11689240, "schedule": 10962288 } - }, - { - "version": "2.10.10.201197", - "offsets": { "length": 11708952, "schedule": 10978688 } - }, - { - "version": "2.10.10.201297", - "offsets": { "length": 11713272, "schedule": 10982784 } - }, - { - "version": "2.10.11.201538", - "offsets": { "length": 11717272, "schedule": 10986880, "pointer": 11713712 } - } -]