mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
[PTRun]Remove BinaryFormatter (#19036)
This commit is contained in:
committed by
GitHub
parent
b7fccc3211
commit
f4dbdbdd7a
@@ -1,10 +1,9 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
@@ -13,7 +12,6 @@ using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using ManagedCommon;
|
||||
using Wox.Infrastructure.Storage;
|
||||
using Wox.Plugin;
|
||||
using Wox.Plugin.Logger;
|
||||
|
||||
@@ -29,7 +27,6 @@ namespace Wox.Infrastructure.Image
|
||||
private static readonly ImageCache ImageCache = new ImageCache();
|
||||
private static readonly ConcurrentDictionary<string, string> GuidToKey = new ConcurrentDictionary<string, string>();
|
||||
|
||||
private static BinaryStorage<Dictionary<string, int>> _storage;
|
||||
private static IImageHashGenerator _hashGenerator;
|
||||
|
||||
public static string ErrorIconPath { get; set; }
|
||||
@@ -49,9 +46,7 @@ namespace Wox.Infrastructure.Image
|
||||
|
||||
public static void Initialize(Theme theme)
|
||||
{
|
||||
_storage = new BinaryStorage<Dictionary<string, int>>("Image");
|
||||
_hashGenerator = new ImageHashGenerator();
|
||||
ImageCache.SetUsageAsDictionary(_storage.TryLoad(new Dictionary<string, int>()));
|
||||
|
||||
foreach (var icon in new[] { Constant.DefaultIcon, Constant.ErrorIcon, Constant.LightThemedDefaultIcon, Constant.LightThemedErrorIcon })
|
||||
{
|
||||
@@ -78,7 +73,7 @@ namespace Wox.Infrastructure.Image
|
||||
public static void Save()
|
||||
{
|
||||
ImageCache.Cleanup();
|
||||
_storage.Save(ImageCache.GetUsageAsDictionary());
|
||||
ImageCache.Save();
|
||||
}
|
||||
|
||||
// Todo : Update it with icons specific to each theme.
|
||||
|
||||
Reference in New Issue
Block a user