mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
WIP Clean Architecture
Windows 8.1 App Uses keepasslib v2.44 (temporarily)
This commit is contained in:
28
ModernKeePass.Domain/AOP/NotifyPropertyChangedBase.cs
Normal file
28
ModernKeePass.Domain/AOP/NotifyPropertyChangedBase.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
9
ModernKeePass.Domain/Dtos/Credentials.cs
Normal file
9
ModernKeePass.Domain/Dtos/Credentials.cs
Normal 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
|
||||
}
|
||||
}
|
8
ModernKeePass.Domain/Dtos/FileInfo.cs
Normal file
8
ModernKeePass.Domain/Dtos/FileInfo.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace ModernKeePass.Domain.Dtos
|
||||
{
|
||||
public class FileInfo
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Path { get; set; }
|
||||
}
|
||||
}
|
16
ModernKeePass.Domain/Dtos/PasswordGenerationOptions.cs
Normal file
16
ModernKeePass.Domain/Dtos/PasswordGenerationOptions.cs
Normal 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; }
|
||||
}
|
||||
}
|
14
ModernKeePass.Domain/Entities/BaseEntity.cs
Normal file
14
ModernKeePass.Domain/Entities/BaseEntity.cs
Normal 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; }
|
||||
}
|
||||
}
|
9
ModernKeePass.Domain/Entities/DatabaseEntity.cs
Normal file
9
ModernKeePass.Domain/Entities/DatabaseEntity.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace ModernKeePass.Domain.Entities
|
||||
{
|
||||
public class DatabaseEntity
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public GroupEntity RootGroupEntity { get; set; }
|
||||
}
|
||||
}
|
19
ModernKeePass.Domain/Entities/EntryEntity.cs
Normal file
19
ModernKeePass.Domain/Entities/EntryEntity.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
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 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; }
|
||||
}
|
||||
}
|
12
ModernKeePass.Domain/Entities/GroupEntity.cs
Normal file
12
ModernKeePass.Domain/Entities/GroupEntity.cs
Normal 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; }
|
||||
}
|
||||
}
|
10
ModernKeePass.Domain/Enums/CredentialStatusTypes.cs
Normal file
10
ModernKeePass.Domain/Enums/CredentialStatusTypes.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace ModernKeePass.Domain.Enums
|
||||
{
|
||||
public enum CredentialStatusTypes
|
||||
{
|
||||
Normal = 0,
|
||||
Error = 1,
|
||||
Warning = 3,
|
||||
Success = 5
|
||||
}
|
||||
}
|
54
ModernKeePass.Domain/Enums/Icon.cs
Normal file
54
ModernKeePass.Domain/Enums/Icon.cs
Normal 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
|
||||
}
|
||||
}
|
7
ModernKeePass.Domain/Enums/ImportFormat.cs
Normal file
7
ModernKeePass.Domain/Enums/ImportFormat.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace ModernKeePass.Domain.Enums
|
||||
{
|
||||
public enum ImportFormat
|
||||
{
|
||||
CSV
|
||||
}
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace ModernKeePass.Domain.Exceptions
|
||||
{
|
||||
public class DatabaseClosedException: Exception
|
||||
{ }
|
||||
}
|
7
ModernKeePass.Domain/Exceptions/DatabaseOpenException.cs
Normal file
7
ModernKeePass.Domain/Exceptions/DatabaseOpenException.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace ModernKeePass.Domain.Exceptions
|
||||
{
|
||||
public class DatabaseOpenException: Exception
|
||||
{ }
|
||||
}
|
11
ModernKeePass.Domain/Exceptions/NavigationException.cs
Normal file
11
ModernKeePass.Domain/Exceptions/NavigationException.cs
Normal 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}")
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
14
ModernKeePass.Domain/Exceptions/SaveException.cs
Normal file
14
ModernKeePass.Domain/Exceptions/SaveException.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
67
ModernKeePass.Domain/ModernKeePass.Domain.csproj
Normal file
67
ModernKeePass.Domain/ModernKeePass.Domain.csproj
Normal file
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{9A0759F1-9069-4841-99E3-3BEC44E17356}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ModernKeePass.Domain</RootNamespace>
|
||||
<AssemblyName>ModernKeePass.Domain</AssemblyName>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<!-- A reference to the entire .NET Framework is automatically included -->
|
||||
<None Include="project.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AOP\NotifyPropertyChangedBase.cs" />
|
||||
<Compile Include="Dtos\Credentials.cs" />
|
||||
<Compile Include="Dtos\FileInfo.cs" />
|
||||
<Compile Include="Dtos\PasswordGenerationOptions.cs" />
|
||||
<Compile Include="Entities\BaseEntity.cs" />
|
||||
<Compile Include="Entities\DatabaseEntity.cs" />
|
||||
<Compile Include="Entities\EntryEntity.cs" />
|
||||
<Compile Include="Entities\GroupEntity.cs" />
|
||||
<Compile Include="Enums\CredentialStatusTypes.cs" />
|
||||
<Compile Include="Enums\Icon.cs" />
|
||||
<Compile Include="Enums\ImportFormat.cs" />
|
||||
<Compile Include="Exceptions\DatabaseClosedException.cs" />
|
||||
<Compile Include="Exceptions\DatabaseOpenException.cs" />
|
||||
<Compile Include="Exceptions\NavigationException.cs" />
|
||||
<Compile Include="Exceptions\SaveException.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
30
ModernKeePass.Domain/Properties/AssemblyInfo.cs
Normal file
30
ModernKeePass.Domain/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Resources;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ModernKeePass.Domain")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ModernKeePass.Domain")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: NeutralResourcesLanguage("en")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
11
ModernKeePass.Domain/project.json
Normal file
11
ModernKeePass.Domain/project.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"supports": {},
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Portable.Compatibility": "1.0.1",
|
||||
"NETStandard.Library": "1.6.1",
|
||||
"Splat": "3.0.0"
|
||||
},
|
||||
"frameworks": {
|
||||
"netstandard1.2": {}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user