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)
|
||||
{
|
||||
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);
|
||||
StartNewMovie(m, false);
|
||||
|
|
|
@ -173,7 +173,7 @@ namespace BizHawk.MultiClient
|
|||
return file;
|
||||
}
|
||||
|
||||
private void LoadLuaFile(string path)
|
||||
public void LoadLuaFile(string path)
|
||||
{
|
||||
if (LuaAlreadyInSession(path) == false)
|
||||
{
|
||||
|
@ -594,18 +594,22 @@ namespace BizHawk.MultiClient
|
|||
string[] filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
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();
|
||||
UpdateNumberOfScripts();
|
||||
}
|
||||
else if (Path.GetExtension(filePaths[0]) == (".luases"))
|
||||
else if (Path.GetExtension(path) == (".luases"))
|
||||
{
|
||||
LoadLuaSession(filePaths[0]);
|
||||
LoadLuaSession(path);
|
||||
RunLuaScripts();
|
||||
DisplayLuaList();
|
||||
UpdateNumberOfScripts();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -746,7 +750,7 @@ namespace BizHawk.MultiClient
|
|||
Global.Sound.StartSound();
|
||||
}
|
||||
|
||||
private bool LoadLuaSession(string path)
|
||||
public bool LoadLuaSession(string path)
|
||||
{
|
||||
var file = new FileInfo(path);
|
||||
if (file.Exists == false) return false;
|
||||
|
|
Loading…
Reference in New Issue