mirror of
https://github.com/Royce551/FRESHMusicPlayer-Core.git
synced 2025-01-22 19:02:35 -05:00
initial commit
This commit is contained in:
parent
aeaadd9206
commit
ef61830a00
23 changed files with 1395 additions and 0 deletions
31
FRESHMusicPlayer.Player/FRESHMusicPlayer.Player.sln
Normal file
31
FRESHMusicPlayer.Player/FRESHMusicPlayer.Player.sln
Normal file
|
@ -0,0 +1,31 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30114.105
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FRESHMusicPlayer.Core", "FRESHMusicPlayer.Player\FRESHMusicPlayer.Core.csproj", "{FFE8EAFD-7FAA-4503-9364-2643821A2BC8}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinformsTest", "WinformsTest\WinformsTest.csproj", "{AA375910-6E80-4570-9663-8EA13238192A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{FFE8EAFD-7FAA-4503-9364-2643821A2BC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FFE8EAFD-7FAA-4503-9364-2643821A2BC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FFE8EAFD-7FAA-4503-9364-2643821A2BC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FFE8EAFD-7FAA-4503-9364-2643821A2BC8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AA375910-6E80-4570-9663-8EA13238192A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AA375910-6E80-4570-9663-8EA13238192A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AA375910-6E80-4570-9663-8EA13238192A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AA375910-6E80-4570-9663-8EA13238192A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {4AD6E028-0932-471C-828A-F2CBCA4A7CED}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,73 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{FFE8EAFD-7FAA-4503-9364-2643821A2BC8}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>FRESHMusicPlayer.Player</RootNamespace>
|
||||
<AssemblyName>FRESHMusicPlayer.Core</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ATL, Version=2.16.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\z440.atl.core.2.16.0\lib\net30\ATL.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DiscordRPC, Version=1.0.150.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DiscordRichPresence.1.0.150\lib\net35\DiscordRPC.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NAudio, Version=1.10.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NAudio.1.10.0\lib\net35\NAudio.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Handlers\DatabaseHandler.cs" />
|
||||
<Compile Include="Handlers\ErrorHandler.cs" />
|
||||
<Compile Include="Handlers\Integrations\Integration.cs" />
|
||||
<Compile Include="Handlers\InternetHandler.cs" />
|
||||
<Compile Include="Player.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Utilities\databaseformat.cs" />
|
||||
<Compile Include="Utilities\PlayerUtils.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Utilities\database.json" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,128 @@
|
|||
using FRESHMusicPlayer.Utilities;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
namespace FRESHMusicPlayer.Handlers
|
||||
{
|
||||
static class DatabaseHandler
|
||||
{
|
||||
public static readonly int DatabaseVersion = 1;
|
||||
public static readonly string DatabasePath;
|
||||
static DatabaseHandler()
|
||||
{
|
||||
DatabasePath = $"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}\\FRESHMusicPlayer";
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns all of the tracks in the database.
|
||||
/// </summary>
|
||||
/// <returns>A list of file paths in the database.</returns>
|
||||
public static List<string> ReadSongs()
|
||||
{
|
||||
if (!File.Exists(DatabasePath + "\\database.json"))
|
||||
{
|
||||
Directory.CreateDirectory(DatabasePath);
|
||||
File.WriteAllText(DatabasePath + "\\database.json", $"{{\"Version\":{DatabaseVersion},\"Songs\":[]}}");
|
||||
}
|
||||
using (StreamReader file = File.OpenText(DatabasePath + "\\database.json")) // Read json file
|
||||
{
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
DatabaseFormat database = (DatabaseFormat)serializer.Deserialize(file, typeof(DatabaseFormat));
|
||||
return database.Songs;
|
||||
}
|
||||
}
|
||||
|
||||
public static void ImportSong(string filepath)
|
||||
{
|
||||
List<string> database = ReadSongs();
|
||||
|
||||
database.Add(filepath); // Add the new song in
|
||||
DatabaseFormat format = new DatabaseFormat();
|
||||
format.Version = 1;
|
||||
format.Songs = new List<string>();
|
||||
format.Songs = database;
|
||||
|
||||
using (StreamWriter file = File.CreateText(DatabasePath + "\\database.json"))
|
||||
{
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
serializer.Serialize(file, format);
|
||||
}
|
||||
|
||||
}
|
||||
public static void ImportSong(string[] filepath)
|
||||
{
|
||||
List<string> database = ReadSongs();
|
||||
|
||||
database.AddRange(filepath);
|
||||
DatabaseFormat format = new DatabaseFormat();
|
||||
format.Version = 1;
|
||||
format.Songs = new List<string>();
|
||||
format.Songs = database;
|
||||
|
||||
using (StreamWriter file = File.CreateText(DatabasePath + "\\database.json"))
|
||||
{
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
serializer.Serialize(file, format);
|
||||
}
|
||||
|
||||
}
|
||||
public static void ImportSong(List<string> filepath)
|
||||
{
|
||||
List<string> database = ReadSongs();
|
||||
|
||||
database.AddRange(filepath);
|
||||
DatabaseFormat format = new DatabaseFormat();
|
||||
format.Version = 1;
|
||||
format.Songs = new List<string>();
|
||||
format.Songs = database;
|
||||
|
||||
using (StreamWriter file = File.CreateText(DatabasePath + "\\database.json"))
|
||||
{
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
serializer.Serialize(file, format);
|
||||
}
|
||||
|
||||
}
|
||||
public static void ImportSong(IList<string> filepath)
|
||||
{
|
||||
List<string> database = ReadSongs();
|
||||
|
||||
database.AddRange(filepath);
|
||||
DatabaseFormat format = new DatabaseFormat();
|
||||
format.Version = 1;
|
||||
format.Songs = new List<string>();
|
||||
format.Songs = database;
|
||||
|
||||
using (StreamWriter file = File.CreateText(DatabasePath + "\\database.json"))
|
||||
{
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
serializer.Serialize(file, format);
|
||||
}
|
||||
|
||||
}
|
||||
public static void DeleteSong(string filepath)
|
||||
{
|
||||
List<string> database = ReadSongs();
|
||||
database.Remove(filepath);
|
||||
DatabaseFormat format = new DatabaseFormat();
|
||||
format.Version = 1;
|
||||
format.Songs = database;
|
||||
|
||||
|
||||
using (StreamWriter file = File.CreateText(DatabasePath + "\\database.json"))
|
||||
{
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
serializer.Serialize(file, format);
|
||||
}
|
||||
}
|
||||
public static void ClearLibrary()
|
||||
{
|
||||
if (File.Exists(DatabasePath + "\\database.json"))
|
||||
{
|
||||
File.Delete(DatabasePath + "\\database.json");
|
||||
File.WriteAllText(DatabasePath + "\\database.json", @"{""Version"":1,""Songs"":[]}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FRESHMusicPlayer.Handlers
|
||||
{
|
||||
public class PlaybackExceptionEventArgs : EventArgs
|
||||
{
|
||||
public string Details { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Drawing;
|
||||
namespace FRESHMusicPlayer.Handlers.Integrations
|
||||
{
|
||||
|
||||
class IntegrationData
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public string Artist { get; set; }
|
||||
public string Album { get; set; }
|
||||
public string Genre { get; set; }
|
||||
public int Year { get; set; }
|
||||
public int TrackNumber { get; set; }
|
||||
public int DiscNumber { get; set; }
|
||||
public int Bitrate { get; set; }
|
||||
//public Image AlbumArt { get; set; }
|
||||
|
||||
}
|
||||
class IntegrationQuery
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public string AltTitle { get; set; }
|
||||
public string Album { get; set; }
|
||||
public int TrackNumber { get; set; }
|
||||
}
|
||||
abstract class Integration
|
||||
{
|
||||
/*abstract public (string type, string label)[] Options { get; }
|
||||
/// <summary>
|
||||
/// Fetches metadata from the integration.
|
||||
/// </summary>
|
||||
/// <param name="query">The query for the integration to use (usually the song title)</param>
|
||||
/// <returns></returns>
|
||||
abstract public List<IntegrationData> FetchMetadata(IntegrationQuery query);*/
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FRESHMusicPlayer.Handlers
|
||||
{
|
||||
public static class InternetHandler
|
||||
{
|
||||
public static HttpClient HttpClient;
|
||||
static InternetHandler()
|
||||
{
|
||||
HttpClient = new HttpClient();
|
||||
HttpClient.DefaultRequestHeaders.UserAgent.ParseAdd($"FRESHMusicPlayer/8.0.0 (https://github.com/Royce551/FRESHMusicPlayer)"); // hi i'm FMP
|
||||
}
|
||||
}
|
||||
}
|
328
FRESHMusicPlayer.Player/FRESHMusicPlayer.Player/Player.cs
Normal file
328
FRESHMusicPlayer.Player/FRESHMusicPlayer.Player/Player.cs
Normal file
|
@ -0,0 +1,328 @@
|
|||
using DiscordRPC;
|
||||
using NAudio.Wave;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using FRESHMusicPlayer.Handlers;
|
||||
using FRESHMusicPlayer.Utilities;
|
||||
using System.Net.Http;
|
||||
namespace FRESHMusicPlayer
|
||||
{
|
||||
public partial class Player : Form
|
||||
{
|
||||
private static WaveOutEvent outputDevice;
|
||||
public static AudioFileReader audioFile;
|
||||
public static bool avoidnextqueue = false;
|
||||
public static DiscordRpcClient client;
|
||||
|
||||
//public static int position;
|
||||
public static float currentvolume = 1;
|
||||
public static string filePath = "";
|
||||
public static bool playing = false;
|
||||
public static bool paused = false;
|
||||
|
||||
public static bool RepeatOnce = false;
|
||||
public static bool Shuffle = false;
|
||||
|
||||
private static List<string> Queue = new List<string>();
|
||||
public static int QueuePosition = 0;
|
||||
|
||||
public static DateTime lastUpdateCheck;
|
||||
/// <summary>
|
||||
/// Raised whenever a new track is being played.
|
||||
/// </summary>
|
||||
public static event EventHandler songChanged;
|
||||
public static event EventHandler songStopped;
|
||||
public static event EventHandler<PlaybackExceptionEventArgs> songException;
|
||||
public Player()
|
||||
{
|
||||
}
|
||||
#region CoreFMP
|
||||
// Queue System
|
||||
/// <summary>
|
||||
/// Adds a track to the <see cref="queue"/>.
|
||||
/// </summary>
|
||||
/// <param name="filePath">The file path to the track to add.</param>
|
||||
public static void AddQueue(string filePath)
|
||||
{
|
||||
Queue.Add(filePath);
|
||||
}
|
||||
public static void AddQueue(string[] filePaths)
|
||||
{
|
||||
Queue.AddRange(filePaths);
|
||||
}
|
||||
public static void ClearQueue() => Queue.Clear();
|
||||
public static List<string> GetQueue()
|
||||
{
|
||||
|
||||
return Queue;
|
||||
}
|
||||
/// <summary>
|
||||
/// Skips to the previous track in the queue. If there are no tracks for the player to go back to, nothing will happen.
|
||||
/// </summary>
|
||||
public static void PreviousSong()
|
||||
{
|
||||
if (QueuePosition <= 1) return;
|
||||
if (Shuffle) Queue = PlayerUtils.ShuffleQueue(Queue);
|
||||
QueuePosition -= 2;
|
||||
PlayMusic();
|
||||
}
|
||||
/// <summary>
|
||||
/// Skips to the next track in the queue. If there are no more tracks, the player will stop.
|
||||
/// </summary>
|
||||
/// <param name="avoidnext">Intended to be used only by the player</param>
|
||||
public static void NextSong(bool avoidnext = false)
|
||||
{
|
||||
avoidnextqueue = avoidnext;
|
||||
if (QueuePosition >= Queue.Count)
|
||||
{
|
||||
Queue.Clear();
|
||||
QueuePosition = 0;
|
||||
StopMusic();
|
||||
return;
|
||||
}
|
||||
if (RepeatOnce) QueuePosition--; // Don't advance queue, play the same thing again
|
||||
if (Shuffle) Queue = PlayerUtils.ShuffleQueue(Queue);
|
||||
PlayMusic();
|
||||
}
|
||||
// Music Playing Controls
|
||||
private static void OnPlaybackStopped(object sender, StoppedEventArgs args)
|
||||
{
|
||||
if (!avoidnextqueue) NextSong(false);
|
||||
else
|
||||
{
|
||||
avoidnextqueue = false;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Repositions the playback position of the player.
|
||||
/// </summary>
|
||||
/// <param name="seconds">The position in to the track to skip in, in seconds.</param>
|
||||
public static void RepositionMusic(int seconds)
|
||||
{
|
||||
audioFile.CurrentTime = TimeSpan.FromSeconds(seconds);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts playing the queue. In order to play a track, you must first add it to the queue using <see cref="AddQueue(string)"/>.
|
||||
/// </summary>
|
||||
/// <param name="repeat">If true, avoids dequeuing the next track. Not to be used for anything other than the player.</param>
|
||||
public static void PlayMusic(bool repeat = false)
|
||||
{
|
||||
if (!repeat && Queue.Count != 0) filePath = Queue[QueuePosition]; // Some functions want to play the same song again
|
||||
QueuePosition++;
|
||||
void PMusic()
|
||||
{
|
||||
if (outputDevice == null)
|
||||
{
|
||||
outputDevice = new WaveOutEvent();
|
||||
outputDevice.PlaybackStopped += OnPlaybackStopped;
|
||||
}
|
||||
if (audioFile == null)
|
||||
{
|
||||
audioFile = new AudioFileReader(filePath);
|
||||
outputDevice.Init(audioFile);
|
||||
}
|
||||
outputDevice.Play();
|
||||
outputDevice.Volume = currentvolume;
|
||||
playing = true;
|
||||
}
|
||||
try
|
||||
{
|
||||
if (playing != true)
|
||||
{
|
||||
PMusic();
|
||||
}
|
||||
else
|
||||
{
|
||||
avoidnextqueue = true;
|
||||
StopMusic();
|
||||
PMusic();
|
||||
}
|
||||
songChanged?.Invoke(null, EventArgs.Empty); // Now that playback has started without any issues, fire the song changed event.
|
||||
}
|
||||
catch (System.IO.FileNotFoundException)
|
||||
{
|
||||
PlaybackExceptionEventArgs args = new PlaybackExceptionEventArgs();
|
||||
args.Details = "That's not a valid file path!";
|
||||
songException.Invoke(null, args);
|
||||
}
|
||||
catch (System.ArgumentException)
|
||||
{
|
||||
PlaybackExceptionEventArgs args = new PlaybackExceptionEventArgs();
|
||||
args.Details = "That's not a valid file path!";
|
||||
songException.Invoke(null, args);
|
||||
}
|
||||
catch (System.Runtime.InteropServices.COMException)
|
||||
{
|
||||
PlaybackExceptionEventArgs args = new PlaybackExceptionEventArgs();
|
||||
args.Details = "This isn't a valid audio file!";
|
||||
songException.Invoke(null, args);
|
||||
}
|
||||
catch (System.FormatException)
|
||||
{
|
||||
PlaybackExceptionEventArgs args = new PlaybackExceptionEventArgs();
|
||||
args.Details = "This audio file might be corrupt!";
|
||||
songException.Invoke(null, args);
|
||||
}
|
||||
catch (System.InvalidOperationException)
|
||||
{
|
||||
PlaybackExceptionEventArgs args = new PlaybackExceptionEventArgs();
|
||||
args.Details = "This audio file uses VBR \nor might be corrupt!";
|
||||
songException.Invoke(null, args);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Completely stops and disposes the player and resets all playback related variables to their defaults.
|
||||
/// </summary>
|
||||
public static void StopMusic()
|
||||
{
|
||||
if (playing)
|
||||
try
|
||||
{
|
||||
outputDevice.Dispose();
|
||||
outputDevice = null;
|
||||
audioFile?.Dispose();
|
||||
audioFile = null;
|
||||
playing = false;
|
||||
paused = false;
|
||||
//position = 0;
|
||||
songStopped?.Invoke(null, EventArgs.Empty);
|
||||
}
|
||||
catch (NAudio.MmException) // This is an old workaround from the original FMP days. Shouldn't be needed anymore, but is kept anyway for the sake of
|
||||
{ // stability.
|
||||
Console.WriteLine("Things are breaking!");
|
||||
Console.WriteLine(filePath);
|
||||
outputDevice?.Dispose();
|
||||
outputDevice = new WaveOutEvent();
|
||||
outputDevice.PlaybackStopped += OnPlaybackStopped; // Does the same initiallization PlayMusic() does.
|
||||
audioFile = new AudioFileReader(filePath);
|
||||
outputDevice.Init(audioFile);
|
||||
PlayMusic(true);
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Pauses playback without disposing. Can later be resumed with <see cref="ResumeMusic()"/>.
|
||||
/// </summary>
|
||||
public static void PauseMusic()
|
||||
{
|
||||
if (!paused) outputDevice?.Pause();
|
||||
paused = true;
|
||||
}// Pauses the music without completely disposing it
|
||||
/// <summary>
|
||||
/// Resumes playback.
|
||||
/// </summary>
|
||||
public static void ResumeMusic()
|
||||
{
|
||||
if (paused) outputDevice?.Play();
|
||||
//playing = true;
|
||||
paused = false;
|
||||
}// Resumes music that has been paused
|
||||
/// <summary>
|
||||
/// Updates the volume of the player during playback to the value of <see cref="currentvolume"/>.
|
||||
/// Even if you don't call this, the volume of the player will update whenever the next track plays.
|
||||
/// </summary>
|
||||
public static void UpdateSettings()
|
||||
{
|
||||
outputDevice.Volume = currentvolume;
|
||||
}
|
||||
// Other Logic Stuff
|
||||
/// <summary>
|
||||
/// Returns a formatted string of the current playback position.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string getSongPosition()
|
||||
{
|
||||
//if (playing) // Only work if music is currently playing
|
||||
//if (!positiononly) position += 1; // Only tick up the position if it's being called from UserInterface
|
||||
|
||||
string Format(int secs)
|
||||
{
|
||||
int hours = 0;
|
||||
int mins = 0;
|
||||
|
||||
while (secs >= 60)
|
||||
{
|
||||
mins++;
|
||||
secs -= 60;
|
||||
}
|
||||
|
||||
while (mins >= 60)
|
||||
{
|
||||
hours++;
|
||||
mins -= 60;
|
||||
}
|
||||
|
||||
string hourStr = hours.ToString(); if (hourStr.Length < 2) hourStr = "0" + hourStr;
|
||||
string minStr = mins.ToString(); if (minStr.Length < 2) minStr = "0" + minStr;
|
||||
string secStr = secs.ToString(); if (secStr.Length < 2) secStr = "0" + secStr;
|
||||
|
||||
string durStr = "";
|
||||
if (hourStr != "00") durStr += hourStr + ":";
|
||||
durStr = minStr + ":" + secStr;
|
||||
|
||||
return durStr;
|
||||
}
|
||||
|
||||
//ATL.Track theTrack = new ATL.Track(filePath);
|
||||
var length = audioFile.TotalTime;
|
||||
|
||||
return $"{Format((int)audioFile.CurrentTime.TotalSeconds)} / {Format((int)length.TotalSeconds)}";
|
||||
}
|
||||
#endregion
|
||||
// Integration
|
||||
#region DiscordRPC
|
||||
public static void InitDiscordRPC()
|
||||
{
|
||||
/*
|
||||
Create a discord client
|
||||
NOTE: If you are using Unity3D, you must use the full constructor and define
|
||||
the pipe connection.
|
||||
*/
|
||||
client = new DiscordRpcClient("656678380283887626");
|
||||
|
||||
//Set the logger
|
||||
//client.Logger = new ConsoleLogger() { Level = Discord.LogLevel.Warning };
|
||||
|
||||
//Subscribe to events
|
||||
client.OnReady += (sender, e) =>
|
||||
{
|
||||
Console.WriteLine("Received Ready from user {0}", e.User.Username);
|
||||
};
|
||||
|
||||
client.OnPresenceUpdate += (sender, e) =>
|
||||
{
|
||||
Console.WriteLine("Received Update! {0}", e.Presence);
|
||||
};
|
||||
|
||||
//Connect to the RPC
|
||||
client.Initialize();
|
||||
|
||||
//Set the rich presence
|
||||
//Call this as many times as you want and anywhere in your code.
|
||||
}
|
||||
public static void UpdateRPC(string Activity, string Artist = null, string Title = null)
|
||||
{
|
||||
client?.SetPresence(new RichPresence()
|
||||
{
|
||||
Details = Title,
|
||||
State = $"by {Artist}",
|
||||
Assets = new Assets()
|
||||
{
|
||||
LargeImageKey = "icon",
|
||||
SmallImageKey = Activity
|
||||
},
|
||||
Timestamps = Timestamps.Now
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
public static void DisposeRPC() => client?.Dispose();
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("FRESHMusicPlayer.Player")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("FRESHMusicPlayer.Player")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("ffe8eafd-7faa-4503-9364-2643821a2bc8")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using FRESHMusicPlayer;
|
||||
namespace FRESHMusicPlayer.Utilities
|
||||
{
|
||||
static class PlayerUtils
|
||||
{
|
||||
private static Random rng = new Random();
|
||||
|
||||
public static List<string> ShuffleQueue(List<string> list)
|
||||
{
|
||||
List<string> listtosort = new List<string>();
|
||||
List<string> listtoreinsert = new List<string>();
|
||||
int number = 0;
|
||||
foreach (string x in list)
|
||||
{
|
||||
if (Player.QueuePosition < number) listtosort.Add(x);
|
||||
else listtoreinsert.Add(x);
|
||||
number++;
|
||||
}
|
||||
|
||||
int n = listtosort.Count;
|
||||
while (n > 1)
|
||||
{
|
||||
n--;
|
||||
int k = rng.Next(n + 1);
|
||||
string value = listtosort[k];
|
||||
listtosort[k] = listtosort[n];
|
||||
listtosort[n] = value;
|
||||
}
|
||||
foreach (string x in listtosort) listtoreinsert.Add(x);
|
||||
return listtoreinsert;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
{"Version":1,"Songs":["C:\\Users\\poohw\\OneDrive\\Music\\Nanahira\\08 - Zennihon Ofuroka Keikaku.mp3","C:\\Users\\poohw\\OneDrive\\Music\\Nanahira\\shutter.mp3","C:\\Users\\poohw\\OneDrive\\Music\\Nanahira\\audio.mp3"]}
|
|
@ -0,0 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace FRESHMusicPlayer.Utilities
|
||||
{
|
||||
public class DatabaseFormat
|
||||
{
|
||||
public int Version { get; set; }
|
||||
public List<string> Songs { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="DiscordRichPresence" version="1.0.150" targetFramework="net472" />
|
||||
<package id="NAudio" version="1.10.0" targetFramework="net472" />
|
||||
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net472" />
|
||||
<package id="z440.atl.core" version="2.16.0" targetFramework="net472" />
|
||||
</packages>
|
6
FRESHMusicPlayer.Player/WinformsTest/App.config
Normal file
6
FRESHMusicPlayer.Player/WinformsTest/App.config
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
</configuration>
|
112
FRESHMusicPlayer.Player/WinformsTest/Form1.Designer.cs
generated
Normal file
112
FRESHMusicPlayer.Player/WinformsTest/Form1.Designer.cs
generated
Normal file
|
@ -0,0 +1,112 @@
|
|||
namespace WinformsTest
|
||||
{
|
||||
partial class FreshMusicPlayer
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.button3 = new System.Windows.Forms.Button();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(12, 26);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(35, 13);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "label1";
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(294, 12);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(143, 41);
|
||||
this.button1.TabIndex = 1;
|
||||
this.button1.Text = "Pause/Resume";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(294, 59);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(143, 41);
|
||||
this.button2.TabIndex = 2;
|
||||
this.button2.Text = "Stop";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||
//
|
||||
// button3
|
||||
//
|
||||
this.button3.Location = new System.Drawing.Point(294, 106);
|
||||
this.button3.Name = "button3";
|
||||
this.button3.Size = new System.Drawing.Size(143, 41);
|
||||
this.button3.TabIndex = 3;
|
||||
this.button3.Text = "Play Song!";
|
||||
this.button3.UseVisualStyleBackColor = true;
|
||||
this.button3.Click += new System.EventHandler(this.button3_Click);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(12, 59);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(35, 13);
|
||||
this.label2.TabIndex = 4;
|
||||
this.label2.Text = "label2";
|
||||
//
|
||||
// FreshMusicPlayer
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(449, 200);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.button3);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Name = "FreshMusicPlayer";
|
||||
this.Text = "FRESHMusicPlayer Core Tester Thingamajiga";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.Button button3;
|
||||
private System.Windows.Forms.Label label2;
|
||||
}
|
||||
}
|
||||
|
61
FRESHMusicPlayer.Player/WinformsTest/Form1.cs
Normal file
61
FRESHMusicPlayer.Player/WinformsTest/Form1.cs
Normal file
|
@ -0,0 +1,61 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using FRESHMusicPlayer;
|
||||
namespace WinformsTest
|
||||
{
|
||||
public partial class FreshMusicPlayer : Form
|
||||
{
|
||||
public FreshMusicPlayer()
|
||||
{
|
||||
InitializeComponent();
|
||||
Player.songChanged += Player_songChanged;
|
||||
Player.songStopped += Player_songStopped;
|
||||
Player.songException += Player_songException;
|
||||
}
|
||||
|
||||
private void Player_songException(object sender, FRESHMusicPlayer.Handlers.PlaybackExceptionEventArgs e)
|
||||
{
|
||||
MessageBox.Show("something did a fucky wucky");
|
||||
}
|
||||
|
||||
private void Player_songStopped(object sender, EventArgs e)
|
||||
{
|
||||
label1.Text = "stopped";
|
||||
}
|
||||
|
||||
private void Player_songChanged(object sender, EventArgs e)
|
||||
{
|
||||
label1.Text = "playing something!";
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Player.paused) Player.ResumeMusic();
|
||||
else Player.PauseMusic();
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
Player.StopMusic();
|
||||
}
|
||||
|
||||
private void button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog openFileDialog1 = new OpenFileDialog();
|
||||
if (openFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
Player.AddQueue(openFileDialog1.FileName);
|
||||
Player.PlayMusic();
|
||||
Player.currentvolume = 0.2f;
|
||||
Player.UpdateSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
FRESHMusicPlayer.Player/WinformsTest/Form1.resx
Normal file
120
FRESHMusicPlayer.Player/WinformsTest/Form1.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
22
FRESHMusicPlayer.Player/WinformsTest/Program.cs
Normal file
22
FRESHMusicPlayer.Player/WinformsTest/Program.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace WinformsTest
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new FreshMusicPlayer());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("WinformsTest")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("WinformsTest")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("aa375910-6e80-4570-9663-8ea13238192a")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
71
FRESHMusicPlayer.Player/WinformsTest/Properties/Resources.Designer.cs
generated
Normal file
71
FRESHMusicPlayer.Player/WinformsTest/Properties/Resources.Designer.cs
generated
Normal file
|
@ -0,0 +1,71 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WinformsTest.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.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()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WinformsTest.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
117
FRESHMusicPlayer.Player/WinformsTest/Properties/Resources.resx
Normal file
117
FRESHMusicPlayer.Player/WinformsTest/Properties/Resources.resx
Normal file
|
@ -0,0 +1,117 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
30
FRESHMusicPlayer.Player/WinformsTest/Properties/Settings.Designer.cs
generated
Normal file
30
FRESHMusicPlayer.Player/WinformsTest/Properties/Settings.Designer.cs
generated
Normal file
|
@ -0,0 +1,30 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WinformsTest.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
89
FRESHMusicPlayer.Player/WinformsTest/WinformsTest.csproj
Normal file
89
FRESHMusicPlayer.Player/WinformsTest/WinformsTest.csproj
Normal file
|
@ -0,0 +1,89 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{AA375910-6E80-4570-9663-8EA13238192A}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>WinformsTest</RootNamespace>
|
||||
<AssemblyName>WinformsTest</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Form1.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FRESHMusicPlayer.Player\FRESHMusicPlayer.Core.csproj">
|
||||
<Project>{ffe8eafd-7faa-4503-9364-2643821a2bc8}</Project>
|
||||
<Name>FRESHMusicPlayer.Core</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
Loading…
Reference in a new issue