Skip to content

Commit

Permalink
全面更改,项目从此为音乐播放器,且已可用
Browse files Browse the repository at this point in the history
  • Loading branch information
Miaoyww committed Aug 15, 2022
1 parent 5d9ab8d commit e4119f5
Show file tree
Hide file tree
Showing 63 changed files with 1,179 additions and 1,698 deletions.
8 changes: 1 addition & 7 deletions NeteaseCloudMusicControl.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32804.467
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ui", "NeteaseCloudMusicControl\Ui.csproj", "{71CE92DD-BD42-48C2-9FBE-59FD2C7EA060}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Service", "NeteaseCloudMusicControlService\Service.csproj", "{7F945FA9-CB84-4B2A-9BCD-3043080D1FD4}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NeteaseCloudMusicControl", "NeteaseCloudMusicControl\NeteaseCloudMusicControl.csproj", "{71CE92DD-BD42-48C2-9FBE-59FD2C7EA060}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -17,10 +15,6 @@ Global
{71CE92DD-BD42-48C2-9FBE-59FD2C7EA060}.Debug|Any CPU.Build.0 = Debug|Any CPU
{71CE92DD-BD42-48C2-9FBE-59FD2C7EA060}.Release|Any CPU.ActiveCfg = Release|Any CPU
{71CE92DD-BD42-48C2-9FBE-59FD2C7EA060}.Release|Any CPU.Build.0 = Release|Any CPU
{7F945FA9-CB84-4B2A-9BCD-3043080D1FD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7F945FA9-CB84-4B2A-9BCD-3043080D1FD4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7F945FA9-CB84-4B2A-9BCD-3043080D1FD4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7F945FA9-CB84-4B2A-9BCD-3043080D1FD4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
3 changes: 2 additions & 1 deletion NeteaseCloudMusicControl/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:NeteaseCloudMusicControl"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
StartupUri="MainWindow.xaml">
Startup="Application_Startup"
StartupUri="Views/MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
Expand Down
43 changes: 34 additions & 9 deletions NeteaseCloudMusicControl/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,42 @@
using System;
using Microsoft.Win32;
using NeteaseCloudMusicControl.Views.Methods;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Net;
using System.Windows;
using System.Windows.Controls;

namespace NeteaseCloudMusicControl
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
private void Application_Startup(object sender, StartupEventArgs e)
{
JObject keys = new();
keys.Add("ServerIpAddress", "127.0.0.1");
keys.Add("ServerPort", "4000");
keys.Add("CurrentVolume", "100");
IEnumerable<JProperty> properties = keys.Properties();
foreach (JProperty key in properties)
{
if (Registry.GetValue(AppConfig.RegPath, key.Name, null) == null)
{
Registry.SetValue(AppConfig.RegPath, key.Name, key.Value);
}
}
CurrentResources.ServerIp = Registry.GetValue(AppConfig.RegPath, "ServerIpAddress", "127.0.0.1").ToString();
CurrentResources.ServerPort = Registry.GetValue(AppConfig.RegPath, "ServerPort", "4000").ToString();
CurrentResources.CurrentVolume = Registry.GetValue(AppConfig.RegPath, "CurrentVolume", "100").ToString();
CurrentResources.musicplayer = new();
CurrentResources.musicplayer.UnloadedBehavior = MediaState.Manual;
CurrentResources.musicplayer.LoadedBehavior = MediaState.Manual;
CurrentResources.musicplayer.MediaOpened += PlayerMethods.Musicplayer_MediaOpened;
CurrentResources.musicplayer.MediaFailed += PlayerMethods.Musicplayer_MediaFailed;
CurrentResources.musicplayer.MediaEnded += PlayerMethods.Musicplayer_MediaEnded;
CurrentResources.musicplayer.Visibility = Visibility.Hidden;
PlayerMethods.timer = new();
PlayerMethods.timer.Elapsed += PlayerMethods.Timer_Elapsed;
}

}
}
}
8 changes: 6 additions & 2 deletions NeteaseCloudMusicControl/AppConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
using System.Text;
using System.Threading.Tasks;

namespace Ui
namespace NeteaseCloudMusicControl
{
internal class AppConfig
public static class AppConfig
{
public static string AppVersion = "0.1.5";

public static string RegPath = @"HKEY_CURRENT_USER\SOFTWARE\Miaoywww\NeteaseCloudMusicControl\";

}
}
28 changes: 28 additions & 0 deletions NeteaseCloudMusicControl/CurrentResources.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;

namespace NeteaseCloudMusicControl
{
public static class CurrentResources
{
public static MediaElement musicplayer;

public static string soundPath;

public static bool isPlayed = false;

public static string CurrentVolume = string.Empty;

public static string ServerIp = "127.0.0.1";

public static string ServerPort = "4000";

public static string Log = string.Empty;

public static string SoundsPath = "./sounds.json";
}
}
56 changes: 0 additions & 56 deletions NeteaseCloudMusicControl/MainWindow.xaml

This file was deleted.

Loading

0 comments on commit e4119f5

Please sign in to comment.