|
|
|
@ -19,7 +19,6 @@ namespace Biblioteque_de_Class
|
|
|
|
|
public List<Theme> ThemeList { get; private set; }
|
|
|
|
|
[DataMember]
|
|
|
|
|
public List<User> UserList { get; private set; }
|
|
|
|
|
public static Theme? DefaultTheme { get; internal set; }
|
|
|
|
|
|
|
|
|
|
public Database()
|
|
|
|
|
{
|
|
|
|
@ -142,25 +141,6 @@ namespace Biblioteque_de_Class
|
|
|
|
|
ThemeList.Add(theme);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// supprimer un theme dans la liste de theme
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void RemoveTheme(Theme theme)
|
|
|
|
|
{
|
|
|
|
|
if (ThemeList.Contains(theme))
|
|
|
|
|
{
|
|
|
|
|
if (theme.Name.Length > 6 && theme.Name[..6] != "Static" )
|
|
|
|
|
{
|
|
|
|
|
throw new AlreadyUsedException("This theme is used a default theme.");
|
|
|
|
|
}
|
|
|
|
|
ThemeList.Remove(theme);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
throw new NotFoundException("Theme not found.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// récupérer un theme
|
|
|
|
|
/// </summary>
|
|
|
|
@ -179,40 +159,6 @@ namespace Biblioteque_de_Class
|
|
|
|
|
throw new NotFoundException("Theme not found.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// modifier le nom d'un theme
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void ModifyThemeName(Theme theme, string newName)
|
|
|
|
|
{
|
|
|
|
|
foreach (Theme existingTheme in ThemeList)
|
|
|
|
|
{
|
|
|
|
|
if (existingTheme.Name == theme.Name)
|
|
|
|
|
{
|
|
|
|
|
existingTheme.Name = newName;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
throw new NotFoundException("Theme not found.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// modifier la liste de couleur d'un theme
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void ModifyThemeColorList(Theme theme, List<string> newColorList)
|
|
|
|
|
{
|
|
|
|
|
foreach (Theme existingTheme in ThemeList)
|
|
|
|
|
{
|
|
|
|
|
if (existingTheme.Name == theme.Name)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
|
{
|
|
|
|
|
existingTheme.ChangeColor(existingTheme.ColorList[i], newColorList[i]);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// changer le pseudo d'un utilisateur
|
|
|
|
|
/// </summary>
|
|
|
|
@ -231,9 +177,16 @@ namespace Biblioteque_de_Class
|
|
|
|
|
user.Username = newUsername;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetDefaultTheme()
|
|
|
|
|
public bool VerifThemeNameNotTaken(string name)
|
|
|
|
|
{
|
|
|
|
|
DefaultTheme = ThemeList[0];
|
|
|
|
|
foreach (Theme theme in ThemeList)
|
|
|
|
|
{
|
|
|
|
|
if (theme.Name == name)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|