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>
</ItemGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.8.1.3\lib\netstandard1.0\BouncyCastle.Crypto.dll</HintPath>
<Reference Include="BouncyCastle.Crypto, Version=1.8.2.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.8.2\lib\netstandard1.0\BouncyCastle.Crypto.dll</HintPath>
<Private>True</Private>
</Reference>
<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>
</Reference>
<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>
</Reference>
<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>
</Reference>
<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>
<Private>True</Private>
</Reference>
<Reference Include="ModernKeePassLib, Version=2.37.0.2000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ModernKeePassLib.2.38.2\lib\netstandard1.2\ModernKeePassLib.dll</HintPath>
<Reference Include="Splat, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Splat.3.0.0\lib\netstandard1.1\Splat.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Splat, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Splat.2.0.0\lib\Portable-Win81+Wpa81\Splat.dll</HintPath>
<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>
</Reference>
<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-80.png" />
</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' ">
<VisualStudioVersion>12.0</VisualStudioVersion>
</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>
</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\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>
<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.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

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

View File

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

View File

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

View File

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

View File

@@ -32,12 +32,15 @@
<RowDefinition Height="40" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<CheckBox 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}}" >
<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" IsPasswordRevealButtonEnabled="True" KeyDown="PasswordBox_KeyDown" BorderBrush="{Binding StatusType, Converter={StaticResource DiscreteIntToSolidColorBrushConverter}}" >
<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}" />
</core:DataTriggerBehavior>
</core:DataTriggerBehavior>-->
</interactivity:Interaction.Behaviors>
</PasswordBox>
<ProgressBar Grid.Row="0" Grid.Column="1"

View File

@@ -1,18 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.AppCenter" version="1.5.0" targetFramework="win81" />
<package id="Microsoft.AppCenter.Analytics" version="1.5.0" targetFramework="win81" />
<package id="Microsoft.AppCenter.Push" version="1.5.0" targetFramework="win81" />
<package id="Microsoft.AppCenter" version="1.6.1" targetFramework="win81" />
<package id="Microsoft.AppCenter.Analytics" version="1.6.1" 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.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.Toolkit.Uwp.Notifications" version="2.0.0" targetFramework="win81" />
<package id="ModernKeePassLib" version="2.38.2" targetFramework="win81" />
<package id="NETStandard.Library" version="2.0.1" targetFramework="win81" />
<package id="Portable.BouncyCastle" version="1.8.1.3" targetFramework="win81" />
<package id="Splat" version="2.0.0" targetFramework="win81" />
<package id="NETStandard.Library" version="2.0.3" targetFramework="win81" />
<package id="Portable.BouncyCastle" version="1.8.2" targetFramework="win81" />
<package id="Splat" version="3.0.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.Drawing.Primitives" 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.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.Extensions" 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.Text.Encoding" 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.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="Validation" version="2.4.18" targetFramework="win81" />
</packages>

View File

@@ -160,16 +160,20 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.8.1.3\lib\netstandard1.0\BouncyCastle.Crypto.dll</HintPath>
<Reference Include="BouncyCastle.Crypto, Version=1.8.2.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.8.2\lib\netstandard1.0\BouncyCastle.Crypto.dll</HintPath>
<Private>True</Private>
</Reference>
<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>
</Reference>
<Reference Include="Splat, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Splat.2.0.0\lib\Portable-Win81+Wpa81\Splat.dll</HintPath>
<Reference Include="Splat, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<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>
</Reference>
<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>
</PropertyGroup>
<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.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

@@ -1,13 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<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="ModernKeePassLib" version="2.37.7000" targetFramework="win81" />
<package id="NETStandard.Library" version="2.0.1" targetFramework="win81" />
<package id="Portable.BouncyCastle" version="1.8.1.3" targetFramework="win81" />
<package id="Splat" version="2.0.0" targetFramework="win81" />
<package id="ModernKeePassLib" version="2.38.2" targetFramework="win81" />
<package id="NETStandard.Library" version="2.0.3" targetFramework="win81" />
<package id="Portable.BouncyCastle" version="1.8.2" 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.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.Xml.XmlSerializer" version="4.3.0" 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
};
var pbC = h.ComputeHash(MemUtil.EmptyByteArray);
var pbC = h.ComputeHash(new byte[0]);
Assert.IsTrue(MemUtil.ArraysEqual(pbC, pbExpc));
}
@@ -91,7 +91,7 @@ namespace ModernKeePassLib.Test.Cryptography.Hash
}
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));

View File

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

View File

@@ -148,16 +148,16 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.8.1.3\lib\netstandard1.0\BouncyCastle.Crypto.dll</HintPath>
<Reference Include="BouncyCastle.Crypto, Version=1.8.2.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.8.2\lib\netstandard1.0\BouncyCastle.Crypto.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ModernKeePassLib, Version=2.37.0.2000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ModernKeePassLib.2.37.7000\lib\netstandard1.2\ModernKeePassLib.dll</HintPath>
<Reference Include="Splat, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Splat.3.0.0\lib\netstandard1.1\Splat.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Splat, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Splat.2.0.0\lib\Portable-Win81+Wpa81\Splat.dll</HintPath>
<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>
</Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
@@ -183,17 +183,16 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</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' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<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.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

@@ -4,7 +4,7 @@ using ModernKeePassLib.Utility;
namespace ModernKeePassLib.Test.Utility
{
[TestClass ()]
[TestClass]
public class GfxUtilTests
{
// 16x16 all white PNG file, base64 encoded
@@ -18,7 +18,7 @@ namespace ModernKeePassLib.Test.Utility
public void TestLoadImage ()
{
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);
Assert.AreEqual(image.Width, 16);
Assert.AreEqual(image.Height, 16);

View File

@@ -1,16 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<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="ModernKeePassLib" version="2.37.7000" targetFramework="win81" />
<package id="NETStandard.Library" version="2.0.1" targetFramework="win81" />
<package id="Portable.BouncyCastle" version="1.8.1.3" targetFramework="win81" />
<package id="Splat" version="2.0.0" targetFramework="win81" />
<package id="ModernKeePassLib" version="2.38.2" targetFramework="win81" />
<package id="NETStandard.Library" version="2.0.3" targetFramework="win81" />
<package id="Portable.BouncyCastle" version="1.8.2" 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.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.Tools" 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.IO" 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.RuntimeInformation" 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.Text.Encoding" 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.Tasks" 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.XmlSerializer" version="4.3.0" 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 readonly bool m_bWriting;

View File

@@ -138,7 +138,7 @@ namespace ModernKeePassLib.Cryptography.KeyDerivation
return null;
}
internal static bool TransformKeyManaged(byte[] pbNewKey32, byte[] pbKeySeed32,
public static bool TransformKeyManaged(byte[] pbNewKey32, byte[] pbKeySeed32,
ulong uNumRounds)
{
#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();
}
}
public static string GetUserRuntimeDir()
{
throw new NotImplementedException();
}
}
public enum DataProtectionScope
{

View File

@@ -80,7 +80,8 @@ namespace ModernKeePassLib.Serialization
string strPath = m_iocBase.Path;
if(m_iocBase.IsLocalFile())
#if !ModernKeePassLib
if(m_iocBase.IsLocalFile())
{
try
{
@@ -112,6 +113,7 @@ namespace ModernKeePassLib.Serialization
}
catch(Exception) { Debug.Assert(false); }
}
#endif
#if !ModernKeePassLib
// 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
const AccessControlSections acs = AccessControlSections.Access;
#endif
bool bEfsEncrypted = false;
byte[] pbSec = null;
#endif
DateTime? otCreation = null;
bool bBaseExists = IOConnection.FileExists(m_iocBase);
@@ -227,7 +229,11 @@ namespace ModernKeePassLib.Serialization
try { if(bEfsEncrypted) File.Decrypt(m_iocBase.Path); } // For TxF
catch(Exception) { Debug.Assert(false); }
#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
// May throw with Mono
FileSecurity sec = File.GetAccessControl(m_iocBase.Path, acs);
@@ -249,12 +255,14 @@ namespace ModernKeePassLib.Serialization
try
{
// If File.GetCreationTimeUtc fails, it may return a
// date with year 1601, and Unix times start in 1970,
// so testing for 1971 should ensure validity;
// https://msdn.microsoft.com/en-us/library/system.io.file.getcreationtimeutc.aspx
// If File.GetCreationTimeUtc fails, it may return a
// date with year 1601, and Unix times start in 1970,
// so testing for 1971 should ensure validity;
// https://msdn.microsoft.com/en-us/library/system.io.file.getcreationtimeutc.aspx
#if !ModernKeePassLib
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(bEfsEncrypted)
@@ -277,8 +285,8 @@ namespace ModernKeePassLib.Serialization
File.SetAccessControl(m_iocBase.Path, sec);
}
#endif
}
catch(Exception) { Debug.Assert(false); }
}
catch (Exception) { Debug.Assert(false); }
if(bMadeUnhidden) UrlUtil.HideFile(m_iocBase.Path, true);
}
@@ -297,8 +305,10 @@ namespace ModernKeePassLib.Serialization
{
if(chDriveLetter == '\0') return false;
#if !ModernKeePassLib
try
#if ModernKeePassLib
return true;
#else
try
{
string strRoot = (new string(chDriveLetter, 1)) + ":\\";
@@ -317,8 +327,8 @@ namespace ModernKeePassLib.Serialization
return ((uFlags & NativeMethods.FILE_SUPPORTS_TRANSACTIONS) != 0);
}
catch(Exception) { Debug.Assert(false); }
#endif
return false;
#endif
}
private void TxfPrepare()
@@ -341,24 +351,33 @@ namespace ModernKeePassLib.Serialization
if((chT != chB) && !TxfIsSupported(chT)) return;
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; }
}
#if !ModernKeePassLib
private bool TxfMove()
{
if(m_iocTxfMidFallback == null) return false;
if(TxfMoveWithTx()) return true;
// Move the temporary file onto the base file's drive first,
// such that it cannot happen that both the base file and
// the temporary file are deleted/corrupted
const uint f = (NativeMethods.MOVEFILE_COPY_ALLOWED |
// Move the temporary file onto the base file's drive first,
// such that it cannot happen that both the base file and
// the temporary file are deleted/corrupted
#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);
bool b = NativeMethods.MoveFileEx(m_iocTemp.Path, m_iocTxfMidFallback.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_iocTxfMidFallback.Path));
#endif
return true;
}
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);
try
{
@@ -415,16 +438,20 @@ namespace ModernKeePassLib.Serialization
catch(Exception) { Debug.Assert(false); }
}
}
return false;
}
#endif
}
internal static void ClearOld()
{
try
{
// See also TxfPrepare method
DirectoryInfo di = new DirectoryInfo(UrlUtil.GetTempPath());
#if ModernKeePassLib
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 +
"*" + StrTxfTempSuffix, SearchOption.TopDirectoryOnly);
@@ -438,9 +465,9 @@ namespace ModernKeePassLib.Serialization
if((DateTime.UtcNow - fi.LastWriteTimeUtc).TotalDays > 1.0)
fi.Delete();
}
#endif
}
catch(Exception) { Debug.Assert(false); }
}
#endif
}
}

View File

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

View File

@@ -1,12 +1,12 @@
{
"supports": {},
"dependencies": {
"Microsoft.NETCore.Portable.Compatibility": "1.0.1",
"NETStandard.Library": "2.0.1",
"Portable.BouncyCastle": "1.8.1.3",
"Splat": "2.0.0",
"Microsoft.NETCore.Portable.Compatibility": "1.0.2",
"NETStandard.Library": "2.0.3",
"Portable.BouncyCastle": "1.8.2",
"Splat": "3.0.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",
"Validation": "2.4.18"
},