Model become a Class Library
continuous-integration/drone/push Build is failing Details

pull/24/head
Corentin LEMAIRE 2 years ago
parent ab623bd165
commit 659c1d5453

@ -4,16 +4,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 17.0.31611.283
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Linaris", "Linaris\Linaris.csproj", "{9E6281F7-95F6-472C-B268-894CE377C8A9}"
ProjectSection(ProjectDependencies) = postProject
{AA1DB94B-8273-437F-A07A-BB1F5F0D278D} = {AA1DB94B-8273-437F-A07A-BB1F5F0D278D}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Console", "Console\Console.csproj", "{BB50C1E3-5A9A-40AF-8CD7-55B41064290B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Model", "Model\Model.csproj", "{AA1DB94B-8273-437F-A07A-BB1F5F0D278D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestUnitaires", "TestUnitaires\TestUnitaires.csproj", "{8B0671CF-1302-4244-8837-916E632007E2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Model", "Model\Model.csproj", "{275B609D-6073-4122-B9F8-1373F76565B2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -30,14 +27,14 @@ Global
{BB50C1E3-5A9A-40AF-8CD7-55B41064290B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BB50C1E3-5A9A-40AF-8CD7-55B41064290B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BB50C1E3-5A9A-40AF-8CD7-55B41064290B}.Release|Any CPU.Build.0 = Release|Any CPU
{AA1DB94B-8273-437F-A07A-BB1F5F0D278D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AA1DB94B-8273-437F-A07A-BB1F5F0D278D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AA1DB94B-8273-437F-A07A-BB1F5F0D278D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AA1DB94B-8273-437F-A07A-BB1F5F0D278D}.Release|Any CPU.Build.0 = Release|Any CPU
{8B0671CF-1302-4244-8837-916E632007E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8B0671CF-1302-4244-8837-916E632007E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8B0671CF-1302-4244-8837-916E632007E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8B0671CF-1302-4244-8837-916E632007E2}.Release|Any CPU.Build.0 = Release|Any CPU
{275B609D-6073-4122-B9F8-1373F76565B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{275B609D-6073-4122-B9F8-1373F76565B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{275B609D-6073-4122-B9F8-1373F76565B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{275B609D-6073-4122-B9F8-1373F76565B2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

@ -18,6 +18,11 @@ public partial class App : Application
var Window = base.CreateWindow(activationState);
Window.Destroying += (sender, eventArgs) =>
{
Manager.SaveSerialization();
};
Window.Stopped += (sender, eventArgs) =>
{
Manager.SaveSerialization();

@ -3,5 +3,6 @@
<application android:allowBackup="false" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true" android:usesCleartextTraffic="false"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest>

@ -125,7 +125,7 @@ namespace Model
infoTitles.Remove(title);
}
public override bool Equals(object? obj)
public override bool Equals(object obj)
{
if (obj is null) return false;
if (obj.GetType() != typeof(Album)) return false;

@ -30,7 +30,7 @@ public class Artist
}
public override bool Equals(object? obj)
public override bool Equals(object obj)
{
if(obj == null) return false;
if(obj.GetType() != typeof(Artist)) return false;

@ -75,10 +75,10 @@ public class CustomTitle : Title, INotifyPropertyChanged
public CustomTitle() : base(Manager.DEFAULT_NAME, Manager.DEFAULT_URL, Manager.DEFAULT_DESC) { }
public bool Equals(CustomTitle? other)
public bool Equals(CustomTitle other)
=> Path.Equals(other?.Path);
public override bool Equals(object? obj)
public override bool Equals(object obj)
{
if (ReferenceEquals(obj, null)) return false;
if (ReferenceEquals(this, obj)) return true;

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Customs>
<CustomTitle Name="croissant.mp3">
<ImageURL>none.png</ImageURL>
<Information></Information>
<Path>D:\Musique\Création\croissant.mp3</Path>
</CustomTitle>
<CustomTitle Name="emma.mp3">
<ImageURL>none.png</ImageURL>
<Information></Information>
<Path>D:\Musique\Création\emma.mp3</Path>
</CustomTitle>
<CustomTitle Name="Emma-.mp3">
<ImageURL>none.png</ImageURL>
<Information></Information>
<Path>D:\Musique\Création\Emma-.mp3</Path>
</CustomTitle>
<CustomTitle Name="heaven.mp3">
<ImageURL>none.png</ImageURL>
<Information></Information>
<Path>D:\Musique\Création\heaven.mp3</Path>
</CustomTitle>
<CustomTitle Name="winter.mp3">
<ImageURL>none.png</ImageURL>
<Information></Information>
<Path>D:\Musique\Création\winter.mp3</Path>
</CustomTitle>
</Customs>

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Playlists>
<Playlist Name="EZ">
<Description></Description>
<ImageURL>D:\Images\blackcat.gif</ImageURL>
<Titles>D:\Musique\Création\emma.mp3 D:\Musique\Création\croissant.mp3 D:\Musique\Création\Emma-.mp3 D:\Musique\Création\heaven.mp3 D:\Musique\Création\winter.mp3 D:\Musique\Création\emma.mp3</Titles>
</Playlist>
<Playlist Name="coucou">
<Description></Description>
<ImageURL>none.png</ImageURL>
<Titles>D:\Musique\Création\emma.mp3</Titles>
</Playlist>
</Playlists>

@ -28,25 +28,25 @@ public interface IDataManager
// Read
ObservableCollection<CustomTitle> GetCustomTitles();
CustomTitle? GetCustomTitleByPath(string custom);
CustomTitle GetCustomTitleByPath(string custom);
ObservableCollection<InfoTitle> GetInfoTitles();
InfoTitle? GetInfoTitleByName(string name);
InfoTitle GetInfoTitleByName(string name);
ObservableCollection<Album> GetAlbums();
Album? GetAlbumByName(string name);
Album GetAlbumByName(string name);
Album? GetAlbumById(long id);
Album GetAlbumById(long id);
List<Artist> GetArtists();
Artist? GetArtistByName(string name);
Artist GetArtistByName(string name);
ObservableCollection<Playlist> GetPlaylists();
Playlist? GetPlaylistByName(string name);
Playlist GetPlaylistByName(string name);
// Update

@ -67,7 +67,7 @@ public class InfoTitle : Title
}
}
public override bool Equals(object? obj)
public override bool Equals(object obj)
{
if (obj is null) return false;
if (obj.GetType() != typeof(InfoTitle)) return false;

@ -82,9 +82,9 @@ public class Manager
}
}
private Playlist? currentPlaylist;
private Playlist currentPlaylist;
public Playlist? CurrentPlaylist
public Playlist CurrentPlaylist
{
get => currentPlaylist;
set
@ -93,9 +93,9 @@ public class Manager
}
}
private InfoTitle? currentInfoTitle;
private InfoTitle currentInfoTitle;
public InfoTitle? CurrentInfoTitle
public InfoTitle CurrentInfoTitle
{
get => currentInfoTitle;
set
@ -104,9 +104,9 @@ public class Manager
}
}
private CustomTitle? currentPlaying;
private CustomTitle currentPlaying;
public CustomTitle? CurrentPlaying
public CustomTitle CurrentPlaying
{
get => currentPlaying;
set
@ -224,32 +224,32 @@ public class Manager
DataManager.SaveSerialization();
}
public Playlist? GetPlaylistByName(string name)
public Playlist GetPlaylistByName(string name)
{
return DataManager.GetPlaylistByName(name);
}
public Artist? GetArtistByName(string name)
public Artist GetArtistByName(string name)
{
return DataManager.GetArtistByName(name);
}
public CustomTitle? GetCustomTitleByPath(string path)
public CustomTitle GetCustomTitleByPath(string path)
{
return DataManager.GetCustomTitleByPath(path);
}
public InfoTitle? GetInfoTitleByName(string name)
public InfoTitle GetInfoTitleByName(string name)
{
return DataManager.GetInfoTitleByName(name);
}
public Album? GetAlbumByName(string name)
public Album GetAlbumByName(string name)
{
return DataManager.GetAlbumByName(name);
}
public Album? GetAlbumById(long id)
public Album GetAlbumById(long id)
{
return DataManager.GetAlbumById(id);
}

@ -1,9 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>net7.0;net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup>
</Project>

@ -0,0 +1,6 @@
namespace Model;
// All the code in this file is only included on Android.
public class PlatformClass1
{
}

@ -0,0 +1,6 @@
namespace Model;
// All the code in this file is only included on Mac Catalyst.
public class PlatformClass1
{
}

@ -0,0 +1,9 @@
using System;
namespace Model
{
// All the code in this file is only included on Tizen.
public class PlatformClass1
{
}
}

@ -0,0 +1,6 @@
namespace Model;
// All the code in this file is only included on Windows.
public class PlatformClass1
{
}

@ -0,0 +1,6 @@
namespace Model;
// All the code in this file is only included on iOS.
public class PlatformClass1
{
}

@ -8,9 +8,9 @@ namespace Model;
public class Playlist : INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string? propertyName = null)
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
public string Name
@ -199,7 +199,7 @@ public class Playlist : INotifyPropertyChanged
}
}
public CustomTitle? GetCurrentTitle()
public CustomTitle GetCurrentTitle()
{
if (Index < titles.Count)
{
@ -212,7 +212,7 @@ public class Playlist : INotifyPropertyChanged
}
public override bool Equals(object? obj)
public override bool Equals(object obj)
{
if (obj is null) return false;
if (obj.GetType() != typeof(Playlist)) return false;

@ -2,12 +2,13 @@
using System.Xml.Linq;
using System.Collections.ObjectModel;
using Model.Stub;
using Microsoft.Maui.Storage;
namespace Model.Serialization;
public class LinqXmlSerialization : IDataManager
{
private static string XMLPATH = GetSerializationDirectory();
private static string XMLPATH = Path.Combine(FileSystem.Current.AppDataDirectory, "Data");
private static string XMLFILEPLAYLISTS = Path.Combine(XMLPATH, "playlists.xml");
@ -231,7 +232,7 @@ public class LinqXmlSerialization : IDataManager
foreach(var custom in customsList)
{
CustomTitle? customTitle = GetCustomTitleByPath(custom);
CustomTitle customTitle = GetCustomTitleByPath(custom);
if (customTitle == null)
{
@ -385,7 +386,7 @@ public class LinqXmlSerialization : IDataManager
else return Genre.K_POP;
}
public InfoTitle? GetInfoTitleByName(string name)
public InfoTitle GetInfoTitleByName(string name)
{
foreach(InfoTitle it in infoTitles)
{
@ -397,7 +398,7 @@ public class LinqXmlSerialization : IDataManager
return null;
}
public Artist? GetArtistByName(string name)
public Artist GetArtistByName(string name)
{
foreach(Artist a in artists)
{
@ -409,7 +410,7 @@ public class LinqXmlSerialization : IDataManager
return null;
}
public Album? GetAlbumByName(string name)
public Album GetAlbumByName(string name)
{
foreach(Album a in albums)
{
@ -421,7 +422,7 @@ public class LinqXmlSerialization : IDataManager
return null;
}
public Album? GetAlbumById(long id)
public Album GetAlbumById(long id)
{
foreach(Album a in albums)
{
@ -430,7 +431,7 @@ public class LinqXmlSerialization : IDataManager
return null;
}
public CustomTitle? GetCustomTitleByPath(string custom)
public CustomTitle GetCustomTitleByPath(string custom)
{
foreach(CustomTitle customTitle in customTitles)
{
@ -482,7 +483,7 @@ public class LinqXmlSerialization : IDataManager
}
}
public Playlist? GetPlaylistByName(string name)
public Playlist GetPlaylistByName(string name)
{
foreach(Playlist p in playlists)
{
@ -504,7 +505,7 @@ public class LinqXmlSerialization : IDataManager
public void UpdateCustomTitleByPath(string path, string name, string newUrl, string info, string newPath)
{
CustomTitle? title = GetCustomTitleByPath(path);
CustomTitle title = GetCustomTitleByPath(path);
if (title != null)
{
title.Name = name;
@ -525,7 +526,7 @@ public class LinqXmlSerialization : IDataManager
public void UpdateInfoTitleByName(string name, string newUrl, string info, Artist artist, string description, Genre genre)
{
InfoTitle? title = GetInfoTitleByName(name);
InfoTitle title = GetInfoTitleByName(name);
if (title != null)
{
title.Name = name;
@ -547,7 +548,7 @@ public class LinqXmlSerialization : IDataManager
public void UpdateAlbumByName(string name, string newUrl, Artist artist, string description, string info)
{
Album? album = GetAlbumByName(name);
Album album = GetAlbumByName(name);
if (album != null)
{
album.Name = name;
@ -562,7 +563,7 @@ public class LinqXmlSerialization : IDataManager
{
album.Name = name;
album.ImageURL = url;
Artist? artist2 = GetArtistByName(artist);
Artist artist2 = GetArtistByName(artist);
if (artist2 != null)
{
album.Artist = artist2;
@ -573,12 +574,12 @@ public class LinqXmlSerialization : IDataManager
public void UpdateAlbumByNameByArtistName(string name, string newUrl, string artist, string description, string info)
{
Album? album = GetAlbumByName(name);
Album album = GetAlbumByName(name);
if (album != null)
{
album.Name = name;
album.ImageURL = newUrl;
Artist? artist2 = GetArtistByName(artist);
Artist artist2 = GetArtistByName(artist);
if (artist2 != null)
{
album.Artist = artist2;
@ -597,7 +598,7 @@ public class LinqXmlSerialization : IDataManager
public void UpdatePlaylistByName(string name, string description, string newUrl)
{
Playlist? playlist = GetPlaylistByName(name);
Playlist playlist = GetPlaylistByName(name);
if (playlist != null)
{
playlist.Name = name;
@ -613,7 +614,7 @@ public class LinqXmlSerialization : IDataManager
public void UpdateArtistByName(string name, string newName)
{
Artist? artist = GetArtistByName(newName);
Artist artist = GetArtistByName(newName);
if (artist != null)
{
artist.Name = newName;
@ -780,10 +781,4 @@ public class LinqXmlSerialization : IDataManager
return false;
}
static string GetSerializationDirectory()
{
DirectoryInfo? directory = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory);
return Path.Combine(directory.ToString(),"Linaris/Data");
}
}

@ -48,7 +48,7 @@ public class StubAlbum
{
return albums;
}
public Album? GetAlbumByName(string name)
public Album GetAlbumByName(string name)
{
foreach(Album album in albums)
{

@ -21,7 +21,7 @@ public class StubArtist
{
return artists;
}
public Artist? GetArtistByName(string name)
public Artist GetArtistByName(string name)
{
foreach (var artist in artists)
{

@ -161,7 +161,7 @@ public class StubManager : IDataManager
// Doesn't do anything because it's Stubs
}
public CustomTitle? GetCustomTitleByPath(string custom)
public CustomTitle GetCustomTitleByPath(string custom)
{
foreach (CustomTitle customTitle in StubCustomTitle.GetCustomTitles())
{
@ -173,7 +173,7 @@ public class StubManager : IDataManager
return null;
}
public InfoTitle? GetInfoTitleByName(string name)
public InfoTitle GetInfoTitleByName(string name)
{
foreach(InfoTitle title in StubInfoTitle.GetInfoTitles())
{
@ -185,7 +185,7 @@ public class StubManager : IDataManager
return null;
}
public Album? GetAlbumByName(string name)
public Album GetAlbumByName(string name)
{
foreach(Album album in StubAlbum.GetAlbums())
{
@ -197,7 +197,7 @@ public class StubManager : IDataManager
return null;
}
public Artist? GetArtistByName(string name)
public Artist GetArtistByName(string name)
{
foreach(Artist artist in StubArtist.GetArtists())
{
@ -249,7 +249,7 @@ public class StubManager : IDataManager
}
}
public Playlist? GetPlaylistByName(string name)
public Playlist GetPlaylistByName(string name)
{
foreach (Playlist p in StubPlaylist.Playlists)
{
@ -271,7 +271,7 @@ public class StubManager : IDataManager
public void UpdateCustomTitleByPath(string path, string name, string newUrl, string info, string newPath)
{
CustomTitle? title = GetCustomTitleByPath(path);
CustomTitle title = GetCustomTitleByPath(path);
if (title != null)
{
title.Name = name;
@ -292,7 +292,7 @@ public class StubManager : IDataManager
public void UpdateInfoTitleByName(string name, string newUrl, string info, Artist artist, string description, Genre genre)
{
InfoTitle? title = GetInfoTitleByName(name);
InfoTitle title = GetInfoTitleByName(name);
if (title != null)
{
title.Name = name;
@ -314,7 +314,7 @@ public class StubManager : IDataManager
public void UpdateAlbumByName(string name, string newUrl, Artist artist, string description, string info)
{
Album? album = GetAlbumByName(name);
Album album = GetAlbumByName(name);
if (album != null)
{
album.Name = name;
@ -329,7 +329,7 @@ public class StubManager : IDataManager
{
album.Name = name;
album.ImageURL = url;
Artist? artist2 = GetArtistByName(artist);
Artist artist2 = GetArtistByName(artist);
if (artist2 != null)
{
album.Artist = artist2;
@ -340,12 +340,12 @@ public class StubManager : IDataManager
public void UpdateAlbumByNameByArtistName(string name, string newUrl, string artist, string description, string info)
{
Album? album = GetAlbumByName(name);
Album album = GetAlbumByName(name);
if (album != null)
{
album.Name = name;
album.ImageURL = newUrl;
Artist? artist2 = GetArtistByName(artist);
Artist artist2 = GetArtistByName(artist);
if (artist2 != null)
{
album.Artist = artist2;
@ -364,7 +364,7 @@ public class StubManager : IDataManager
public void UpdatePlaylistByName(string name, string description, string newUrl)
{
Playlist? playlist = GetPlaylistByName(name);
Playlist playlist = GetPlaylistByName(name);
if (playlist != null)
{
playlist.Name = name;
@ -380,7 +380,7 @@ public class StubManager : IDataManager
public void UpdateArtistByName(string name, string newName)
{
Artist? artist = GetArtistByName(newName);
Artist artist = GetArtistByName(newName);
if (artist != null)
{
artist.Name = newName;
@ -547,7 +547,7 @@ public class StubManager : IDataManager
return false;
}
public Album? GetAlbumById(long id)
public Album GetAlbumById(long id)
{
foreach(Album album in StubAlbum.Albums)
{

@ -33,7 +33,7 @@ public class StubPlaylist
{
return playlists;
}
public Playlist? GetPlaylistByName(string name)
public Playlist GetPlaylistByName(string name)
{
foreach(var playlist in playlists)
{

@ -8,9 +8,9 @@ namespace Model;
public class Title
{
public event PropertyChangedEventHandler? PropertyChanged;
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string? propertyName = null)
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
public string Name
@ -74,7 +74,7 @@ public class Title
Information = informations;
}
public override bool Equals(object? obj)
public override bool Equals(object obj)
{
if (obj is null) return false;
if (obj.GetType() != typeof(Title)) return false;

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>

Loading…
Cancel
Save