File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11using HTools ;
22using Lavcode . IService ;
33using Lavcode . Service . Sqlite . Entities ;
4- using Newtonsoft . Json . Linq ;
54using SQLite ;
65using System ;
7- using System . Diagnostics ;
86using System . Linq ;
97using System . Threading . Tasks ;
108
@@ -22,22 +20,14 @@ public async Task<bool> Connect(object args)
2220 _args = args ;
2321
2422 var filePath = DynamicHelper . ToExpandoObject ( args ) . FilePath as string ;
25- try
26- {
27- Connection ? . Dispose ( ) ;
28- Connection = new SQLiteConnection ( filePath ) ;
29- await TaskExtend . Run ( ( ) =>
30- {
31- CreateTables ( ) ;
32- TryUpdateKvpId ( ) ;
33- } ) ;
34- return true ;
35- }
36- catch ( Exception ex )
23+ Connection ? . Dispose ( ) ;
24+ Connection = new SQLiteConnection ( filePath ) ;
25+ await TaskExtend . Run ( ( ) =>
3726 {
38- Debug . Write ( ex ) ;
39- return false ;
40- }
27+ TryUpdateKvpId ( ) ;
28+ CreateTables ( ) ;
29+ } ) ;
30+ return true ;
4131 }
4232
4333 public virtual async Task < bool > Refresh ( )
@@ -67,12 +57,15 @@ private void TryUpdateKvpId()
6757 {
6858 if ( ! IsKvpIdNeedUpdate ( ) ) return ;
6959
70- var kvps = Connection . Table < KeyValuePairEntity > ( ) . ToArray ( ) ;
71- foreach ( var kvp in kvps )
60+ var index = 1 ;
61+ var kvps = Connection . Table < BeforeKeyValuePairEntity > ( ) . ToArray ( ) . Select ( item => new KeyValuePairEntity ( )
7262 {
7363 // fix 合并冲突
74- kvp . Id = kvp . Id + kvp . PasswordId ;
75- }
64+ Id = item . Id + item . SourceId + index ++ ,
65+ PasswordId = item . SourceId ,
66+ Key = item . Key ,
67+ Value = item . Value ,
68+ } ) ;
7669 Connection . RunInTransaction ( ( ) =>
7770 {
7871 Connection . Execute ( "drop table [KeyValuePair]" ) ;
Original file line number Diff line number Diff line change 1+ using SQLite ;
2+
3+ namespace Lavcode . Service . Sqlite . Entities
4+ {
5+ [ Table ( "KeyValuePair" ) ]
6+ public class BeforeKeyValuePairEntity
7+ {
8+ public virtual int Id { get ; set ; }
9+ public virtual string SourceId { get ; set ; }
10+ public virtual string Key { get ; set ; }
11+ public virtual string Value { get ; set ; }
12+ }
13+ }
Original file line number Diff line number Diff line change 44 <PropertyGroup >
55 <LangVersion >9.0</LangVersion >
66 <GenerateTemporaryStoreCertificate >True</GenerateTemporaryStoreCertificate >
7- <PackageCertificateThumbprint >2F4003FF881CEE581F179666C77E123DDA351ACC</PackageCertificateThumbprint >
7+ <PackageCertificateThumbprint >
8+ </PackageCertificateThumbprint >
89 <DefaultLanguage >zh-CN</DefaultLanguage >
910 </PropertyGroup >
1011 <PropertyGroup >
2829 <AppxAutoIncrementPackageRevision >False</AppxAutoIncrementPackageRevision >
2930 <GenerateTestArtifacts >True</GenerateTestArtifacts >
3031 <AppxBundle >Always</AppxBundle >
31- <AppxBundlePlatforms >x86| x64|arm|arm64 </AppxBundlePlatforms >
32+ <AppxBundlePlatforms >x64</AppxBundlePlatforms >
3233 <HoursBetweenUpdateChecks >0</HoursBetweenUpdateChecks >
3334 <PackageCertificateKeyFile >Lavcode.Uwp_TemporaryKey.pfx</PackageCertificateKeyFile >
3435 </PropertyGroup >
Original file line number Diff line number Diff line change 1111 <Identity
1212 Name =" 524473F72DB2F.Lavcode"
1313 Publisher =" CN=72C1148F-5C2B-4F28-9B8C-891A63D2777E"
14- Version =" 1.2.1 .0" />
14+ Version =" 1.2.3 .0" />
1515
1616 <mp : PhoneIdentity PhoneProductId =" cda4abc7-39a4-4c92-8937-e609f1c9fb70" PhonePublisherId =" 00000000-0000-0000-0000-000000000000" />
1717
You can’t perform that action at this time.
0 commit comments