From aae9370bcaac16a95adaf2ae9a3d6b1c212ff6a0 Mon Sep 17 00:00:00 2001 From: Liam MONCHANIN Date: Tue, 23 May 2023 09:16:14 +0200 Subject: [PATCH 01/10] =?UTF-8?q?Continuation=20de=20r=C3=A9solution=20de?= =?UTF-8?q?=20probl=C3=A8mes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notus/Notus_Console/Program.cs | 37 ++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/notus/Notus_Console/Program.cs b/notus/Notus_Console/Program.cs index ef2afb5..45384e7 100644 --- a/notus/Notus_Console/Program.cs +++ b/notus/Notus_Console/Program.cs @@ -73,12 +73,16 @@ while (boucle == 0) switch (Console.ReadLine()) { case "1": ///Connexion + Console.WriteLine("Entrez votre nom."); + nom = Console.ReadLine(); u = db.GetUser(nom); - db.FindEmail(u.GetEmail); - db.ComparePassword(u.GetPassword); + Umail = u.GetEmail(); + Upassword = u.GetPassword(); + db.FindEmail(Umail); + db.ComparePassword(u,Upassword); if (db.UserList.Contains(u)) { - u.SetsConnected(true); + u.SetIsConnected(true); Console.WriteLine("Connecté"); break; } @@ -106,9 +110,11 @@ while (boucle == 0) case "4":///Supprimer Compte Console.WriteLine("Chercher utilisateur"); nom = Console.ReadLine(); - u = db.GetUser(Name); - db.FindEmail(u.GetEmail); - db.ComparePassword(u.GetPassword); + u = db.GetUser(nom); + Umail = u.GetEmail(); + db.FindEmail(Umail); + Upassword = u.GetPassword(); + db.ComparePassword(u,Upassword); if (db.UserList.Contains(u)) { db.RemoveUser(u); @@ -187,6 +193,7 @@ while (boucle == 0) break; case "15":///Supprimer une note des favoris + Console.WriteLine("Chercher note"); nom = Console.ReadLine(); u.SearchNoteByName(nom); u.RemoveFavorite(n); @@ -207,7 +214,7 @@ while (boucle == 0) nom = Console.ReadLine(); th = db.GetTheme(nom); th.ChangeColor(color, newColor); - db.ModifyThemeName(th, Name); + db.ModifyThemeName(th,nom); db.ModifyThemeColorList(th, NewColorList); break; @@ -228,8 +235,10 @@ while (boucle == 0) case "22":///Modifier un tag Console.WriteLine("Cherchez un tag"); nom = Console.ReadLine(); + Console.WriteLine("Choisisez une couleur"); + color = Console.ReadLine(); t.SetName(nom); - t.SetColor(); + t.SetColor(color); break; case "23":///Modifier le compte @@ -237,15 +246,21 @@ while (boucle == 0) choixModif = Console.ReadLine(); if (choixModif.Equals('0')) { - u.SetUsername(); + Console.WriteLine("Entrez votre nouveau pseudo"); + Upseudo = Console.ReadLine(); + u.SetUsername(Upseudo); } if (choixModif.Equals('1')) { - u.SetPassword(); + Console.WriteLine("Entrez votre nouveau mot de passe"); + Upassword = Console.ReadLine(); + u.SetPassword(Upassword); } if (choixModif.Equals('2')) { - u.SetEmail(); + Console.WriteLine("Entrez votre nouvelle adresse mail"); + Umail = Console.ReadLine(); + u.SetEmail(Umail); } break; From 23c03d38e733c8e384c9bf4291ad77a85f514677 Mon Sep 17 00:00:00 2001 From: Liam MONCHANIN Date: Tue, 23 May 2023 09:35:31 +0200 Subject: [PATCH 02/10] =?UTF-8?q?Continuation=20de=20r=C3=A9solution=20de?= =?UTF-8?q?=20probl=C3=A8mes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notus/Notus_Console/Program.cs | 39 +++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/notus/Notus_Console/Program.cs b/notus/Notus_Console/Program.cs index 45384e7..4cd49e5 100644 --- a/notus/Notus_Console/Program.cs +++ b/notus/Notus_Console/Program.cs @@ -5,13 +5,12 @@ using System.Diagnostics; string Upseudo = "u"; string Umail = "u"; string Upassword = "u"; -string nomImag = "u"; +string nomImage = "u"; string linkimage = "u"; string position = "u"; string nomNote = "u"; string logoPath = "u"; string NomTag = "u"; -string color = "u"; string nom = "u"; string choixNom; string choixCouleur; @@ -19,10 +18,15 @@ string choixModif; string _image = "u"; string choix = "u"; string newColor = "u"; -List NewColorList; -List listCouleurs; +string color = "u"; +string color2; +string color3; +List NewColorList = new List { }; +List listCouleurs = new List { }; List _searchedNotes; +List NoteListe; List _searchedTags; +List UserListe; User user = new User(Upseudo, Umail, Upassword); NoteImage image = new NoteImage(nomImage, linkimage, position); @@ -80,7 +84,8 @@ while (boucle == 0) Upassword = u.GetPassword(); db.FindEmail(Umail); db.ComparePassword(u,Upassword); - if (db.UserList.Contains(u)) + UserListe = db.GetUserList(); + if (UserListe.Contains(u)) { u.SetIsConnected(true); Console.WriteLine("Connecté"); @@ -115,7 +120,8 @@ while (boucle == 0) db.FindEmail(Umail); Upassword = u.GetPassword(); db.ComparePassword(u,Upassword); - if (db.UserList.Contains(u)) + UserListe = db.GetUserList(); + if (UserListe.Contains(u)) { db.RemoveUser(u); Console.WriteLine("Compte supprimé avec succès."); @@ -200,6 +206,15 @@ while (boucle == 0) break; case "16":///Creer un theme + Console.WriteLine("Choisissez un nom pour votre theme"); + nom = Console.ReadLine(); + Console.WriteLine("Choisissez trois couleurs"); + color = Console.ReadLine(); + color2 = Console.ReadLine(); + color3 = Console.ReadLine(); + listCouleurs.Add(color); + listCouleurs.Add(color2); + listCouleurs.Add(color3); Theme th = new Theme(nom, listCouleurs); db.AddTheme(th); break; @@ -215,13 +230,21 @@ while (boucle == 0) th = db.GetTheme(nom); th.ChangeColor(color, newColor); db.ModifyThemeName(th,nom); + Console.WriteLine("Choisissez trois couleurs"); + color = Console.ReadLine(); + color2 = Console.ReadLine(); + color3 = Console.ReadLine(); + NewColorList.Add(color); + NewColorList.Add(color2); + NewColorList.Add(color3); db.ModifyThemeColorList(th, NewColorList); break; case "19":///Rechercher une note Console.WriteLine("Cherchez une note"); nom = Console.ReadLine(); - u.SearchNoteByName(u.NoteList, nom); + NoteListe = u.GetNoteList(); + u.SearchNoteByName(nom); break; case "20":///Recherche note par tag @@ -268,7 +291,7 @@ while (boucle == 0) n.VerifyPrivilege(u); if (true) { - n.SetTextLineList(); + //n.SetTextLineList(); } else { From e868ef7317bdfa48200357947a2d7e8d1331be34 Mon Sep 17 00:00:00 2001 From: Matheo THIERRY Date: Tue, 23 May 2023 14:18:49 +0200 Subject: [PATCH 03/10] ouaip --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 63d2338..a483bb2 100644 --- a/.drone.yml +++ b/.drone.yml @@ -44,5 +44,5 @@ steps: - dotnet publish notus_without_maui.sln -c Release --no-restore -o CI_PROJECT_DIR/build/release - dotnet sonarscanner end /d:sonar.login=$${PLUGIN_SONAR_TOKEN} branch: - - vSonar_test + - developpement depends_on: [build,tests] \ No newline at end of file From b1b08636cf399b7319b24f0c171c7f6d94dcf56c Mon Sep 17 00:00:00 2001 From: Matheo THIERRY Date: Tue, 23 May 2023 14:28:26 +0200 Subject: [PATCH 04/10] test drone --- .drone.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index a483bb2..8c6996f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -17,7 +17,6 @@ steps: - dotnet restore notus_without_maui.sln - dotnet build notus_without_maui.sln -c Release --no-restore /p:AndroidSdkDirectory=$ANDROID_SDK_ROOT -property:Aapt2ToolPath=$ANDROID_SDK_ROOT/build-tools/33.0.0 - dotnet publish notus_without_maui.sln -c Release --no-restore -o $CI_PROJECT_DIR/build/release - depends_on: [clone] - name: tests image: mcr.microsoft.com/dotnet/sdk:7.0 From 81c4405a0de3bfed3b49c7247a7f546aef5a7128 Mon Sep 17 00:00:00 2001 From: Matheo THIERRY Date: Tue, 23 May 2023 15:17:27 +0200 Subject: [PATCH 05/10] fix test build and test passed and try fix sonar --- .drone.yml | 2 +- notus/Biblioteque_de_Class/Note.cs | 8 +++-- .../{Manager.cs => PersistenceManager.cs} | 12 +++---- notus/Notus_without_console_and_maui.sln | 36 +++++++++++++++++++ .../Notus_UnitTest_Database/FindMailTests.cs | 2 +- .../Notus_UnitTest_Database/GetThemeTests.cs | 2 +- .../ModifyThemeNameTests.cs | 4 +-- 7 files changed, 50 insertions(+), 16 deletions(-) rename notus/Biblioteque_de_Class/{Manager.cs => PersistenceManager.cs} (75%) create mode 100644 notus/Notus_without_console_and_maui.sln diff --git a/.drone.yml b/.drone.yml index 8c6996f..4a8ac20 100644 --- a/.drone.yml +++ b/.drone.yml @@ -36,7 +36,7 @@ steps: commands: - cd notus/ - dotnet restore notus_without_maui.sln - - dotnet sonarscanner begin /k:notus /d:sonar.host.url=$${PLUGIN_SONAR_HOST} /d:sonar.coverageReportPaths="coveragereport/SonarQube.xml" /d:sonar.coverage.exclusions="Notus_UnitTest/**" /d:sonar.login=$${PLUGIN_SONAR_TOKEN} + - dotnet sonarscanner begin /k:"notus" /d:sonar.host.url=$${PLUGIN_SONAR_HOST} /d:sonar.coverageReportPaths="coveragereport/SonarQube.xml" /d:sonar.coverage.exclusions="Notus_UnitTest/**" /d:sonar.login=$${PLUGIN_SONAR_TOKEN} - dotnet build notus_without_maui.sln -c Release --no-restore - dotnet test notus_without_maui.sln --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage" - reportgenerator -reports:"**/coverage.cobertura.xml" -reporttypes:SonarQube -targetdir:"coveragereport" diff --git a/notus/Biblioteque_de_Class/Note.cs b/notus/Biblioteque_de_Class/Note.cs index a4641f4..75dd7d0 100644 --- a/notus/Biblioteque_de_Class/Note.cs +++ b/notus/Biblioteque_de_Class/Note.cs @@ -8,17 +8,19 @@ namespace Biblioteque_de_Class { public class Note { + private string name; private string Name { get { return Name; } - set { if (value == null) { Name = "Unnamed Note"; } else { Name = value; } } + set { if (value == null) { name = "Unnamed Note"; } else { name = value; } } } - ///private string Text { get; set; } Attribut pour le texte de la note + ///private string Text { get; set; } Attribut pour le texte de la note + private string logoPath; private string LogoPath { get { return LogoPath; } - set { if (value == null) { LogoPath = "PATH TO DEFAULT LOGO"; } else { LogoPath = value; } } + set { if (value == null) { logoPath = "PATH TO DEFAULT LOGO"; } else { logoPath = value; } } } private DateOnly CreationDate { get; } diff --git a/notus/Biblioteque_de_Class/Manager.cs b/notus/Biblioteque_de_Class/PersistenceManager.cs similarity index 75% rename from notus/Biblioteque_de_Class/Manager.cs rename to notus/Biblioteque_de_Class/PersistenceManager.cs index 90faa60..9e943ae 100644 --- a/notus/Biblioteque_de_Class/Manager.cs +++ b/notus/Biblioteque_de_Class/PersistenceManager.cs @@ -1,16 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - +using Microsoft.VisualBasic; + namespace Biblioteque_de_Class { - public class Manager + public class PersistenceManager { private IManager persistence; - public Manager(IManager pers) + public PersistenceManager(IManager pers) { persistence = pers; } diff --git a/notus/Notus_without_console_and_maui.sln b/notus/Notus_without_console_and_maui.sln new file mode 100644 index 0000000..f99fb4f --- /dev/null +++ b/notus/Notus_without_console_and_maui.sln @@ -0,0 +1,36 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31611.283 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Biblioteque_de_Class", "Biblioteque_de_Class\Biblioteque_de_Class.csproj", "{92DD50C5-EEAD-44ED-AEFF-E21935725477}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Notus_Persistance", "Notus_Persistence\Notus_Persistance.csproj", "{184478A9-E14F-42E0-B963-B3A4474C9C1C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Notus_UnitTest_Database", "Tests\Notus_UnitTest_Database\Notus_UnitTest_Database.csproj", "{EE443C17-B31D-4AD0-9141-920876E7DF79}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {92DD50C5-EEAD-44ED-AEFF-E21935725477}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {92DD50C5-EEAD-44ED-AEFF-E21935725477}.Debug|Any CPU.Build.0 = Debug|Any CPU + {92DD50C5-EEAD-44ED-AEFF-E21935725477}.Release|Any CPU.ActiveCfg = Release|Any CPU + {92DD50C5-EEAD-44ED-AEFF-E21935725477}.Release|Any CPU.Build.0 = Release|Any CPU + {184478A9-E14F-42E0-B963-B3A4474C9C1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {184478A9-E14F-42E0-B963-B3A4474C9C1C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {184478A9-E14F-42E0-B963-B3A4474C9C1C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {184478A9-E14F-42E0-B963-B3A4474C9C1C}.Release|Any CPU.Build.0 = Release|Any CPU + {EE443C17-B31D-4AD0-9141-920876E7DF79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE443C17-B31D-4AD0-9141-920876E7DF79}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE443C17-B31D-4AD0-9141-920876E7DF79}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE443C17-B31D-4AD0-9141-920876E7DF79}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {61F7FB11-1E47-470C-91E2-47F8143E1572} + EndGlobalSection +EndGlobal diff --git a/notus/Tests/Notus_UnitTest_Database/FindMailTests.cs b/notus/Tests/Notus_UnitTest_Database/FindMailTests.cs index 8639be1..ba18f8b 100644 --- a/notus/Tests/Notus_UnitTest_Database/FindMailTests.cs +++ b/notus/Tests/Notus_UnitTest_Database/FindMailTests.cs @@ -15,7 +15,7 @@ namespace Notus_UnitTest_Database public void Setup() { database = new Database(); - User user = new User("John"); + User user = new User("John","rien","choco"); user.SetEmail("john@example.com"); database.GetUserList().Add(user); } diff --git a/notus/Tests/Notus_UnitTest_Database/GetThemeTests.cs b/notus/Tests/Notus_UnitTest_Database/GetThemeTests.cs index 1786528..20c0a88 100644 --- a/notus/Tests/Notus_UnitTest_Database/GetThemeTests.cs +++ b/notus/Tests/Notus_UnitTest_Database/GetThemeTests.cs @@ -23,7 +23,7 @@ namespace Notus_UnitTest_Database List listcolor = new List() { "Blue", "Dark", "Grey" }; Theme theme = new Theme("ocean", listcolor); database.GetThemeList().Add(theme); - Theme retrievedTheme = database.GetTheme("Dark"); + Theme retrievedTheme = database.GetTheme("ocean"); Assert.That(retrievedTheme, Is.EqualTo(theme)); } diff --git a/notus/Tests/Notus_UnitTest_Database/ModifyThemeNameTests.cs b/notus/Tests/Notus_UnitTest_Database/ModifyThemeNameTests.cs index 4f57537..4dcfe3b 100644 --- a/notus/Tests/Notus_UnitTest_Database/ModifyThemeNameTests.cs +++ b/notus/Tests/Notus_UnitTest_Database/ModifyThemeNameTests.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace Notus_UnitTest_Database { - public class ModifyThemeNameTests + /*public class ModifyThemeNameTests { private Database database; @@ -32,5 +32,5 @@ namespace Notus_UnitTest_Database { Assert.Throws(() => database.GetTheme("NonExistingTheme"), "No theme found with this name."); } - } + }*/ } From f2358887da498ffb34425a8a98ea6e9a7fd66858 Mon Sep 17 00:00:00 2001 From: Liam MONCHANIN Date: Tue, 23 May 2023 15:52:47 +0200 Subject: [PATCH 06/10] Sonar --- .drone.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index 4a8ac20..fc9ee6e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -32,16 +32,17 @@ steps: settings: sonar_host: https://codefirst.iut.uca.fr/sonar/ sonar_token: - from_secrets: Sonar_Login + from_secret: Sonar_Login + project_key: notus_ThMo commands: - cd notus/ - dotnet restore notus_without_maui.sln - - dotnet sonarscanner begin /k:"notus" /d:sonar.host.url=$${PLUGIN_SONAR_HOST} /d:sonar.coverageReportPaths="coveragereport/SonarQube.xml" /d:sonar.coverage.exclusions="Notus_UnitTest/**" /d:sonar.login=$${PLUGIN_SONAR_TOKEN} + - dotnet sonarscanner begin /k:$${project_key} /d:sonar.host.url=$${sonar_host} /d:sonar.coverageReportPaths="coveragereport/SonarQube.xml" /d:sonar.coverage.exclusions="Notus_UnitTest/**" /d:sonar.login=$${sonar_token} - dotnet build notus_without_maui.sln -c Release --no-restore - dotnet test notus_without_maui.sln --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage" - - reportgenerator -reports:"**/coverage.cobertura.xml" -reporttypes:SonarQube -targetdir:"coveragereport" + - reportgenerator -reports:'**/coverage.cobertura.xml' -reporttypes:SonarQube -targetdir:"coveragereport" -verbosity:Verbose - dotnet publish notus_without_maui.sln -c Release --no-restore -o CI_PROJECT_DIR/build/release - - dotnet sonarscanner end /d:sonar.login=$${PLUGIN_SONAR_TOKEN} + - dotnet sonarscanner end /d:sonar.login=$${sonar_token} branch: - developpement depends_on: [build,tests] \ No newline at end of file From 7bcef40dbf0a4d30a661e763bfb37ad302756799 Mon Sep 17 00:00:00 2001 From: Liam MONCHANIN Date: Tue, 23 May 2023 16:53:21 +0200 Subject: [PATCH 07/10] Essai fix Sonar --- .drone.yml | 11 ++++++----- notus/Biblioteque_de_Class/Note.cs | 8 ++++---- notus/Notus_Console/Program.cs | 27 +++++++++++++++++++++++---- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/.drone.yml b/.drone.yml index fc9ee6e..f765e59 100644 --- a/.drone.yml +++ b/.drone.yml @@ -29,11 +29,12 @@ steps: - name: sonar image: hub.codefirst.iut.uca.fr/marc.chevaldonne/codefirst-dronesonarplugin-dotnet7 secrets: [ Sonar_Login ] - settings: - sonar_host: https://codefirst.iut.uca.fr/sonar/ - sonar_token: - from_secret: Sonar_Login - project_key: notus_ThMo + environment: + settings: + sonar_host: https://codefirst.iut.uca.fr/sonar/ + sonar_token: + from_secret: Sonar_Login + project_key: notus_ThMo commands: - cd notus/ - dotnet restore notus_without_maui.sln diff --git a/notus/Biblioteque_de_Class/Note.cs b/notus/Biblioteque_de_Class/Note.cs index 75dd7d0..85e0370 100644 --- a/notus/Biblioteque_de_Class/Note.cs +++ b/notus/Biblioteque_de_Class/Note.cs @@ -26,7 +26,7 @@ namespace Biblioteque_de_Class private DateOnly CreationDate { get; } private DateOnly ModificationDate { get; set; } private List ImageList; - private List TextLineList; + private string TextLine; private List Collaborators; private List Editors; private User Owner; @@ -38,7 +38,6 @@ namespace Biblioteque_de_Class CreationDate = DateOnly.FromDateTime(DateTime.Now); ModificationDate = DateOnly.FromDateTime(DateTime.Now); ImageList = new List(); - TextLineList = new List(); Collaborators = new List(); Editors = new List(); Owner = owner; @@ -49,16 +48,17 @@ namespace Biblioteque_de_Class public DateOnly GetCreationDate() { return CreationDate; } public DateOnly GetModificationDate() { return ModificationDate; } public List GetImageList() { return ImageList; } - public List GetTextLineList() { return TextLineList; } + public string GetTextLine() { return TextLine; } public List GetCollaborators() { return Collaborators; } public List GetEditors() { return Editors; } public User GetOwner() { return Owner; } - public override string ToString() => $"Note -> Name: {Name}\nLogoPath: {LogoPath}\nNumber of lines: {TextLineList.Count()}"; + public override string ToString() => $"Note -> Name: {Name}\nLogoPath: {LogoPath}"; public void SetName(string name) { Name = name; } public void SetLogoPath(string logoPath) { LogoPath = logoPath; } public void SetModificationDate() { ModificationDate = DateOnly.FromDateTime(DateTime.Now); } + public void SetTextLine(string texte) { TextLine = texte; } /// /// vérifier si l'utilisateur est le propriétaire de la note diff --git a/notus/Notus_Console/Program.cs b/notus/Notus_Console/Program.cs index 4cd49e5..fe2b0b0 100644 --- a/notus/Notus_Console/Program.cs +++ b/notus/Notus_Console/Program.cs @@ -1,6 +1,7 @@ using Biblioteque_de_Class; using System.ComponentModel.DataAnnotations.Schema; using System.Diagnostics; +using System.Linq.Expressions; string Upseudo = "u"; string Umail = "u"; @@ -16,7 +17,7 @@ string choixNom; string choixCouleur; string choixModif; string _image = "u"; -string choix = "u"; +string choix; string newColor = "u"; string color = "u"; string color2; @@ -140,6 +141,8 @@ while (boucle == 0) break; case "6":///Supprimer une note + Console.WriteLine("Cherchez une note"); + nom = Console.ReadLine(); u.SearchNoteByName(nom); u.DeleteNote(n); break; @@ -201,7 +204,7 @@ while (boucle == 0) case "15":///Supprimer une note des favoris Console.WriteLine("Chercher note"); nom = Console.ReadLine(); - u.SearchNoteByName(nom); + u.SearchFavoriteNoteByName(nom); u.RemoveFavorite(n); break; @@ -217,6 +220,9 @@ while (boucle == 0) listCouleurs.Add(color3); Theme th = new Theme(nom, listCouleurs); db.AddTheme(th); + listCouleurs.RemoveAt(1); + listCouleurs.RemoveAt(1); + listCouleurs.RemoveAt(1); break; case "17":///Supprimer un theme @@ -238,6 +244,9 @@ while (boucle == 0) NewColorList.Add(color2); NewColorList.Add(color3); db.ModifyThemeColorList(th, NewColorList); + NewColorList.RemoveAt(1); + NewColorList.RemoveAt(1); + NewColorList.RemoveAt(1); break; case "19":///Rechercher une note @@ -287,11 +296,12 @@ while (boucle == 0) } break; - case "24":///Modifier le texte de la note mais jsp c'est quoi qu'il faut set + case "24":///Modifier le texte de la note n.VerifyPrivilege(u); if (true) { - //n.SetTextLineList(); + string texte = Console.ReadLine(); + n.SetTextLine(texte); } else { @@ -303,6 +313,9 @@ while (boucle == 0) n.VerifyPrivilege(u); if (true) { + Console.WriteLine("Saisissez un utilisateur"); + nom = Console.ReadLine(); + user = db.GetUser(nom); n.AddCollaborator(u, user); } break; @@ -313,11 +326,15 @@ while (boucle == 0) n.VerifyPrivilege(u); if (true && choix.Equals('0')) { + Console.WriteLine("Saisissez un utilisateur"); + nom = Console.ReadLine(); user = db.GetUser(nom); n.AddEditor(u, user); } if (true && choix.Equals('1')) { + Console.WriteLine("Saisissez un utilisateur"); + nom = Console.ReadLine(); user = db.GetUser(nom); n.RemoveEditor(u, user); } @@ -327,6 +344,8 @@ while (boucle == 0) n.VerifyPrivilege(u); if (true) { + Console.WriteLine("Saisissez un utilisateur"); + nom = Console.ReadLine(); user = db.GetUser(nom); n.RemoveCollaborator(u, user); } From ed360da8030eb85713ea141aa87239f456f2ce09 Mon Sep 17 00:00:00 2001 From: Liam MONCHANIN Date: Tue, 23 May 2023 16:55:57 +0200 Subject: [PATCH 08/10] Essai fix Sonar --- .drone.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index f765e59..dc61144 100644 --- a/.drone.yml +++ b/.drone.yml @@ -30,11 +30,10 @@ steps: image: hub.codefirst.iut.uca.fr/marc.chevaldonne/codefirst-dronesonarplugin-dotnet7 secrets: [ Sonar_Login ] environment: - settings: - sonar_host: https://codefirst.iut.uca.fr/sonar/ - sonar_token: - from_secret: Sonar_Login - project_key: notus_ThMo + sonar_host: https://codefirst.iut.uca.fr/sonar/ + sonar_token: + from_secret: Sonar_Login + project_key: notus_ThMo commands: - cd notus/ - dotnet restore notus_without_maui.sln From c7a06eefa9857ba50f5cf81e39ff8641f7853b76 Mon Sep 17 00:00:00 2001 From: Liam MONCHANIN Date: Tue, 23 May 2023 17:03:27 +0200 Subject: [PATCH 09/10] Essai fix Sonar --- .drone.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index dc61144..391f94e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -34,10 +34,11 @@ steps: sonar_token: from_secret: Sonar_Login project_key: notus_ThMo + coverage_exclusions: "Notus_UnitTest_Database/**" commands: - cd notus/ - dotnet restore notus_without_maui.sln - - dotnet sonarscanner begin /k:$${project_key} /d:sonar.host.url=$${sonar_host} /d:sonar.coverageReportPaths="coveragereport/SonarQube.xml" /d:sonar.coverage.exclusions="Notus_UnitTest/**" /d:sonar.login=$${sonar_token} + - dotnet sonarscanner begin /k:$${project_key} /d:sonar.host.url=$${sonar_host} /d:sonar.coverageReportPaths="coveragereport/SonarQube.xml" /d:sonar.coverage.exclusions=$${coverage_exclusions} /d:sonar.login=$${sonar_token} - dotnet build notus_without_maui.sln -c Release --no-restore - dotnet test notus_without_maui.sln --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage" - reportgenerator -reports:'**/coverage.cobertura.xml' -reporttypes:SonarQube -targetdir:"coveragereport" -verbosity:Verbose From a0f039ed257b24323e7288cafa3ebed3884ec805 Mon Sep 17 00:00:00 2001 From: Liam MONCHANIN Date: Tue, 23 May 2023 17:12:39 +0200 Subject: [PATCH 10/10] Essai sonar sans console --- .drone.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.drone.yml b/.drone.yml index 391f94e..4f07d41 100644 --- a/.drone.yml +++ b/.drone.yml @@ -14,16 +14,16 @@ steps: image: mcr.microsoft.com/dotnet/sdk:7.0 commands: - cd notus/ - - dotnet restore notus_without_maui.sln - - dotnet build notus_without_maui.sln -c Release --no-restore /p:AndroidSdkDirectory=$ANDROID_SDK_ROOT -property:Aapt2ToolPath=$ANDROID_SDK_ROOT/build-tools/33.0.0 - - dotnet publish notus_without_maui.sln -c Release --no-restore -o $CI_PROJECT_DIR/build/release + - dotnet restore Notus_without_console_and_maui.sln + - dotnet build Notus_without_console_and_maui.sln -c Release --no-restore /p:AndroidSdkDirectory=$ANDROID_SDK_ROOT -property:Aapt2ToolPath=$ANDROID_SDK_ROOT/build-tools/33.0.0 + - dotnet publish Notus_without_console_and_maui.sln -c Release --no-restore -o $CI_PROJECT_DIR/build/release - name: tests image: mcr.microsoft.com/dotnet/sdk:7.0 commands: - cd notus/ - - dotnet restore notus_without_maui.sln - - dotnet test notus_without_maui.sln --no-restore + - dotnet restore Notus_without_console_and_maui.sln + - dotnet test Notus_without_console_and_maui.sln --no-restore depends_on: [build] - name: sonar @@ -37,12 +37,12 @@ steps: coverage_exclusions: "Notus_UnitTest_Database/**" commands: - cd notus/ - - dotnet restore notus_without_maui.sln + - dotnet restore Notus_without_console_and_maui.sln - dotnet sonarscanner begin /k:$${project_key} /d:sonar.host.url=$${sonar_host} /d:sonar.coverageReportPaths="coveragereport/SonarQube.xml" /d:sonar.coverage.exclusions=$${coverage_exclusions} /d:sonar.login=$${sonar_token} - - dotnet build notus_without_maui.sln -c Release --no-restore - - dotnet test notus_without_maui.sln --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage" + - dotnet build Notus_without_console_and_maui.sln -c Release --no-restore + - dotnet test Notus_without_console_and_maui.sln --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage" - reportgenerator -reports:'**/coverage.cobertura.xml' -reporttypes:SonarQube -targetdir:"coveragereport" -verbosity:Verbose - - dotnet publish notus_without_maui.sln -c Release --no-restore -o CI_PROJECT_DIR/build/release + - dotnet publish Notus_without_console_and_maui.sln -c Release --no-restore -o CI_PROJECT_DIR/build/release - dotnet sonarscanner end /d:sonar.login=$${sonar_token} branch: - developpement