X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=AppliStation%2FAppliStation.Util%2FToolStripPetitLauncherMenuItem.cs;h=be9e074c36f1e80cc262e95b27d54d57513575d8;hb=02c471102b6654a7ebd3f4e6b994307e2058731c;hp=b90d67489588462f1b333ccc5a8875d07f529638;hpb=32bc8532eff2826912feb85062514c69f3542355;p=applistation%2FAppliStation.git
diff --git a/AppliStation/AppliStation.Util/ToolStripPetitLauncherMenuItem.cs b/AppliStation/AppliStation.Util/ToolStripPetitLauncherMenuItem.cs
index b90d674..be9e074 100644
--- a/AppliStation/AppliStation.Util/ToolStripPetitLauncherMenuItem.cs
+++ b/AppliStation/AppliStation.Util/ToolStripPetitLauncherMenuItem.cs
@@ -81,24 +81,31 @@ namespace AppliStation.Util
}
}
- private void _insertItemFor(string filepath, ref bool cmdIsAdded)
+ private void _insertItemFor(string filepath, ref bool cmdIsAdded, string basedir)
{
string extension = Path.GetExtension(filepath).ToLower();
+
+ string dirname = Path.GetDirectoryName(filepath);
+ string itemtext = NaGet.Utils.GetRelativePath(basedir, filepath);
+#if DEBUG
+Debug.Assert(! itemtext.Contains(".."), string.Format("{2} -- base:{0}, dirname:{1}", basedir, dirname, itemtext));
+#endif
+
if (extension == ".exe") {
switch (NaGet.InteropServices.PEFileInfoUtils.GetPEFileType(filepath)) {
- case NaGet.InteropServices.PEFileInfoUtils.PEFileType.WinGUI:
- _addToItemsInv(CreateMenuItemForFile(filepath));
+ case NaGet.InteropServices.PEFileType.WinGUI:
+ _addToItemsInv(CreateMenuItemForFile(filepath, itemtext));
break;
- case NaGet.InteropServices.PEFileInfoUtils.PEFileType.WinConsole:
- case NaGet.InteropServices.PEFileInfoUtils.PEFileType.MSDosCom:
+ case NaGet.InteropServices.PEFileType.WinConsole:
+ case NaGet.InteropServices.PEFileType.MSDosCom:
if (! cmdIsAdded) {
- _insertToItemsInv(0, CreateMenuItemForCmdAt(Path.GetDirectoryName(filepath)));
+ _insertToItemsInv(0, CreateMenuItemForCmdAt(basedir));
cmdIsAdded = true;
}
break;
}
} else if ((extension == ".bat") || (extension == ".lnk")) {
- _addToItemsInv(CreateMenuItemForFile(filepath));
+ _addToItemsInv(CreateMenuItemForFile(filepath, itemtext));
}
}
@@ -106,7 +113,7 @@ namespace AppliStation.Util
private void buildItems()
{
try {
- string folderPath = baseFolderPath;
+ string folderPath = Path.GetFullPath(baseFolderPath);
ToolStripSeparator sep = new ToolStripSeparator();
bool cmdIsAdded = false;
@@ -117,7 +124,16 @@ namespace AppliStation.Util
foreach (string filepath in Directory.GetFiles(folderPath)) {
if (baseFolderPath != folderPath) return; // éä¸ã§ãªããæä½ããã¦ãããªãã°çµäº
- _insertItemFor(filepath, ref cmdIsAdded);
+ _insertItemFor(filepath, ref cmdIsAdded, folderPath);
+ }
+
+ string bindir = Path.Combine(folderPath, "bin");
+ if (Directory.Exists(bindir)) {
+ foreach (string filepath in Directory.GetFiles(bindir)) {
+ if (baseFolderPath != folderPath) return; // éä¸ã§ãªããæä½ããã¦ãããªãã°çµäº
+
+ _insertItemFor(filepath, ref cmdIsAdded, folderPath);
+ }
}
}
} catch (ThreadInterruptedException) {}
@@ -132,9 +148,9 @@ namespace AppliStation.Util
///
public static ToolStripMenuItem CreateMenuItemForFolder(string folderPath)
{
- ToolStripMenuItem item = CreateMenuItemForFile(folderPath);
+ ToolStripMenuItem item = CreateMenuItemForFile(folderPath, "ãã©ã«ããéã(&O)");
item.Image = GUIUtils.GetShellIconForFolder().ToBitmap();
- item.Text = "ãã©ã«ããéã(&O)";
+ item.ShowShortcutKeys = true;
return item;
}
@@ -143,12 +159,11 @@ namespace AppliStation.Util
///
/// ãã¡ã¤ã«ãã¹
/// çæãããã¡ãã¥ã¼ã¢ã¤ãã
- public static ToolStripMenuItem CreateMenuItemForFile(string filePath)
+ public static ToolStripMenuItem CreateMenuItemForFile(string filePath, string text)
{
ToolStripMenuItem item = new ToolStripMenuItem();
- string fileName = Path.GetFileName(filePath);
- item.Text = fileName;
+ item.Text = text;
item.ShowShortcutKeys = false;
item.Tag = filePath;
item.Click += new System.EventHandler(menuItemForFileClicked);