66using LiteDB ;
77using Microsoft . Win32 ;
88using System . Runtime . CompilerServices ;
9- using System . Runtime . InteropServices ;
109using System . Runtime . InteropServices . WindowsRuntime ;
1110using System . Text ;
1211using Windows . ApplicationModel ;
1817
1918namespace Files . App . Server . Database
2019{
21- public sealed class FileTagsDatabase : IDisposable
20+ public sealed class FileTagsDatabase
2221 {
2322 private readonly static string FileTagsKey = @$ "Software\Files Community\{ Package . Current . Id . FullName } \v1\FileTags";
2423
2524 private readonly static string FileTagsDbPath = Path . Combine ( ApplicationData . Current . LocalFolder . Path , "filetags.db" ) ;
2625 private const string FileTagsCollectionName = "taggedfiles" ;
2726
28- private readonly GCHandle _handle ;
29- private bool _disposed = false ;
30-
3127 static FileTagsDatabase ( )
3228 {
3329 if ( File . Exists ( FileTagsDbPath ) )
@@ -48,25 +44,6 @@ static FileTagsDatabase()
4844 }
4945 }
5046
51- public FileTagsDatabase ( )
52- {
53- throw new NotSupportedException ( $ "Instantiating { nameof ( FileTagsDatabase ) } by non-parameterized constructor is not supported.") ;
54- }
55-
56- public FileTagsDatabase ( int processId )
57- {
58- _handle = GCHandle . Alloc ( this , GCHandleType . Pinned ) ;
59-
60- if ( AppInstanceMonitor . AppInstanceResources . TryGetValue ( processId , out var instances ) )
61- {
62- instances . Add ( this ) ;
63- }
64- else
65- {
66- AppInstanceMonitor . AppInstanceResources [ processId ] = [ this ] ;
67- }
68- }
69-
7047 private static void UpdateDb ( LiteDatabase database )
7148 {
7249 if ( database . UserVersion == 0 )
@@ -302,14 +279,5 @@ private void IterateKeys(List<TaggedFile> list, string path, int depth)
302279 IterateKeys ( list , CombineKeys ( path , subKey ) , depth + 1 ) ;
303280 }
304281 }
305-
306- public void Dispose ( )
307- {
308- if ( ! _disposed )
309- {
310- _disposed = true ;
311- _handle . Free ( ) ;
312- }
313- }
314282 }
315283}
0 commit comments