diff --git a/.drone.yml b/.drone.yml index 78871c5..0a54d90 100644 --- a/.drone.yml +++ b/.drone.yml @@ -47,4 +47,21 @@ steps: - dotnet sonarscanner end /d:sonar.login=$${sonar_token} branch: - developpement - depends_on: [build,tests] \ No newline at end of file + depends_on: [build,tests] + + - name: generate-and-deploy-docs + image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-docdeployer + failure: ignore + volumes: + - name: docs + path: /docs + commands: + - /entrypoint.sh + when: + branch: + - master +# environment: +# NODOXYGEN: true +volumes: +- name: docs + temp: {} \ No newline at end of file diff --git a/notus/Biblioteque_de_Class/Exception.cs b/notus/Biblioteque_de_Class/Exception.cs index fb033a2..86ecca8 100644 --- a/notus/Biblioteque_de_Class/Exception.cs +++ b/notus/Biblioteque_de_Class/Exception.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Runtime.Serialization; using System.Text; @@ -7,7 +8,7 @@ using System.Threading.Tasks; namespace Biblioteque_de_Class { - [Serializable] + [Serializable, ExcludeFromCodeCoverage] public class NotAllowedException : Exception { public NotAllowedException(string message) : base(message) diff --git a/notus/Biblioteque_de_Class/IManager.cs b/notus/Biblioteque_de_Class/IManager.cs index 94a25a5..a88aac1 100644 --- a/notus/Biblioteque_de_Class/IManager.cs +++ b/notus/Biblioteque_de_Class/IManager.cs @@ -9,6 +9,7 @@ namespace Biblioteque_de_Class public interface IManager { public void SaveDatabaseData(List UserList); + public void SaveDefaultData(List DefaultThemeList, List DefaultLogoList); public List LoadDatabaseData(); public List LoadDefaultTheme(); public List LoadDefaultLogo(); diff --git a/notus/Biblioteque_de_Class/PersistenceManager.cs b/notus/Biblioteque_de_Class/PersistenceManager.cs index 19c5718..e68f7e1 100644 --- a/notus/Biblioteque_de_Class/PersistenceManager.cs +++ b/notus/Biblioteque_de_Class/PersistenceManager.cs @@ -18,6 +18,11 @@ namespace Biblioteque_de_Class persistence.SaveDatabaseData(database.UserList); } + public void SaveDefaultData(Database database) + { + persistence.SaveDefaultData(database.ThemeList, database.DefaultLogoList); + } + public Database LoadDatabaseData() { db.SetUserList(persistence.LoadDatabaseData()); diff --git a/notus/Notus_Console/Program.cs b/notus/Notus_Console/Program.cs index 1230308..9b728b1 100644 --- a/notus/Notus_Console/Program.cs +++ b/notus/Notus_Console/Program.cs @@ -1143,3 +1143,4 @@ while (arreter) } managerSave.SaveDatabaseData(db); +managerSave.SaveDefaultData(db); diff --git a/notus/Notus_Persistence/Stub.cs b/notus/Notus_Persistence/Stub.cs index 0058ac8..1970b85 100644 --- a/notus/Notus_Persistence/Stub.cs +++ b/notus/Notus_Persistence/Stub.cs @@ -17,6 +17,11 @@ namespace Notus_Persistance throw new NotImplementedException(); } + public void SaveDefaultData(List DefaultThemeList, List DefaultLogoList) + { + throw new NotImplementedException() ; + } + //Loaders List IManager.LoadDatabaseData() { diff --git a/notus/Notus_Persistence/ToXML.cs b/notus/Notus_Persistence/ToXML.cs index 136af8e..a177846 100644 --- a/notus/Notus_Persistence/ToXML.cs +++ b/notus/Notus_Persistence/ToXML.cs @@ -28,10 +28,28 @@ namespace Notus_Persistance DatabaseXmlSerializer.WriteObject(writer, UserList); } + public void SaveDefaultData(List DefaultThemeList, List DefaultLogoList) + { + if (!Directory.Exists(DataFilePath)) + { Directory.CreateDirectory(DataFilePath); } + XmlWriterSettings settings = new() { Indent = true }; + using TextWriter tw = File.CreateText(Path.Combine(DataFilePath + DefaultThemeName)); + using XmlWriter writer = XmlWriter.Create(tw, settings); + DatabaseXmlSerializer.WriteObject(writer, DefaultThemeList); + + using TextWriter tw2 = File.CreateText(Path.Combine(DataFilePath + DefaultLogoName)); + using XmlWriter writer2 = XmlWriter.Create(tw2, settings); + DatabaseXmlSerializer.WriteObject(writer2, DefaultLogoList); + } + private static IEnumerable GetKnownTypes() { yield return typeof(User); yield return typeof(List); + yield return typeof(Theme); + yield return typeof(List); + yield return typeof(Logo); + yield return typeof(List); } public List LoadDatabaseData()