From c509a17a482d75f4ea37cb68bf6f85a267fa509c Mon Sep 17 00:00:00 2001
From: Lior Banai <36262995+LiorBanai@users.noreply.github.com>
Date: Sun, 12 Jul 2020 19:08:07 +0300
Subject: [PATCH] show open folder regardless of provider supplied folder. Fix
#229
---
Analogy/Analogy.csproj | 9 +++++-
Analogy/CommonChangeLog.cs | 6 ++--
Analogy/Forms/MainForm.cs | 65 ++++++++++++++++++--------------------
3 files changed, 42 insertions(+), 38 deletions(-)
diff --git a/Analogy/Analogy.csproj b/Analogy/Analogy.csproj
index cda44610..3839f750 100644
--- a/Analogy/Analogy.csproj
+++ b/Analogy/Analogy.csproj
@@ -628,7 +628,10 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
@@ -637,6 +640,10 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
diff --git a/Analogy/CommonChangeLog.cs b/Analogy/CommonChangeLog.cs
index cb429b64..e4152328 100644
--- a/Analogy/CommonChangeLog.cs
+++ b/Analogy/CommonChangeLog.cs
@@ -9,8 +9,10 @@ public static class CommonChangeLog
public static IEnumerable GetChangeLog()
{
return new List
- {
- new AnalogyChangeLog("Add ability to add notes to log messages. #217 ",AnalogChangeLogType.Improvement,"Lior Banai",new DateTime(2020,07,10)),
+ {
+ new AnalogyChangeLog("show open folder regardless of provider supplied folder. #229",AnalogChangeLogType.Improvement,"Lior Banai",new DateTime(2020,07,12)),
+ new AnalogyChangeLog("Add Support for reading compressed Zip files. #218",AnalogChangeLogType.Improvement,"Lior Banai",new DateTime(2020,07,11)),
+ new AnalogyChangeLog("Add ability to add notes to log messages. #217",AnalogChangeLogType.Improvement,"Lior Banai",new DateTime(2020,07,10)),
new AnalogyChangeLog("Shows AnalogyLogMessage's AdditionalInformation Properties in Detailed Window. #215",AnalogChangeLogType.Improvement,"Lior Banai",new DateTime(2020,07,10)),
new AnalogyChangeLog("System.ArgumentException when using the 'messages grouping' tab with a log file that contains custom columns. #225",AnalogChangeLogType.Bug,"Lior Banai",new DateTime(2020,07,10)),
new AnalogyChangeLog("Add providers icon to the ribbon page. #219",AnalogChangeLogType.Improvement,"Lior Banai",new DateTime(2020,07,09)),
diff --git a/Analogy/Forms/MainForm.cs b/Analogy/Forms/MainForm.cs
index c7e67765..74946fce 100644
--- a/Analogy/Forms/MainForm.cs
+++ b/Analogy/Forms/MainForm.cs
@@ -915,35 +915,30 @@ void OnXtcLogsOnControlRemoved(object sender, DockPanelEventArgs arg)
recentBar.RibbonStyle = RibbonItemStyles.All;
//local folder
- if (offlineProviders.Any(i => !string.IsNullOrEmpty(i.InitialFolderFullPath) &&
- Directory.Exists(i.InitialFolderFullPath)))
- {
- BarSubItem folderBar = new BarSubItem();
- folderBar.Caption = "Open Folder";
- folderBar.ImageOptions.Image = Resources.Open2_32x32;
- folderBar.ImageOptions.LargeImage = Resources.Open2_32x32;
- folderBar.RibbonStyle = RibbonItemStyles.All;
- group.ItemLinks.Add(folderBar);
- foreach (var dataProvider in offlineProviders)
- {
+ BarSubItem folderBar = new BarSubItem();
+ folderBar.Caption = "Open Folder";
+ folderBar.ImageOptions.Image = Resources.Open2_32x32;
+ folderBar.ImageOptions.LargeImage = Resources.Open2_32x32;
+ folderBar.RibbonStyle = RibbonItemStyles.All;
+ group.ItemLinks.Add(folderBar);
- //add local folder button:
- if (!string.IsNullOrEmpty(dataProvider.InitialFolderFullPath) &&
- Directory.Exists(dataProvider.InitialFolderFullPath))
- {
- BarButtonItem btn = new BarButtonItem { Caption = dataProvider.InitialFolderFullPath };
- btn.ItemClick += (s, be) =>
- {
- OpenOffline(dataProvider.OptionalTitle, dataProvider,
- dataProvider.InitialFolderFullPath);
- };
-
- folderBar.AddItem(btn);
- }
- }
+ foreach (var dataProvider in offlineProviders)
+ {
+ string directory = (!string.IsNullOrEmpty(dataProvider.InitialFolderFullPath) &&
+ Directory.Exists(dataProvider.InitialFolderFullPath))
+ ? dataProvider.InitialFolderFullPath
+ : Environment.CurrentDirectory;
+ //add local folder button:
+ BarButtonItem btn = new BarButtonItem { Caption = directory };
+ btn.ItemClick += (s, be) =>
+ {
+ OpenOffline(dataProvider.OptionalTitle, dataProvider, directory);
+ };
+ folderBar.AddItem(btn);
}
+
//add recent folders
//recent bar
BarSubItem recentFolders = new BarSubItem { Caption = "Recent Folders" };
@@ -1216,16 +1211,16 @@ void OnXtcLogsOnControlRemoved(object sender, DockPanelEventArgs arg)
}
//add local folder button:
- if (!string.IsNullOrEmpty(offlineAnalogy.InitialFolderFullPath) &&
- Directory.Exists(offlineAnalogy.InitialFolderFullPath))
- {
- BarButtonItem localfolder = new BarButtonItem();
- localfolder.Caption = "Open Folder";
- localfolder.RibbonStyle = RibbonItemStyles.All;
- group.ItemLinks.Add(localfolder);
- localfolder.ImageOptions.Image = Resources.Open2_32x32;
- localfolder.ItemClick += (sender, e) => { OpenOffline(title, offlineAnalogy.InitialFolderFullPath); };
- }
+ string directory = (!string.IsNullOrEmpty(offlineAnalogy.InitialFolderFullPath) &&
+ Directory.Exists(offlineAnalogy.InitialFolderFullPath))
+ ? offlineAnalogy.InitialFolderFullPath
+ : Environment.CurrentDirectory;
+ BarButtonItem localfolder = new BarButtonItem();
+ localfolder.Caption = "Open Folder";
+ localfolder.RibbonStyle = RibbonItemStyles.All;
+ group.ItemLinks.Add(localfolder);
+ localfolder.ImageOptions.Image = Resources.Open2_32x32;
+ localfolder.ItemClick += (sender, e) => { OpenOffline(title, directory); };
//recent folder
//recent bar