Path Config - implement path config for watch files

This commit is contained in:
andres.delikat 2011-05-03 02:32:21 +00:00
parent dc4c1d54d3
commit 344e50e33d
4 changed files with 41 additions and 5 deletions

View File

@ -18,10 +18,20 @@
TI83Controller[0] = new TI83ControllerTemplate(true);
}
// Directories
public string LastRomPath = ".";
public string BasePath = ".";
public string BaseNES = ".\\NES";
public string BaseSMS = ".\\SMS";
public string BaseGenesis = ".\\Genesis";
public string BasePCE = ".\\PCE";
public string BaseGameboy = ".\\Gameboy";
public string BaseTI83 = ".\\TI83";
public string WatchPath = ".";
// General Client Settings
public int TargetZoomFactor = 2;
public string LastRomPath = ".";
public bool AutoLoadMostRecentRom = false; //TODO: eventually make a class or struct for all the auto-loads, which will include recent roms, movies, etc, as well as autoloading any modeless dialog
public bool AutoLoadMostRecentRom = false;
public RecentFiles RecentRoms = new RecentFiles(8);
public bool PauseWhenMenuActivated = true;
public bool SaveWindowPosition = true;

View File

@ -219,6 +219,7 @@
this.BrowseWatch.TabIndex = 15;
this.BrowseWatch.Text = "Browse";
this.BrowseWatch.UseVisualStyleBackColor = true;
this.BrowseWatch.Click += new System.EventHandler(this.BrowseWatch_Click);
//
// MoviesBox
//

View File

@ -6,6 +6,8 @@ using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Reflection;
namespace BizHawk.MultiClient
{
@ -19,6 +21,7 @@ namespace BizHawk.MultiClient
//Path text boxes shoudl be anchored L + R and the remaining widgets anchored R
//Alight everything in each tab the same
string EXEPath;
public PathConfig()
{
@ -27,12 +30,24 @@ namespace BizHawk.MultiClient
private void PathConfig_Load(object sender, EventArgs e)
{
EXEPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
WatchBox.Text = Global.Config.WatchPath;
}
private string ProcessPath(string path)
{
//if (path == "`recent`")
if (path == "%base%")
return BasePathBox.Text;
if (path == "%exe%")
return EXEPath;
return path;
}
private void SaveSettings()
{
Global.Config.WatchPath = WatchBox.Text;
}
private void Cancel_Click(object sender, EventArgs e)
@ -85,5 +100,15 @@ namespace BizHawk.MultiClient
TI83BrowseROMs.Enabled = true;
}
}
private void BrowseWatch_Click(object sender, EventArgs e)
{
FolderBrowserDialog f = new FolderBrowserDialog();
f.Description = "Set the directory for Watch (.wch) files";
//TODO: find a way to set root folder to base
DialogResult result = f.ShowDialog();
if (result == DialogResult.OK)
WatchBox.Text = f.SelectedPath;
}
}
}

View File

@ -586,7 +586,7 @@ namespace BizHawk.MultiClient
var ofd = new OpenFileDialog();
if (currentWatchFile.Length > 0)
ofd.FileName = Path.GetFileNameWithoutExtension(currentWatchFile);
ofd.InitialDirectory = Global.Config.LastRomPath;
ofd.InitialDirectory = Global.Config.WatchPath;
ofd.Filter = "Watch Files (*.wch)|*.wch|All Files|*.*";
ofd.RestoreDirectory = true;
@ -635,7 +635,7 @@ namespace BizHawk.MultiClient
sfd.FileName = Path.GetFileNameWithoutExtension(currentWatchFile);
else if (!(Global.Emulator is NullEmulator))
sfd.FileName = Global.Game.Name;
sfd.InitialDirectory = Global.Config.LastRomPath;
sfd.InitialDirectory = Global.Config.WatchPath;
sfd.Filter = "Watch Files (*.wch)|*.wch|All Files|*.*";
sfd.RestoreDirectory = true;
Global.Sound.StopSound();