From 2e9b4ccf15bc4e4d6fb1aa76e227cfec5c60cc0e Mon Sep 17 00:00:00 2001 From: "Jade.VAN_BRABANDT" Date: Wed, 3 May 2023 15:27:38 +0200 Subject: [PATCH] =?UTF-8?q?build=20:=20Chgt=20rep=20pour=20le=20C#=20/=20C?= =?UTF-8?q?r=C3=A9ation=20de=20la=20console=20pour=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/Stim/Console/Console.csproj | 10 ++++++++ Sources/Stim/Console/Program.cs | 2 ++ Sources/Stim/Stim.sln | 12 +++++++++ Sources/Stim/Stim_Model/Administrateur.cs | 27 +++++++++++++++++++++ Sources/Stim/{Stim => Stim_Model}/Game.cs | 6 ++--- Sources/Stim/{Stim => Stim_Model}/Review.cs | 2 +- Sources/Stim/Stim_Model/Stim_Model.csproj | 20 +++++++++++++++ Sources/Stim/{Stim => Stim_Model}/User.cs | 22 +++++++++-------- 8 files changed, 87 insertions(+), 14 deletions(-) create mode 100644 Sources/Stim/Console/Console.csproj create mode 100644 Sources/Stim/Console/Program.cs create mode 100644 Sources/Stim/Stim_Model/Administrateur.cs rename Sources/Stim/{Stim => Stim_Model}/Game.cs (88%) rename Sources/Stim/{Stim => Stim_Model}/Review.cs (92%) create mode 100644 Sources/Stim/Stim_Model/Stim_Model.csproj rename Sources/Stim/{Stim => Stim_Model}/User.cs (69%) diff --git a/Sources/Stim/Console/Console.csproj b/Sources/Stim/Console/Console.csproj new file mode 100644 index 0000000..40c60dd --- /dev/null +++ b/Sources/Stim/Console/Console.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/Sources/Stim/Console/Program.cs b/Sources/Stim/Console/Program.cs new file mode 100644 index 0000000..83fa4f4 --- /dev/null +++ b/Sources/Stim/Console/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/Sources/Stim/Stim.sln b/Sources/Stim/Stim.sln index f15be14..bf98d4b 100644 --- a/Sources/Stim/Stim.sln +++ b/Sources/Stim/Stim.sln @@ -5,6 +5,10 @@ VisualStudioVersion = 17.0.31611.283 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stim", "Stim\Stim.csproj", "{88365436-AFDF-4183-B010-C13784779E6B}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stim_Model", "Stim_Model\Stim_Model.csproj", "{F9E5DE48-8AF0-4F85-8A78-7639066FD061}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Console", "Console\Console.csproj", "{D1C5D8F9-A7E8-4D52-9A7E-15373CAD5C08}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -17,6 +21,14 @@ Global {88365436-AFDF-4183-B010-C13784779E6B}.Release|Any CPU.ActiveCfg = Release|Any CPU {88365436-AFDF-4183-B010-C13784779E6B}.Release|Any CPU.Build.0 = Release|Any CPU {88365436-AFDF-4183-B010-C13784779E6B}.Release|Any CPU.Deploy.0 = Release|Any CPU + {F9E5DE48-8AF0-4F85-8A78-7639066FD061}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F9E5DE48-8AF0-4F85-8A78-7639066FD061}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F9E5DE48-8AF0-4F85-8A78-7639066FD061}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F9E5DE48-8AF0-4F85-8A78-7639066FD061}.Release|Any CPU.Build.0 = Release|Any CPU + {D1C5D8F9-A7E8-4D52-9A7E-15373CAD5C08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D1C5D8F9-A7E8-4D52-9A7E-15373CAD5C08}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D1C5D8F9-A7E8-4D52-9A7E-15373CAD5C08}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D1C5D8F9-A7E8-4D52-9A7E-15373CAD5C08}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Sources/Stim/Stim_Model/Administrateur.cs b/Sources/Stim/Stim_Model/Administrateur.cs new file mode 100644 index 0000000..68e2947 --- /dev/null +++ b/Sources/Stim/Stim_Model/Administrateur.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Stim_Model +{ + internal class Administrateur : User + { + public int Permission + { + get { return permission; } + private set + { + permission = value; + } + } + private int permission; + + public Administrateur(string username, string biographie, string email, string password, int perm) + : base(username, biographie, email, password) + { + Permission = perm; + } + } +} diff --git a/Sources/Stim/Stim/Game.cs b/Sources/Stim/Stim_Model/Game.cs similarity index 88% rename from Sources/Stim/Stim/Game.cs rename to Sources/Stim/Stim_Model/Game.cs index d25ebe6..e68a4bf 100644 --- a/Sources/Stim/Stim/Game.cs +++ b/Sources/Stim/Stim_Model/Game.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace Stim +namespace Stim_Model { internal class Game { @@ -35,7 +35,7 @@ namespace Stim get { return year; } private set { - if (value < 1950 || value > 2023) return ; + if (value < 1957 || value >= 2023) return; year = value; } } @@ -62,7 +62,7 @@ namespace Stim { sum += review.Rate; } - return sum/Reviews.Count; + return sum / Reviews.Count; } public void AddReview(Review review) diff --git a/Sources/Stim/Stim/Review.cs b/Sources/Stim/Stim_Model/Review.cs similarity index 92% rename from Sources/Stim/Stim/Review.cs rename to Sources/Stim/Stim_Model/Review.cs index dc15cad..70bafac 100644 --- a/Sources/Stim/Stim/Review.cs +++ b/Sources/Stim/Stim_Model/Review.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace Stim +namespace Stim_Model { internal class Review { diff --git a/Sources/Stim/Stim_Model/Stim_Model.csproj b/Sources/Stim/Stim_Model/Stim_Model.csproj new file mode 100644 index 0000000..3fb2ceb --- /dev/null +++ b/Sources/Stim/Stim_Model/Stim_Model.csproj @@ -0,0 +1,20 @@ + + + + net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst + $(TargetFrameworks);net6.0-windows10.0.19041.0 + + + true + true + enable + + 14.2 + 14.0 + 21.0 + 10.0.17763.0 + 10.0.17763.0 + 6.5 + + + diff --git a/Sources/Stim/Stim/User.cs b/Sources/Stim/Stim_Model/User.cs similarity index 69% rename from Sources/Stim/Stim/User.cs rename to Sources/Stim/Stim_Model/User.cs index 0a0802c..34f96c3 100644 --- a/Sources/Stim/Stim/User.cs +++ b/Sources/Stim/Stim_Model/User.cs @@ -2,19 +2,19 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading.Tasks; using System.Text.RegularExpressions; +using System.Threading.Tasks; -namespace Stim +namespace Stim_Model { internal class User { - static int nbUser=0; + static int nbUser = 0; private int id; public string Username { - get { return Username; } + get { return username; } private set { username = value; @@ -29,24 +29,26 @@ namespace Stim get { return email; } private set { - //check email - email = value; + Regex rg_email = new Regex("^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$"); + if (rg_email.IsMatch(email)) + email = value; + return; } } private string email; public string Password { - get { return password; } + get { return password; } private set { - Regex rg = new Regex("^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$"); + Regex rg = new Regex("^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,32}$"); if (!rg.IsMatch(password)) return; password = value; } } private string password; - public List Games { get; set; } + public List Followed_Games { get; set; } public User(string username, string biographie, string email, string password) { @@ -57,7 +59,7 @@ namespace Stim Biographie = biographie; Email = email; Password = password; - Games = new List(); + Followed_Games = new List(); } } }