:fire:增加自定义背景保存
This commit is contained in:
@@ -57,7 +57,8 @@ namespace GeekDesk.Util
|
||||
catch
|
||||
{
|
||||
DirectoryInfo dirInfo = new DirectoryInfo(Constants.DATA_FILE_BAK_DIR_PATH);
|
||||
FileInfo[] files = dirInfo.GetFiles();
|
||||
FileInfo[] files = dirInfo.GetFiles()
|
||||
.Where(f => f.Extension.Equals(".bak", StringComparison.OrdinalIgnoreCase)).ToArray(); ;
|
||||
if (files.Length > 0)
|
||||
{
|
||||
FileInfo[] sortedFiles = files.OrderByDescending(file => file.CreationTime).ToArray();
|
||||
|
||||
28
Util/DeepCopyUtil.cs
Normal file
28
Util/DeepCopyUtil.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
{
|
||||
public static class DeepCopyUtil
|
||||
{
|
||||
// 使用序列化和反序列化实现深度拷贝
|
||||
public static T DeepCopy<T>(T obj)
|
||||
{
|
||||
if (obj == null)
|
||||
throw new ArgumentNullException(nameof(obj));
|
||||
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
var formatter = new BinaryFormatter();
|
||||
formatter.Serialize(memoryStream, obj); // 序列化
|
||||
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||
return (T)formatter.Deserialize(memoryStream); // 反序列化
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -144,10 +144,10 @@ namespace GeekDesk.Util
|
||||
icon.Count++;
|
||||
|
||||
//隐藏搜索框
|
||||
if (RunTimeStatus.SEARCH_BOX_SHOW)
|
||||
{
|
||||
MainWindow.mainWindow.HidedSearchBox();
|
||||
}
|
||||
//if (RunTimeStatus.SEARCH_BOX_SHOW)
|
||||
//{
|
||||
// MainWindow.mainWindow.HidedSearchBox();
|
||||
//}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user