mirror of https://github.com/PCSX2/pcsx2.git
GSDumpGUI: Update textboxes after using the File Dialog.
Also, minor style changes.
This commit is contained in:
parent
c14c23a063
commit
62c1fc621a
|
@ -48,7 +48,7 @@ namespace GSDumpGUI
|
||||||
|
|
||||||
static private TreeNode CurrentNode;
|
static private TreeNode CurrentNode;
|
||||||
static public IntPtr hMainIcon;
|
static public IntPtr hMainIcon;
|
||||||
static public bool prog_running;
|
static public bool isProgRunning;
|
||||||
|
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main(String[] args)
|
static void Main(String[] args)
|
||||||
|
@ -118,14 +118,14 @@ namespace GSDumpGUI
|
||||||
Server.OnClientAfterConnect += new TCPLibrary.Core.Server.ConnectedHandler(Server_OnClientAfterConnect);
|
Server.OnClientAfterConnect += new TCPLibrary.Core.Server.ConnectedHandler(Server_OnClientAfterConnect);
|
||||||
Server.OnClientAfterDisconnected += new TCPLibrary.Core.Server.DisconnectedHandler(Server_OnClientAfterDisconnected);
|
Server.OnClientAfterDisconnected += new TCPLibrary.Core.Server.DisconnectedHandler(Server_OnClientAfterDisconnected);
|
||||||
Server.Enabled = true;
|
Server.Enabled = true;
|
||||||
prog_running = true;
|
isProgRunning = true;
|
||||||
|
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
frmMain = new GSDumpGUI();
|
frmMain = new GSDumpGUI();
|
||||||
Application.Run(frmMain);
|
Application.Run(frmMain);
|
||||||
|
|
||||||
prog_running = false;
|
isProgRunning = false;
|
||||||
Server.Enabled = false;
|
Server.Enabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,12 +94,12 @@ namespace GSDumpGUI
|
||||||
private readonly GsDumps _availableGsDumps;
|
private readonly GsDumps _availableGsDumps;
|
||||||
private readonly GsDlls _availableGsDlls;
|
private readonly GsDlls _availableGsDlls;
|
||||||
|
|
||||||
private List<FileSystemWatcher> dll_watcher;
|
private List<FileSystemWatcher> _dllWatcher;
|
||||||
private List<FileSystemWatcher> dump_watcher;
|
private List<FileSystemWatcher> _dumpWatcher;
|
||||||
|
|
||||||
private ConcurrentQueue<int> watcher_events;
|
private ConcurrentQueue<int> _watcherEvents;
|
||||||
|
|
||||||
private string gsdx_path_old, dump_path_old;
|
private string _gsdxPathOld, _dumpPathOld;
|
||||||
|
|
||||||
public GSDumpGUI()
|
public GSDumpGUI()
|
||||||
{
|
{
|
||||||
|
@ -116,6 +116,12 @@ namespace GSDumpGUI
|
||||||
|
|
||||||
_availableGsDumps.OnIndexUpdatedEvent += UpdatePreviewImage;
|
_availableGsDumps.OnIndexUpdatedEvent += UpdatePreviewImage;
|
||||||
|
|
||||||
|
if (String.IsNullOrEmpty(Settings.GSDXDir))
|
||||||
|
Settings.GSDXDir = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
|
|
||||||
|
if (String.IsNullOrEmpty(Settings.DumpDir))
|
||||||
|
Settings.DumpDir = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
|
|
||||||
txtGSDXDirectory.Text = Settings.GSDXDir;
|
txtGSDXDirectory.Text = Settings.GSDXDir;
|
||||||
txtDumpsDirectory.Text = Settings.DumpDir;
|
txtDumpsDirectory.Text = Settings.DumpDir;
|
||||||
|
|
||||||
|
@ -126,46 +132,43 @@ namespace GSDumpGUI
|
||||||
|
|
||||||
NoImage = CreateDefaultImage();
|
NoImage = CreateDefaultImage();
|
||||||
|
|
||||||
dll_watcher = new List<FileSystemWatcher>();
|
_dllWatcher = new List<FileSystemWatcher>();
|
||||||
dump_watcher = new List<FileSystemWatcher>();
|
_dumpWatcher = new List<FileSystemWatcher>();
|
||||||
watcher_events = new ConcurrentQueue<int>();
|
_watcherEvents = new ConcurrentQueue<int>();
|
||||||
|
|
||||||
Thread wt = new Thread(changes_watchdog_thread);
|
Thread watcherThread = new Thread(ChangesWatchdogThread);
|
||||||
wt.Start();
|
watcherThread.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changes_watchdog_thread()
|
private void ChangesWatchdogThread()
|
||||||
{
|
{
|
||||||
while (Program.prog_running)
|
while (Program.isProgRunning)
|
||||||
{
|
{
|
||||||
bool dll_reload = false;
|
bool dllReload = false;
|
||||||
bool dump_reload = false;
|
bool dumpReload = false;
|
||||||
|
|
||||||
int evt;
|
int evt;
|
||||||
while (watcher_events.TryDequeue(out evt))
|
while (_watcherEvents.TryDequeue(out evt))
|
||||||
{
|
{
|
||||||
if (evt == 1) dll_reload = true;
|
if (evt == 1) dllReload = true;
|
||||||
else if (evt == 2) dump_reload = true;
|
else if (evt == 2) dumpReload = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dll_reload) this.Invoke((MethodInvoker)delegate { ReloadGsdxDlls(); });
|
if (dllReload) this.Invoke((MethodInvoker)delegate { ReloadGsdxDlls(); });
|
||||||
if (dump_reload) this.Invoke((MethodInvoker)delegate { ReloadGsdxDumps(); });
|
if (dumpReload) this.Invoke((MethodInvoker)delegate { ReloadGsdxDumps(); });
|
||||||
|
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void OnDllDirChange(object source, FileSystemEventArgs e)
|
private void OnDllDirChange(object source, FileSystemEventArgs e)
|
||||||
{
|
{
|
||||||
watcher_events.Enqueue(1);
|
_watcherEvents.Enqueue(1);
|
||||||
//ReloadGsdxDlls();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDumpDirChange(object source, FileSystemEventArgs e)
|
private void OnDumpDirChange(object source, FileSystemEventArgs e)
|
||||||
{
|
{
|
||||||
watcher_events.Enqueue(2);
|
_watcherEvents.Enqueue(2);
|
||||||
//ReloadGsdxDumps();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void BindListControl<TModel, TElement>(ListControl lb, TModel model, Func<TModel, BindingList<TElement>> collectionAccessor, Expression<Func<TElement, string>> displayTextAccessor, Expression<Func<TModel, int>> selectedIndexAccessor)
|
private static void BindListControl<TModel, TElement>(ListControl lb, TModel model, Func<TModel, BindingList<TElement>> collectionAccessor, Expression<Func<TElement, string>> displayTextAccessor, Expression<Func<TModel, int>> selectedIndexAccessor)
|
||||||
|
@ -204,13 +207,13 @@ namespace GSDumpGUI
|
||||||
|
|
||||||
string[] paths = { "", "\\plugins", "\\dll", "\\dlls" };
|
string[] paths = { "", "\\plugins", "\\dll", "\\dlls" };
|
||||||
|
|
||||||
foreach (FileSystemWatcher w in dll_watcher)
|
foreach (FileSystemWatcher w in _dllWatcher)
|
||||||
{
|
{
|
||||||
w.EnableRaisingEvents = false;
|
w.EnableRaisingEvents = false;
|
||||||
w.Dispose();
|
w.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
dll_watcher.Clear();
|
_dllWatcher.Clear();
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
|
@ -222,7 +225,7 @@ namespace GSDumpGUI
|
||||||
w.Deleted += OnDllDirChange;
|
w.Deleted += OnDllDirChange;
|
||||||
w.Renamed += OnDllDirChange;
|
w.Renamed += OnDllDirChange;
|
||||||
w.EnableRaisingEvents = true;
|
w.EnableRaisingEvents = true;
|
||||||
dll_watcher.Add(w);
|
_dllWatcher.Add(w);
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
@ -243,13 +246,13 @@ namespace GSDumpGUI
|
||||||
|
|
||||||
string[] paths = { "", "\\dumps", "\\gsdumps" };
|
string[] paths = { "", "\\dumps", "\\gsdumps" };
|
||||||
|
|
||||||
foreach (FileSystemWatcher w in dump_watcher)
|
foreach (FileSystemWatcher w in _dumpWatcher)
|
||||||
{
|
{
|
||||||
w.EnableRaisingEvents = false;
|
w.EnableRaisingEvents = false;
|
||||||
w.Dispose();
|
w.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
dump_watcher.Clear();
|
_dumpWatcher.Clear();
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
|
@ -261,7 +264,7 @@ namespace GSDumpGUI
|
||||||
w.Deleted += OnDumpDirChange;
|
w.Deleted += OnDumpDirChange;
|
||||||
w.Renamed += OnDumpDirChange;
|
w.Renamed += OnDumpDirChange;
|
||||||
w.EnableRaisingEvents = true;
|
w.EnableRaisingEvents = true;
|
||||||
dump_watcher.Add(w);
|
_dumpWatcher.Add(w);
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
@ -291,6 +294,7 @@ namespace GSDumpGUI
|
||||||
string newpath = Path.GetDirectoryName(ofd.FileName);
|
string newpath = Path.GetDirectoryName(ofd.FileName);
|
||||||
if (!Settings.GSDXDir.ToLower().Equals(newpath.ToLower()))
|
if (!Settings.GSDXDir.ToLower().Equals(newpath.ToLower()))
|
||||||
{
|
{
|
||||||
|
txtGSDXDirectory.Text = newpath;
|
||||||
Settings.GSDXDir = newpath;
|
Settings.GSDXDir = newpath;
|
||||||
Settings.Save();
|
Settings.Save();
|
||||||
ReloadGsdxDlls();
|
ReloadGsdxDlls();
|
||||||
|
@ -313,6 +317,7 @@ namespace GSDumpGUI
|
||||||
string newpath = Path.GetDirectoryName(ofd.FileName);
|
string newpath = Path.GetDirectoryName(ofd.FileName);
|
||||||
if (!Settings.DumpDir.ToLower().Equals(newpath.ToLower()))
|
if (!Settings.DumpDir.ToLower().Equals(newpath.ToLower()))
|
||||||
{
|
{
|
||||||
|
txtDumpsDirectory.Text = newpath;
|
||||||
Settings.DumpDir = newpath;
|
Settings.DumpDir = newpath;
|
||||||
Settings.Save();
|
Settings.Save();
|
||||||
ReloadGsdxDumps();
|
ReloadGsdxDumps();
|
||||||
|
@ -506,12 +511,12 @@ namespace GSDumpGUI
|
||||||
|
|
||||||
private void txtGSDXDirectory_Enter(object sender, EventArgs e)
|
private void txtGSDXDirectory_Enter(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
gsdx_path_old = txtGSDXDirectory.Text;
|
_gsdxPathOld = txtGSDXDirectory.Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void txtDumpsDirectory_Enter(object sender, EventArgs e)
|
private void txtDumpsDirectory_Enter(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
dump_path_old = txtDumpsDirectory.Text;
|
_dumpPathOld = txtDumpsDirectory.Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void txtGSDXDirectory_Leave(object sender, EventArgs e)
|
private void txtGSDXDirectory_Leave(object sender, EventArgs e)
|
||||||
|
@ -519,7 +524,7 @@ namespace GSDumpGUI
|
||||||
string newpath = txtGSDXDirectory.Text;
|
string newpath = txtGSDXDirectory.Text;
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(newpath) &&
|
if (!String.IsNullOrEmpty(newpath) &&
|
||||||
!gsdx_path_old.ToLower().Equals(newpath.ToLower()) &&
|
!_gsdxPathOld.ToLower().Equals(newpath.ToLower()) &&
|
||||||
Directory.Exists(newpath))
|
Directory.Exists(newpath))
|
||||||
{
|
{
|
||||||
Settings.GSDXDir = newpath;
|
Settings.GSDXDir = newpath;
|
||||||
|
@ -534,7 +539,7 @@ namespace GSDumpGUI
|
||||||
string newpath = txtDumpsDirectory.Text;
|
string newpath = txtDumpsDirectory.Text;
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(newpath) &&
|
if (!String.IsNullOrEmpty(newpath) &&
|
||||||
!dump_path_old.ToLower().Equals(newpath.ToLower()) &&
|
!_dumpPathOld.ToLower().Equals(newpath.ToLower()) &&
|
||||||
Directory.Exists(newpath))
|
Directory.Exists(newpath))
|
||||||
{
|
{
|
||||||
Settings.DumpDir = newpath;
|
Settings.DumpDir = newpath;
|
||||||
|
|
Loading…
Reference in New Issue