Skip to content

Commit

Permalink
Playback Panel ✔ (✘ List Context Menu), Settings ✔
Browse files Browse the repository at this point in the history
Library Panel 15%
  • Loading branch information
LordKBX committed Nov 19, 2024
1 parent 9fd2f88 commit b9f3039
Show file tree
Hide file tree
Showing 86 changed files with 10,762 additions and 406 deletions.
17 changes: 15 additions & 2 deletions AnotherMusicPlayer.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
README.md = README.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PagedControl.NET6", "PagedControl.NET6\PagedControl.NET6.csproj", "{9DDC6E93-CA54-4AD9-B70B-49BE6E7A3790}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libs", "Libs", "{B58DC619-E3D4-4B36-8F3B-39D3DDBC3149}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TabControl.NET6", "TabControl.NET6\TabControl.NET6.csproj", "{DE57CFCC-A0B0-4F6B-B56B-81C0CD46CFE9}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "m3uParser", "Libs\m3uParser\m3uParser.csproj", "{0648E6DD-7B6B-4EE0-A3EE-CDBB64D0446E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PagedControl.NET6", "Libs\PagedControl.NET6\PagedControl.NET6.csproj", "{9DDC6E93-CA54-4AD9-B70B-49BE6E7A3790}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TabControl.NET6", "Libs\TabControl.NET6\TabControl.NET6.csproj", "{DE57CFCC-A0B0-4F6B-B56B-81C0CD46CFE9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -32,10 +36,19 @@ Global
{DE57CFCC-A0B0-4F6B-B56B-81C0CD46CFE9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE57CFCC-A0B0-4F6B-B56B-81C0CD46CFE9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DE57CFCC-A0B0-4F6B-B56B-81C0CD46CFE9}.Release|Any CPU.Build.0 = Release|Any CPU
{0648E6DD-7B6B-4EE0-A3EE-CDBB64D0446E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0648E6DD-7B6B-4EE0-A3EE-CDBB64D0446E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0648E6DD-7B6B-4EE0-A3EE-CDBB64D0446E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0648E6DD-7B6B-4EE0-A3EE-CDBB64D0446E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{9DDC6E93-CA54-4AD9-B70B-49BE6E7A3790} = {B58DC619-E3D4-4B36-8F3B-39D3DDBC3149}
{DE57CFCC-A0B0-4F6B-B56B-81C0CD46CFE9} = {B58DC619-E3D4-4B36-8F3B-39D3DDBC3149}
{0648E6DD-7B6B-4EE0-A3EE-CDBB64D0446E} = {B58DC619-E3D4-4B36-8F3B-39D3DDBC3149}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3ABE685A-0A6E-4F6C-BC38-D2BCC10F5241}
EndGlobalSection
Expand Down
21 changes: 12 additions & 9 deletions AnotherMusicPlayer/AnotherMusicPlayer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,15 @@
<UseWindowsForms>True</UseWindowsForms>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<ApplicationHighDpiMode>SystemAware</ApplicationHighDpiMode>
<ForceDesignerDpiUnaware>true</ForceDesignerDpiUnaware>
<ForceDesignerDpiUnaware>false</ForceDesignerDpiUnaware>
<StartupObject>AnotherMusicPlayer.App</StartupObject>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Libs\**" />
<EmbeddedResource Remove="Libs\**" />
<None Remove="Libs\**" />
<Page Remove="Libs\**" />
</ItemGroup>
<ItemGroup>
<None Remove="icons\icon_large.ico" />
<None Remove="play.png" />
Expand All @@ -47,30 +54,26 @@
<ItemGroup>
<PackageReference Include="ByteDev.M3u" Version="1.0.0" />
<PackageReference Include="gong-wpf-dragdrop" Version="3.1.1" />
<PackageReference Include="m3uParser.NET" Version="1.0.17" />
<PackageReference Include="MaterialDesignThemes" Version="4.3.0" />
<PackageReference Include="Microsoft-WindowsAPICodePack-Core" Version="1.1.5" />
<PackageReference Include="Microsoft-WindowsAPICodePack-Shell" Version="1.1.4" />
<PackageReference Include="NAudio" Version="2.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="System.Data.SQLite" Version="1.0.115.5" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
<PackageReference Include="System.Data.SQLite" Version="1.0.119" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="taglib-sharp-netstandard2.0" Version="2.1.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TabControl.NET6\TabControl.NET6.csproj" />
<ProjectReference Include="..\Libs\m3uParser\m3uParser.csproj" />
<ProjectReference Include="..\Libs\TabControl.NET6\TabControl.NET6.csproj" />
</ItemGroup>
<ItemGroup>
<Resource Include="icons\icon_large.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Update="App.xaml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</ApplicationDefinition>
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
Expand Down
136 changes: 136 additions & 0 deletions AnotherMusicPlayer/App.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
using AnotherMusicPlayer.Properties;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Forms;
using System.Windows.Media.Imaging;
using System.Windows.Threading;

namespace AnotherMusicPlayer
{
public static class App
{
public static readonly string AppName = "AnotherMusicPlayer";
public static Database bdd = new Database();

private static bool _IsDebug = false;
public static bool IsDebug { get { return App._IsDebug; } }

[Conditional("DEBUG")]
public static void TestDebug() { App._IsDebug = true; }

private static ResourceDictionary Resources = new ResourceDictionary();
private static AnotherMusicPlayer.MainWindow2.MainWindow2 win1;

/// <summary>
/// Point d'entrée principal de l'application.
/// </summary>
[STAThread]
public static void Main(string[] args)
{
TestDebug();
Settings.LoadSettings();
TranslationUpdate();
Player.INIT();

win1 = new AnotherMusicPlayer.MainWindow2.MainWindow2();
win1.ShowDialog();
win1.Dispose();
Environment.Exit(0);
}

public static void UnsetLockScreen() { /*win1.UnsetLockScreen();*/ }

/// <summary> Convert milliseconds times in human readable string </summary>
public static string displayTime(long time)
{
string ret = ""; int Days = 0, Hours = 0, Minutes = 0;
int ms = (int)(time % 1000); long TotalSeconds = (time - ms) / 1000, reste;
if (TotalSeconds >= 86400) { reste = (TotalSeconds % 86400); Days = (int)((TotalSeconds - reste) / 86400); TotalSeconds = reste; }
if (TotalSeconds >= 3600) { reste = (TotalSeconds % 3600); Hours = (int)((TotalSeconds - reste) / 3600); TotalSeconds = reste; }
if (TotalSeconds >= 60) { reste = (TotalSeconds % 60); Minutes = (int)((TotalSeconds - reste) / 60); TotalSeconds = reste; }

if (Days > 0) { ret += ((Days < 10) ? "0" : "") + Days + "d "; }
if (Hours > 0) { ret += ((Hours < 10) ? "0" : "") + Hours + ":"; } //ret += ((Minutes < 10) ? "0" : "") + Minutes + ":" + ((TotalSeconds < 10) ? "0" : "") + TotalSeconds;
return ret + ((Minutes < 10) ? "0" : "") + Minutes + ":" + ((TotalSeconds < 10) ? "0" : "") + TotalSeconds;
}

public static void TranslationUpdate()
{
if (Resources.MergedDictionaries.Count < 1) { Resources.MergedDictionaries.Add(new ResourceDictionary()); }
string end = "";
if (Settings.Lang == null) { end = "en"; }
else if (Settings.Lang.StartsWith("fr-")) { end = "fr"; }
else { end = "en"; }
if (Resources.MergedDictionaries.Count < 1)
{
Resources.MergedDictionaries.Add(new ResourceDictionary { Source = new Uri("pack://application:,,,/AnotherMusicPlayer;component/Traductions/" + end + ".xaml", UriKind.Absolute) });
}
else
{
Resources.MergedDictionaries[0].Clear();
Resources.MergedDictionaries[0] = new ResourceDictionary { Source = new Uri("pack://application:,,,/AnotherMusicPlayer;component/Traductions/" + end + ".xaml", UriKind.Absolute) };
}
}

/// <summary> Get string stored in traduction file </summary>
public static string GetTranslation(string reference)
{
try { return (string)Resources.MergedDictionaries[0][reference]; }
catch { return ""; }
}

private static Dictionary<Control, ToolTip> DefinedToolTipArray = new Dictionary<Control, ToolTip>();

public static bool SetToolTip(Control control, string tooltip)
{
try
{
if (DefinedToolTipArray.ContainsKey(control)) { DelToolTip(control); }
ToolTip tp = new ToolTip();
tp.SetToolTip(control, tooltip);
DefinedToolTipArray.Add(control, tp);
return true;
}
catch (Exception/* ex*/) { }
return false;
}

public static bool DelToolTip(Control control)
{
try
{
if (DefinedToolTipArray.ContainsKey(control))
{
DefinedToolTipArray[control].RemoveAll();
DefinedToolTipArray[control].Dispose();
DefinedToolTipArray.Remove(control);
return true;
}
else { return false; }
}
catch (Exception/* ex*/) { }
return false;
}

public static Bitmap BitmapImage2Bitmap(BitmapImage bitmapImage)
{
using (MemoryStream outStream = new MemoryStream())
{
BitmapEncoder enc = new BmpBitmapEncoder();
enc.Frames.Add(BitmapFrame.Create(bitmapImage));
enc.Save(outStream);
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(outStream);

return new Bitmap(bitmap);
}
}
}
}
15 changes: 0 additions & 15 deletions AnotherMusicPlayer/App.xaml

This file was deleted.

48 changes: 0 additions & 48 deletions AnotherMusicPlayer/App.xaml.cs

This file was deleted.

47 changes: 47 additions & 0 deletions AnotherMusicPlayer/Commons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Diagnostics;
using System.Linq;

namespace AnotherMusicPlayer
{
Expand All @@ -21,6 +22,29 @@ public class PlayListViewItem
public string Performers { get; set; }
public string Composers { get; set; }
public string AlbumArtists { get; set; }
public string Artists
{
get
{
List<string> list = new List<string>();
if (Composers.Trim().Length > 0)
{
List<string> cpl = Composers.Replace("; ", ";").Replace(" ;", ";").Replace(" ; ", ";").Split(';').ToList();
foreach (string comp in cpl) { if (!list.Contains(comp)) { list.Add(comp); } }
}
if (Performers.Trim().Length > 0)
{
List<string> pel = Performers.Replace("; ", ";").Replace(" ;", ";").Replace(" ; ", ";").Split(';').ToList();
foreach (string perf in pel) { if (!list.Contains(perf)) { list.Add(perf); } }
}
if (AlbumArtists.Trim().Length > 0)
{
List<string> aal = AlbumArtists.Replace("; ", ";").Replace(" ;", ";").Replace(" ; ", ";").Split(';').ToList();
foreach (string artist in aal) { if (!list.Contains(artist)) { list.Add(artist); } }
}
return (list.Count > 0)?string.Join("; ", list):"";
}
}

public string InnerUID { get; set; }

Expand All @@ -39,6 +63,29 @@ public PlayListViewItem()

InnerUID = Guid.NewGuid().ToString();
}

public static PlayListViewItem FromFilePath(string path) {
if (!File.Exists(path)) { return null; }
Dictionary<string, object> ret = App.bdd.DatabaseFileInfo(path);
if (ret != null)
{
PlayListViewItem item = new PlayListViewItem();
item.Selected = "";
item.Path = path;
item.OriginPath = path;
item.Name = "" + ret["Name"];
item.Album = "" + ret["Album"];
item.Duration = long.Parse("" + ret["Duration"]);
item.DurationS = App.displayTime(item.Duration);
item.Performers = "" + ret["Performers"];
item.Composers = "" + ret["Composers"];
item.AlbumArtists = "" + ret["AlbumArtists"];

return item;
}
else
{ return FilesTags.MediaInfoShort(path, false); }
}
}

public class Common
Expand Down
Loading

0 comments on commit b9f3039

Please sign in to comment.