From 8352aeaba634eaea181804037760a02c8628e72b Mon Sep 17 00:00:00 2001
From: Dinesh Solanki <15937452+dineshsolanki@users.noreply.github.com>
Date: Sun, 14 Jul 2024 00:13:49 +0530
Subject: [PATCH 01/13] Add Dummy image context menu
---
FoliCon/Views/ProSearchResult.xaml | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/FoliCon/Views/ProSearchResult.xaml b/FoliCon/Views/ProSearchResult.xaml
index ebc61881..da87bad7 100644
--- a/FoliCon/Views/ProSearchResult.xaml
+++ b/FoliCon/Views/ProSearchResult.xaml
@@ -13,6 +13,9 @@
mc:Ignorable="d"
prism:ViewModelLocator.AutoWireViewModel="True"
d:DataContext="{d:DesignInstance viewModels:ProSearchResultViewModel }">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FoliCon/Views/ManualExplorer.xaml.cs b/FoliCon/Views/ManualExplorer.xaml.cs
new file mode 100644
index 00000000..b62556b7
--- /dev/null
+++ b/FoliCon/Views/ManualExplorer.xaml.cs
@@ -0,0 +1,32 @@
+using System.Windows.Controls;
+
+namespace FoliCon.Views
+{
+ ///
+ /// Interaction logic for ManualExplorer
+ ///
+ public partial class ManualExplorer : UserControl
+ {
+ private bool _autoScroll = true;
+
+ public ManualExplorer()
+ {
+ InitializeComponent();
+ }
+
+ private void ScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e)
+ {
+ if (e.ExtentHeightChange == 0)
+ {
+
+ _autoScroll = ScrollViewer.VerticalOffset == ScrollViewer.ScrollableHeight;
+ }
+
+
+ if (_autoScroll && e.ExtentHeightChange != 0)
+ {
+ ScrollViewer.ScrollToVerticalOffset(ScrollViewer.ExtentHeight);
+ }
+ }
+ }
+}
From b17c74f5c62168f310b9442656930ce887da5d05 Mon Sep 17 00:00:00 2001
From: Dinesh Solanki <15937452+dineshsolanki@users.noreply.github.com>
Date: Tue, 16 Jul 2024 00:25:06 +0530
Subject: [PATCH 07/13] fix: change target directory path identifier
Changed the identifier for the target directory path from the dArtDownloadResponse.Filename to the deviationId for fixing the potential long path issue.
---
FoliCon/Modules/DeviantArt/DArt.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/FoliCon/Modules/DeviantArt/DArt.cs b/FoliCon/Modules/DeviantArt/DArt.cs
index 76984fc8..f554daa7 100644
--- a/FoliCon/Modules/DeviantArt/DArt.cs
+++ b/FoliCon/Modules/DeviantArt/DArt.cs
@@ -97,7 +97,7 @@ public async Task Download(string deviationId)
{
GetClientAccessTokenAsync();
var dArtDownloadResponse = await GetDArtDownloadResponseAsync(deviationId);
- var targetDirectoryPath = FileUtils.CreateDirectoryInFoliConTemp(dArtDownloadResponse.Filename);
+ var targetDirectoryPath = FileUtils.CreateDirectoryInFoliConTemp(deviationId);
dArtDownloadResponse.localDownloadPath = targetDirectoryPath;
var downloadResponse = await Services.HttpC.GetAsync(dArtDownloadResponse.Src);
From 345f3a6db6cc01681fc17be714803c60350cdc97 Mon Sep 17 00:00:00 2001
From: Dinesh Solanki <15937452+dineshsolanki@users.noreply.github.com>
Date: Tue, 16 Jul 2024 00:44:34 +0530
Subject: [PATCH 08/13] Complete pickMethod for ManualExtraction
A check has been added to differentiate between local and remote image paths when downloading images as files are local in case of ManualExtraction. The "FrameworkElement_OnUnloaded" event has been added to ensure image sources are properly released and no lock is present on them.
---
FoliCon/Modules/utils/FileUtils.cs | 19 ++++++-
FoliCon/ViewModels/MainWindowViewModel.cs | 11 +++-
FoliCon/ViewModels/ManualExplorerViewModel.cs | 24 +++++++--
.../ViewModels/ProSearchResultViewModel.cs | 7 ++-
FoliCon/Views/ManualExplorer.xaml | 11 ++--
FoliCon/Views/ManualExplorer.xaml.cs | 50 +++++++++++--------
6 files changed, 82 insertions(+), 40 deletions(-)
diff --git a/FoliCon/Modules/utils/FileUtils.cs b/FoliCon/Modules/utils/FileUtils.cs
index 78ebb3bd..ddfa991a 100644
--- a/FoliCon/Modules/utils/FileUtils.cs
+++ b/FoliCon/Modules/utils/FileUtils.cs
@@ -482,7 +482,7 @@ public static bool CreateDirectory(string path)
public static string CreateDirectoryInFoliConTemp(string path)
{
- var foliConTempPath = FoliConTempPath();
+ var foliConTempPath = FoliConTempDeviationsPath();
var fullPath = Path.Combine(foliConTempPath, path);
CreateDirectory(fullPath);
return fullPath;
@@ -504,8 +504,25 @@ public static void DeleteDirectoryIfEmpty(string targetDirectoryPath)
}
}
+ public static void DeleteFoliConTempDeviationDirectory(bool ifEmpty = false)
+ {
+ if (ifEmpty)
+ {
+ DeleteDirectoryIfEmpty(FoliConTempDeviationsPath());
+ }
+ else
+ {
+ Directory.Delete(FoliConTempDeviationsPath(), true);
+ }
+ }
+
private static string FoliConTempPath()
{
return Path.Combine(Path.GetTempPath(), "FoliCon");
}
+
+ private static string FoliConTempDeviationsPath()
+ {
+ return Path.Combine(FoliConTempPath(), "Deviations");
+ }
}
\ No newline at end of file
diff --git a/FoliCon/ViewModels/MainWindowViewModel.cs b/FoliCon/ViewModels/MainWindowViewModel.cs
index a8a30429..164ade62 100644
--- a/FoliCon/ViewModels/MainWindowViewModel.cs
+++ b/FoliCon/ViewModels/MainWindowViewModel.cs
@@ -806,7 +806,14 @@ private async Task DownloadAndMakeIconsAsync()
try
{
- await NetworkUtils.DownloadImageFromUrlAsync(img.RemotePath, img.LocalPath);
+ if (img.RemotePath.IsFile)
+ {
+ File.Move(img.RemotePath.AbsolutePath, img.LocalPath);
+ }
+ else
+ {
+ await NetworkUtils.DownloadImageFromUrlAsync(img.RemotePath, img.LocalPath);
+ }
}
catch (UnauthorizedAccessException e)
{
@@ -834,6 +841,7 @@ private async Task DownloadAndMakeIconsAsync()
}
IsMakeEnabled = true;
+ FileUtils.DeleteFoliConTempDeviationDirectory();
}
private void MakeIcons()
@@ -911,5 +919,6 @@ public void Dispose()
{
_tmdbClient?.Dispose();
GC.SuppressFinalize(this);
+ FileUtils.DeleteFoliConTempDeviationDirectory();
}
}
\ No newline at end of file
diff --git a/FoliCon/ViewModels/ManualExplorerViewModel.cs b/FoliCon/ViewModels/ManualExplorerViewModel.cs
index ece36bda..b6c8654c 100644
--- a/FoliCon/ViewModels/ManualExplorerViewModel.cs
+++ b/FoliCon/ViewModels/ManualExplorerViewModel.cs
@@ -15,12 +15,13 @@ public ManualExplorerViewModel()
OpenImageCommand = new DelegateCommand