WIP Clean Architecture

Windows 8.1 App Uses keepasslib v2.44 (temporarily)
This commit is contained in:
Geoffroy BONNEVILLE
2020-03-24 13:01:14 +01:00
parent 34cd4ca3d8
commit 7e44d47065
290 changed files with 4084 additions and 36416 deletions

View File

@@ -0,0 +1,28 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace ModernKeePass.Domain.AOP
{
public class NotifyPropertyChangedBase : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
protected bool SetProperty<T>(ref T property, T value, [CallerMemberName] string propertyName = "")
{
if (EqualityComparer<T>.Default.Equals(property, value))
{
return false;
}
property = value;
OnPropertyChanged(propertyName);
return true;
}
}
}

View File

@@ -0,0 +1,9 @@
namespace ModernKeePass.Domain.Dtos
{
public class Credentials
{
public string Password { get; set; }
public string KeyFilePath { get; set; }
// TODO: add Windows Hello
}
}

View File

@@ -0,0 +1,8 @@
namespace ModernKeePass.Domain.Dtos
{
public class FileInfo
{
public string Name { get; set; }
public string Path { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
namespace ModernKeePass.Domain.Dtos
{
public class PasswordGenerationOptions
{
public int PasswordLength { get; set; }
public bool UpperCasePatternSelected { get; set; }
public bool LowerCasePatternSelected { get; set; }
public bool DigitsPatternSelected { get; set; }
public bool SpecialPatternSelected { get; set; }
public bool MinusPatternSelected { get; set; }
public bool UnderscorePatternSelected { get; set; }
public bool SpacePatternSelected { get; set; }
public bool BracketsPatternSelected { get; set; }
public string CustomChars { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Drawing;
namespace ModernKeePass.Domain.Entities
{
public class BaseEntity
{
public string Id { get; set; }
public string Name { get; set; }
public Color ForegroundColor { get; set; }
public Color BackgroundColor { get; set; }
public DateTimeOffset LastModificationDate { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace ModernKeePass.Domain.Entities
{
public class DatabaseEntity
{
public string Name { get; set; }
public GroupEntity RootGroupEntity { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using ModernKeePass.Domain.Enums;
namespace ModernKeePass.Domain.Entities
{
public class EntryEntity: BaseEntity
{
public string UserName { get; set; }
public string Password { get; set; }
public Uri Url { get; set; }
public string Notes { get; set; }
public DateTimeOffset ExpirationDate { get; set; }
public Color ForegroundColor { get; set; }
public Color BackgroundColor { get; set; }
public Dictionary<string, string> AdditionalFields { get; set; } = new Dictionary<string, string>();
public IEnumerable<EntryEntity> History { get; set; }
public Icon Icon { get; set; }
public bool HasExpirationDate { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using System.Collections.Generic;
using ModernKeePass.Domain.Enums;
namespace ModernKeePass.Domain.Entities
{
public class GroupEntity : BaseEntity
{
public List<GroupEntity> SubGroups { get; set; } = new List<GroupEntity>();
public List<EntryEntity> Entries { get; set; } = new List<EntryEntity>();
public Icon Icon { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
namespace ModernKeePass.Domain.Enums
{
public enum CredentialStatusTypes
{
Normal = 0,
Error = 1,
Warning = 3,
Success = 5
}
}

View File

@@ -0,0 +1,54 @@
namespace ModernKeePass.Domain.Enums
{
public enum Icon
{
Delete,
Edit,
Save,
Cancel,
Accept,
Home,
Camera,
Setting,
Mail,
Find,
Help,
Clock,
Crop,
World,
Flag,
PreviewLink,
Document,
ProtectedDocument,
ContactInfo,
ViewAll,
Rotate,
List,
Shop,
BrowsePhotos,
Caption,
Repair,
Page,
Paste,
Important,
SlideShow,
MapDrive,
ContactPresence,
Contact,
Folder,
View,
Permissions,
Map,
CellPhone,
OutlineStar,
Calculator,
Library,
SyncFolder,
GoToStart,
ZeroBars,
FourBars,
Scan,
ReportHacked,
Stop
}
}

View File

@@ -0,0 +1,7 @@
namespace ModernKeePass.Domain.Enums
{
public enum ImportFormat
{
CSV
}
}

View File

@@ -0,0 +1,7 @@
using System;
namespace ModernKeePass.Domain.Exceptions
{
public class DatabaseClosedException: Exception
{ }
}

View File

@@ -0,0 +1,7 @@
using System;
namespace ModernKeePass.Domain.Exceptions
{
public class DatabaseOpenException: Exception
{ }
}

View File

@@ -0,0 +1,11 @@
using System;
namespace ModernKeePass.Domain.Exceptions
{
public class NavigationException: Exception
{
public NavigationException(Type pageType) : base($"Failed to load Page {pageType.FullName}")
{
}
}
}

View File

@@ -0,0 +1,14 @@
using System;
namespace ModernKeePass.Domain.Exceptions
{
public class SaveException : Exception
{
public new Exception InnerException { get; }
public SaveException(Exception exception)
{
InnerException = exception;
}
}
}

View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard1.2</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Splat" Version="3.0.0" />
</ItemGroup>
</Project>