mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-10 17:29:08 +00:00
Compare commits
2 Commits
copilot/fi
...
copilot/fi
Author | SHA1 | Date | |
---|---|---|---|
![]() |
19bba7f229 | ||
![]() |
7a05793bf7 |
@@ -58,16 +58,50 @@ public partial class InfoPanel : UserControl
|
||||
Dispatcher.BeginInvoke(new Action(() => image.Source = source));
|
||||
});
|
||||
|
||||
var name = Path.GetFileName(path);
|
||||
string name;
|
||||
try
|
||||
{
|
||||
name = Path.GetFileName(path);
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
// Handle invalid path characters gracefully
|
||||
name = path;
|
||||
}
|
||||
catch (PathTooLongException)
|
||||
{
|
||||
// Handle path too long scenarios
|
||||
name = path;
|
||||
}
|
||||
filename.Text = string.IsNullOrEmpty(name) ? path : name;
|
||||
|
||||
try
|
||||
{
|
||||
var last = File.GetLastWriteTime(path);
|
||||
modDate.Text = string.Format(TranslationHelper.Get("InfoPanel_LastModified"),
|
||||
last.ToString(CultureInfo.CurrentCulture));
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
// Handle invalid path characters gracefully
|
||||
modDate.Text = TranslationHelper.Get("InfoPanel_LastModified_Unavailable") ?? "Last modified: Unavailable";
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
// Handle access denied scenarios
|
||||
modDate.Text = TranslationHelper.Get("InfoPanel_LastModified_Unavailable") ?? "Last modified: Unavailable";
|
||||
}
|
||||
catch (PathTooLongException)
|
||||
{
|
||||
// Handle path too long scenarios
|
||||
modDate.Text = TranslationHelper.Get("InfoPanel_LastModified_Unavailable") ?? "Last modified: Unavailable";
|
||||
}
|
||||
|
||||
Stop = false;
|
||||
|
||||
_ = Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(path))
|
||||
{
|
||||
@@ -117,6 +151,22 @@ public partial class InfoPanel : UserControl
|
||||
$"{totalSizeL.ToPrettySize(2)} {t}";
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
// Handle invalid path characters gracefully
|
||||
Dispatcher.Invoke(() => { totalSize.Text = "Size: Unavailable"; });
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
// Handle access denied scenarios
|
||||
Dispatcher.Invoke(() => { totalSize.Text = "Size: Unavailable"; });
|
||||
}
|
||||
catch (PathTooLongException)
|
||||
{
|
||||
// Handle path too long scenarios
|
||||
Dispatcher.Invoke(() => { totalSize.Text = "Size: Unavailable"; });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user