Skip to content

Commit 6092c6f

Browse files
author
Carl Chang
committed
fix cache threads not being calculated correctly;
rename cacheview;
1 parent fdaada5 commit 6092c6f

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

ContextMenuWindow.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ private void Menu_PreviewMouseDown(object sender, MouseButtonEventArgs e) {
9797
}
9898
break;
9999
case nameof(B_CacheFirst):
100-
CacheHelper.CacheView(ObjectInfo.FileSystemPath, true);
100+
CacheHelper.CachePath(ObjectInfo.FileSystemPath, true);
101101
break;
102102
case nameof(B_CacheAll):
103-
CacheHelper.CacheView(ObjectInfo.FileSystemPath, false);
103+
CacheHelper.CachePath(ObjectInfo.FileSystemPath, false);
104104
break;
105105
case nameof(B_Slideshow):
106106
var sldWin = new SlideshowWindow(ObjectInfo.ContainerPath);

Helpers/CacheHelper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace ZipImageViewer
1616
public static class CacheHelper
1717
{
1818
/// <param name="mainWin">If not null, MainWindow will be halted before caching is finished.</param>
19-
public static void CacheView(string cachePath, bool firstOnly, Window owner = null, MainWindow mainWin = null) {
19+
public static void CachePath(string cachePath, bool firstOnly, Window owner = null, MainWindow mainWin = null) {
2020
var bw = new BlockWindow(owner) {
2121
MessageTitle = GetRes("msg_Processing")
2222
};
@@ -112,9 +112,9 @@ void cacheObjInfo(ObjectInfo objInfo) {
112112
}
113113

114114
//calculate max thread count
115-
var threadCount = maxThreads > 0 ? MaxLoadThreads / 2 : maxThreads;
115+
var threadCount = maxThreads > 0 ? maxThreads : MaxLoadThreads / 2;
116116
if (threadCount < 1) threadCount = 1;
117-
//else if (threadCount > 6) threadCount = 6;
117+
else if (threadCount > MaxLoadThreads) threadCount = MaxLoadThreads;
118118

119119
//loop
120120
try {

MainWindow.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,10 @@ private void Sidebar_Click(object sender, MouseButtonEventArgs e) {
320320
openFolderPrompt();
321321
break;
322322
case nameof(HY_CacheFirst):
323-
CacheHelper.CacheView(CurrentPath, true, this, this);
323+
CacheHelper.CachePath(CurrentPath, true, this, this);
324324
break;
325325
case nameof(HY_CacheAll):
326-
CacheHelper.CacheView(CurrentPath, false, this, this);
326+
CacheHelper.CachePath(CurrentPath, false, this, this);
327327
break;
328328
case nameof(HY_Options):
329329
var win = new SettingsWindow(this);

0 commit comments

Comments
 (0)