test v4 sonar fix code bon fonctionnement pour build
continuous-integration/drone/push Build is failing Details

vSonar_test
Matheo THIERRY 2 years ago
parent 19967ed99a
commit 720585a043

@ -34,6 +34,11 @@ namespace Biblioteque_de_Class
LogoPATH = logoPATH; LogoPATH = logoPATH;
DateCreation = DateOnly.FromDateTime(DateTime.Now); DateCreation = DateOnly.FromDateTime(DateTime.Now);
DateModif = DateOnly.FromDateTime(DateTime.Now); DateModif = DateOnly.FromDateTime(DateTime.Now);
listeImage = new List<NoteImage>();
listeLigneTexte = new List<String>();
cooperateurs = new List<Utilisateur>();
editeurs = new List<Utilisateur>();
owner = uOwner; owner = uOwner;
} }
@ -41,9 +46,8 @@ namespace Biblioteque_de_Class
public string GetLogoPATH() { return LogoPATH; } public string GetLogoPATH() { return LogoPATH; }
public DateOnly GetDateCreation() { return DateCreation; } public DateOnly GetDateCreation() { return DateCreation; }
public DateOnly GetDateModif() { return DateModif; } public DateOnly GetDateModif() { return DateModif; }
public List<String> GetListeImage() { return listeImage; } public List<NoteImage> GetListeImage() { return listeImage; }
public List<String> GetListeLigneTexte() { return listeLigneTexte; } public List<string> GetListeLigneTexte() { return listeLigneTexte; }
public List<String> GetListePosiImage() { return listePosiImage; }
public List<Utilisateur> GetCooperateurs() { return cooperateurs; } public List<Utilisateur> GetCooperateurs() { return cooperateurs; }
public List<Utilisateur> GetEditeurs() { return editeurs; } public List<Utilisateur> GetEditeurs() { return editeurs; }
public Utilisateur GetOwner() { return owner; } public Utilisateur GetOwner() { return owner; }
@ -65,11 +69,11 @@ namespace Biblioteque_de_Class
public void AjouterImage(string linkImage, string position) public void AjouterImage(string linkImage, string position)
{ {
foreach (NoteImage image in listeImage) foreach (NoteImage image in this.GetListeImage())
{ {
if (image.GetLinkImage() == linkImage) if (image.GetLinkImage() == linkImage)
{ {
name = listeImage.Count();
} }
} }
} }

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Biblioteque_de_Class namespace Biblioteque_de_Class
{ {
internal class NoteImage public class NoteImage
{ {
private string Nom { get; set; } private string Nom { get; set; }
private string LinkImage { get; set; } private string LinkImage { get; set; }

@ -13,7 +13,7 @@ namespace Biblioteque_de_Class
private List<Tags> TagList; private List<Tags> TagList;
private List<Note> FavList; private List<Note> FavList;
private bool connecte { get; set; } private bool connecte { get; set; }
private Map<Note, List<Tags>> NoteTaged; private Dictionary<Note, List<Tags>> NoteTaged;
public Utilisateur(string Upseudo, string Umail, string Upassword) public Utilisateur(string Upseudo, string Umail, string Upassword)
{ {
@ -30,9 +30,9 @@ namespace Biblioteque_de_Class
public List<Tags> GetTagList() { return TagList; } public List<Tags> GetTagList() { return TagList; }
public List<Note> GetFavList() { return FavList; } public List<Note> GetFavList() { return FavList; }
public bool GetConnecte() { return connecte; } public bool GetConnecte() { return connecte; }
public Map<Note, List<Tags>> GetNoteTaged() { return NoteTaged; } public Dictionary<Note, List<Tags>> GetNoteTaged() { return NoteTaged; }
public override string ToString() => $"pseudo : {Pseudo}\nmail : {Mail}\npassword : {Mdp}\nNote possédé : {NoteList.Count}"; public override string ToString() => $"pseudo : {Pseudo}\nmail : {Mail}\npassword : {Password}\nNote possédé : {NoteList.Count}";
/// <summary> /// <summary>
/// rechercher une note dans la liste de note de l'utilisateur /// rechercher une note dans la liste de note de l'utilisateur
@ -40,9 +40,9 @@ namespace Biblioteque_de_Class
public List<Note> RechercherNote(string name) public List<Note> RechercherNote(string name)
{ {
List<Note> ListNotesearch = new List<Note>(); List<Note> ListNotesearch = new List<Note>();
string search = name.Tolower(); string search = name.ToLower();
foreach(Note note in NoteList){ foreach(Note note in NoteList){
if(note.Nom.Tolower().Contains(search)) { ListNotesearch.Add(note.Nom); } if(note.GetNom().ToLower().Contains(search)) { ListNotesearch.Add(note); }
}return ListNotesearch; }return ListNotesearch;
} }
@ -52,22 +52,23 @@ namespace Biblioteque_de_Class
public List<Note> RechercherNoteFav(string name) public List<Note> RechercherNoteFav(string name)
{ {
List<Note> ListNotesearch = new List<Note>(); List<Note> ListNotesearch = new List<Note>();
string search = name.Tolower(); string search = name.ToLower();
foreach(Note note in FavList){ foreach(Note note in FavList){
if(note.Nom.Tolower().Contains(search)) { ListNotesearch.Add(note.Nom); } if(note.GetNom().ToLower().Contains(search)) { ListNotesearch.Add(note); }
}return ListNotesearch; }return ListNotesearch;
} }
/// <summary> /// <summary>
/// rechercher un tag dans la liste de tag de l'utilisateur /// rechercher un tag dans la liste de tag de l'utilisateur
/// </summary> /// </summary>
public Tags RechercherTags(string name) public List<Tags> RechercherTags(string name)
{ {
List<Tags> ListTagssearch = new List<Tags>(); List<Tags> ListTagssearch = new List<Tags>();
string search = name.Tolower(); string search = name.ToLower();
foreach(Tags tag in TagList){ foreach(Tags tag in TagList){
if(tag.Nom.Tolower().Contains(search)) { ListTagssearch.Add(tag.Nom); } if(tag.GetNom().ToLower().Contains(search)) { ListTagssearch.Add(tag); }
}return ListTagssearch; }
return ListTagssearch;
} }
/// <summary> /// <summary>
@ -105,9 +106,11 @@ namespace Biblioteque_de_Class
/// </summary> /// </summary>
public void CreateNote(string nom, string LogoPath) public void CreateNote(string nom, string LogoPath)
{ {
List<Note> NoteList = this.GetNoteList();
Dictionary<Note, List<Tags>> NoteTaged = this.GetNoteTaged();
foreach (Note note in NoteList) foreach (Note note in NoteList)
{ {
if (note.Nom == nom) if (note.GetNom() == nom)
{ {
throw new Exception("Note already exist"); throw new Exception("Note already exist");
} }
@ -137,7 +140,7 @@ namespace Biblioteque_de_Class
public void CreateTag(string name, string color) public void CreateTag(string name, string color)
{ {
foreach(Tags tag in TagList){ foreach(Tags tag in TagList){
if(tag.Nom == name) { throw new Exception("Tag already exist"); } if(tag.GetNom() == name) { throw new Exception("Tag already exist"); }
} }
TagList.Add(new Tags(name, color)); TagList.Add(new Tags(name, color));
} }
@ -148,7 +151,7 @@ namespace Biblioteque_de_Class
public void DeleteTag(string name) public void DeleteTag(string name)
{ {
foreach(Tags tag in TagList){ foreach(Tags tag in TagList){
if(tag.Nom == name) { TagList.Remove(tag); } if(tag.GetNom() == name) { TagList.Remove(tag); }
} }
} }
@ -157,7 +160,8 @@ namespace Biblioteque_de_Class
/// </summary> /// </summary>
public void AddOneTagToNoteList(Note note, Tags tagtoadd) public void AddOneTagToNoteList(Note note, Tags tagtoadd)
{ {
if(ListTags.Contains(tagtoadd) == false) { throw new Exception("Tag not found"); } List<Tags> ListTags = this.GetTagList();
if (ListTags.Contains(tagtoadd) == false) { throw new Exception("Tag not found"); }
if(NoteList.Contains(note) == false) { throw new Exception("Note not found"); } if(NoteList.Contains(note) == false) { throw new Exception("Note not found"); }
else else
{ {
@ -170,7 +174,8 @@ namespace Biblioteque_de_Class
/// </summary> /// </summary>
public void SupOneTagToNoteList(Note note, Tags tagtosup) public void SupOneTagToNoteList(Note note, Tags tagtosup)
{ {
if(ListTags.Contains(tagtosup) == false) { throw new Exception("Tag not found"); } List<Tags> ListTags = this.GetTagList();
if (ListTags.Contains(tagtosup) == false) { throw new Exception("Tag not found"); }
if(NoteList.Contains(note) == false) { throw new Exception("Note not found"); } if(NoteList.Contains(note) == false) { throw new Exception("Note not found"); }
else else
{ {

Loading…
Cancel
Save