straighten out handling of missing archive files
This commit is contained in:
parent
36cc8ba307
commit
f1dd4c625a
|
@ -14,12 +14,7 @@ namespace BizHawk.MultiClient
|
|||
/// <summary>
|
||||
/// returns whether a bound file exists. if there is no bound file, it can't exist
|
||||
/// </summary>
|
||||
public bool Exists { get { if (!rootExists) return false; return boundStream != null; } }
|
||||
|
||||
/// <summary>
|
||||
/// returns whether the root exists (the actual physical file)
|
||||
/// </summary>
|
||||
public bool RootExists { get { return rootExists; } }
|
||||
public bool Exists { get { return exists; } }
|
||||
|
||||
/// <summary>
|
||||
/// gets the directory containing the root
|
||||
|
@ -32,7 +27,7 @@ namespace BizHawk.MultiClient
|
|||
public Stream GetStream()
|
||||
{
|
||||
if (boundStream == null)
|
||||
throw new InvalidOperationException("HawkFil: Can't call GetStream() before youve successfully bound something!");
|
||||
throw new InvalidOperationException("HawkFile: Can't call GetStream() before youve successfully bound something!");
|
||||
return boundStream;
|
||||
}
|
||||
|
||||
|
@ -61,11 +56,6 @@ namespace BizHawk.MultiClient
|
|||
/// </summary>
|
||||
public bool IsArchive { get { return extractor != null; } }
|
||||
|
||||
public static bool PathExists(string path)
|
||||
{
|
||||
using (var hf = new HawkFile(path))
|
||||
return hf.Exists;
|
||||
}
|
||||
|
||||
public class ArchiveItem
|
||||
{
|
||||
|
@ -84,6 +74,7 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
|
||||
//---
|
||||
bool exists;
|
||||
bool rootExists;
|
||||
string rootPath;
|
||||
string memberPath;
|
||||
|
@ -108,6 +99,7 @@ namespace BizHawk.MultiClient
|
|||
return;
|
||||
|
||||
rootPath = path;
|
||||
exists = true;
|
||||
|
||||
AnalyzeArchive(path);
|
||||
if (extractor == null)
|
||||
|
@ -128,6 +120,8 @@ namespace BizHawk.MultiClient
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
exists = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@
|
|||
this.rAMPokeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.hexEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.luaConsoleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.nESToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.NESToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.pPUViewerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.nameTableViewerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.gameGenieCodesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -173,7 +173,7 @@
|
|||
this.viewToolStripMenuItem,
|
||||
this.configToolStripMenuItem,
|
||||
this.toolsToolStripMenuItem,
|
||||
this.nESToolStripMenuItem,
|
||||
this.NESToolStripMenuItem,
|
||||
this.helpToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
|
@ -1178,13 +1178,13 @@
|
|||
//
|
||||
// nESToolStripMenuItem
|
||||
//
|
||||
this.nESToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.NESToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.pPUViewerToolStripMenuItem,
|
||||
this.nameTableViewerToolStripMenuItem,
|
||||
this.gameGenieCodesToolStripMenuItem});
|
||||
this.nESToolStripMenuItem.Name = "nESToolStripMenuItem";
|
||||
this.nESToolStripMenuItem.Size = new System.Drawing.Size(38, 20);
|
||||
this.nESToolStripMenuItem.Text = "&NES";
|
||||
this.NESToolStripMenuItem.Name = "nESToolStripMenuItem";
|
||||
this.NESToolStripMenuItem.Size = new System.Drawing.Size(38, 20);
|
||||
this.NESToolStripMenuItem.Text = "&NES";
|
||||
//
|
||||
// pPUViewerToolStripMenuItem
|
||||
//
|
||||
|
@ -1381,7 +1381,7 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem saveConfigToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem loadConfigToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem replayInputLogToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem nESToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem NESToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem pPUViewerToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem nameTableViewerToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem gameGenieCodesToolStripMenuItem;
|
||||
|
|
|
@ -381,10 +381,10 @@ namespace BizHawk.MultiClient
|
|||
switch (system)
|
||||
{
|
||||
case "NES":
|
||||
nESToolStripMenuItem.Visible = true;
|
||||
NESToolStripMenuItem.Visible = true;
|
||||
break;
|
||||
default:
|
||||
nESToolStripMenuItem.Visible = false;
|
||||
NESToolStripMenuItem.Visible = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -394,7 +394,7 @@ namespace BizHawk.MultiClient
|
|||
using (var file = new HawkFile(path))
|
||||
{
|
||||
//if the provided file doesnt even exist, give up!
|
||||
if (!file.RootExists) return false;
|
||||
if (!file.Exists) return false;
|
||||
|
||||
//try binding normal rom extensions first
|
||||
if (!file.IsBound)
|
||||
|
@ -1097,7 +1097,7 @@ namespace BizHawk.MultiClient
|
|||
private void MainForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
//Hide platform specific menus until an appropriate ROM is loaded
|
||||
nESToolStripMenuItem.Visible = false;
|
||||
NESToolStripMenuItem.Visible = false;
|
||||
}
|
||||
|
||||
private void frameSkipToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace BizHawk.MultiClient
|
|||
using (var patchFile = new HawkFile(patch))
|
||||
{
|
||||
patchFile.BindFirstOf("IPS");
|
||||
if(patchFile.Exists)
|
||||
if(patchFile.IsBound)
|
||||
IPS.Patch(RomData, patchFile.GetStream());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue