Added initial Logging library

This commit is contained in:
colincreasman 2021-12-13 20:18:42 -08:00
parent 4f2f4c8fce
commit c021d5f04f
12 changed files with 188 additions and 128 deletions

View File

@ -4,6 +4,7 @@
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Platforms>AnyCPU;x86</Platforms>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -10,7 +10,7 @@ namespace TeamHobby.HobbyProjectGenerator.Logging
{ {
bool Log(LogEntry log); bool Log(LogEntry log);
IList<string> GetAllLogs(); // IList<string> GetAllLogs();
} }
} }

View File

@ -10,6 +10,7 @@ namespace TeamHobby.HobbyProjectGenerator.Logging.Contracts
{ {
ILogger CreateLogger() ILogger CreateLogger()
{ {
return new DBLogger();
} }
} }
} }

View File

@ -1,21 +1,16 @@
using System; // using System;
using System.Collections.Generic; // using System.Collections.Generic;
using System.Linq; // using System.Linq;
using System.Text; // using System.Text;
using System.Threading.Tasks; // using System.Threading.Tasks;
namespace TeamHobby.HobbyProjectGenerator.Logging // namespace TeamHobby.HobbyProjectGenerator.Logging
{ // {
public class ConsoleLogger : ILogger // public class ConsoleLogger : ILogger
{ // {
public IList<string> GetAllLogs() // public bool Log(LogEntry log)
{ // {
throw new NotImplementedException(); // return true;
} // }
// }
public bool Log(string description) // }
{
throw new NotImplementedException();
}
}
}

View File

@ -1,18 +1,23 @@
using System; // using System;
namespace TeamHobby.HobbyProjectGenerator.Logging // namespace TeamHobby.HobbyProjectGenerator.Logging
{ // {
public class FileLogger : ILogger // public class FileLogger : Ilogger
{ // {
public IList<string> GetAllLogs() // public FileLogger()
{ // {
throw new NotImplementedException(); // }
}
public bool Log(string description) // public IList<string> GetAllLogs()
{ // {
throw new NotImplementedException(); // throw new NotImplementedException();
} // }
}
} // public bool Log(LogEntry log)
// {
// throw new NotImplementedException();
// }
// }
// }

View File

@ -1,38 +1,58 @@
using System; // using System;
using System.Collections.Generic; // using System.Collections.Generic;
namespace TeamHobby.HobbyProjectGenerator.Logging // namespace TeamHobby.HobbyProjectGenerator.Logging
{ // {
// implementation of ILogger that stores logs as they initialize // // implementation of ILogger that stores logs as they initialize
public class InMemoryLogger : ILogger // public class InMemoryLogger : ILogger
{ // {
// make readonly to prevent it from being changed somewhere other than in the constructor // // make readonly to prevent it from being changed somewhere other than in the constructor
private readonly IList<string> _logStore; // private readonly IList<string> _logStore;
public InMemoryLogger() // public InMemoryLogger()
{ // {
// list of current logs // // list of current logs
_logStore = new List<string>(); // _logStore = new List<string>();
} // }
// public InMemoryLogger(IList<string> logStore)
// {
// _logStore = logStore;
// }
// public bool Log(LogEntry entry)
// {
// if (entry is null)
// {
// throw new ArgumentNullException(nameof(entry));
// }
public bool Log(string description) // try
{ // {
try // // string interpolation to add UTC timestamp to log description
{ // //_logStore.Add($"{DateTime.UtcNow}-> {description}");
// string interpolation to add UTC timestamp to log description // return true;
_logStore.Add($"{DateTime.UtcNow}-> {description}"); // }
return true; // catch
} // {
catch // return false;
{ // }
return false; // }
} // public IList<string> GetAllLogs()
} // {
public IList<string> GetAllLogs() // return _logStore;
{ // }
return _logStore;
}
}
}
// public override bool Equals(object? obj)
// {
// return obj is InMemoryLogger logger &&
// EqualityComparer<IList<string>>.Default.Equals(_logStore, logger._logStore);
// }
// public override int GetHashCode()
// {
// return HashCode.Combine(_logStore);
// }
// }
// }

View File

@ -26,5 +26,29 @@ namespace TeamHobby.HobbyProjectGenerator.Logging
public string description { get; init; } public string description { get; init; }
public DateTime timestamp { get; init; } public DateTime timestamp { get; init; }
// Constructor requireing only the description as an arg
// Assigns default values for LogLevel (Info), LogCategory (Server), user ("System"), and the UTC time at initialization for timestamp
public LogEntry(string description)
{
this.level = LogLevel.Info;
this.category = LogCategory.Server;
this.user = "System";
this.description = description;
this.timestamp = DateTime.UtcNow;
}
// Constructor with args for all fields except timestamp
// timestamp is always set to the UTC time at the time of initialization
public LogEntry(LogLevel level, string user, LogCategory category, string description)
{
this.level = level;
this.category = category;
this.user = user;
this.description = description;
this.timestamp = DateTime.UtcNow;
}
} }
} }

View File

@ -9,23 +9,23 @@ using TeamHobby.HobbyProjectGenerator.Logging.Implementations;
namespace TeamHobby.HobbyProjectGenerator.Logging namespace TeamHobby.HobbyProjectGenerator.Logging
{ {
internal class LoggingController internal class LoggingManager
{ {
private readonly IDataSource<string> _conn; private readonly IDataSource<string> _conn;
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly ILoggerFactory _factory; private readonly ILoggerFactory _factory;
// private readonly LogEntry _logEntry; private readonly LogEntry _logEntry;
// Both Constructors take an IDataSource arg to make logging extensible to future data sources // Both Constructors take an IDataSource arg to make logging extensible to future data sources
// first constructor has no additional args - defaults to using the DBFactiry implementation // first constructor has no additional args - defaults to using the DBFactiry implementation
public LoggingController(IDataSource<string> dataSource) public LoggingManager(IDataSource<string> dataSource)
{ {
_conn = dataSource; _conn = dataSource;
_factory = new DBLoggerFactory(); _factory = new DBLoggerFactory();
_logger = _factory.CreateLogger(); _logger = _factory.CreateLogger();
} }
// second constructor takes an additional ILoggerFactory arg - allows for extensible logger types // second constructor takes an additional ILoggerFactory arg - allows for extensible logger types
public LoggingController(IDataSource<string> dataSource, ILoggerFactory factory) public LoggingManager(IDataSource<string> dataSource, ILoggerFactory factory)
{ {
_conn = dataSource; _conn = dataSource;
_factory = factory; _factory = factory;
@ -35,7 +35,7 @@ namespace TeamHobby.HobbyProjectGenerator.Logging
public void Process() public void Process()
{ {
_logger.Log(); _logger.Log(_logEntry);
} }

View File

@ -4,6 +4,7 @@
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Platforms>AnyCPU;x86</Platforms>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -26,87 +26,87 @@ EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86 Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C75B6909-FD9E-4382-94B6-7CA2CE371C9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C75B6909-FD9E-4382-94B6-7CA2CE371C9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C75B6909-FD9E-4382-94B6-7CA2CE371C9A}.Debug|Any CPU.Build.0 = Debug|Any CPU {C75B6909-FD9E-4382-94B6-7CA2CE371C9A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C75B6909-FD9E-4382-94B6-7CA2CE371C9A}.Debug|x86.ActiveCfg = Debug|Any CPU {C75B6909-FD9E-4382-94B6-7CA2CE371C9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C75B6909-FD9E-4382-94B6-7CA2CE371C9A}.Debug|x86.Build.0 = Debug|Any CPU {C75B6909-FD9E-4382-94B6-7CA2CE371C9A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C75B6909-FD9E-4382-94B6-7CA2CE371C9A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C75B6909-FD9E-4382-94B6-7CA2CE371C9A}.Release|Any CPU.Build.0 = Release|Any CPU
{C75B6909-FD9E-4382-94B6-7CA2CE371C9A}.Release|Any CPU.ActiveCfg = Release|Any CPU {C75B6909-FD9E-4382-94B6-7CA2CE371C9A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C75B6909-FD9E-4382-94B6-7CA2CE371C9A}.Release|Any CPU.Build.0 = Release|Any CPU {C75B6909-FD9E-4382-94B6-7CA2CE371C9A}.Release|Any CPU.Build.0 = Release|Any CPU
{C75B6909-FD9E-4382-94B6-7CA2CE371C9A}.Release|x86.ActiveCfg = Release|Any CPU
{C75B6909-FD9E-4382-94B6-7CA2CE371C9A}.Release|x86.Build.0 = Release|Any CPU
{5C5A44B4-EC3C-44F2-8F39-F917F8ED932F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5C5A44B4-EC3C-44F2-8F39-F917F8ED932F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5C5A44B4-EC3C-44F2-8F39-F917F8ED932F}.Debug|x86.ActiveCfg = Debug|Any CPU {5C5A44B4-EC3C-44F2-8F39-F917F8ED932F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5C5A44B4-EC3C-44F2-8F39-F917F8ED932F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5C5A44B4-EC3C-44F2-8F39-F917F8ED932F}.Release|Any CPU.Build.0 = Release|Any CPU
{5C5A44B4-EC3C-44F2-8F39-F917F8ED932F}.Release|Any CPU.ActiveCfg = Release|Any CPU {5C5A44B4-EC3C-44F2-8F39-F917F8ED932F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5C5A44B4-EC3C-44F2-8F39-F917F8ED932F}.Release|Any CPU.Build.0 = Release|Any CPU {5C5A44B4-EC3C-44F2-8F39-F917F8ED932F}.Release|Any CPU.Build.0 = Release|Any CPU
{5C5A44B4-EC3C-44F2-8F39-F917F8ED932F}.Release|x86.ActiveCfg = Release|Any CPU
{5C5A44B4-EC3C-44F2-8F39-F917F8ED932F}.Release|x86.Build.0 = Release|Any CPU
{75DED6C2-D404-4E71-A58B-0F616DB5C062}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {75DED6C2-D404-4E71-A58B-0F616DB5C062}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{75DED6C2-D404-4E71-A58B-0F616DB5C062}.Debug|Any CPU.Build.0 = Debug|Any CPU {75DED6C2-D404-4E71-A58B-0F616DB5C062}.Debug|Any CPU.Build.0 = Debug|Any CPU
{75DED6C2-D404-4E71-A58B-0F616DB5C062}.Debug|x86.ActiveCfg = Debug|Any CPU {75DED6C2-D404-4E71-A58B-0F616DB5C062}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{75DED6C2-D404-4E71-A58B-0F616DB5C062}.Debug|x86.Build.0 = Debug|Any CPU {75DED6C2-D404-4E71-A58B-0F616DB5C062}.Debug|Any CPU.Build.0 = Debug|Any CPU
{75DED6C2-D404-4E71-A58B-0F616DB5C062}.Release|Any CPU.ActiveCfg = Release|Any CPU
{75DED6C2-D404-4E71-A58B-0F616DB5C062}.Release|Any CPU.Build.0 = Release|Any CPU
{75DED6C2-D404-4E71-A58B-0F616DB5C062}.Release|Any CPU.ActiveCfg = Release|Any CPU {75DED6C2-D404-4E71-A58B-0F616DB5C062}.Release|Any CPU.ActiveCfg = Release|Any CPU
{75DED6C2-D404-4E71-A58B-0F616DB5C062}.Release|Any CPU.Build.0 = Release|Any CPU {75DED6C2-D404-4E71-A58B-0F616DB5C062}.Release|Any CPU.Build.0 = Release|Any CPU
{75DED6C2-D404-4E71-A58B-0F616DB5C062}.Release|x86.ActiveCfg = Release|Any CPU
{75DED6C2-D404-4E71-A58B-0F616DB5C062}.Release|x86.Build.0 = Release|Any CPU
{30C7EBF3-3957-46E5-86C1-C13356841ECA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {30C7EBF3-3957-46E5-86C1-C13356841ECA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{30C7EBF3-3957-46E5-86C1-C13356841ECA}.Debug|Any CPU.Build.0 = Debug|Any CPU {30C7EBF3-3957-46E5-86C1-C13356841ECA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{30C7EBF3-3957-46E5-86C1-C13356841ECA}.Debug|x86.ActiveCfg = Debug|Any CPU {30C7EBF3-3957-46E5-86C1-C13356841ECA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{30C7EBF3-3957-46E5-86C1-C13356841ECA}.Debug|x86.Build.0 = Debug|Any CPU {30C7EBF3-3957-46E5-86C1-C13356841ECA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{30C7EBF3-3957-46E5-86C1-C13356841ECA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{30C7EBF3-3957-46E5-86C1-C13356841ECA}.Release|Any CPU.Build.0 = Release|Any CPU
{30C7EBF3-3957-46E5-86C1-C13356841ECA}.Release|Any CPU.ActiveCfg = Release|Any CPU {30C7EBF3-3957-46E5-86C1-C13356841ECA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{30C7EBF3-3957-46E5-86C1-C13356841ECA}.Release|Any CPU.Build.0 = Release|Any CPU {30C7EBF3-3957-46E5-86C1-C13356841ECA}.Release|Any CPU.Build.0 = Release|Any CPU
{30C7EBF3-3957-46E5-86C1-C13356841ECA}.Release|x86.ActiveCfg = Release|Any CPU
{30C7EBF3-3957-46E5-86C1-C13356841ECA}.Release|x86.Build.0 = Release|Any CPU
{B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Debug|Any CPU.Build.0 = Debug|Any CPU {B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Debug|x86.ActiveCfg = Debug|Any CPU {B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Debug|x86.Build.0 = Debug|Any CPU {B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Release|Any CPU.Build.0 = Release|Any CPU
{B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Release|Any CPU.ActiveCfg = Release|Any CPU {B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Release|Any CPU.Build.0 = Release|Any CPU {B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Release|Any CPU.Build.0 = Release|Any CPU
{B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Release|x86.ActiveCfg = Release|Any CPU
{B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Release|x86.Build.0 = Release|Any CPU
{ED126EFB-B337-42F9-BE4B-65A5AE90503B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {ED126EFB-B337-42F9-BE4B-65A5AE90503B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ED126EFB-B337-42F9-BE4B-65A5AE90503B}.Debug|x86.ActiveCfg = Debug|Any CPU {ED126EFB-B337-42F9-BE4B-65A5AE90503B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ED126EFB-B337-42F9-BE4B-65A5AE90503B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ED126EFB-B337-42F9-BE4B-65A5AE90503B}.Release|Any CPU.Build.0 = Release|Any CPU
{ED126EFB-B337-42F9-BE4B-65A5AE90503B}.Release|Any CPU.ActiveCfg = Release|Any CPU {ED126EFB-B337-42F9-BE4B-65A5AE90503B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ED126EFB-B337-42F9-BE4B-65A5AE90503B}.Release|Any CPU.Build.0 = Release|Any CPU {ED126EFB-B337-42F9-BE4B-65A5AE90503B}.Release|Any CPU.Build.0 = Release|Any CPU
{ED126EFB-B337-42F9-BE4B-65A5AE90503B}.Release|x86.ActiveCfg = Release|Any CPU
{ED126EFB-B337-42F9-BE4B-65A5AE90503B}.Release|x86.Build.0 = Release|Any CPU
{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Debug|Any CPU.Build.0 = Debug|Any CPU {AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Debug|x86.ActiveCfg = Debug|x86 {AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Debug|x86.Build.0 = Debug|x86 {AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Release|Any CPU.Build.0 = Release|Any CPU
{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Release|Any CPU.ActiveCfg = Release|Any CPU {AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Release|Any CPU.Build.0 = Release|Any CPU {AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Release|Any CPU.Build.0 = Release|Any CPU
{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Release|x86.ActiveCfg = Release|Any CPU
{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Release|x86.Build.0 = Release|Any CPU
{C0494115-838E-43A3-8896-133E5D1E874A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C0494115-838E-43A3-8896-133E5D1E874A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C0494115-838E-43A3-8896-133E5D1E874A}.Debug|Any CPU.Build.0 = Debug|Any CPU {C0494115-838E-43A3-8896-133E5D1E874A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C0494115-838E-43A3-8896-133E5D1E874A}.Debug|x86.ActiveCfg = Debug|Any CPU {C0494115-838E-43A3-8896-133E5D1E874A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C0494115-838E-43A3-8896-133E5D1E874A}.Debug|x86.Build.0 = Debug|Any CPU {C0494115-838E-43A3-8896-133E5D1E874A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C0494115-838E-43A3-8896-133E5D1E874A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C0494115-838E-43A3-8896-133E5D1E874A}.Release|Any CPU.Build.0 = Release|Any CPU
{C0494115-838E-43A3-8896-133E5D1E874A}.Release|Any CPU.ActiveCfg = Release|Any CPU {C0494115-838E-43A3-8896-133E5D1E874A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C0494115-838E-43A3-8896-133E5D1E874A}.Release|Any CPU.Build.0 = Release|Any CPU {C0494115-838E-43A3-8896-133E5D1E874A}.Release|Any CPU.Build.0 = Release|Any CPU
{C0494115-838E-43A3-8896-133E5D1E874A}.Release|x86.ActiveCfg = Release|Any CPU
{C0494115-838E-43A3-8896-133E5D1E874A}.Release|x86.Build.0 = Release|Any CPU
{2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Debug|Any CPU.Build.0 = Debug|Any CPU {2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Debug|x86.ActiveCfg = Debug|Any CPU {2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Debug|x86.Build.0 = Debug|Any CPU {2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Release|Any CPU.Build.0 = Release|Any CPU
{2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Release|Any CPU.ActiveCfg = Release|Any CPU {2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Release|Any CPU.Build.0 = Release|Any CPU {2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Release|Any CPU.Build.0 = Release|Any CPU
{2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Release|x86.ActiveCfg = Release|Any CPU
{2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Release|x86.Build.0 = Release|Any CPU
{CA8D11CF-807C-4C90-A529-0371F73518F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CA8D11CF-807C-4C90-A529-0371F73518F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CA8D11CF-807C-4C90-A529-0371F73518F6}.Debug|Any CPU.Build.0 = Debug|Any CPU {CA8D11CF-807C-4C90-A529-0371F73518F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CA8D11CF-807C-4C90-A529-0371F73518F6}.Debug|x86.ActiveCfg = Debug|x86 {CA8D11CF-807C-4C90-A529-0371F73518F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CA8D11CF-807C-4C90-A529-0371F73518F6}.Debug|x86.Build.0 = Debug|x86 {CA8D11CF-807C-4C90-A529-0371F73518F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CA8D11CF-807C-4C90-A529-0371F73518F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CA8D11CF-807C-4C90-A529-0371F73518F6}.Release|Any CPU.Build.0 = Release|Any CPU
{CA8D11CF-807C-4C90-A529-0371F73518F6}.Release|Any CPU.ActiveCfg = Release|Any CPU {CA8D11CF-807C-4C90-A529-0371F73518F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CA8D11CF-807C-4C90-A529-0371F73518F6}.Release|Any CPU.Build.0 = Release|Any CPU {CA8D11CF-807C-4C90-A529-0371F73518F6}.Release|Any CPU.Build.0 = Release|Any CPU
{CA8D11CF-807C-4C90-A529-0371F73518F6}.Release|x86.ActiveCfg = Release|Any CPU
{CA8D11CF-807C-4C90-A529-0371F73518F6}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -6,8 +6,10 @@ using TeamHobby.HobbyProjectGenerator.Logging;
using TeamHobby.HobbyProjectGenerator.UserManagement; using TeamHobby.HobbyProjectGenerator.UserManagement;
namespace TeamHobby.HobbyProjectGenerator.Main namespace TeamHobby.HobbyProjectGenerator.Main
{ {
public class GetCredentials public class GetCredentials
{ {
public string? GetUserName() public string? GetUserName()
{ {
Console.WriteLine("Please enter a username:"); Console.WriteLine("Please enter a username:");
@ -24,6 +26,7 @@ namespace TeamHobby.HobbyProjectGenerator.Main
} }
public class Controller public class Controller
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
// Logger log = new Logger(); // Logger log = new Logger();
@ -31,28 +34,34 @@ namespace TeamHobby.HobbyProjectGenerator.Main
//GetCredentials credentials = new GetCredentials(); //GetCredentials credentials = new GetCredentials();
//string? username = credentials.GetUserName(); //string? username = credentials.GetUserName();
//string? password = credentials.GetPassword(); //string? password = credentials.GetPassword();
// Console customization
// Change the look of the console
Console.Title = "HobbyProjectGenerator";
// Change console text color
Console.ForegroundColor = ConsoleColor.Green;
// Change terminal height
Console.WindowHeight = 40;
//Console.WriteLine(value: $"username is {username}\npassword is {password}"); //Console.WriteLine(value: $"username is {username}\npassword is {password}");
// Creating the Factory class // Creating the Factory class
// Creating the Factory class // Creating the Factory class
string dbType = "sql"; string dbType = "sql";
RDSFactory factory = new RDSFactory(); RDSFactory factory = new RDSFactory();
// Testing Data Access Layer // Testing Data Access Layer
string dbInfo = "DRIVER={MariaDB ODBC 3.1 Driver};" + string dbInfo = "DRIVER={MariaDB ODBC 3.1 Driver};" +
"TCPIP=1;" + "TCPIP=1;" +
"SERVER=localhost;" + "SERVER=localhost;" +
"DATABASE=hobby;" + "DATABASE=hobby;" +
"UID=root;" + "UID=root;" +
"PASSWORD=Teamhobby;" + "PASSWORD=Teamhobby;" +
"PORT=3306;"; "PORT=3306;" +
IDataSource<string> datasource = dbFactory.getDataSource(dbType, dbInfo); "OPTION=3";
// IDataSource<string> datasource = factory.getDataSource(dbType, dbInfo);
"OPTION=3";
IDataSource<string> datasource = factory.getDataSource(dbType, dbInfo);*/ IDataSource<string> datasource = factory.getDataSource(dbType, dbInfo);
// Create manager class from UserManagement // Create manager class from UserManagement
SystemAccountManager manager = new SystemAccountManager(); SystemAccountManager manager = new SystemAccountManager();
@ -190,7 +199,7 @@ namespace TeamHobby.HobbyProjectGenerator.Main
break; break;
// Create a new account // Create a new account
case 1: case 1:
user.newUser(); user.newUser();
break; break;
// Access Admin features // Access Admin features
case 2: case 2:
@ -232,4 +241,7 @@ namespace TeamHobby.HobbyProjectGenerator.Main
} }
} }
}
} }

View File

@ -5,7 +5,8 @@
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<Platforms>AnyCPU</Platforms>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>