Add drag & drop for lua and luases files to main window. Allow multiple lua script drop to console and main window
This commit is contained in:
parent
c8d07a5078
commit
93b266838c
|
@ -851,7 +851,27 @@ namespace BizHawk.MultiClient
|
||||||
private void FormDragDrop(object sender, DragEventArgs e)
|
private void FormDragDrop(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
string[] filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
|
string[] filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||||
if (IsValidMovieExtension(Path.GetExtension(filePaths[0])))
|
|
||||||
|
bool isLua = false;
|
||||||
|
foreach (string path in filePaths)
|
||||||
|
{
|
||||||
|
if (Path.GetExtension(path).ToUpper() == ".LUA")
|
||||||
|
{
|
||||||
|
OpenLuaConsole();
|
||||||
|
LuaConsole1.LoadLuaFile(path);
|
||||||
|
isLua = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isLua)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (Path.GetExtension(filePaths[0]).ToUpper() == ".LUASES")
|
||||||
|
{
|
||||||
|
OpenLuaConsole();
|
||||||
|
LuaConsole1.LoadLuaSession(filePaths[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (IsValidMovieExtension(Path.GetExtension(filePaths[0])))
|
||||||
{
|
{
|
||||||
Movie m = new Movie(filePaths[0], MOVIEMODE.PLAY);
|
Movie m = new Movie(filePaths[0], MOVIEMODE.PLAY);
|
||||||
StartNewMovie(m, false);
|
StartNewMovie(m, false);
|
||||||
|
|
|
@ -173,7 +173,7 @@ namespace BizHawk.MultiClient
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadLuaFile(string path)
|
public void LoadLuaFile(string path)
|
||||||
{
|
{
|
||||||
if (LuaAlreadyInSession(path) == false)
|
if (LuaAlreadyInSession(path) == false)
|
||||||
{
|
{
|
||||||
|
@ -594,18 +594,22 @@ namespace BizHawk.MultiClient
|
||||||
string[] filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
|
string[] filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (Path.GetExtension(filePaths[0]) == (".lua") || Path.GetExtension(filePaths[0]) == (".txt"))
|
foreach (string path in filePaths)
|
||||||
{
|
{
|
||||||
LoadLuaFile(filePaths[0]);
|
if (Path.GetExtension(path) == (".lua") || Path.GetExtension(path) == (".txt"))
|
||||||
|
{
|
||||||
|
LoadLuaFile(path);
|
||||||
DisplayLuaList();
|
DisplayLuaList();
|
||||||
UpdateNumberOfScripts();
|
UpdateNumberOfScripts();
|
||||||
}
|
}
|
||||||
else if (Path.GetExtension(filePaths[0]) == (".luases"))
|
else if (Path.GetExtension(path) == (".luases"))
|
||||||
{
|
{
|
||||||
LoadLuaSession(filePaths[0]);
|
LoadLuaSession(path);
|
||||||
RunLuaScripts();
|
RunLuaScripts();
|
||||||
DisplayLuaList();
|
DisplayLuaList();
|
||||||
UpdateNumberOfScripts();
|
UpdateNumberOfScripts();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -746,7 +750,7 @@ namespace BizHawk.MultiClient
|
||||||
Global.Sound.StartSound();
|
Global.Sound.StartSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool LoadLuaSession(string path)
|
public bool LoadLuaSession(string path)
|
||||||
{
|
{
|
||||||
var file = new FileInfo(path);
|
var file = new FileInfo(path);
|
||||||
if (file.Exists == false) return false;
|
if (file.Exists == false) return false;
|
||||||
|
|
Loading…
Reference in New Issue