clean up recent roms contextmenu processing, and add support for launching the whole shell contextmenu.. its kind of cruddy though.
This commit is contained in:
parent
adf07367ad
commit
5ebb1b1e2e
|
@ -66,6 +66,9 @@
|
||||||
<NoWin32Manifest>true</NoWin32Manifest>
|
<NoWin32Manifest>true</NoWin32Manifest>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="GongShell">
|
||||||
|
<HintPath>..\References\GongShell.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="ICSharpCode.SharpZipLib">
|
<Reference Include="ICSharpCode.SharpZipLib">
|
||||||
<HintPath>..\References\ICSharpCode.SharpZipLib.dll</HintPath>
|
<HintPath>..\References\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
|
|
@ -37,7 +37,8 @@ namespace BizHawk.Client.EmuHawk.ToolExtensions
|
||||||
};
|
};
|
||||||
|
|
||||||
//TODO - use standard methods to split filename (hawkfile acquire?)
|
//TODO - use standard methods to split filename (hawkfile acquire?)
|
||||||
var hf = new HawkFile(temp);
|
var hf = new HawkFile();
|
||||||
|
hf.Parse(temp);
|
||||||
bool canExplore = true;
|
bool canExplore = true;
|
||||||
if (!File.Exists(hf.FullPathWithoutMember))
|
if (!File.Exists(hf.FullPathWithoutMember))
|
||||||
canExplore = false;
|
canExplore = false;
|
||||||
|
@ -50,31 +51,56 @@ namespace BizHawk.Client.EmuHawk.ToolExtensions
|
||||||
var timestamp = File.GetLastWriteTime(hf.FullPathWithoutMember);
|
var timestamp = File.GetLastWriteTime(hf.FullPathWithoutMember);
|
||||||
var tsmiTimestamp = new ToolStripLabel { Text = timestamp.ToString() };
|
var tsmiTimestamp = new ToolStripLabel { Text = timestamp.ToString() };
|
||||||
|
|
||||||
//make a menuitem to let you explore to it
|
|
||||||
var tsmiExplore = new ToolStripMenuItem { Text = "&Explore" };
|
|
||||||
tsmiExplore.Click += (o, ev) => { System.Diagnostics.Process.Start("explorer.exe", "/select, " + hf.FullPathWithoutMember); };
|
|
||||||
|
|
||||||
//make a menuitem to let you copy the path
|
|
||||||
var tsmiCopyPath = new ToolStripMenuItem { Text = "&Copy Canonical Path" };
|
|
||||||
tsmiCopyPath.Click += (o, ev) => { System.Windows.Forms.Clipboard.SetText(temp); };
|
|
||||||
|
|
||||||
tsdd.Items.Add(tsmiTimestamp);
|
tsdd.Items.Add(tsmiTimestamp);
|
||||||
var sep = new ToolStripSeparator();
|
tsdd.Items.Add(new ToolStripSeparator());
|
||||||
tsdd.Items.Add(sep);
|
|
||||||
tsdd.Items.Add(tsmiExplore);
|
|
||||||
tsdd.Items.Add(tsmiCopyPath);
|
|
||||||
|
|
||||||
//make a special action to open archive in default archiver
|
|
||||||
if (hf.IsArchive)
|
if (hf.IsArchive)
|
||||||
{
|
{
|
||||||
var tsmiOpenArchive = new ToolStripMenuItem { Text = "Open &Archive" };
|
//make a menuitem to let you copy the path
|
||||||
tsmiOpenArchive.Click += (o, ev) => { System.Diagnostics.Process.Start(hf.FullPathWithoutMember); };
|
var tsmiCopyCanonicalPath = new ToolStripMenuItem { Text = "&Copy Canonical Path" };
|
||||||
tsdd.Items.Add(tsmiOpenArchive);
|
tsmiCopyCanonicalPath.Click += (o, ev) => { System.Windows.Forms.Clipboard.SetText(temp); };
|
||||||
|
tsdd.Items.Add(tsmiCopyCanonicalPath);
|
||||||
|
|
||||||
var tsmiCopyArchivePath = new ToolStripMenuItem { Text = "Copy Archive Path" };
|
var tsmiCopyArchivePath = new ToolStripMenuItem { Text = "Copy Archive Path" };
|
||||||
tsmiCopyArchivePath.Click += (o, ev) => { System.Windows.Forms.Clipboard.SetText(hf.FullPathWithoutMember); };
|
tsmiCopyArchivePath.Click += (o, ev) => { System.Windows.Forms.Clipboard.SetText(hf.FullPathWithoutMember); };
|
||||||
tsdd.Items.Add(tsmiCopyArchivePath);
|
tsdd.Items.Add(tsmiCopyArchivePath);
|
||||||
|
|
||||||
|
var tsmiOpenArchive = new ToolStripMenuItem { Text = "Open &Archive" };
|
||||||
|
tsmiOpenArchive.Click += (o, ev) => { System.Diagnostics.Process.Start(hf.FullPathWithoutMember); };
|
||||||
|
tsdd.Items.Add(tsmiOpenArchive);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//make a menuitem to let you copy the path
|
||||||
|
var tsmiCopyPath = new ToolStripMenuItem { Text = "&Copy Path" };
|
||||||
|
tsmiCopyPath.Click += (o, ev) => { System.Windows.Forms.Clipboard.SetText(temp); };
|
||||||
|
tsdd.Items.Add(tsmiCopyPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
tsdd.Items.Add(new ToolStripSeparator());
|
||||||
|
|
||||||
|
//make a menuitem to let you explore to it
|
||||||
|
var tsmiExplore = new ToolStripMenuItem { Text = "&Explore" };
|
||||||
|
tsmiExplore.Click += (o, ev) => { System.Diagnostics.Process.Start("explorer.exe", "/select, " + hf.FullPathWithoutMember); };
|
||||||
|
tsdd.Items.Add(tsmiExplore);
|
||||||
|
|
||||||
|
var tsmiCopyFile = new ToolStripMenuItem { Text = "Copy &File" };
|
||||||
|
var lame = new System.Collections.Specialized.StringCollection();
|
||||||
|
lame.Add(hf.FullPathWithoutMember);
|
||||||
|
tsmiCopyFile.Click += (o, ev) => { System.Windows.Forms.Clipboard.SetFileDropList(lame); };
|
||||||
|
tsdd.Items.Add(tsmiCopyFile);
|
||||||
|
|
||||||
|
var tsmiTest = new ToolStripMenuItem { Text = "&Shell Context Menu" };
|
||||||
|
tsmiTest.Click += (o, ev) => {
|
||||||
|
var si = new GongSolutions.Shell.ShellItem(hf.FullPathWithoutMember);
|
||||||
|
var scm = new GongSolutions.Shell.ShellContextMenu(si);
|
||||||
|
var tsddi = o as ToolStripDropDownItem;
|
||||||
|
tsddi.Owner.Update();
|
||||||
|
scm.ShowContextMenu(tsddi.Owner, new System.Drawing.Point(0, 0));
|
||||||
|
};
|
||||||
|
tsdd.Items.Add(tsmiTest);
|
||||||
|
|
||||||
tsdd.Items.Add(new ToolStripSeparator());
|
tsdd.Items.Add(new ToolStripSeparator());
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ namespace BizHawk.Common
|
||||||
private string _memberPath;
|
private string _memberPath;
|
||||||
private Stream _rootStream, _boundStream;
|
private Stream _rootStream, _boundStream;
|
||||||
private IHawkFileArchiveHandler _extractor;
|
private IHawkFileArchiveHandler _extractor;
|
||||||
|
private bool _isArchive;
|
||||||
private List<HawkFileArchiveItem> _archiveItems;
|
private List<HawkFileArchiveItem> _archiveItems;
|
||||||
private int? _boundIndex;
|
private int? _boundIndex;
|
||||||
|
|
||||||
|
@ -89,6 +90,11 @@ namespace BizHawk.Common
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string FullPathWithoutMember { get { return _rootPath; } }
|
public string FullPathWithoutMember { get { return _rootPath; } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// returns the member path part of the bound file
|
||||||
|
/// </summary>
|
||||||
|
public string ArchiveMemberPath { get { return _memberPath; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// returns the extension of Name
|
/// returns the extension of Name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -97,7 +103,7 @@ namespace BizHawk.Common
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates whether this file is an archive
|
/// Indicates whether this file is an archive
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsArchive { get { return _extractor != null; } }
|
public bool IsArchive { get { return _isArchive; } }
|
||||||
|
|
||||||
public IList<HawkFileArchiveItem> ArchiveItems
|
public IList<HawkFileArchiveItem> ArchiveItems
|
||||||
{
|
{
|
||||||
|
@ -167,6 +173,26 @@ namespace BizHawk.Common
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string[] NonArchiveExtensions = { };
|
public string[] NonArchiveExtensions = { };
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Parses the given filename to create an un-opened HawkFile with some information available about its path constitution
|
||||||
|
/// </summary>
|
||||||
|
public void Parse(string path)
|
||||||
|
{
|
||||||
|
bool isArchivePath = IsCanonicalArchivePath(path);
|
||||||
|
if (isArchivePath)
|
||||||
|
{
|
||||||
|
var parts = path.Split('|');
|
||||||
|
path = parts[0];
|
||||||
|
_memberPath = parts[1];
|
||||||
|
//we're gonna assume, on parsing, that this is
|
||||||
|
_isArchive = true;
|
||||||
|
}
|
||||||
|
_rootPath = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Parses the given filename and then opens it. This may take a while (the archive may be accessed and scanned).
|
||||||
|
/// </summary>
|
||||||
public void Open(string path)
|
public void Open(string path)
|
||||||
{
|
{
|
||||||
if (_rootPath != null)
|
if (_rootPath != null)
|
||||||
|
@ -419,6 +445,7 @@ namespace BizHawk.Common
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ScanArchive();
|
ScanArchive();
|
||||||
|
_isArchive = true;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Loading…
Reference in New Issue