Skip to content

Commit

Permalink
Merge pull request #2 from shugaoye/main
Browse files Browse the repository at this point in the history
Build 2.0.2
  • Loading branch information
passxyz authored Aug 24, 2022
2 parents a312a3e + cd74bf6 commit 577c650
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 31 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Change log

### 2.0.2
- Built for .NET MAUI GA release

### 2.0.1-rc.1
- Upgraded to .NET MAUI RC1
- PassXYZLib moved to a separate project
Expand Down
41 changes: 15 additions & 26 deletions PassXYZLib.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>PassXYZLib</id>
<version>2.0.1-rc.1</version>
<version>2.0.2</version>
<authors>Roger Ye</authors>
<owners>Roger Ye</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
Expand All @@ -13,47 +13,37 @@
- Fixed dependency issue
</releaseNotes>
<copyright>Roger Ye</copyright>
<repository url="https://github.com/passxyz/KPCLib" />
<repository url="https://github.com/passxyz/Lib" />
<dependencies>
<group targetFramework="net6.0">
<dependency id="HtmlAgilityPack" version="1.11.42" exclude="Build,Analyzers" />
<dependency id="Markdig" version="0.23.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.Maui.Dependencies" version="6.0.200-preview.14.5099" exclude="Build,Analyzers" />
<dependency id="Microsoft.Maui.Extensions" version="6.0.200-preview.14.5099" exclude="Build,Analyzers" />
<dependency id="Newtonsoft.Json" version="13.0.1" exclude="Build,Analyzers" />
<dependency id="PassXYZ" version="2.1.5.22" exclude="Build,Analyzers" />
<dependency id="PassXYZ" version="2.1.5.28" exclude="Build,Analyzers" />
</group>
<group targetFramework="net6.0-android31.0">
<dependency id="HtmlAgilityPack" version="1.11.42" exclude="Build,Analyzers" />
<dependency id="Markdig" version="0.23.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.Maui.Dependencies" version="6.0.200-preview.14.5099" exclude="Build,Analyzers" />
<dependency id="Microsoft.Maui.Extensions" version="6.0.200-preview.14.5099" exclude="Build,Analyzers" />
<dependency id="Newtonsoft.Json" version="13.0.1" exclude="Build,Analyzers" />
<dependency id="PassXYZ" version="2.1.5.22" exclude="Build,Analyzers" />
<dependency id="PassXYZ" version="2.1.5.28" exclude="Build,Analyzers" />
</group>
<group targetFramework="net6.0-ios15.2">
<group targetFramework="net6.0-ios15.4">
<dependency id="HtmlAgilityPack" version="1.11.42" exclude="Build,Analyzers" />
<dependency id="Markdig" version="0.23.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.Maui.Dependencies" version="6.0.200-preview.14.5099" exclude="Build,Analyzers" />
<dependency id="Microsoft.Maui.Extensions" version="6.0.200-preview.14.5099" exclude="Build,Analyzers" />
<dependency id="Newtonsoft.Json" version="13.0.1" exclude="Build,Analyzers" />
<dependency id="PassXYZ" version="2.1.5.22" exclude="Build,Analyzers" />
<dependency id="PassXYZ" version="2.1.5.28" exclude="Build,Analyzers" />
</group>
<group targetFramework="net6.0-maccatalyst15.2">
<group targetFramework="net6.0-maccatalyst15.4">
<dependency id="HtmlAgilityPack" version="1.11.42" exclude="Build,Analyzers" />
<dependency id="Markdig" version="0.23.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.Maui.Dependencies" version="6.0.200-preview.14.5099" exclude="Build,Analyzers" />
<dependency id="Microsoft.Maui.Extensions" version="6.0.200-preview.14.5099" exclude="Build,Analyzers" />
<dependency id="Newtonsoft.Json" version="13.0.1" exclude="Build,Analyzers" />
<dependency id="PassXYZ" version="2.1.5.22" exclude="Build,Analyzers" />
<dependency id="PassXYZ" version="2.1.5.28" exclude="Build,Analyzers" />
</group>
<group targetFramework="net6.0-windows10.0.19041">
<dependency id="HtmlAgilityPack" version="1.11.42" exclude="Build,Analyzers" />
<dependency id="Markdig" version="0.23.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.Maui.Dependencies" version="6.0.200-preview.14.5099" exclude="Build,Analyzers" />
<dependency id="Microsoft.Maui.Extensions" version="6.0.200-preview.14.5099" exclude="Build,Analyzers" />
<dependency id="Newtonsoft.Json" version="13.0.1" exclude="Build,Analyzers" />
<dependency id="PassXYZ" version="2.1.5.22" exclude="Build,Analyzers" />
<dependency id="PassXYZ" version="2.1.5.28" exclude="Build,Analyzers" />
</group>
</dependencies>
<summary>PassXYZLib added additional features for .NET MAUI.</summary>
Expand All @@ -62,14 +52,13 @@
<file src="PassXYZLib/bin/Release/net6.0/PassXYZLib.dll" target="lib/net6.0/PassXYZLib.dll" />
<file src="PassXYZLib/bin/Release/net6.0/PureOtp.dll" target="lib/net6.0/PureOtp.dll" />
<file src="PassXYZLib/bin/Release/net6.0-android/PassXYZLib.dll" target="lib/net6.0-android31.0/PassXYZLib.dll" />
<file src="PassXYZLib/bin/Release/net6.0-android/PassXYZLib.aar" target="lib/net6.0-android31.0/PassXYZLib.aar" />
<file src="PassXYZLib/bin/Release/net6.0-android/PassXYZLib.xml" target="lib/net6.0-android31.0/PassXYZLib.xml" />
<file src="PassXYZLib/bin/Release/net6.0-android/PureOtp.dll" target="lib/net6.0-android31.0/PureOtp.dll" />
<file src="PassXYZLib/bin/Release/net6.0-ios/PassXYZLib.dll" target="lib/net6.0-ios15.2/PassXYZLib.dll" />
<file src="PassXYZLib/bin/Release/net6.0-ios/PureOtp.dll" target="lib/net6.0-ios15.2/PureOtp.dll" />
<file src="PassXYZLib/bin/Release/net6.0-maccatalyst/PassXYZLib.dll" target="lib/net6.0-maccatalyst15.2/PassXYZLib.dll" />
<file src="PassXYZLib/bin/Release/net6.0-maccatalyst/PureOtp.dll" target="lib/net6.0-maccatalyst15.2/PureOtp.dll" />
<file src="PassXYZLib/bin/Release/net6.0-windows10.0.19041/PassXYZLib.dll" target="lib/net6.0-windows10.0.19041/PassXYZLib.dll" />
<file src="PassXYZLib/bin/Release/net6.0-windows10.0.19041/PureOtp.dll" target="lib/net6.0-windows10.0.19041/PureOtp.dll" />
<file src="PassXYZLib/bin/Release/net6.0-ios/PassXYZLib.dll" target="lib/net6.0-ios15.4/PassXYZLib.dll" />
<file src="PassXYZLib/bin/Release/net6.0-ios/PureOtp.dll" target="lib/net6.0-ios15.4/PureOtp.dll" />
<file src="PassXYZLib/bin/Release/net6.0-maccatalyst/PassXYZLib.dll" target="lib/net6.0-maccatalyst15.4/PassXYZLib.dll" />
<file src="PassXYZLib/bin/Release/net6.0-maccatalyst/PureOtp.dll" target="lib/net6.0-maccatalyst15.4/PureOtp.dll" />
<file src="PassXYZLib/bin/Release/net6.0-windows10.0.19041.0/PassXYZLib.dll" target="lib/net6.0-windows10.0.19041/PassXYZLib.dll" />
<file src="PassXYZLib/bin/Release/net6.0-windows10.0.19041.0/PureOtp.dll" target="lib/net6.0-windows10.0.19041/PureOtp.dll" />
</files>
</package>
15 changes: 15 additions & 0 deletions PassXYZLib/IKeyValue.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PassXYZLib
{
public interface IKeyValue
{
string Key { get; set; }
string Value { get; set; }
bool IsValid { get => !(string.IsNullOrEmpty(Key) || string.IsNullOrEmpty(Value)); }
}
}
15 changes: 15 additions & 0 deletions PassXYZLib/NewField.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PassXYZLib
{
public class NewField : Field
{
public NewField(string key = "", string value="", bool isProtected=false) : base(key, value, isProtected)
{
}
}
}
37 changes: 37 additions & 0 deletions PassXYZLib/NewItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using KPCLib;
using PassXYZLib;

namespace PassXYZLib
{
public class NewItem : Item
{
private readonly Guid uid = new();
public override string Id
{
get
{
return uid.ToString();
}
}
public override string Name { get; set; } = default!;
public override string Notes { get; set; } = default!;
public override bool IsGroup { get => (SubType == ItemSubType.Group); }
public override DateTime LastModificationTime { get; set; } = default!;
public override string Description
{
get
{
return $"{ItemType} | {LastModificationTime.ToString("yyyy'-'MM'-'dd")} | {Notes}".Truncate(50);
}
}
public ItemSubType SubType { get; set; } = ItemSubType.Group;
public string ItemType
{
get => SubType.ToString();
set
{
SubType = SubType.GetItemSubType(value);
}
}
}
}
2 changes: 1 addition & 1 deletion PassXYZLib/PassXYZLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<GeneratePackageOnBuild>True</GeneratePackageOnBuild>

<Version>2.0.1</Version>
<Version>2.0.2</Version>
<NeutralLanguage>en-US</NeutralLanguage>
</PropertyGroup>

Expand Down
18 changes: 18 additions & 0 deletions PassXYZLib/PwEntryEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,24 @@ public static void SetPxEntry(this PwEntry entry)
entry.CustomData.Set(PxDefs.PxCustomDataItemSubType, ItemSubType.PxEntry.ToString());
}

/// <summary>
/// Find the encoded key using a key in the field.
/// </summary>
/// <param name="entry">an instance of PwEntry</param>
/// <param name="key">key of Field</param>
/// <returns>encoded key</returns>
public static string FindEncodeKey(this PwEntry entry, string key)
{
if (PxDefs.IsPxEntry(entry))
{
return PxDefs.FindEncodeKey(entry.Strings, key);
}
else
{
return key;
}
}

/// <summary>
/// Create a new encoded key for PxEntry.
/// </summary>
Expand Down
11 changes: 11 additions & 0 deletions PassXYZLib/PxDefs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,18 @@ public static string GetDatabaseType(string fileName)
{
return "KeePass";
}
}

public static ItemSubType GetItemSubType(this ItemSubType subType, string type)
{
if (type == ItemSubType.Group.ToString()) return ItemSubType.Group;
if (type == ItemSubType.Entry.ToString()) return ItemSubType.Entry;
if (type == ItemSubType.Notes.ToString()) return ItemSubType.Notes;
if (type == ItemSubType.PxEntry.ToString()) return ItemSubType.PxEntry;

return ItemSubType.None;
}

// The end of PxDefs
}

Expand Down
19 changes: 15 additions & 4 deletions PassXYZLib/PxItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -452,12 +452,23 @@ public static string GetCustomIcon(this Item item)
}
else
{
Debug.WriteLine("SetIcon: PasswordDb is closed");
Debug.WriteLine("GetCustomIcon: PasswordDb is closed");
}
}
else
{
Debug.WriteLine("SetIcon: No PasswordDb instance");
Debug.WriteLine("GetCustomIcon: No PasswordDb instance");
}
}
else
{
if (item.IsGroup)
{
return "folder.svg";
}
else
{
return "file.svg";
}
}
return string.Empty;
Expand Down Expand Up @@ -560,7 +571,7 @@ public static Field AddField(this Item item, string key, string value, bool isPr

if (entry.IsPxEntry())
{
field = new Field(k, value, isProtected, FieldIcons.GetImage, entry.EncodeKey(k));
field = new Field(key, value, isProtected, FieldIcons.GetImage, entry.EncodeKey(k));
}
else
{
Expand Down Expand Up @@ -604,7 +615,7 @@ public static void UpdateField(this Item item, string key, string value, bool is
{
if (item is PwEntry entry)
{
string k = entry.IsPxEntry() ? entry.EncodeKey(key) : key;
string k = entry.IsPxEntry() ? entry.FindEncodeKey(key) : key;
if (entry.Strings.Exists(k))
{
entry.Strings.Set(k, new ProtectedString(isProtected, value));
Expand Down

0 comments on commit 577c650

Please sign in to comment.