diff --git a/.nuget/NuGet.Config b/.nuget/NuGet.Config new file mode 100644 index 0000000..67f8ea0 --- /dev/null +++ b/.nuget/NuGet.Config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.nuget/NuGet.exe b/.nuget/NuGet.exe new file mode 100644 index 0000000..9f8781d Binary files /dev/null and b/.nuget/NuGet.exe differ diff --git a/.nuget/NuGet.targets b/.nuget/NuGet.targets new file mode 100644 index 0000000..3f8c37b --- /dev/null +++ b/.nuget/NuGet.targets @@ -0,0 +1,144 @@ + + + + $(MSBuildProjectDirectory)\..\ + + + false + + + false + + + true + + + false + + + + + + + + + + + $([System.IO.Path]::Combine($(SolutionDir), ".nuget")) + + + + + $(SolutionDir).nuget + + + + $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config + $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config + + + + $(MSBuildProjectDirectory)\packages.config + $(PackagesProjectConfig) + + + + + $(NuGetToolsPath)\NuGet.exe + @(PackageSource) + + "$(NuGetExePath)" + mono --runtime=v4.0.30319 "$(NuGetExePath)" + + $(TargetDir.Trim('\\')) + + -RequireConsent + -NonInteractive + + "$(SolutionDir) " + "$(SolutionDir)" + + + $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir) + $(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols + + + + RestorePackages; + $(BuildDependsOn); + + + + + $(BuildDependsOn); + BuildPackage; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Refactoring.sln b/Refactoring.sln index e744380..9acc4a0 100644 --- a/Refactoring.sln +++ b/Refactoring.sln @@ -1,12 +1,17 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.40629.0 -MinimumVisualStudioVersion = 10.0.40219.1 +# Visual Studio 2012 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Refactoring", "Refactoring\Refactoring.csproj", "{2D3F5D0E-4A6B-44C0-8F63-8E95243AC028}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestProject", "UnitTestProject\UnitTestProject.csproj", "{1FAF99A1-CCBF-435D-B599-4DAE1DAD5105}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{305082F7-07C1-49F5-A9C5-B3679B23EF73}" + ProjectSection(SolutionItems) = preProject + .nuget\NuGet.Config = .nuget\NuGet.Config + .nuget\NuGet.exe = .nuget\NuGet.exe + .nuget\NuGet.targets = .nuget\NuGet.targets + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/Refactoring/Login.cs b/Refactoring/Login.cs new file mode 100644 index 0000000..83f25ca --- /dev/null +++ b/Refactoring/Login.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Refactoring +{ + class Login + { + private List user; + private User currentUser; + + public Login(List user) + { + this.user = user; + this.currentUser = null; + } + + public bool validateUsername(string usernameInput) { + bool validUser = false; + foreach(User user in this.user) { + if(user.Name == usernameInput) { + validUser = true; + this.currentUser = user; + } + } + return validUser; + } + + public bool validatePassword(string passwordInput) + { + if (this.currentUser != null) + { + return this.currentUser.Pwd == passwordInput; + } + return false; + } + + public User getValidUser() + { + return this.currentUser; + } + } +} diff --git a/Refactoring/Program.cs b/Refactoring/Program.cs index f0509aa..f056470 100644 --- a/Refactoring/Program.cs +++ b/Refactoring/Program.cs @@ -14,7 +14,7 @@ public static void Main(string[] args) // Load users from data file List users = JsonConvert.DeserializeObject>(File.ReadAllText(@"Data/Users.json")); - // Load products from data file + // Load products from data file List products = JsonConvert.DeserializeObject>(File.ReadAllText(@"Data/Products.json")); Tusc.Start(users, products); diff --git a/Refactoring/Refactoring.csproj b/Refactoring/Refactoring.csproj index 6696ba9..33ebefa 100644 --- a/Refactoring/Refactoring.csproj +++ b/Refactoring/Refactoring.csproj @@ -11,6 +11,8 @@ Refactoring v4.5 512 + ..\ + true AnyCPU @@ -45,6 +47,7 @@ + @@ -62,6 +65,7 @@ +