mirror of
https://github.com/Royce551/FRESHMusicPlayer.git
synced 2025-01-22 02:41:48 -05:00
:hel
This commit is contained in:
parent
ca64bea422
commit
630ec1c72a
6 changed files with 40 additions and 13 deletions
|
@ -1,3 +1,5 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
@ -8,6 +10,17 @@ namespace FRESHMusicPlayer
|
|||
{
|
||||
public class App : Application
|
||||
{
|
||||
public static string DataFolderLocation
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Directory.Exists("Data")) return "Data";
|
||||
var applicationData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||
if (applicationData == "") return "Data"; // apparently can happen on macos? just fall back to standalone mode
|
||||
else return Path.Combine(applicationData, "FRESHMusicPlayer");
|
||||
}
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
|
|
Binary file not shown.
|
@ -11,7 +11,8 @@
|
|||
<Company>Squid Grill</Company>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DefineConstants>DEBUG</DefineConstants>
|
||||
<DefineConstants>DEBUG;NET;NET6_0;NETCOREAPP</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\" />
|
||||
|
@ -23,6 +24,10 @@
|
|||
<None Remove="Assets\queue.svg" />
|
||||
<None Remove="Assets\search.svg" />
|
||||
<None Remove="Assets\settings.svg" />
|
||||
<None Remove="FRESHMusicPlayer.Core" />
|
||||
<None Remove="LiteDB" />
|
||||
<None Remove="System.Composition" />
|
||||
<None Remove="NAudio" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="0.10.13" />
|
||||
|
@ -31,15 +36,23 @@
|
|||
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.13" />
|
||||
<PackageReference Include="Avalonia.Svg.Skia" Version="0.10.10" />
|
||||
<PackageReference Include="DiscordRichPresence" Version="1.0.150" />
|
||||
<PackageReference Include="FRESHMusicPlayer.Core" Version="4.0.1" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.3" />
|
||||
<PackageReference Include="Tmds.DBus" Version="0.9.1" />
|
||||
<PackageReference Include="z440.atl.core" Version="3.19.0" />
|
||||
<PackageReference Include="LiteDB" Version="5.0.9" />
|
||||
<PackageReference Include="System.Composition" Version="1.4.1" />
|
||||
<PackageReference Include="NAudio" Version="1.10.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="SIADL.Avalonia">
|
||||
<HintPath>Dependencies\SIADL.Avalonia.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FRESHMusicPlayer.Core">
|
||||
<HintPath>..\..\..\freshmusicplayer-core\FRESHMusicPlayer.Player\FRESHMusicPlayer.Player\bin\Release\netstandard2.0\FRESHMusicPlayer.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FRESHMusicPlayer.Core">
|
||||
<HintPath>..\..\..\..\..\..\Users\squid\Desktop\freshmusicplayer-core\FRESHMusicPlayer.Player\FmpBassBackend\bin\Release\netstandard2.0\FRESHMusicPlayer.Core.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
|
|
|
@ -11,10 +11,9 @@ namespace FRESHMusicPlayer.Handlers.Configuration
|
|||
|
||||
static ConfigurationHandler()
|
||||
{
|
||||
savePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "FRESHMusicPlayer", "Configuration", "FMP-Avalonia");
|
||||
savePath = Path.Combine(App.DataFolderLocation, "Configuration", "FMP-Avalonia");
|
||||
}
|
||||
|
||||
|
||||
public static async Task<ConfigurationFile> Read()
|
||||
{
|
||||
if (!File.Exists(Path.Combine(savePath, "config.json")))
|
||||
|
|
|
@ -73,9 +73,9 @@ namespace FRESHMusicPlayer.ViewModels
|
|||
Player = new();
|
||||
StartThings();
|
||||
#if DEBUG // allow multiple instances of FMP in debug (at the expense of stability with heavy library use)
|
||||
var library = new LiteDatabase($"Filename=\"{Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "FRESHMusicPlayer", "database.fdb2")}\";Connection=shared");
|
||||
var library = new LiteDatabase($"Filename=\"{Path.Combine(App.DataFolderLocation, "database.fdb2")}\";Connection=shared");
|
||||
#elif !DEBUG
|
||||
var library = new LiteDatabase(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "FRESHMusicPlayer", "database.fdb2"));
|
||||
var library = new LiteDatabase(Path.Combine(App.DataFolderLocation "database.fdb2"));
|
||||
#endif
|
||||
Library = new Library(library);
|
||||
}
|
||||
|
@ -566,11 +566,11 @@ namespace FRESHMusicPlayer.ViewModels
|
|||
{
|
||||
if (Program.Config.AutoImportPaths.Count <= 0) return; // not really needed but prevents going through unneeded
|
||||
// effort (and showing the notification)
|
||||
//var notification = new Notification()
|
||||
//{
|
||||
// ContentText = Properties.Resources.Notification_Scanning
|
||||
//};
|
||||
//Notifications.Add(notification);
|
||||
//var notification = new Notification()
|
||||
//{
|
||||
// ContentText = Properties.Resources.Notification_Scanning
|
||||
//};
|
||||
//Notifications.Add(notification);
|
||||
//var filesToImport = new List<string>();
|
||||
//var library = Library.Read();
|
||||
//await Task.Run(() =>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Avalonia;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
|
@ -177,7 +177,9 @@ namespace FRESHMusicPlayer.Views
|
|||
}
|
||||
private async void OnDragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
ViewModel.Player.Queue.Add(e.Data.GetFileNames().ToArray());
|
||||
var paths = e.Data.GetFileNames().ToArray();
|
||||
ViewModel.Library.Import(paths);
|
||||
ViewModel.Player.Queue.Add(paths);
|
||||
await ViewModel.Player.PlayAsync();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue