Skip to content

Commit b74b3b3

Browse files
authored
Dev 1.1.9 (#14)
* move usnState update out of loop. * fix the icon crash casused by early disposed * CacheLength added
1 parent a4ce15f commit b74b3b3

File tree

8 files changed

+22
-17
lines changed

8 files changed

+22
-17
lines changed

EngineCore/Engine/Actions/USN/FrnFileClass.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ public void DoWhileFileChanges() //筛选USN状态改变
132132
files.Remove(f.FileReferenceNumber);
133133
}
134134
}
135-
usnStates = newUsnState; //更新状态
136135
}
136+
usnStates = newUsnState; //更新状态
137137
}
138138
}
139139

EngineCore/Utils/FileIconService.cs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Microsoft.IO;
2+
using System.Collections.Concurrent;
23
using System.Diagnostics;
34
using System.Drawing;
45
using System.Runtime.InteropServices;
@@ -115,7 +116,7 @@ uint uFlags
115116
return null;
116117
}
117118

118-
const int maxCache = 500;
119+
//const int maxCache = 500;
119120

120121
static void SetCache(string ext,Bitmap? icon)
121122
{
@@ -124,16 +125,16 @@ static void SetCache(string ext,Bitmap? icon)
124125

125126
if (!iconCache.ContainsKey(ext))
126127
{
127-
if (iconCache.Count() > maxCache)
128-
{
129-
foreach (var item in iconCache)
130-
{
131-
item.Value.Dispose();
132-
}
133-
iconCache.Clear();
134-
}
128+
//if (iconCache.Count() > maxCache)
129+
//{
130+
// foreach (var item in iconCache)
131+
// {
132+
// item.Value.Dispose();
133+
// }
134+
// iconCache.Clear();
135+
//}
135136

136-
iconCache.Add(ext, icon);
137+
iconCache.TryAdd(ext, icon);
137138
}
138139
}
139140

@@ -142,12 +143,12 @@ static bool GetCache(string ext, out Bitmap? icon)
142143
return iconCache.TryGetValue(ext, out icon);
143144
}
144145

145-
static Dictionary<string , Bitmap> iconCache=new Dictionary<string , Bitmap>(64);
146+
static ConcurrentDictionary<string , Bitmap> iconCache=new ConcurrentDictionary<string , Bitmap>();
146147

147148

148149
private static readonly RecyclableMemoryStreamManager
149150
recyclableMemoryStreamManager =
150-
new RecyclableMemoryStreamManager(new RecyclableMemoryStreamManager.Options(2048, 2048,4096, 2048 * 500, 2048 * 500));
151+
new RecyclableMemoryStreamManager(/*new RecyclableMemoryStreamManager.Options(2048, 2048,4096, 2048 * 500, 2048 * 500)*/);
151152
private static Bitmap? ConvertToAvaloniaBitmap(System.Drawing.Bitmap systemBitmap)
152153
{
153154
int targetSize = 32;

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# TDS - The Ultimate Windows File Finder
22

3-
[2025.1.1.8] Welcome to TDS, your go-to tool for lightning-fast file searches on Windows systems.
3+
[2025.1.1.9] Welcome to TDS, your go-to tool for lightning-fast file searches on Windows systems.
44

55
(Tip:Support Pinyin Initial Abbreviation Translation.)
66

TDSAot/MainWindow/MainWindow.axaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<!-- 正确的 ItemsPanel 配置 -->
7070
<ListBox.ItemsPanel>
7171
<ItemsPanelTemplate>
72-
<VirtualizingStackPanel />
72+
<VirtualizingStackPanel CacheLength="1" />
7373
</ItemsPanelTemplate>
7474
</ListBox.ItemsPanel>
7575

TDSAot/MainWindow/MainWindow_Event.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public partial class MainWindow : Window
2525
string bufferedText_prev = string.Empty;
2626
string bufferedText = string.Empty;
2727
private void GoSearch()
28-
{
28+
{
2929
if (string.IsNullOrWhiteSpace(bufferedText))
3030
{
3131
words = [];

TDSAot/MainWindow/MainWindow_TaskLoop.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ private async void SearchFilesThreadLoop(CancellationToken cancellationToken)
248248

249249
if (resultNum < 50)//提前显示
250250
{
251+
if (resultNum == 1)
252+
{
253+
Debug.WriteLine(f.fileReferenceNumber.ToString());
254+
}
251255
resultNumGlobal = resultNum;
252256
UpdateList(false); //必须异步BeginInvoke,不然不同步
253257
}

TDSAot/State/AppInfomation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ internal class AppInfomation
1010
{
1111
public const string AboutTitle = "About TDS";
1212
public const string AboutInfo =
13-
"v2025.1.1.8 (c) 2018-2025\r\n"+
13+
"v2025.1.1.9 (c) 2018-2025\r\n"+
1414
"\r\n"+
1515
"Sample:\r\n"+
1616
"List all the files with the name contains \"log\" and ended with \".json\" in the folder \"App\" from disks \"c:\" and \"d:\"\r\n" +

result.gif

3.02 MB
Loading

0 commit comments

Comments
 (0)