ModernKeePass lib version 2.39.1 seemeegly functional

WIP in some pages
This commit is contained in:
BONNEVILLE Geoffroy
2018-06-04 18:38:48 +02:00
parent ad02740d8a
commit 4d86c25411
21 changed files with 201 additions and 171 deletions

View File

@@ -342,32 +342,32 @@
</Page> </Page>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL"> <Reference Include="BouncyCastle.Crypto, Version=1.8.2.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.8.1.3\lib\netstandard1.0\BouncyCastle.Crypto.dll</HintPath> <HintPath>..\packages\Portable.BouncyCastle.1.8.2\lib\netstandard1.0\BouncyCastle.Crypto.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Microsoft.AppCenter, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Microsoft.AppCenter, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AppCenter.1.5.0\lib\portable-net45+win8+wpa81+wp8\Microsoft.AppCenter.dll</HintPath> <HintPath>..\packages\Microsoft.AppCenter.1.6.1\lib\portable-net45+win8+wpa81+wp8\Microsoft.AppCenter.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Microsoft.AppCenter.Analytics, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Microsoft.AppCenter.Analytics, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AppCenter.Analytics.1.5.0\lib\portable-net45+win8+wpa81+wp8\Microsoft.AppCenter.Analytics.dll</HintPath> <HintPath>..\packages\Microsoft.AppCenter.Analytics.1.6.1\lib\portable-net45+win8+wpa81+wp8\Microsoft.AppCenter.Analytics.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Microsoft.AppCenter.Push, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Microsoft.AppCenter.Push, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AppCenter.Push.1.5.0\lib\portable-net45+win8+wpa81+wp8\Microsoft.AppCenter.Push.dll</HintPath> <HintPath>..\packages\Microsoft.AppCenter.Push.1.6.1\lib\portable-net45+win8+wpa81+wp8\Microsoft.AppCenter.Push.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Microsoft.Toolkit.Uwp.Notifications, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Microsoft.Toolkit.Uwp.Notifications, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Toolkit.Uwp.Notifications.2.0.0\lib\dotnet\Microsoft.Toolkit.Uwp.Notifications.dll</HintPath> <HintPath>..\packages\Microsoft.Toolkit.Uwp.Notifications.2.0.0\lib\dotnet\Microsoft.Toolkit.Uwp.Notifications.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="ModernKeePassLib, Version=2.37.0.2000, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Splat, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ModernKeePassLib.2.38.2\lib\netstandard1.2\ModernKeePassLib.dll</HintPath> <HintPath>..\packages\Splat.3.0.0\lib\netstandard1.1\Splat.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Splat, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="System.Drawing.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Splat.2.0.0\lib\Portable-Win81+Wpa81\Splat.dll</HintPath> <HintPath>..\packages\System.Drawing.Primitives.4.3.0\lib\netstandard1.1\System.Drawing.Primitives.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
@@ -458,6 +458,12 @@
<Content Include="Assets\Wide310x150Logo.scale-180.png" /> <Content Include="Assets\Wide310x150Logo.scale-180.png" />
<Content Include="Assets\Wide310x150Logo.scale-80.png" /> <Content Include="Assets\Wide310x150Logo.scale-80.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ModernKeePassLib\ModernKeePass.Lib.csproj">
<Project>{2e710089-9559-4967-846c-e763dd1f3acb}</Project>
<Name>ModernKeePass.Lib</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '12.0' "> <PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '12.0' ">
<VisualStudioVersion>12.0</VisualStudioVersion> <VisualStudioVersion>12.0</VisualStudioVersion>
</PropertyGroup> </PropertyGroup>
@@ -467,10 +473,8 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup> </PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" /> <Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
<Error Condition="!Exists('..\packages\NETStandard.Library.2.0.1\build\NETStandard.Library.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NETStandard.Library.2.0.1\build\NETStandard.Library.targets'))" />
</Target> </Target>
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" /> <Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
<Import Project="..\packages\NETStandard.Library.2.0.1\build\NETStandard.Library.targets" Condition="Exists('..\packages\NETStandard.Library.2.0.1\build\NETStandard.Library.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">

View File

@@ -2,7 +2,6 @@
using System.ComponentModel; using System.ComponentModel;
using System.Text; using System.Text;
using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls;
using ModernKeePass.Attributes;
using ModernKeePass.Interfaces; using ModernKeePass.Interfaces;
using ModernKeePass.Mappings; using ModernKeePass.Mappings;
using ModernKeePass.Services; using ModernKeePass.Services;
@@ -213,7 +212,6 @@ namespace ModernKeePass.ViewModels
return _pwEntry?.Strings.GetSafe(key).ReadString(); return _pwEntry?.Strings.GetSafe(key).ReadString();
} }
[DatabaseChanged]
private void SetEntryValue(string key, string newValue) private void SetEntryValue(string key, string newValue)
{ {
_pwEntry?.Strings.Set(key, new ProtectedString(true, newValue)); _pwEntry?.Strings.Set(key, new ProtectedString(true, newValue));

View File

@@ -4,7 +4,6 @@ using System.Collections.Specialized;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls;
using ModernKeePass.Attributes;
using ModernKeePass.Common; using ModernKeePass.Common;
using ModernKeePass.Interfaces; using ModernKeePass.Interfaces;
using ModernKeePass.Mappings; using ModernKeePass.Mappings;
@@ -55,7 +54,6 @@ namespace ModernKeePass.ViewModels
public string Name public string Name
{ {
get { return _pwGroup == null ? string.Empty : _pwGroup.Name; } get { return _pwGroup == null ? string.Empty : _pwGroup.Name; }
[DatabaseChanged]
set { _pwGroup.Name = value; } set { _pwGroup.Name = value; }
} }
@@ -117,7 +115,6 @@ namespace ModernKeePass.ViewModels
Groups = new ObservableCollection<GroupVm>(pwGroup.Groups.Select(g => new GroupVm(g, this, recycleBinId))); Groups = new ObservableCollection<GroupVm>(pwGroup.Groups.Select(g => new GroupVm(g, this, recycleBinId)));
} }
[DatabaseChanged]
private void Entries_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) private void Entries_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{ {
switch (e.Action) switch (e.Action)
@@ -134,7 +131,6 @@ namespace ModernKeePass.ViewModels
} }
} }
[DatabaseChanged]
public GroupVm AddNewGroup(string name = "") public GroupVm AddNewGroup(string name = "")
{ {
var pwGroup = new PwGroup(true, true, name, PwIcon.Folder); var pwGroup = new PwGroup(true, true, name, PwIcon.Folder);
@@ -165,7 +161,6 @@ namespace ModernKeePass.ViewModels
Move(PreviousGroup); Move(PreviousGroup);
} }
[DatabaseChanged]
public void Move(GroupVm destination) public void Move(GroupVm destination)
{ {
PreviousGroup = ParentGroup; PreviousGroup = ParentGroup;
@@ -193,7 +188,6 @@ namespace ModernKeePass.ViewModels
_database.Save(); _database.Save();
} }
[DatabaseChanged]
public void SortEntries() public void SortEntries()
{ {
var comparer = new PwEntryComparer(PwDefs.TitleField, true, false); var comparer = new PwEntryComparer(PwDefs.TitleField, true, false);
@@ -208,7 +202,6 @@ namespace ModernKeePass.ViewModels
} }
} }
[DatabaseChanged]
public void SortGroups() public void SortGroups()
{ {
try try

View File

@@ -373,7 +373,7 @@
</Style> </Style>
</Page.Resources> </Page.Resources>
<Page.DataContext> <Page.DataContext>
<viewModels:EntryVm/> <viewModels:EntryVm />
</Page.DataContext> </Page.DataContext>
<Page.BottomAppBar> <Page.BottomAppBar>
<CommandBar x:Name="CommandBar" VerticalAlignment="Center"> <CommandBar x:Name="CommandBar" VerticalAlignment="Center">

View File

@@ -221,60 +221,64 @@
</interactivity:Interaction.Behaviors> </interactivity:Interaction.Behaviors>
<GridView.ItemTemplate> <GridView.ItemTemplate>
<DataTemplate> <DataTemplate>
<Grid Height="110" Width="480" x:Name="EntryGrid" Background="{Binding BackgroundColor, ConverterParameter={StaticResource AppBarBackgroundThemeBrush}, Converter={StaticResource ColorToBrushConverter}}"> <Border Padding="30,30,0,0" >
<Grid.ColumnDefinitions> <Grid Height="110" Width="480" x:Name="EntryGrid">
<ColumnDefinition Width="Auto"/> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/>
<SymbolIcon Grid.Column="0" Symbol="{Binding IconSymbol}" Width="100" Height="100" RenderTransformOrigin="0.5,0.5" > </Grid.ColumnDefinitions>
<SymbolIcon.RenderTransform> <Border Grid.Column="0" Background="{Binding BackgroundColor, ConverterParameter={StaticResource AppBarBackgroundThemeBrush}, Converter={StaticResource ColorToBrushConverter}}">
<CompositeTransform ScaleX="2" TranslateX="0" TranslateY="0" ScaleY="2"/> <SymbolIcon Symbol="{Binding IconSymbol}" Width="100" Height="100" RenderTransformOrigin="0.5,0.5">
</SymbolIcon.RenderTransform> <SymbolIcon.RenderTransform>
</SymbolIcon> <CompositeTransform ScaleX="2" TranslateX="0" TranslateY="0" ScaleY="2"/>
<StackPanel Grid.Column="1" VerticalAlignment="Top" Margin="10,10,0,0" > </SymbolIcon.RenderTransform>
<TextBlock x:Name="NameTextBlock" Text="{Binding Name}" Style="{StaticResource TitleTextBlockStyle}" TextWrapping="NoWrap" Foreground="{Binding ForegroundColor, ConverterParameter={StaticResource TextBoxForegroundThemeBrush}, Converter={StaticResource ColorToBrushConverter}}"/> </SymbolIcon>
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" TextWrapping="NoWrap"/> </Border>
<TextBlock Text="{Binding UserName}" Style="{StaticResource BodyTextBlockStyle}" MaxHeight="60" /> <StackPanel Grid.Column="1" VerticalAlignment="Top" Margin="10,10,0,0" >
<TextBlock Text="{Binding Url}" Style="{StaticResource BodyTextBlockStyle}" MaxHeight="60" /> <TextBlock x:Name="NameTextBlock" Text="{Binding Name}" Style="{StaticResource TitleTextBlockStyle}" TextWrapping="NoWrap" Foreground="{Binding ForegroundColor, ConverterParameter={StaticResource TextBoxForegroundThemeBrush}, Converter={StaticResource ColorToBrushConverter}}"/>
</StackPanel> <TextBlock Style="{StaticResource CaptionTextBlockStyle}" TextWrapping="NoWrap"/>
<Button Grid.Column="2" Style="{StaticResource NoBorderButtonStyle}" VerticalAlignment="Bottom"> <TextBlock Text="{Binding UserName}" Style="{StaticResource BodyTextBlockStyle}" MaxHeight="60" />
<SymbolIcon Symbol="More" /> <TextBlock Text="{Binding Url}" Style="{StaticResource BodyTextBlockStyle}" MaxHeight="60" />
<Button.Flyout> </StackPanel>
<MenuFlyout> <Button Grid.Column="2" Style="{StaticResource NoBorderButtonStyle}" Background="{Binding BackgroundColor, ConverterParameter={StaticResource AppBarBackgroundThemeBrush}, Converter={StaticResource ColorToBrushConverter}}" VerticalAlignment="Bottom">
<MenuFlyoutItem x:Uid="EntryItemCopyLogin"> <SymbolIcon Symbol="More" />
<interactivity:Interaction.Behaviors> <Button.Flyout>
<core:EventTriggerBehavior EventName="Click"> <MenuFlyout>
<actions:ClipboardAction Text="{Binding UserName}" /> <MenuFlyoutItem x:Uid="EntryItemCopyLogin">
</core:EventTriggerBehavior> <interactivity:Interaction.Behaviors>
</interactivity:Interaction.Behaviors> <core:EventTriggerBehavior EventName="Click">
</MenuFlyoutItem> <actions:ClipboardAction Text="{Binding UserName}" />
<MenuFlyoutItem x:Uid="EntryItemCopyPassword"> </core:EventTriggerBehavior>
<interactivity:Interaction.Behaviors> </interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click"> </MenuFlyoutItem>
<actions:ClipboardAction Text="{Binding Password}" /> <MenuFlyoutItem x:Uid="EntryItemCopyPassword">
</core:EventTriggerBehavior> <interactivity:Interaction.Behaviors>
</interactivity:Interaction.Behaviors> <core:EventTriggerBehavior EventName="Click">
</MenuFlyoutItem> <actions:ClipboardAction Text="{Binding Password}" />
<MenuFlyoutItem x:Uid="EntryItemCopyUrl"> </core:EventTriggerBehavior>
<interactivity:Interaction.Behaviors> </interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click"> </MenuFlyoutItem>
<actions:NavigateToUrlAction Url="{Binding Url}" /> <MenuFlyoutItem x:Uid="EntryItemCopyUrl">
</core:EventTriggerBehavior> <interactivity:Interaction.Behaviors>
</interactivity:Interaction.Behaviors> <core:EventTriggerBehavior EventName="Click">
</MenuFlyoutItem> <actions:NavigateToUrlAction Url="{Binding Url}" />
</MenuFlyout> </core:EventTriggerBehavior>
</Button.Flyout> </interactivity:Interaction.Behaviors>
</Button> </MenuFlyoutItem>
</Grid> </MenuFlyout>
</Button.Flyout>
</Button>
</Grid>
</Border>
</DataTemplate> </DataTemplate>
</GridView.ItemTemplate> </GridView.ItemTemplate>
<GridView.ItemsSource> <GridView.ItemsSource>
<Binding Source="{StaticResource EntriesViewSource}"/> <Binding Source="{StaticResource EntriesViewSource}"/>
</GridView.ItemsSource> </GridView.ItemsSource>
<GridView.DataContext> <!--<GridView.DataContext>
<viewModels:EntryVm/> <viewModels:EntryVm/>
</GridView.DataContext> </GridView.DataContext>-->
<GridView.ItemContainerStyle> <GridView.ItemContainerStyle>
<Style TargetType = "GridViewItem" > <Style TargetType = "GridViewItem" >
<Setter Property = "Template" > <Setter Property = "Template" >

View File

@@ -32,12 +32,15 @@
<RowDefinition Height="40" /> <RowDefinition Height="40" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<CheckBox Grid.Row="0" Grid.Column="0" IsChecked="{Binding HasPassword, Mode=TwoWay}" /> <CheckBox x:Name="PasswordCheckBox" Grid.Row="0" Grid.Column="0" IsChecked="{Binding HasPassword, Mode=TwoWay}" />
<PasswordBox Grid.Row="0" Grid.Column="1" x:Name="PasswordBox" x:Uid="CompositeKeyPassword" Password="{Binding Password, Mode=TwoWay}" Height="30" IsEnabled="{Binding HasPassword}" IsPasswordRevealButtonEnabled="True" KeyDown="PasswordBox_KeyDown" BorderBrush="{Binding StatusType, Converter={StaticResource DiscreteIntToSolidColorBrushConverter}}" > <PasswordBox Grid.Row="0" Grid.Column="1" x:Name="PasswordBox" x:Uid="CompositeKeyPassword" Password="{Binding Password, Mode=TwoWay}" Height="30" IsPasswordRevealButtonEnabled="True" KeyDown="PasswordBox_KeyDown" BorderBrush="{Binding StatusType, Converter={StaticResource DiscreteIntToSolidColorBrushConverter}}" >
<interactivity:Interaction.Behaviors> <interactivity:Interaction.Behaviors>
<core:DataTriggerBehavior Binding="{Binding HasPassword}" Value="True"> <core:EventTriggerBehavior EventName="GotFocus">
<core:ChangePropertyAction TargetObject="{Binding ElementName=PasswordCheckBox}" PropertyName="IsChecked" Value="True" />
</core:EventTriggerBehavior>
<!--<core:DataTriggerBehavior Binding="{Binding HasPassword}" Value="True">
<actions:SetupFocusAction TargetObject="{Binding ElementName=PasswordBox}" /> <actions:SetupFocusAction TargetObject="{Binding ElementName=PasswordBox}" />
</core:DataTriggerBehavior> </core:DataTriggerBehavior>-->
</interactivity:Interaction.Behaviors> </interactivity:Interaction.Behaviors>
</PasswordBox> </PasswordBox>
<ProgressBar Grid.Row="0" Grid.Column="1" <ProgressBar Grid.Row="0" Grid.Column="1"

View File

@@ -1,18 +1,20 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Microsoft.AppCenter" version="1.5.0" targetFramework="win81" /> <package id="Microsoft.AppCenter" version="1.6.1" targetFramework="win81" />
<package id="Microsoft.AppCenter.Analytics" version="1.5.0" targetFramework="win81" /> <package id="Microsoft.AppCenter.Analytics" version="1.6.1" targetFramework="win81" />
<package id="Microsoft.AppCenter.Push" version="1.5.0" targetFramework="win81" /> <package id="Microsoft.AppCenter.Push" version="1.6.1" targetFramework="win81" />
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="win81" /> <package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="win81" />
<package id="Microsoft.NETCore.Platforms" version="2.0.1" targetFramework="win81" /> <package id="Microsoft.NETCore.Platforms" version="2.1.0" targetFramework="win81" />
<package id="Microsoft.NETCore.Portable.Compatibility" version="1.0.2" targetFramework="win81" /> <package id="Microsoft.NETCore.Portable.Compatibility" version="1.0.2" targetFramework="win81" />
<package id="Microsoft.Toolkit.Uwp.Notifications" version="2.0.0" targetFramework="win81" /> <package id="Microsoft.Toolkit.Uwp.Notifications" version="2.0.0" targetFramework="win81" />
<package id="ModernKeePassLib" version="2.38.2" targetFramework="win81" /> <package id="ModernKeePassLib" version="2.38.2" targetFramework="win81" />
<package id="NETStandard.Library" version="2.0.1" targetFramework="win81" /> <package id="NETStandard.Library" version="2.0.3" targetFramework="win81" />
<package id="Portable.BouncyCastle" version="1.8.1.3" targetFramework="win81" /> <package id="Portable.BouncyCastle" version="1.8.2" targetFramework="win81" />
<package id="Splat" version="2.0.0" targetFramework="win81" /> <package id="Splat" version="3.0.0" targetFramework="win81" />
<package id="System.Collections" version="4.3.0" targetFramework="win81" /> <package id="System.Collections" version="4.3.0" targetFramework="win81" />
<package id="System.Diagnostics.Contracts" version="4.3.0" targetFramework="win81" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="win81" /> <package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="win81" />
<package id="System.Drawing.Primitives" version="4.3.0" targetFramework="win81" />
<package id="System.Globalization" version="4.3.0" targetFramework="win81" /> <package id="System.Globalization" version="4.3.0" targetFramework="win81" />
<package id="System.IO" version="4.3.0" targetFramework="win81" /> <package id="System.IO" version="4.3.0" targetFramework="win81" />
<package id="System.Linq" version="4.3.0" targetFramework="win81" /> <package id="System.Linq" version="4.3.0" targetFramework="win81" />
@@ -22,11 +24,12 @@
<package id="System.Runtime" version="4.3.0" targetFramework="win81" /> <package id="System.Runtime" version="4.3.0" targetFramework="win81" />
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="win81" /> <package id="System.Runtime.Extensions" version="4.3.0" targetFramework="win81" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="win81" /> <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="win81" />
<package id="System.Runtime.Serialization.Primitives" version="4.3.0" targetFramework="win81" />
<package id="System.Runtime.WindowsRuntime" version="4.3.0" targetFramework="win81" /> <package id="System.Runtime.WindowsRuntime" version="4.3.0" targetFramework="win81" />
<package id="System.Text.Encoding" version="4.3.0" targetFramework="win81" /> <package id="System.Text.Encoding" version="4.3.0" targetFramework="win81" />
<package id="System.Threading" version="4.3.0" targetFramework="win81" /> <package id="System.Threading" version="4.3.0" targetFramework="win81" />
<package id="System.Threading.Tasks" version="4.3.0" targetFramework="win81" /> <package id="System.Threading.Tasks" version="4.3.0" targetFramework="win81" />
<package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="win81" /> <package id="System.Xml.ReaderWriter" version="4.3.1" targetFramework="win81" />
<package id="System.Xml.XmlSerializer" version="4.3.0" targetFramework="win81" /> <package id="System.Xml.XmlSerializer" version="4.3.0" targetFramework="win81" />
<package id="Validation" version="2.4.18" targetFramework="win81" /> <package id="Validation" version="2.4.18" targetFramework="win81" />
</packages> </packages>

View File

@@ -160,16 +160,20 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL"> <Reference Include="BouncyCastle.Crypto, Version=1.8.2.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.8.1.3\lib\netstandard1.0\BouncyCastle.Crypto.dll</HintPath> <HintPath>..\packages\Portable.BouncyCastle.1.8.2\lib\netstandard1.0\BouncyCastle.Crypto.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="ModernKeePassLib, Version=2.37.0.2000, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="ModernKeePassLib, Version=2.37.0.2000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ModernKeePassLib.2.37.7000\lib\netstandard1.2\ModernKeePassLib.dll</HintPath> <HintPath>..\packages\ModernKeePassLib.2.38.2\lib\netstandard1.2\ModernKeePassLib.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Splat, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Splat, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Splat.2.0.0\lib\Portable-Win81+Wpa81\Splat.dll</HintPath> <HintPath>..\packages\Splat.3.0.0\lib\netstandard1.1\Splat.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Drawing.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Drawing.Primitives.4.3.0\lib\netstandard1.1\System.Drawing.Primitives.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
@@ -185,13 +189,6 @@
<VisualStudioVersion>14.0</VisualStudioVersion> <VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<Import Project="..\packages\NETStandard.Library.2.0.1\build\NETStandard.Library.targets" Condition="Exists('..\packages\NETStandard.Library.2.0.1\build\NETStandard.Library.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\NETStandard.Library.2.0.1\build\NETStandard.Library.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NETStandard.Library.2.0.1\build\NETStandard.Library.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">

View File

@@ -1,13 +1,16 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Microsoft.NETCore.Platforms" version="2.0.1" targetFramework="win81" /> <package id="Microsoft.NETCore.Platforms" version="2.1.0" targetFramework="win81" />
<package id="Microsoft.NETCore.Portable.Compatibility" version="1.0.2" targetFramework="win81" /> <package id="Microsoft.NETCore.Portable.Compatibility" version="1.0.2" targetFramework="win81" />
<package id="ModernKeePassLib" version="2.37.7000" targetFramework="win81" /> <package id="ModernKeePassLib" version="2.38.2" targetFramework="win81" />
<package id="NETStandard.Library" version="2.0.1" targetFramework="win81" /> <package id="NETStandard.Library" version="2.0.3" targetFramework="win81" />
<package id="Portable.BouncyCastle" version="1.8.1.3" targetFramework="win81" /> <package id="Portable.BouncyCastle" version="1.8.2" targetFramework="win81" />
<package id="Splat" version="2.0.0" targetFramework="win81" /> <package id="Splat" version="3.0.0" targetFramework="win81" />
<package id="System.Diagnostics.Contracts" version="4.3.0" targetFramework="win81" />
<package id="System.Drawing.Primitives" version="4.3.0" targetFramework="win81" />
<package id="System.Net.Requests" version="4.3.0" targetFramework="win81" /> <package id="System.Net.Requests" version="4.3.0" targetFramework="win81" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="win81" /> <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="win81" />
<package id="System.Runtime.Serialization.Primitives" version="4.3.0" targetFramework="win81" />
<package id="System.Runtime.WindowsRuntime" version="4.3.0" targetFramework="win81" /> <package id="System.Runtime.WindowsRuntime" version="4.3.0" targetFramework="win81" />
<package id="System.Xml.XmlSerializer" version="4.3.0" targetFramework="win81" /> <package id="System.Xml.XmlSerializer" version="4.3.0" targetFramework="win81" />
<package id="Validation" version="2.4.18" targetFramework="win81" /> <package id="Validation" version="2.4.18" targetFramework="win81" />

View File

@@ -54,7 +54,7 @@ namespace ModernKeePassLib.Test.Cryptography.Hash
0xD5, 0x6F, 0x70, 0x1A, 0xFE, 0x9B, 0xE2, 0xCE 0xD5, 0x6F, 0x70, 0x1A, 0xFE, 0x9B, 0xE2, 0xCE
}; };
var pbC = h.ComputeHash(MemUtil.EmptyByteArray); var pbC = h.ComputeHash(new byte[0]);
Assert.IsTrue(MemUtil.ArraysEqual(pbC, pbExpc)); Assert.IsTrue(MemUtil.ArraysEqual(pbC, pbExpc));
} }
@@ -91,7 +91,7 @@ namespace ModernKeePassLib.Test.Cryptography.Hash
} }
Assert.AreEqual(p, pbData.Length); Assert.AreEqual(p, pbData.Length);
h.TransformFinalBlock(MemUtil.EmptyByteArray, 0, 0); h.TransformFinalBlock(new byte[0], 0, 0);
Assert.IsTrue(MemUtil.ArraysEqual(h.Hash, pbExpc)); Assert.IsTrue(MemUtil.ArraysEqual(h.Hash, pbExpc));

View File

@@ -99,7 +99,7 @@ namespace ModernKeePassLib.Test.Cryptography.Hash
using (var h = new HMACSHA256(pbKey)) using (var h = new HMACSHA256(pbKey))
{ {
h.TransformBlock(pbMsg, 0, pbMsg.Length, pbMsg, 0); h.TransformBlock(pbMsg, 0, pbMsg.Length, pbMsg, 0);
h.TransformFinalBlock(MemUtil.EmptyByteArray, 0, 0); h.TransformFinalBlock(new byte[0], 0, 0);
byte[] pbHash = h.Hash; byte[] pbHash = h.Hash;
Assert.IsTrue(MemUtil.ArraysEqual(pbHash, pbExpc)); Assert.IsTrue(MemUtil.ArraysEqual(pbHash, pbExpc));
@@ -107,7 +107,7 @@ namespace ModernKeePassLib.Test.Cryptography.Hash
// Reuse the object // Reuse the object
h.Initialize(); h.Initialize();
h.TransformBlock(pbMsg, 0, pbMsg.Length, pbMsg, 0); h.TransformBlock(pbMsg, 0, pbMsg.Length, pbMsg, 0);
h.TransformFinalBlock(MemUtil.EmptyByteArray, 0, 0); h.TransformFinalBlock(new byte[0], 0, 0);
pbHash = h.Hash; pbHash = h.Hash;
Assert.IsTrue(MemUtil.ArraysEqual(pbHash, pbExpc)); Assert.IsTrue(MemUtil.ArraysEqual(pbHash, pbExpc));

View File

@@ -148,16 +148,16 @@
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL"> <Reference Include="BouncyCastle.Crypto, Version=1.8.2.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.8.1.3\lib\netstandard1.0\BouncyCastle.Crypto.dll</HintPath> <HintPath>..\packages\Portable.BouncyCastle.1.8.2\lib\netstandard1.0\BouncyCastle.Crypto.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="ModernKeePassLib, Version=2.37.0.2000, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Splat, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ModernKeePassLib.2.37.7000\lib\netstandard1.2\ModernKeePassLib.dll</HintPath> <HintPath>..\packages\Splat.3.0.0\lib\netstandard1.1\Splat.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Splat, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="System.Drawing.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Splat.2.0.0\lib\Portable-Win81+Wpa81\Splat.dll</HintPath> <HintPath>..\packages\System.Drawing.Primitives.4.3.0\lib\netstandard1.1\System.Drawing.Primitives.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
@@ -183,17 +183,16 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ModernKeePassLib\ModernKeePass.Lib.csproj">
<Project>{2e710089-9559-4967-846c-e763dd1f3acb}</Project>
<Name>ModernKeePass.Lib</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' "> <PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion> <VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<Import Project="..\packages\NETStandard.Library.2.0.1\build\NETStandard.Library.targets" Condition="Exists('..\packages\NETStandard.Library.2.0.1\build\NETStandard.Library.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\NETStandard.Library.2.0.1\build\NETStandard.Library.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NETStandard.Library.2.0.1\build\NETStandard.Library.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">

View File

@@ -4,7 +4,7 @@ using ModernKeePassLib.Utility;
namespace ModernKeePassLib.Test.Utility namespace ModernKeePassLib.Test.Utility
{ {
[TestClass ()] [TestClass]
public class GfxUtilTests public class GfxUtilTests
{ {
// 16x16 all white PNG file, base64 encoded // 16x16 all white PNG file, base64 encoded
@@ -18,7 +18,7 @@ namespace ModernKeePassLib.Test.Utility
public void TestLoadImage () public void TestLoadImage ()
{ {
var testData = Convert.FromBase64String (testImageData); var testData = Convert.FromBase64String (testImageData);
var image = GfxUtil.ScaleImage(testData, 16, 16).GetAwaiter().GetResult(); var image = GfxUtil.ScaleImage(testData, 16, 16);
//var image = GfxUtil.LoadImage(testData); //var image = GfxUtil.LoadImage(testData);
Assert.AreEqual(image.Width, 16); Assert.AreEqual(image.Width, 16);
Assert.AreEqual(image.Height, 16); Assert.AreEqual(image.Height, 16);

View File

@@ -1,16 +1,18 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Microsoft.NETCore.Platforms" version="2.0.1" targetFramework="win81" /> <package id="Microsoft.NETCore.Platforms" version="2.1.0" targetFramework="win81" />
<package id="Microsoft.NETCore.Portable.Compatibility" version="1.0.2" targetFramework="win81" /> <package id="Microsoft.NETCore.Portable.Compatibility" version="1.0.2" targetFramework="win81" />
<package id="ModernKeePassLib" version="2.37.7000" targetFramework="win81" /> <package id="ModernKeePassLib" version="2.38.2" targetFramework="win81" />
<package id="NETStandard.Library" version="2.0.1" targetFramework="win81" /> <package id="NETStandard.Library" version="2.0.3" targetFramework="win81" />
<package id="Portable.BouncyCastle" version="1.8.1.3" targetFramework="win81" /> <package id="Portable.BouncyCastle" version="1.8.2" targetFramework="win81" />
<package id="Splat" version="2.0.0" targetFramework="win81" /> <package id="Splat" version="3.0.0" targetFramework="win81" />
<package id="System.Collections" version="4.3.0" targetFramework="win81" /> <package id="System.Collections" version="4.3.0" targetFramework="win81" />
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="win81" /> <package id="System.Collections.Concurrent" version="4.3.0" targetFramework="win81" />
<package id="System.Diagnostics.Contracts" version="4.3.0" targetFramework="win81" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="win81" /> <package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="win81" />
<package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="win81" /> <package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="win81" />
<package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="win81" /> <package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="win81" />
<package id="System.Drawing.Primitives" version="4.3.0" targetFramework="win81" />
<package id="System.Globalization" version="4.3.0" targetFramework="win81" /> <package id="System.Globalization" version="4.3.0" targetFramework="win81" />
<package id="System.IO" version="4.3.0" targetFramework="win81" /> <package id="System.IO" version="4.3.0" targetFramework="win81" />
<package id="System.IO.Compression" version="4.3.0" targetFramework="win81" /> <package id="System.IO.Compression" version="4.3.0" targetFramework="win81" />
@@ -29,6 +31,7 @@
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="win81" /> <package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="win81" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="win81" /> <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="win81" />
<package id="System.Runtime.Numerics" version="4.3.0" targetFramework="win81" /> <package id="System.Runtime.Numerics" version="4.3.0" targetFramework="win81" />
<package id="System.Runtime.Serialization.Primitives" version="4.3.0" targetFramework="win81" />
<package id="System.Runtime.WindowsRuntime" version="4.3.0" targetFramework="win81" /> <package id="System.Runtime.WindowsRuntime" version="4.3.0" targetFramework="win81" />
<package id="System.Text.Encoding" version="4.3.0" targetFramework="win81" /> <package id="System.Text.Encoding" version="4.3.0" targetFramework="win81" />
<package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="win81" /> <package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="win81" />
@@ -36,7 +39,7 @@
<package id="System.Threading" version="4.3.0" targetFramework="win81" /> <package id="System.Threading" version="4.3.0" targetFramework="win81" />
<package id="System.Threading.Tasks" version="4.3.0" targetFramework="win81" /> <package id="System.Threading.Tasks" version="4.3.0" targetFramework="win81" />
<package id="System.Threading.Timer" version="4.3.0" targetFramework="win81" /> <package id="System.Threading.Timer" version="4.3.0" targetFramework="win81" />
<package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="win81" /> <package id="System.Xml.ReaderWriter" version="4.3.1" targetFramework="win81" />
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="win81" /> <package id="System.Xml.XDocument" version="4.3.0" targetFramework="win81" />
<package id="System.Xml.XmlSerializer" version="4.3.0" targetFramework="win81" /> <package id="System.Xml.XmlSerializer" version="4.3.0" targetFramework="win81" />
<package id="Validation" version="2.4.18" targetFramework="win81" /> <package id="Validation" version="2.4.18" targetFramework="win81" />

View File

@@ -69,7 +69,7 @@ namespace ModernKeePassLib.Cryptography.Cipher
} }
} }
internal sealed class ChaCha20Stream : Stream public sealed class ChaCha20Stream : Stream
{ {
private Stream m_sBase; private Stream m_sBase;
private readonly bool m_bWriting; private readonly bool m_bWriting;

View File

@@ -138,7 +138,7 @@ namespace ModernKeePassLib.Cryptography.KeyDerivation
return null; return null;
} }
internal static bool TransformKeyManaged(byte[] pbNewKey32, byte[] pbKeySeed32, public static bool TransformKeyManaged(byte[] pbNewKey32, byte[] pbKeySeed32,
ulong uNumRounds) ulong uNumRounds)
{ {
#if ModernKeePassLib || KeePassUAP #if ModernKeePassLib || KeePassUAP

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(NuGetPackageRoot)' == ''">
<NuGetPackageRoot>$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
</PropertyGroup>
<ImportGroup>
<Import Project="$(NuGetPackageRoot)\NETStandard.Library\2.0.1\build\NETStandard.Library.targets" Condition="Exists('$(NuGetPackageRoot)\NETStandard.Library\2.0.1\build\NETStandard.Library.targets')" />
</ImportGroup>
</Project>

View File

@@ -52,7 +52,12 @@ namespace ModernKeePassLib.Native
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
}
public static string GetUserRuntimeDir()
{
throw new NotImplementedException();
}
}
public enum DataProtectionScope public enum DataProtectionScope
{ {

View File

@@ -80,7 +80,8 @@ namespace ModernKeePassLib.Serialization
string strPath = m_iocBase.Path; string strPath = m_iocBase.Path;
if(m_iocBase.IsLocalFile()) #if !ModernKeePassLib
if(m_iocBase.IsLocalFile())
{ {
try try
{ {
@@ -112,6 +113,7 @@ namespace ModernKeePassLib.Serialization
} }
catch(Exception) { Debug.Assert(false); } catch(Exception) { Debug.Assert(false); }
} }
#endif
#if !ModernKeePassLib #if !ModernKeePassLib
// Prevent transactions for FTP URLs under .NET 4.0 in order to // Prevent transactions for FTP URLs under .NET 4.0 in order to
@@ -210,9 +212,9 @@ namespace ModernKeePassLib.Serialization
// UnauthorizedAccessException; thus we restore 'Access' (DACL) only // UnauthorizedAccessException; thus we restore 'Access' (DACL) only
const AccessControlSections acs = AccessControlSections.Access; const AccessControlSections acs = AccessControlSections.Access;
#endif
bool bEfsEncrypted = false; bool bEfsEncrypted = false;
byte[] pbSec = null; byte[] pbSec = null;
#endif
DateTime? otCreation = null; DateTime? otCreation = null;
bool bBaseExists = IOConnection.FileExists(m_iocBase); bool bBaseExists = IOConnection.FileExists(m_iocBase);
@@ -227,7 +229,11 @@ namespace ModernKeePassLib.Serialization
try { if(bEfsEncrypted) File.Decrypt(m_iocBase.Path); } // For TxF try { if(bEfsEncrypted) File.Decrypt(m_iocBase.Path); } // For TxF
catch(Exception) { Debug.Assert(false); } catch(Exception) { Debug.Assert(false); }
#endif #endif
otCreation = File.GetCreationTimeUtc(m_iocBase.Path); #if ModernKeePassLib
otCreation = m_iocBase.StorageFile.DateCreated.UtcDateTime;
#else
otCreation = File.GetCreationTimeUtc(m_iocBase.Path);
#endif
#if !ModernKeePassLib #if !ModernKeePassLib
// May throw with Mono // May throw with Mono
FileSecurity sec = File.GetAccessControl(m_iocBase.Path, acs); FileSecurity sec = File.GetAccessControl(m_iocBase.Path, acs);
@@ -249,12 +255,14 @@ namespace ModernKeePassLib.Serialization
try try
{ {
// If File.GetCreationTimeUtc fails, it may return a // If File.GetCreationTimeUtc fails, it may return a
// date with year 1601, and Unix times start in 1970, // date with year 1601, and Unix times start in 1970,
// so testing for 1971 should ensure validity; // so testing for 1971 should ensure validity;
// https://msdn.microsoft.com/en-us/library/system.io.file.getcreationtimeutc.aspx // https://msdn.microsoft.com/en-us/library/system.io.file.getcreationtimeutc.aspx
#if !ModernKeePassLib
if(otCreation.HasValue && (otCreation.Value.Year >= 1971)) if(otCreation.HasValue && (otCreation.Value.Year >= 1971))
File.SetCreationTimeUtc(m_iocBase.Path, otCreation.Value); File.SetCreationTimeUtc(m_iocBase.Path, otCreation.Value);
#endif
#if !ModernKeePassLib #if !ModernKeePassLib
if(bEfsEncrypted) if(bEfsEncrypted)
@@ -277,8 +285,8 @@ namespace ModernKeePassLib.Serialization
File.SetAccessControl(m_iocBase.Path, sec); File.SetAccessControl(m_iocBase.Path, sec);
} }
#endif #endif
} }
catch(Exception) { Debug.Assert(false); } catch (Exception) { Debug.Assert(false); }
if(bMadeUnhidden) UrlUtil.HideFile(m_iocBase.Path, true); if(bMadeUnhidden) UrlUtil.HideFile(m_iocBase.Path, true);
} }
@@ -297,8 +305,10 @@ namespace ModernKeePassLib.Serialization
{ {
if(chDriveLetter == '\0') return false; if(chDriveLetter == '\0') return false;
#if !ModernKeePassLib #if ModernKeePassLib
try return true;
#else
try
{ {
string strRoot = (new string(chDriveLetter, 1)) + ":\\"; string strRoot = (new string(chDriveLetter, 1)) + ":\\";
@@ -317,8 +327,8 @@ namespace ModernKeePassLib.Serialization
return ((uFlags & NativeMethods.FILE_SUPPORTS_TRANSACTIONS) != 0); return ((uFlags & NativeMethods.FILE_SUPPORTS_TRANSACTIONS) != 0);
} }
catch(Exception) { Debug.Assert(false); } catch(Exception) { Debug.Assert(false); }
#endif
return false; return false;
#endif
} }
private void TxfPrepare() private void TxfPrepare()
@@ -341,24 +351,33 @@ namespace ModernKeePassLib.Serialization
if((chT != chB) && !TxfIsSupported(chT)) return; if((chT != chB) && !TxfIsSupported(chT)) return;
m_iocTxfMidFallback = m_iocTemp; m_iocTxfMidFallback = m_iocTemp;
m_iocTemp = IOConnectionInfo.FromPath(strTemp); #if ModernKeePassLib
var tempFile = ApplicationData.Current.TemporaryFolder.CreateFileAsync(m_iocTemp.Path).GetAwaiter()
.GetResult();
m_iocTemp = IOConnectionInfo.FromFile(tempFile);
#else
m_iocTemp = IOConnectionInfo.FromPath(strTemp);
#endif
m_lToDelete.Add(m_iocTemp); m_lToDelete.Add(m_iocTemp);
} }
catch(Exception) { Debug.Assert(false); m_iocTxfMidFallback = null; } catch(Exception) { Debug.Assert(false); m_iocTxfMidFallback = null; }
} }
#if !ModernKeePassLib
private bool TxfMove() private bool TxfMove()
{ {
if(m_iocTxfMidFallback == null) return false; if(m_iocTxfMidFallback == null) return false;
if(TxfMoveWithTx()) return true; if(TxfMoveWithTx()) return true;
// Move the temporary file onto the base file's drive first, // Move the temporary file onto the base file's drive first,
// such that it cannot happen that both the base file and // such that it cannot happen that both the base file and
// the temporary file are deleted/corrupted // the temporary file are deleted/corrupted
const uint f = (NativeMethods.MOVEFILE_COPY_ALLOWED | #if ModernKeePassLib
m_iocTemp.StorageFile = ApplicationData.Current.TemporaryFolder.CreateFileAsync(m_iocTemp.Path).GetAwaiter()
.GetResult();
#else
const uint f = (NativeMethods.MOVEFILE_COPY_ALLOWED |
NativeMethods.MOVEFILE_REPLACE_EXISTING); NativeMethods.MOVEFILE_REPLACE_EXISTING);
bool b = NativeMethods.MoveFileEx(m_iocTemp.Path, m_iocTxfMidFallback.Path, f); bool b = NativeMethods.MoveFileEx(m_iocTemp.Path, m_iocTxfMidFallback.Path, f);
if(b) b = NativeMethods.MoveFileEx(m_iocTxfMidFallback.Path, m_iocBase.Path, f); if(b) b = NativeMethods.MoveFileEx(m_iocTxfMidFallback.Path, m_iocBase.Path, f);
@@ -366,12 +385,16 @@ namespace ModernKeePassLib.Serialization
Debug.Assert(!File.Exists(m_iocTemp.Path)); Debug.Assert(!File.Exists(m_iocTemp.Path));
Debug.Assert(!File.Exists(m_iocTxfMidFallback.Path)); Debug.Assert(!File.Exists(m_iocTxfMidFallback.Path));
#endif
return true; return true;
} }
private bool TxfMoveWithTx() private bool TxfMoveWithTx()
{ {
IntPtr hTx = new IntPtr((int)NativeMethods.INVALID_HANDLE_VALUE); #if ModernKeePassLib
return true;
#else
IntPtr hTx = new IntPtr((int)NativeMethods.INVALID_HANDLE_VALUE);
Debug.Assert(hTx.ToInt64() == NativeMethods.INVALID_HANDLE_VALUE); Debug.Assert(hTx.ToInt64() == NativeMethods.INVALID_HANDLE_VALUE);
try try
{ {
@@ -415,16 +438,20 @@ namespace ModernKeePassLib.Serialization
catch(Exception) { Debug.Assert(false); } catch(Exception) { Debug.Assert(false); }
} }
} }
return false; return false;
} #endif
}
internal static void ClearOld() internal static void ClearOld()
{ {
try try
{ {
// See also TxfPrepare method #if ModernKeePassLib
DirectoryInfo di = new DirectoryInfo(UrlUtil.GetTempPath()); ApplicationData.Current.TemporaryFolder.GetFileAsync(UrlUtil.GetTempPath()).GetAwaiter()
.GetResult().DeleteAsync().GetAwaiter().GetResult();
#else
// See also TxfPrepare method
DirectoryInfo di = new DirectoryInfo(UrlUtil.GetTempPath());
List<FileInfo> l = UrlUtil.GetFileInfos(di, StrTxfTempPrefix + List<FileInfo> l = UrlUtil.GetFileInfos(di, StrTxfTempPrefix +
"*" + StrTxfTempSuffix, SearchOption.TopDirectoryOnly); "*" + StrTxfTempSuffix, SearchOption.TopDirectoryOnly);
@@ -438,9 +465,9 @@ namespace ModernKeePassLib.Serialization
if((DateTime.UtcNow - fi.LastWriteTimeUtc).TotalDays > 1.0) if((DateTime.UtcNow - fi.LastWriteTimeUtc).TotalDays > 1.0)
fi.Delete(); fi.Delete();
} }
#endif
} }
catch(Exception) { Debug.Assert(false); } catch(Exception) { Debug.Assert(false); }
} }
#endif
} }
} }

View File

@@ -641,10 +641,9 @@ namespace ModernKeePassLib.Utility
if(NativeLib.IsUnix()) if(NativeLib.IsUnix())
strDir = NativeMethods.GetUserRuntimeDir(); strDir = NativeMethods.GetUserRuntimeDir();
#if ModernKeePassLib #if ModernKeePassLib
else strDir = Windows.Storage.ApplicationData.Current.TemporaryFolder.Path; else strDir = ApplicationData.Current.TemporaryFolder.Path;
#else #else
else strDir = Path.GetTempPath(); else strDir = Path.GetTempPath();
#endif
try try
{ {
@@ -652,6 +651,7 @@ namespace ModernKeePassLib.Utility
} }
catch(Exception) { Debug.Assert(false); } catch(Exception) { Debug.Assert(false); }
#endif
return strDir; return strDir;
} }

View File

@@ -1,12 +1,12 @@
{ {
"supports": {}, "supports": {},
"dependencies": { "dependencies": {
"Microsoft.NETCore.Portable.Compatibility": "1.0.1", "Microsoft.NETCore.Portable.Compatibility": "1.0.2",
"NETStandard.Library": "2.0.1", "NETStandard.Library": "2.0.3",
"Portable.BouncyCastle": "1.8.1.3", "Portable.BouncyCastle": "1.8.2",
"Splat": "2.0.0", "Splat": "3.0.0",
"System.Runtime.WindowsRuntime": "4.3.0", "System.Runtime.WindowsRuntime": "4.3.0",
"System.Xml.ReaderWriter": "4.3.0", "System.Xml.ReaderWriter": "4.3.1",
"System.Xml.XmlSerializer": "4.3.0", "System.Xml.XmlSerializer": "4.3.0",
"Validation": "2.4.18" "Validation": "2.4.18"
}, },