diff --git a/Sources/Console/Console.csproj b/Sources/Console/Console.csproj index b491ec4..a816ead 100644 --- a/Sources/Console/Console.csproj +++ b/Sources/Console/Console.csproj @@ -13,6 +13,10 @@ + + + + diff --git a/Sources/Linaris/App.xaml.cs b/Sources/Linaris/App.xaml.cs index eaea099..e506791 100644 --- a/Sources/Linaris/App.xaml.cs +++ b/Sources/Linaris/App.xaml.cs @@ -5,7 +5,7 @@ namespace Linaris; public partial class App : Application { - public Manager Manager = new(new LinqXmlSerialization()); + public Manager Manager = new(new LinqXmlSerialization(Path.Combine(FileSystem.Current.AppDataDirectory, "Data"))); public App() { diff --git a/Sources/Linaris/Linaris.csproj b/Sources/Linaris/Linaris.csproj index b05cdaa..588adb8 100644 --- a/Sources/Linaris/Linaris.csproj +++ b/Sources/Linaris/Linaris.csproj @@ -104,12 +104,16 @@ - + Always - + Always + + + + diff --git a/Sources/Linaris/MainPage.xaml.cs b/Sources/Linaris/MainPage.xaml.cs index 72f76fb..e38b2e5 100644 --- a/Sources/Linaris/MainPage.xaml.cs +++ b/Sources/Linaris/MainPage.xaml.cs @@ -6,8 +6,6 @@ namespace Linaris; public partial class MainPage : ContentPage { - private readonly IAudioManager audioManager; - private readonly ObservableCollection albums = (Application.Current as App).Manager.GetAlbums(); public ObservableCollection Albums @@ -15,11 +13,10 @@ public partial class MainPage : ContentPage get => albums; } - public MainPage(IAudioManager audioManager) + public MainPage() { InitializeComponent(); BindingContext = this; - this.audioManager = audioManager; } async void GoToAlbum(object sender, EventArgs e) @@ -34,21 +31,22 @@ public partial class MainPage : ContentPage } } - public void PlayAudio(string path) + public async void PlayAudio(string path) { - using (var stream = File.OpenRead(path)) + var audioPlayer = AudioManager.Current.CreatePlayer(await FileSystem.OpenAppPackageFileAsync("peaches.mp3")); + audioPlayer.Play(); + /*using (var stream = File.OpenRead(path)) { - var audioPlayer = audioManager.CreatePlayer(stream); - audioPlayer.Volume = 1.0f; + audioPlayer = audioManager.CreatePlayer(stream); audioPlayer.Play(); - } + }*/ } public void play(object sender, EventArgs e) { - string CurrentPath = (Application.Current as App).Manager.CurrentPlaying.Path; - if (CurrentPath == null) return; - PlayAudio(CurrentPath); + /*string CurrentPath = (Application.Current as App).Manager.CurrentPlaying.Path; + if (CurrentPath == null) return;*/ + PlayAudio(""); /*string url = ((FileImageSource)Play.Source).File;*/ /*if (url == "play.png") { diff --git a/Sources/Linaris/Resources/Musics/peaches.mp3 b/Sources/Linaris/Resources/Raw/peaches.mp3 similarity index 100% rename from Sources/Linaris/Resources/Musics/peaches.mp3 rename to Sources/Linaris/Resources/Raw/peaches.mp3 diff --git a/Sources/Linaris/Resources/Musics/winter.mp3 b/Sources/Linaris/Resources/Raw/winter.mp3 similarity index 100% rename from Sources/Linaris/Resources/Musics/winter.mp3 rename to Sources/Linaris/Resources/Raw/winter.mp3 diff --git a/Sources/Model/Model.csproj b/Sources/Model/Model.csproj index 5e08cad..9198747 100644 --- a/Sources/Model/Model.csproj +++ b/Sources/Model/Model.csproj @@ -1,4 +1,4 @@ - + net7.0;net7.0-android @@ -19,4 +19,8 @@ 6.5 + + + + \ No newline at end of file diff --git a/Sources/Model/Serialization/LINQ_XML_Serialization.cs b/Sources/Model/Serialization/LINQ_XML_Serialization.cs index 9420614..fe19dfc 100644 --- a/Sources/Model/Serialization/LINQ_XML_Serialization.cs +++ b/Sources/Model/Serialization/LINQ_XML_Serialization.cs @@ -7,11 +7,11 @@ namespace Model.Serialization; public class LinqXmlSerialization : IDataManager { - private static string XMLPATH = Path.Combine(FileSystem.Current.AppDataDirectory, "Data"); + private string XMLPATH; - private static string XMLFILEPLAYLISTS = Path.Combine(XMLPATH, "playlists.xml"); + private string XMLFILEPLAYLISTS; - private static string XMLFILECUSTOMS = Path.Combine(XMLPATH, "customs.xml"); + private string XMLFILECUSTOMS; private StubInfoTitle stubInfoTitle = new(); @@ -71,8 +71,11 @@ public class LinqXmlSerialization : IDataManager } } - public LinqXmlSerialization() + public LinqXmlSerialization(string pathDirectory) { + XMLPATH = pathDirectory; + XMLFILECUSTOMS = Path.Combine(XMLPATH, "playlists.xml"); + XMLFILEPLAYLISTS = Path.Combine(XMLPATH, "customs.xml"); playlists = new ObservableCollection(); artists = new List(); infoTitles = new ObservableCollection(); diff --git a/Sources/TestUnitaires/TU_Manager.cs b/Sources/TestUnitaires/TU_Manager.cs index 850fb5a..68b0c46 100644 --- a/Sources/TestUnitaires/TU_Manager.cs +++ b/Sources/TestUnitaires/TU_Manager.cs @@ -18,7 +18,7 @@ namespace TestUnitaires Playlist p = new Playlist(test, "PlaceHolder", "place.holder"); Album album = new Album(test, "place.holder", new Artist("test"), "PlaceHolder", "PlaceHolder"); CustomTitle t = new CustomTitle(test, "test. mp3", "Banger", "path"); - Manager m = new Manager(new LinqXmlSerialization()); + Manager m = new Manager(new LinqXmlSerialization(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data"))); m.AddCustomTitle(t); m.AddPlaylist(p); m.AddAlbum(album); diff --git a/Sources/TestUnitaires/TestUnitaires.csproj b/Sources/TestUnitaires/TestUnitaires.csproj index ec9d410..932cd10 100644 --- a/Sources/TestUnitaires/TestUnitaires.csproj +++ b/Sources/TestUnitaires/TestUnitaires.csproj @@ -10,6 +10,7 @@ + runtime; build; native; contentfiles; analyzers; buildtransitive