Browse Source

Converted MoonSharp line endings to OSX for consistency with rest of project.

master
Christopher 9 years ago
parent
commit
aeda0dedec
  1. 10
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Debugger/DebuggerLogic/IAsyncDebuggerClient.cs
  2. 66
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Debugger/DebuggerLogic/MoonSharpDebugSession.cs
  3. 6
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Debugger/DebuggerLogic/VariableInspector.cs
  4. 796
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Debugger/MoonSharpVsCodeDebugServer.cs
  5. 50
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Debugger/SDK/DebugSession.cs
  6. 50
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Debugger/SDK/Protocol.cs
  7. 58
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Debugger/SDK/Utilities.cs
  8. 16
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/AsyncExtensions.cs
  9. 6
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Compatibility/Attributes.cs
  10. 32
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Compatibility/Framework.cs
  11. 150
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Compatibility/Frameworks/Base/FrameworkBase.cs
  12. 230
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Compatibility/Frameworks/Base/FrameworkClrBase.cs
  13. 152
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Compatibility/Frameworks/Base/FrameworkReflectionBase.cs
  14. 62
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Compatibility/Frameworks/FrameworkCLR.cs
  15. 262
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Compatibility/Frameworks/FrameworkCore.cs
  16. 56
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Compatibility/Frameworks/FrameworkPCL.cs
  17. 318
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Compatibility/Frameworks/FrameworkWin8.cs
  18. 2
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/CoreLib/BasicModule.cs
  19. 4
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/CoreLib/IO/FileUserDataBase.cs
  20. 6
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/CoreLib/IoModule.cs
  21. 4
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/CoreLib/LoadModule.cs
  22. 4
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/CoreLib/OsTimeModule.cs
  23. 6
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/DataTypes/CallbackFunction.cs
  24. 20
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/DataTypes/UserData.cs
  25. 8
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Errors/DynamicExpressionException.cs
  26. 4
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Errors/InternalErrorException.cs
  27. 4
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Errors/InterpreterException.cs
  28. 4
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Errors/ScriptRuntimeException.cs
  29. 2
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Errors/SyntaxErrorException.cs
  30. 8
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Execution/VM/ByteCode.cs
  31. 14
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Execution/VM/Processor/Processor.cs
  32. 12
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/IO/UndisposableStream.cs
  33. 2
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/BasicDescriptors/DispatchingUserDataDescriptor.cs
  34. 4
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/BasicDescriptors/ParameterDescriptor.cs
  35. 12
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/Converters/ClrToScriptConversions.cs
  36. 4
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/Converters/ScriptToClrConversions.cs
  37. 4
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/Converters/TableConversions.cs
  38. 16
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/DescriptorHelpers.cs
  39. 1088
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/LuaStateInterop/Tools.cs
  40. 4
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/PropertyTableAssigner.cs
  41. 2
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/AutoDescribingUserDataDescriptor.cs
  42. 4
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/CompositeUserDataDescriptor.cs
  43. 2
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/MemberDescriptors/FunctionMemberDescriptorBase.cs
  44. 4
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/ProxyUserDataDescriptor.cs
  45. 4
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/EventMemberDescriptor.cs
  46. 4
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/FieldMemberDescriptor.cs
  47. 2
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/MethodMemberDescriptor.cs
  48. 6
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/OverloadedMethodMemberDescriptor.cs
  49. 2
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/PropertyMemberDescriptor.cs
  50. 2
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/ValueTypeDefaultCtorMemberDescriptor.cs
  51. 2
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/StandardEnumUserDataDescriptor.cs
  52. 8
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/StandardGenericsUserDataDescriptor.cs
  53. 28
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/StandardUserDataDescriptor.cs
  54. 16
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/UserDataRegistries/ExtensionMethodsRegistry.cs
  55. 192
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/UserDataRegistries/TypeDescriptorRegistry.cs
  56. 18
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Loaders/EmbeddedResourcesScriptLoader.cs
  57. 348
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Loaders/UnityAssetsScriptLoader.cs
  58. 14
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Modules/ModuleRegister.cs
  59. 98
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Platforms/DotNetCorePlatformAccessor.cs
  60. 156
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Platforms/PlatformAccessorBase.cs
  61. 58
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Platforms/PlatformAutoDetector.cs
  62. 136
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Platforms/StandardPlatformAccessor.cs
  63. 22
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Script.cs
  64. 2
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Serialization/ObjectValueConverter.cs
  65. 6
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Tree/Lexer/LexerUtils.cs
  66. 14
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Tree/Statements/FunctionCallStatement.cs

10
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Debugger/DebuggerLogic/IAsyncDebuggerClient.cs vendored

@ -1,5 +1,5 @@
#if (!PCL) && ((!UNITY_5) || UNITY_STANDALONE) #if (!PCL) && ((!UNITY_5) || UNITY_STANDALONE)
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -15,9 +15,9 @@ namespace MoonSharp.VsCodeDebugger.DebuggerLogic
void OnWatchesUpdated(WatchType watchType); void OnWatchesUpdated(WatchType watchType);
void OnSourceCodeChanged(int sourceID); void OnSourceCodeChanged(int sourceID);
void OnExecutionEnded(); void OnExecutionEnded();
void OnException(ScriptRuntimeException ex); void OnException(ScriptRuntimeException ex);
void Unbind(); void Unbind();
} }
} }
#endif #endif

66
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Debugger/DebuggerLogic/MoonSharpDebugSession.cs vendored

@ -1,5 +1,5 @@
#if (!PCL) && ((!UNITY_5) || UNITY_STANDALONE) #if (!PCL) && ((!UNITY_5) || UNITY_STANDALONE)
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -32,19 +32,19 @@ namespace MoonSharp.VsCodeDebugger.DebuggerLogic
} }
public override void Initialize(Response response, Table args) public override void Initialize(Response response, Table args)
{ {
#if DOTNET_CORE #if DOTNET_CORE
SendText("Connected to MoonSharp {0} [{1}]", SendText("Connected to MoonSharp {0} [{1}]",
Script.VERSION, Script.VERSION,
Script.GlobalOptions.Platform.GetPlatformName()); Script.GlobalOptions.Platform.GetPlatformName());
#else #else
SendText("Connected to MoonSharp {0} [{1}] on process {2} (PID {3})", SendText("Connected to MoonSharp {0} [{1}] on process {2} (PID {3})",
Script.VERSION, Script.VERSION,
Script.GlobalOptions.Platform.GetPlatformName(), Script.GlobalOptions.Platform.GetPlatformName(),
System.Diagnostics.Process.GetCurrentProcess().ProcessName, System.Diagnostics.Process.GetCurrentProcess().ProcessName,
System.Diagnostics.Process.GetCurrentProcess().Id); System.Diagnostics.Process.GetCurrentProcess().Id);
#endif #endif
SendText("Debugging script '{0}'; use the debug console to debug another script.", m_Debug.Name); SendText("Debugging script '{0}'; use the debug console to debug another script.", m_Debug.Name);
SendText("Type '!help' in the Debug Console for available commands."); SendText("Type '!help' in the Debug Console for available commands.");
@ -174,31 +174,31 @@ namespace MoonSharp.VsCodeDebugger.DebuggerLogic
SendText("Notifications of execution end are : {0}", m_NotifyExecutionEnd ? "enabled" : "disabled"); SendText("Notifications of execution end are : {0}", m_NotifyExecutionEnd ? "enabled" : "disabled");
} }
else if (cmd == "list") else if (cmd == "list")
{ {
int currId = m_Server.CurrentId ?? -1000; int currId = m_Server.CurrentId ?? -1000;
foreach (var pair in m_Server.GetAttachedDebuggersByIdAndName()) foreach (var pair in m_Server.GetAttachedDebuggersByIdAndName())
{ {
string isthis = (pair.Key == m_Debug.Id) ? " (this)" : ""; string isthis = (pair.Key == m_Debug.Id) ? " (this)" : "";
string isdef = (pair.Key == currId) ? " (default)" : ""; string isdef = (pair.Key == currId) ? " (default)" : "";
SendText("{0} : {1}{2}{3}", pair.Key.ToString().PadLeft(9), pair.Value, isdef, isthis); SendText("{0} : {1}{2}{3}", pair.Key.ToString().PadLeft(9), pair.Value, isdef, isthis);
} }
} }
else if (cmd.StartsWith("select") || cmd.StartsWith("switch")) else if (cmd.StartsWith("select") || cmd.StartsWith("switch"))
{ {
string arg = cmd.Substring("switch".Length).Trim(); string arg = cmd.Substring("switch".Length).Trim();
try try
{ {
int id = int.Parse(arg); int id = int.Parse(arg);
m_Server.CurrentId = id; m_Server.CurrentId = id;
if (cmd.StartsWith("switch")) if (cmd.StartsWith("switch"))
Unbind(); Unbind();
else else
SendText("Next time you'll attach the debugger, it will be atteched to script #{0}", id); SendText("Next time you'll attach the debugger, it will be atteched to script #{0}", id);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -447,14 +447,14 @@ namespace MoonSharp.VsCodeDebugger.DebuggerLogic
public void OnException(ScriptRuntimeException ex) public void OnException(ScriptRuntimeException ex)
{ {
SendText("runtime error : {0}", ex.DecoratedMessage); SendText("runtime error : {0}", ex.DecoratedMessage);
} }
public void Unbind() public void Unbind()
{ {
SendText("Debug session has been closed by the hosting process."); SendText("Debug session has been closed by the hosting process.");
SendText("Bye."); SendText("Bye.");
SendEvent(new TerminatedEvent()); SendEvent(new TerminatedEvent());
} }
} }
} }
#endif #endif

6
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Debugger/DebuggerLogic/VariableInspector.cs vendored

@ -1,5 +1,5 @@
#if (!PCL) && ((!UNITY_5) || UNITY_STANDALONE) #if (!PCL) && ((!UNITY_5) || UNITY_STANDALONE)
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -83,6 +83,6 @@ namespace MoonSharp.VsCodeDebugger.DebuggerLogic
} }
} }
} }
} }
#endif #endif

796
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Debugger/MoonSharpVsCodeDebugServer.cs vendored

@ -1,399 +1,399 @@
#if (!PCL) && ((!UNITY_5) || UNITY_STANDALONE) #if (!PCL) && ((!UNITY_5) || UNITY_STANDALONE)
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using MoonSharp.VsCodeDebugger.DebuggerLogic; using MoonSharp.VsCodeDebugger.DebuggerLogic;
using MoonSharp.Interpreter; using MoonSharp.Interpreter;
using MoonSharp.Interpreter.Debugging; using MoonSharp.Interpreter.Debugging;
using MoonSharp.VsCodeDebugger.SDK; using MoonSharp.VsCodeDebugger.SDK;
namespace MoonSharp.VsCodeDebugger namespace MoonSharp.VsCodeDebugger
{ {
/// <summary> /// <summary>
/// Class implementing a debugger allowing attaching from a Visual Studio Code debugging session. /// Class implementing a debugger allowing attaching from a Visual Studio Code debugging session.
/// </summary> /// </summary>
public class MoonSharpVsCodeDebugServer : IDisposable public class MoonSharpVsCodeDebugServer : IDisposable
{ {
object m_Lock = new object(); object m_Lock = new object();
List<AsyncDebugger> m_DebuggerList = new List<AsyncDebugger>(); List<AsyncDebugger> m_DebuggerList = new List<AsyncDebugger>();
AsyncDebugger m_Current = null; AsyncDebugger m_Current = null;
ManualResetEvent m_StopEvent = new ManualResetEvent(false); ManualResetEvent m_StopEvent = new ManualResetEvent(false);
bool m_Started = false; bool m_Started = false;
int m_Port; int m_Port;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="MoonSharpVsCodeDebugServer" /> class. /// Initializes a new instance of the <see cref="MoonSharpVsCodeDebugServer" /> class.
/// </summary> /// </summary>
/// <param name="port">The port on which the debugger listens. It's recommended to use 41912.</param> /// <param name="port">The port on which the debugger listens. It's recommended to use 41912.</param>
public MoonSharpVsCodeDebugServer(int port = 41912) public MoonSharpVsCodeDebugServer(int port = 41912)
{ {
m_Port = port; m_Port = port;
} }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="MoonSharpVsCodeDebugServer" /> class with a default script. /// Initializes a new instance of the <see cref="MoonSharpVsCodeDebugServer" /> class with a default script.
/// Note that for this specific script, it will NOT attach the debugger to the script. /// Note that for this specific script, it will NOT attach the debugger to the script.
/// </summary> /// </summary>
/// <param name="script">The script object to debug.</param> /// <param name="script">The script object to debug.</param>
/// <param name="port">The port on which the debugger listens. It's recommended to use 41912 unless you are going to keep more than one script object around.</param> /// <param name="port">The port on which the debugger listens. It's recommended to use 41912 unless you are going to keep more than one script object around.</param>
/// <param name="sourceFinder">A function which gets in input a source code and returns the path to /// <param name="sourceFinder">A function which gets in input a source code and returns the path to
/// source file to use. It can return null and in that case (or if the file cannot be found) /// source file to use. It can return null and in that case (or if the file cannot be found)
/// a temporary file will be generated on the fly.</param> /// a temporary file will be generated on the fly.</param>
[Obsolete("Use the constructor taking only a port, and the 'Attach' method instead.")] [Obsolete("Use the constructor taking only a port, and the 'Attach' method instead.")]
public MoonSharpVsCodeDebugServer(Script script, int port, Func<SourceCode, string> sourceFinder = null) public MoonSharpVsCodeDebugServer(Script script, int port, Func<SourceCode, string> sourceFinder = null)
{ {
m_Port = port; m_Port = port;
m_Current = new AsyncDebugger(script, sourceFinder ?? (s => s.Name), "Default script"); m_Current = new AsyncDebugger(script, sourceFinder ?? (s => s.Name), "Default script");
m_DebuggerList.Add(m_Current); m_DebuggerList.Add(m_Current);
} }
/// <summary> /// <summary>
/// Attaches the specified script to the debugger /// Attaches the specified script to the debugger
/// </summary> /// </summary>
/// <param name="script">The script.</param> /// <param name="script">The script.</param>
/// <param name="name">The name of the script.</param> /// <param name="name">The name of the script.</param>
/// <param name="sourceFinder">A function which gets in input a source code and returns the path to /// <param name="sourceFinder">A function which gets in input a source code and returns the path to
/// source file to use. It can return null and in that case (or if the file cannot be found) /// source file to use. It can return null and in that case (or if the file cannot be found)
/// a temporary file will be generated on the fly.</param> /// a temporary file will be generated on the fly.</param>
/// <exception cref="ArgumentException">If the script has already been attached to this debugger.</exception> /// <exception cref="ArgumentException">If the script has already been attached to this debugger.</exception>
public void AttachToScript(Script script, string name, Func<SourceCode, string> sourceFinder = null) public void AttachToScript(Script script, string name, Func<SourceCode, string> sourceFinder = null)
{ {
lock (m_Lock) lock (m_Lock)
{ {
if (m_DebuggerList.Any(d => d.Script == script)) if (m_DebuggerList.Any(d => d.Script == script))
throw new ArgumentException("Script already attached to this debugger."); throw new ArgumentException("Script already attached to this debugger.");
var debugger = new AsyncDebugger(script, sourceFinder ?? (s => s.Name), name); var debugger = new AsyncDebugger(script, sourceFinder ?? (s => s.Name), name);
script.AttachDebugger(debugger); script.AttachDebugger(debugger);
m_DebuggerList.Add(debugger); m_DebuggerList.Add(debugger);
if (m_Current == null) if (m_Current == null)
m_Current = debugger; m_Current = debugger;
} }
} }
/// <summary> /// <summary>
/// Gets a list of the attached debuggers by id and name /// Gets a list of the attached debuggers by id and name
/// </summary> /// </summary>
public IEnumerable<KeyValuePair<int, string>> GetAttachedDebuggersByIdAndName() public IEnumerable<KeyValuePair<int, string>> GetAttachedDebuggersByIdAndName()
{ {
lock (m_Lock) lock (m_Lock)
return m_DebuggerList return m_DebuggerList
.OrderBy(d => d.Id) .OrderBy(d => d.Id)
.Select(d => new KeyValuePair<int, string>(d.Id, d.Name)) .Select(d => new KeyValuePair<int, string>(d.Id, d.Name))
.ToArray(); .ToArray();
} }
/// <summary> /// <summary>
/// Gets or sets the current script by ID (see GetAttachedDebuggersByIdAndName). /// Gets or sets the current script by ID (see GetAttachedDebuggersByIdAndName).
/// New vscode connections will attach to this debugger ID. Changing the current ID does NOT disconnect /// New vscode connections will attach to this debugger ID. Changing the current ID does NOT disconnect
/// connected clients. /// connected clients.
/// </summary> /// </summary>
public int? CurrentId public int? CurrentId
{ {
get { lock (m_Lock) return m_Current != null ? m_Current.Id : (int?)null; } get { lock (m_Lock) return m_Current != null ? m_Current.Id : (int?)null; }
set set
{ {
lock (m_Lock) lock (m_Lock)
{ {
if (value == null) if (value == null)
{ {
m_Current = null; m_Current = null;
return; return;
} }
var current = (m_DebuggerList.FirstOrDefault(d => d.Id == value)); var current = (m_DebuggerList.FirstOrDefault(d => d.Id == value));
if (current == null) if (current == null)
throw new ArgumentException("Cannot find debugger with given Id."); throw new ArgumentException("Cannot find debugger with given Id.");
m_Current = current; m_Current = current;
} }
} }
} }
/// <summary> /// <summary>
/// Gets or sets the current script. New vscode connections will attach to this script. Changing the current script does NOT disconnect /// Gets or sets the current script. New vscode connections will attach to this script. Changing the current script does NOT disconnect
/// connected clients. /// connected clients.
/// </summary> /// </summary>
public Script Current public Script Current
{ {
get { lock(m_Lock) return m_Current != null ? m_Current.Script : null; } get { lock(m_Lock) return m_Current != null ? m_Current.Script : null; }
set set
{ {
lock (m_Lock) lock (m_Lock)
{ {
if (value == null) if (value == null)
{ {
m_Current = null; m_Current = null;
return; return;
} }
var current = (m_DebuggerList.FirstOrDefault(d => d.Script == value)); var current = (m_DebuggerList.FirstOrDefault(d => d.Script == value));
if (current == null) if (current == null)
throw new ArgumentException("Cannot find debugger with given script associated."); throw new ArgumentException("Cannot find debugger with given script associated.");
m_Current = current; m_Current = current;
} }
} }
} }
/// <summary> /// <summary>
/// Detaches the specified script. The debugger attached to that script will get disconnected. /// Detaches the specified script. The debugger attached to that script will get disconnected.
/// </summary> /// </summary>
/// <param name="script">The script.</param> /// <param name="script">The script.</param>
/// <exception cref="ArgumentException">Thrown if the script cannot be found.</exception> /// <exception cref="ArgumentException">Thrown if the script cannot be found.</exception>
public void Detach(Script script) public void Detach(Script script)
{ {
lock (m_Lock) lock (m_Lock)
{ {
var removed = m_DebuggerList.FirstOrDefault(d => d.Script == script); var removed = m_DebuggerList.FirstOrDefault(d => d.Script == script);
if (removed == null) if (removed == null)
throw new ArgumentException("Cannot detach script - not found."); throw new ArgumentException("Cannot detach script - not found.");
removed.Client = null; removed.Client = null;
m_DebuggerList.Remove(removed); m_DebuggerList.Remove(removed);
if (m_Current == removed) if (m_Current == removed)
{ {
if (m_DebuggerList.Count > 0) if (m_DebuggerList.Count > 0)
m_Current = m_DebuggerList[m_DebuggerList.Count - 1]; m_Current = m_DebuggerList[m_DebuggerList.Count - 1];
else else
m_Current = null; m_Current = null;
} }
} }
} }
/// <summary> /// <summary>
/// Gets or sets a delegate which will be called when logging messages are generated /// Gets or sets a delegate which will be called when logging messages are generated
/// </summary> /// </summary>
public Action<string> Logger { get; set; } public Action<string> Logger { get; set; }
/// <summary> /// <summary>
/// Gets the debugger object. Obsolete, use the new interface using the Attach method instead. /// Gets the debugger object. Obsolete, use the new interface using the Attach method instead.
/// </summary> /// </summary>
[Obsolete("Use the Attach method instead.")] [Obsolete("Use the Attach method instead.")]
public IDebugger GetDebugger() public IDebugger GetDebugger()
{ {
lock(m_Lock) lock(m_Lock)
return m_Current; return m_Current;
} }
/// <summary> /// <summary>
/// Stops listening /// Stops listening
/// </summary> /// </summary>
/// <exception cref="InvalidOperationException">Cannot stop; server was not started.</exception> /// <exception cref="InvalidOperationException">Cannot stop; server was not started.</exception>
public void Dispose() public void Dispose()
{ {
m_StopEvent.Set(); m_StopEvent.Set();
} }
/// <summary> /// <summary>
/// Starts listening on the localhost for incoming connections. /// Starts listening on the localhost for incoming connections.
/// </summary> /// </summary>
public MoonSharpVsCodeDebugServer Start() public MoonSharpVsCodeDebugServer Start()
{ {
lock (m_Lock) lock (m_Lock)
{ {
if (m_Started) if (m_Started)
throw new InvalidOperationException("Cannot start; server has already been started."); throw new InvalidOperationException("Cannot start; server has already been started.");
m_StopEvent.Reset(); m_StopEvent.Reset();
TcpListener serverSocket = null; TcpListener serverSocket = null;
serverSocket = new TcpListener(IPAddress.Parse("127.0.0.1"), m_Port); serverSocket = new TcpListener(IPAddress.Parse("127.0.0.1"), m_Port);
serverSocket.Start(); serverSocket.Start();
SpawnThread("VsCodeDebugServer_" + m_Port.ToString(), () => ListenThread(serverSocket)); SpawnThread("VsCodeDebugServer_" + m_Port.ToString(), () => ListenThread(serverSocket));
m_Started = true; m_Started = true;
return this; return this;
} }
} }
private void ListenThread(TcpListener serverSocket) private void ListenThread(TcpListener serverSocket)
{ {
try try
{ {
while (!m_StopEvent.WaitOne(0)) while (!m_StopEvent.WaitOne(0))
{ {
#if DOTNET_CORE #if DOTNET_CORE
var task = serverSocket.AcceptSocketAsync(); var task = serverSocket.AcceptSocketAsync();
task.Wait(); task.Wait();
var clientSocket = task.Result; var clientSocket = task.Result;
#else #else
var clientSocket = serverSocket.AcceptSocket(); var clientSocket = serverSocket.AcceptSocket();
#endif #endif
if (clientSocket != null) if (clientSocket != null)
{ {
string sessionId = Guid.NewGuid().ToString("N"); string sessionId = Guid.NewGuid().ToString("N");
Log("[{0}] : Accepted connection from client {1}", sessionId, clientSocket.RemoteEndPoint); Log("[{0}] : Accepted connection from client {1}", sessionId, clientSocket.RemoteEndPoint);
SpawnThread("VsCodeDebugSession_" + sessionId, () => SpawnThread("VsCodeDebugSession_" + sessionId, () =>
{ {
using (var networkStream = new NetworkStream(clientSocket)) using (var networkStream = new NetworkStream(clientSocket))
{ {
try try
{ {
RunSession(sessionId, networkStream); RunSession(sessionId, networkStream);
} }
catch (Exception ex) catch (Exception ex)
{ {
Log("[{0}] : Error : {1}", ex.Message); Log("[{0}] : Error : {1}", ex.Message);
} }
} }
#if DOTNET_CORE #if DOTNET_CORE
clientSocket.Dispose(); clientSocket.Dispose();
#else #else
clientSocket.Close(); clientSocket.Close();
#endif #endif
Log("[{0}] : Client connection closed", sessionId); Log("[{0}] : Client connection closed", sessionId);
}); });
} }
} }
} }
catch (Exception e) catch (Exception e)
{ {
Log("Fatal error in listening thread : {0}", e.Message); Log("Fatal error in listening thread : {0}", e.Message);
} }
finally finally
{ {
if (serverSocket != null) if (serverSocket != null)
serverSocket.Stop(); serverSocket.Stop();
} }
} }
private void RunSession(string sessionId, NetworkStream stream) private void RunSession(string sessionId, NetworkStream stream)
{ {
DebugSession debugSession = null; DebugSession debugSession = null;
lock (m_Lock) lock (m_Lock)
{ {
if (m_Current != null) if (m_Current != null)
debugSession = new MoonSharpDebugSession(this, m_Current); debugSession = new MoonSharpDebugSession(this, m_Current);
else else
debugSession = new EmptyDebugSession(this); debugSession = new EmptyDebugSession(this);
} }
debugSession.ProcessLoop(stream, stream); debugSession.ProcessLoop(stream, stream);
} }
private void Log(string format, params object[] args) private void Log(string format, params object[] args)
{ {
Action<string> logger = Logger; Action<string> logger = Logger;
if (logger != null) if (logger != null)
{ {
string msg = string.Format(format, args); string msg = string.Format(format, args);
logger(msg); logger(msg);
} }
} }
private static void SpawnThread(string name, Action threadProc) private static void SpawnThread(string name, Action threadProc)
{ {
#if DOTNET_CORE #if DOTNET_CORE
System.Threading.Tasks.Task.Run(() => threadProc()); System.Threading.Tasks.Task.Run(() => threadProc());
#else #else
new System.Threading.Thread(() => threadProc()) new System.Threading.Thread(() => threadProc())
{ {
IsBackground = true, IsBackground = true,
Name = name Name = name
} }
.Start(); .Start();
#endif #endif
} }
} }
} }
#else #else
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using MoonSharp.Interpreter; using MoonSharp.Interpreter;
using MoonSharp.Interpreter.Debugging; using MoonSharp.Interpreter.Debugging;
namespace MoonSharp.VsCodeDebugger namespace MoonSharp.VsCodeDebugger
{ {
public class MoonSharpVsCodeDebugServer : IDisposable public class MoonSharpVsCodeDebugServer : IDisposable
{ {
public MoonSharpVsCodeDebugServer(int port = 41912) public MoonSharpVsCodeDebugServer(int port = 41912)
{ {
} }
[Obsolete("Use the constructor taking only a port, and the 'Attach' method instead.")] [Obsolete("Use the constructor taking only a port, and the 'Attach' method instead.")]
public MoonSharpVsCodeDebugServer(Script script, int port, Func<SourceCode, string> sourceFinder = null) public MoonSharpVsCodeDebugServer(Script script, int port, Func<SourceCode, string> sourceFinder = null)
{ {
} }
public void AttachToScript(Script script, string name, Func<SourceCode, string> sourceFinder = null) public void AttachToScript(Script script, string name, Func<SourceCode, string> sourceFinder = null)
{ {
} }
public IEnumerable<KeyValuePair<int, string>> GetAttachedDebuggersByIdAndName() public IEnumerable<KeyValuePair<int, string>> GetAttachedDebuggersByIdAndName()
{ {
yield break; yield break;
} }
public int? CurrentId public int? CurrentId
{ {
get { return null; } get { return null; }
set { } set { }
} }
public Script Current public Script Current
{ {
get { return null; } get { return null; }
set { } set { }
} }
/// <summary> /// <summary>
/// Detaches the specified script. The debugger attached to that script will get disconnected. /// Detaches the specified script. The debugger attached to that script will get disconnected.
/// </summary> /// </summary>
/// <param name="script">The script.</param> /// <param name="script">The script.</param>
/// <exception cref="ArgumentException">Thrown if the script cannot be found.</exception> /// <exception cref="ArgumentException">Thrown if the script cannot be found.</exception>
public void Detach(Script script) public void Detach(Script script)
{ {
} }
public Action<string> Logger { get; set; } public Action<string> Logger { get; set; }
[Obsolete("Use the Attach method instead.")] [Obsolete("Use the Attach method instead.")]
public IDebugger GetDebugger() public IDebugger GetDebugger()
{ {
return null; return null;
} }
public void Dispose() public void Dispose()
{ {
} }
public MoonSharpVsCodeDebugServer Start() public MoonSharpVsCodeDebugServer Start()
{ {
return this; return this;
} }
} }
} }
#endif #endif

50
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Debugger/SDK/DebugSession.cs vendored

@ -1,30 +1,30 @@
#if (!PCL) && ((!UNITY_5) || UNITY_STANDALONE) #if (!PCL) && ((!UNITY_5) || UNITY_STANDALONE)
/*--------------------------------------------------------------------------------------------- /*---------------------------------------------------------------------------------------------
Copyright (c) Microsoft Corporation Copyright (c) Microsoft Corporation
All rights reserved. All rights reserved.
MIT License MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software. copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -606,5 +606,5 @@ namespace MoonSharp.VsCodeDebugger.SDK
} }
} }
} }
} }
#endif #endif

50
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Debugger/SDK/Protocol.cs vendored

@ -1,30 +1,30 @@
#if (!PCL) && ((!UNITY_5) || UNITY_STANDALONE) #if (!PCL) && ((!UNITY_5) || UNITY_STANDALONE)
/*--------------------------------------------------------------------------------------------- /*---------------------------------------------------------------------------------------------
Copyright (c) Microsoft Corporation Copyright (c) Microsoft Corporation
All rights reserved. All rights reserved.
MIT License MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software. copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
using System; using System;
using System.Text; using System.Text;
using System.IO; using System.IO;
@ -338,5 +338,5 @@ namespace MoonSharp.VsCodeDebugger.SDK
} }
} }
#endif #endif

58
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Debugger/SDK/Utilities.cs vendored

@ -1,38 +1,38 @@
#if (!PCL) && ((!UNITY_5) || UNITY_STANDALONE) #if (!PCL) && ((!UNITY_5) || UNITY_STANDALONE)
/*--------------------------------------------------------------------------------------------- /*---------------------------------------------------------------------------------------------
Copyright (c) Microsoft Corporation Copyright (c) Microsoft Corporation
All rights reserved. All rights reserved.
MIT License MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software. copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
using System; using System;
using System.Net; using System.Net;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Reflection; using System.Reflection;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
namespace MoonSharp.VsCodeDebugger.SDK namespace MoonSharp.VsCodeDebugger.SDK
{ {
internal class Utilities internal class Utilities
@ -90,6 +90,6 @@ namespace MoonSharp.VsCodeDebugger.SDK
*/ */
} }
} }
} }
#endif #endif

16
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/AsyncExtensions.cs vendored

@ -69,8 +69,8 @@ namespace MoonSharp.Interpreter
public static Task<DynValue> CallAsync(this Closure function, params DynValue[] args) public static Task<DynValue> CallAsync(this Closure function, params DynValue[] args)
{ {
return ExecAsync(() => function.Call(args)); return ExecAsync(() => function.Call(args));
} }
/// <summary> /// <summary>
/// Asynchronously loads and executes a string containing a Lua/MoonSharp script. /// Asynchronously loads and executes a string containing a Lua/MoonSharp script.
/// ///
@ -86,9 +86,9 @@ namespace MoonSharp.Interpreter
public static Task<DynValue> DoStringAsync(this Script script, string code, Table globalContext = null, string codeFriendlyName = null) public static Task<DynValue> DoStringAsync(this Script script, string code, Table globalContext = null, string codeFriendlyName = null)
{ {
return ExecAsync(() => script.DoString(code, globalContext, codeFriendlyName)); return ExecAsync(() => script.DoString(code, globalContext, codeFriendlyName));
} }
/// <summary> /// <summary>
/// Asynchronously loads and executes a stream containing a Lua/MoonSharp script. /// Asynchronously loads and executes a stream containing a Lua/MoonSharp script.
/// ///
@ -104,9 +104,9 @@ namespace MoonSharp.Interpreter
public static Task<DynValue> DoStreamAsync(this Script script, Stream stream, Table globalContext = null, string codeFriendlyName = null) public static Task<DynValue> DoStreamAsync(this Script script, Stream stream, Table globalContext = null, string codeFriendlyName = null)
{ {
return ExecAsync(() => script.DoStream(stream, globalContext, codeFriendlyName)); return ExecAsync(() => script.DoStream(stream, globalContext, codeFriendlyName));
} }
/// <summary> /// <summary>
/// Asynchronously loads and executes a file containing a Lua/MoonSharp script. /// Asynchronously loads and executes a file containing a Lua/MoonSharp script.
/// ///

6
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Compatibility/Attributes.cs vendored

@ -16,6 +16,6 @@ namespace System.Reflection
public GuidAttribute(string dummy) public GuidAttribute(string dummy)
{ } { }
} }
} }
#endif #endif

32
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Compatibility/Framework.cs vendored

@ -1,16 +1,16 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using MoonSharp.Interpreter.Compatibility.Frameworks; using MoonSharp.Interpreter.Compatibility.Frameworks;
namespace MoonSharp.Interpreter.Compatibility namespace MoonSharp.Interpreter.Compatibility
{ {
public static class Framework public static class Framework
{ {
static FrameworkCurrent s_FrameworkCurrent = new FrameworkCurrent(); static FrameworkCurrent s_FrameworkCurrent = new FrameworkCurrent();
public static FrameworkBase Do { get { return s_FrameworkCurrent; } } public static FrameworkBase Do { get { return s_FrameworkCurrent; } }
} }
} }

150
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Compatibility/Frameworks/Base/FrameworkBase.cs vendored

@ -1,75 +1,75 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
namespace MoonSharp.Interpreter.Compatibility.Frameworks namespace MoonSharp.Interpreter.Compatibility.Frameworks
{ {
public abstract class FrameworkBase public abstract class FrameworkBase
{ {
public abstract bool StringContainsChar(string str, char chr); public abstract bool StringContainsChar(string str, char chr);
public abstract bool IsValueType(Type t); public abstract bool IsValueType(Type t);
public abstract Assembly GetAssembly(Type t); public abstract Assembly GetAssembly(Type t);
public abstract Type GetBaseType(Type t); public abstract Type GetBaseType(Type t);
public abstract bool IsGenericType(Type t); public abstract bool IsGenericType(Type t);
public abstract bool IsGenericTypeDefinition(Type t); public abstract bool IsGenericTypeDefinition(Type t);
public abstract bool IsEnum(Type t); public abstract bool IsEnum(Type t);
public abstract bool IsNestedPublic(Type t); public abstract bool IsNestedPublic(Type t);
public abstract bool IsAbstract(Type t); public abstract bool IsAbstract(Type t);
public abstract bool IsInterface(Type t); public abstract bool IsInterface(Type t);
public abstract Attribute[] GetCustomAttributes(Type t, bool inherit); public abstract Attribute[] GetCustomAttributes(Type t, bool inherit);
public abstract Attribute[] GetCustomAttributes(Type t, Type at, bool inherit); public abstract Attribute[] GetCustomAttributes(Type t, Type at, bool inherit);
public abstract Type[] GetInterfaces(Type t); public abstract Type[] GetInterfaces(Type t);
public abstract bool IsInstanceOfType(Type t, object o); public abstract bool IsInstanceOfType(Type t, object o);
public abstract MethodInfo GetAddMethod(EventInfo ei); public abstract MethodInfo GetAddMethod(EventInfo ei);
public abstract MethodInfo GetRemoveMethod(EventInfo ei); public abstract MethodInfo GetRemoveMethod(EventInfo ei);
public abstract MethodInfo GetGetMethod(PropertyInfo pi); public abstract MethodInfo GetGetMethod(PropertyInfo pi);
public abstract MethodInfo GetSetMethod(PropertyInfo pi); public abstract MethodInfo GetSetMethod(PropertyInfo pi);
public abstract Type GetInterface(Type type, string name); public abstract Type GetInterface(Type type, string name);
public abstract PropertyInfo[] GetProperties(Type type); public abstract PropertyInfo[] GetProperties(Type type);
public abstract PropertyInfo GetProperty(Type type, string name); public abstract PropertyInfo GetProperty(Type type, string name);
public abstract Type[] GetNestedTypes(Type type); public abstract Type[] GetNestedTypes(Type type);
public abstract EventInfo[] GetEvents(Type type); public abstract EventInfo[] GetEvents(Type type);
public abstract ConstructorInfo[] GetConstructors(Type type); public abstract ConstructorInfo[] GetConstructors(Type type);
public abstract Type[] GetAssemblyTypes(Assembly asm); public abstract Type[] GetAssemblyTypes(Assembly asm);
public abstract MethodInfo[] GetMethods(Type type); public abstract MethodInfo[] GetMethods(Type type);
public abstract FieldInfo[] GetFields(Type t); public abstract FieldInfo[] GetFields(Type t);
public abstract MethodInfo GetMethod(Type type, string name); public abstract MethodInfo GetMethod(Type type, string name);
public abstract Type[] GetGenericArguments(Type t); public abstract Type[] GetGenericArguments(Type t);
public abstract bool IsAssignableFrom(Type current, Type toCompare); public abstract bool IsAssignableFrom(Type current, Type toCompare);
public abstract bool IsDbNull(object o); public abstract bool IsDbNull(object o);
public abstract MethodInfo GetMethod(Type resourcesType, string v, Type[] type); public abstract MethodInfo GetMethod(Type resourcesType, string v, Type[] type);
} }
} }

230
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Compatibility/Frameworks/Base/FrameworkClrBase.cs vendored

@ -1,116 +1,116 @@
#if !(DOTNET_CORE || NETFX_CORE) #if !(DOTNET_CORE || NETFX_CORE)
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
namespace MoonSharp.Interpreter.Compatibility.Frameworks namespace MoonSharp.Interpreter.Compatibility.Frameworks
{ {
abstract class FrameworkClrBase : FrameworkReflectionBase abstract class FrameworkClrBase : FrameworkReflectionBase
{ {
BindingFlags BINDINGFLAGS_MEMBER = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static; BindingFlags BINDINGFLAGS_MEMBER = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static;
BindingFlags BINDINGFLAGS_INNERCLASS = BindingFlags.Public | BindingFlags.NonPublic; BindingFlags BINDINGFLAGS_INNERCLASS = BindingFlags.Public | BindingFlags.NonPublic;
public override Type GetTypeInfoFromType(Type t) public override Type GetTypeInfoFromType(Type t)
{ {
return t; return t;
} }
public override MethodInfo GetAddMethod(EventInfo ei) public override MethodInfo GetAddMethod(EventInfo ei)
{ {
return ei.GetAddMethod(true); return ei.GetAddMethod(true);
} }
public override ConstructorInfo[] GetConstructors(Type type) public override ConstructorInfo[] GetConstructors(Type type)
{ {
return type.GetConstructors(BINDINGFLAGS_MEMBER); return type.GetConstructors(BINDINGFLAGS_MEMBER);
} }
public override EventInfo[] GetEvents(Type type) public override EventInfo[] GetEvents(Type type)
{ {
return type.GetEvents(BINDINGFLAGS_MEMBER); return type.GetEvents(BINDINGFLAGS_MEMBER);
} }
public override FieldInfo[] GetFields(Type type) public override FieldInfo[] GetFields(Type type)
{ {
return type.GetFields(BINDINGFLAGS_MEMBER); return type.GetFields(BINDINGFLAGS_MEMBER);
} }
public override Type[] GetGenericArguments(Type type) public override Type[] GetGenericArguments(Type type)
{ {
return type.GetGenericArguments(); return type.GetGenericArguments();
} }
public override MethodInfo GetGetMethod(PropertyInfo pi) public override MethodInfo GetGetMethod(PropertyInfo pi)
{ {
return pi.GetGetMethod(true); return pi.GetGetMethod(true);
} }
public override Type[] GetInterfaces(Type t) public override Type[] GetInterfaces(Type t)
{ {
return t.GetInterfaces(); return t.GetInterfaces();
} }
public override MethodInfo GetMethod(Type type, string name) public override MethodInfo GetMethod(Type type, string name)
{ {
return type.GetMethod(name); return type.GetMethod(name);
} }
public override MethodInfo[] GetMethods(Type type) public override MethodInfo[] GetMethods(Type type)
{ {
return type.GetMethods(BINDINGFLAGS_MEMBER); return type.GetMethods(BINDINGFLAGS_MEMBER);
} }
public override Type[] GetNestedTypes(Type type) public override Type[] GetNestedTypes(Type type)
{ {
return type.GetNestedTypes(BINDINGFLAGS_INNERCLASS); return type.GetNestedTypes(BINDINGFLAGS_INNERCLASS);
} }
public override PropertyInfo[] GetProperties(Type type) public override PropertyInfo[] GetProperties(Type type)
{ {
return type.GetProperties(BINDINGFLAGS_MEMBER); return type.GetProperties(BINDINGFLAGS_MEMBER);
} }
public override PropertyInfo GetProperty(Type type, string name) public override PropertyInfo GetProperty(Type type, string name)
{ {
return type.GetProperty(name); return type.GetProperty(name);
} }
public override MethodInfo GetRemoveMethod(EventInfo ei) public override MethodInfo GetRemoveMethod(EventInfo ei)
{ {
return ei.GetRemoveMethod(true); return ei.GetRemoveMethod(true);
} }
public override MethodInfo GetSetMethod(PropertyInfo pi) public override MethodInfo GetSetMethod(PropertyInfo pi)
{ {
return pi.GetSetMethod(true); return pi.GetSetMethod(true);
} }
public override bool IsAssignableFrom(Type current, Type toCompare) public override bool IsAssignableFrom(Type current, Type toCompare)
{ {
return current.IsAssignableFrom(toCompare); return current.IsAssignableFrom(toCompare);
} }
public override bool IsInstanceOfType(Type t, object o) public override bool IsInstanceOfType(Type t, object o)
{ {
return t.IsInstanceOfType(o); return t.IsInstanceOfType(o);
} }
public override MethodInfo GetMethod(Type resourcesType, string name, Type[] types) public override MethodInfo GetMethod(Type resourcesType, string name, Type[] types)
{ {
return resourcesType.GetMethod(name, types); return resourcesType.GetMethod(name, types);
} }
public override Type[] GetAssemblyTypes(Assembly asm) public override Type[] GetAssemblyTypes(Assembly asm)
{ {
return asm.GetTypes(); return asm.GetTypes();
} }
} }
} }
#endif #endif

152
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Compatibility/Frameworks/Base/FrameworkReflectionBase.cs vendored

@ -1,76 +1,76 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
#if DOTNET_CORE || NETFX_CORE #if DOTNET_CORE || NETFX_CORE
using TTypeInfo = System.Reflection.TypeInfo; using TTypeInfo = System.Reflection.TypeInfo;
#else #else
using TTypeInfo = System.Type; using TTypeInfo = System.Type;
#endif #endif
namespace MoonSharp.Interpreter.Compatibility.Frameworks namespace MoonSharp.Interpreter.Compatibility.Frameworks
{ {
abstract class FrameworkReflectionBase : FrameworkBase abstract class FrameworkReflectionBase : FrameworkBase
{ {
public abstract TTypeInfo GetTypeInfoFromType(Type t); public abstract TTypeInfo GetTypeInfoFromType(Type t);
public override Assembly GetAssembly(Type t) public override Assembly GetAssembly(Type t)
{ {
return GetTypeInfoFromType(t).Assembly; return GetTypeInfoFromType(t).Assembly;
} }
public override Type GetBaseType(Type t) public override Type GetBaseType(Type t)
{ {
return GetTypeInfoFromType(t).BaseType; return GetTypeInfoFromType(t).BaseType;
} }
public override bool IsValueType(Type t) public override bool IsValueType(Type t)
{ {
return GetTypeInfoFromType(t).IsValueType; return GetTypeInfoFromType(t).IsValueType;
} }
public override bool IsInterface(Type t) public override bool IsInterface(Type t)
{ {
return GetTypeInfoFromType(t).IsInterface; return GetTypeInfoFromType(t).IsInterface;
} }
public override bool IsNestedPublic(Type t) public override bool IsNestedPublic(Type t)
{ {
return GetTypeInfoFromType(t).IsNestedPublic; return GetTypeInfoFromType(t).IsNestedPublic;
} }
public override bool IsAbstract(Type t) public override bool IsAbstract(Type t)
{ {
return GetTypeInfoFromType(t).IsAbstract; return GetTypeInfoFromType(t).IsAbstract;
} }
public override bool IsEnum(Type t) public override bool IsEnum(Type t)
{ {
return GetTypeInfoFromType(t).IsEnum; return GetTypeInfoFromType(t).IsEnum;
} }
public override bool IsGenericTypeDefinition(Type t) public override bool IsGenericTypeDefinition(Type t)
{ {
return GetTypeInfoFromType(t).IsGenericTypeDefinition; return GetTypeInfoFromType(t).IsGenericTypeDefinition;
} }
public override bool IsGenericType(Type t) public override bool IsGenericType(Type t)
{ {
return GetTypeInfoFromType(t).IsGenericType; return GetTypeInfoFromType(t).IsGenericType;
} }
public override Attribute[] GetCustomAttributes(Type t, bool inherit) public override Attribute[] GetCustomAttributes(Type t, bool inherit)
{ {
return GetTypeInfoFromType(t).GetCustomAttributes(inherit).OfType<Attribute>().ToArray(); return GetTypeInfoFromType(t).GetCustomAttributes(inherit).OfType<Attribute>().ToArray();
} }
public override Attribute[] GetCustomAttributes(Type t, Type at, bool inherit) public override Attribute[] GetCustomAttributes(Type t, Type at, bool inherit)
{ {
return GetTypeInfoFromType(t).GetCustomAttributes(at, inherit).OfType<Attribute>().ToArray(); return GetTypeInfoFromType(t).GetCustomAttributes(at, inherit).OfType<Attribute>().ToArray();
} }
} }
} }

62
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Compatibility/Frameworks/FrameworkCLR.cs vendored

@ -1,31 +1,31 @@
#if !(DOTNET_CORE || NETFX_CORE) && !PCL #if !(DOTNET_CORE || NETFX_CORE) && !PCL
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
namespace MoonSharp.Interpreter.Compatibility.Frameworks namespace MoonSharp.Interpreter.Compatibility.Frameworks
{ {
class FrameworkCurrent : FrameworkClrBase class FrameworkCurrent : FrameworkClrBase
{ {
public override bool IsDbNull(object o) public override bool IsDbNull(object o)
{ {
return o != null && Convert.IsDBNull(o); return o != null && Convert.IsDBNull(o);
} }
public override bool StringContainsChar(string str, char chr) public override bool StringContainsChar(string str, char chr)
{ {
return str.Contains(chr); return str.Contains(chr);
} }
public override Type GetInterface(Type type, string name) public override Type GetInterface(Type type, string name)
{ {
return type.GetInterface(name); return type.GetInterface(name);
} }
} }
} }
#endif #endif

262
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Compatibility/Frameworks/FrameworkCore.cs vendored

@ -1,132 +1,132 @@
#if DOTNET_CORE #if DOTNET_CORE
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
namespace MoonSharp.Interpreter.Compatibility.Frameworks namespace MoonSharp.Interpreter.Compatibility.Frameworks
{ {
class FrameworkCurrent : FrameworkReflectionBase class FrameworkCurrent : FrameworkReflectionBase
{ {
public override TypeInfo GetTypeInfoFromType(Type t) public override TypeInfo GetTypeInfoFromType(Type t)
{ {
return t.GetTypeInfo(); return t.GetTypeInfo();
} }
private T[] SafeArray<T>(IEnumerable<T> prop) private T[] SafeArray<T>(IEnumerable<T> prop)
{ {
return prop != null ? prop.ToArray() : new T[0]; return prop != null ? prop.ToArray() : new T[0];
} }
public override MethodInfo GetAddMethod(EventInfo ei) public override MethodInfo GetAddMethod(EventInfo ei)
{ {
return ei.GetAddMethod(true); return ei.GetAddMethod(true);
} }
public override ConstructorInfo[] GetConstructors(Type type) public override ConstructorInfo[] GetConstructors(Type type)
{ {
return SafeArray(GetTypeInfoFromType(type).DeclaredConstructors); return SafeArray(GetTypeInfoFromType(type).DeclaredConstructors);
} }
public override EventInfo[] GetEvents(Type type) public override EventInfo[] GetEvents(Type type)
{ {
return SafeArray(GetTypeInfoFromType(type).DeclaredEvents); return SafeArray(GetTypeInfoFromType(type).DeclaredEvents);
} }
public override FieldInfo[] GetFields(Type type) public override FieldInfo[] GetFields(Type type)
{ {
return SafeArray(GetTypeInfoFromType(type).DeclaredFields); return SafeArray(GetTypeInfoFromType(type).DeclaredFields);
} }
public override Type[] GetGenericArguments(Type type) public override Type[] GetGenericArguments(Type type)
{ {
return type.GetTypeInfo().GetGenericArguments(); return type.GetTypeInfo().GetGenericArguments();
} }
public override MethodInfo GetGetMethod(PropertyInfo pi) public override MethodInfo GetGetMethod(PropertyInfo pi)
{ {
return pi.GetGetMethod(true); return pi.GetGetMethod(true);
} }
public override Type GetInterface(Type type, string name) public override Type GetInterface(Type type, string name)
{ {
return GetTypeInfoFromType(type).GetInterface(name); return GetTypeInfoFromType(type).GetInterface(name);
} }
public override Type[] GetInterfaces(Type t) public override Type[] GetInterfaces(Type t)
{ {
return GetTypeInfoFromType(t).GetInterfaces(); return GetTypeInfoFromType(t).GetInterfaces();
} }
public override MethodInfo GetMethod(Type type, string name) public override MethodInfo GetMethod(Type type, string name)
{ {
return GetTypeInfoFromType(type).GetMethod(name); return GetTypeInfoFromType(type).GetMethod(name);
} }
public override MethodInfo[] GetMethods(Type type) public override MethodInfo[] GetMethods(Type type)
{ {
return SafeArray(GetTypeInfoFromType(type).DeclaredMethods); return SafeArray(GetTypeInfoFromType(type).DeclaredMethods);
} }
public override Type[] GetNestedTypes(Type type) public override Type[] GetNestedTypes(Type type)
{ {
return SafeArray(GetTypeInfoFromType(type).DeclaredNestedTypes.Select(ti => ti.AsType())); return SafeArray(GetTypeInfoFromType(type).DeclaredNestedTypes.Select(ti => ti.AsType()));
} }
public override PropertyInfo[] GetProperties(Type type) public override PropertyInfo[] GetProperties(Type type)
{ {
return SafeArray(GetTypeInfoFromType(type).DeclaredProperties); return SafeArray(GetTypeInfoFromType(type).DeclaredProperties);
} }
public override PropertyInfo GetProperty(Type type, string name) public override PropertyInfo GetProperty(Type type, string name)
{ {
return GetTypeInfoFromType(type).GetProperty(name); return GetTypeInfoFromType(type).GetProperty(name);
} }
public override MethodInfo GetRemoveMethod(EventInfo ei) public override MethodInfo GetRemoveMethod(EventInfo ei)
{ {
return ei.GetRemoveMethod(true); return ei.GetRemoveMethod(true);
} }
public override MethodInfo GetSetMethod(PropertyInfo pi) public override MethodInfo GetSetMethod(PropertyInfo pi)
{ {
return pi.GetSetMethod(true); return pi.GetSetMethod(true);
} }
public override bool IsAssignableFrom(Type current, Type toCompare) public override bool IsAssignableFrom(Type current, Type toCompare)
{ {
return current.GetTypeInfo().IsAssignableFrom(toCompare.GetTypeInfo()); return current.GetTypeInfo().IsAssignableFrom(toCompare.GetTypeInfo());
} }
public override bool IsDbNull(object o) public override bool IsDbNull(object o)
{ {
return o != null && o.GetType().FullName.StartsWith("System.DBNull"); return o != null && o.GetType().FullName.StartsWith("System.DBNull");
} }
public override bool IsInstanceOfType(Type t, object o) public override bool IsInstanceOfType(Type t, object o)
{ {
return t.GetTypeInfo().IsInstanceOfType(o); return t.GetTypeInfo().IsInstanceOfType(o);
} }
public override bool StringContainsChar(string str, char chr) public override bool StringContainsChar(string str, char chr)
{ {
return str.Contains(chr); return str.Contains(chr);
} }
public override MethodInfo GetMethod(Type resourcesType, string name, Type[] types) public override MethodInfo GetMethod(Type resourcesType, string name, Type[] types)
{ {
return resourcesType.GetTypeInfo().GetMethod(name, types); return resourcesType.GetTypeInfo().GetMethod(name, types);
} }
public override Type[] GetAssemblyTypes(Assembly asm) public override Type[] GetAssemblyTypes(Assembly asm)
{ {
return asm.GetExportedTypes(); return asm.GetExportedTypes();
} }
} }
} }
#endif #endif

56
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Compatibility/Frameworks/FrameworkPCL.cs vendored

@ -1,30 +1,30 @@
#if !(DOTNET_CORE || NETFX_CORE) && PCL #if !(DOTNET_CORE || NETFX_CORE) && PCL
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
namespace MoonSharp.Interpreter.Compatibility.Frameworks namespace MoonSharp.Interpreter.Compatibility.Frameworks
{ {
class FrameworkCurrent : FrameworkClrBase class FrameworkCurrent : FrameworkClrBase
{ {
public override bool IsDbNull(object o) public override bool IsDbNull(object o)
{ {
return o != null && o.GetType().FullName.StartsWith("System.DBNull"); return o != null && o.GetType().FullName.StartsWith("System.DBNull");
} }
public override bool StringContainsChar(string str, char chr) public override bool StringContainsChar(string str, char chr)
{ {
return str.Contains(chr.ToString()); return str.Contains(chr.ToString());
} }
public override Type GetInterface(Type type, string name) public override Type GetInterface(Type type, string name)
{ {
return type.GetInterfaces(). return type.GetInterfaces().
FirstOrDefault(t => t.Name == name); FirstOrDefault(t => t.Name == name);
} }
} }
} }
#endif #endif

318
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Compatibility/Frameworks/FrameworkWin8.cs vendored

@ -1,160 +1,160 @@
#if NETFX_CORE && !DOTNET_CORE #if NETFX_CORE && !DOTNET_CORE
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
namespace MoonSharp.Interpreter.Compatibility.Frameworks namespace MoonSharp.Interpreter.Compatibility.Frameworks
{ {
class FrameworkCurrent : FrameworkReflectionBase class FrameworkCurrent : FrameworkReflectionBase
{ {
public override TypeInfo GetTypeInfoFromType(Type t) public override TypeInfo GetTypeInfoFromType(Type t)
{ {
return t.GetTypeInfo(); return t.GetTypeInfo();
} }
private T[] SafeArray<T>(IEnumerable<T> prop) private T[] SafeArray<T>(IEnumerable<T> prop)
{ {
return prop != null ? prop.ToArray() : new T[0]; return prop != null ? prop.ToArray() : new T[0];
} }
public override MethodInfo GetAddMethod(EventInfo ei) public override MethodInfo GetAddMethod(EventInfo ei)
{ {
return ei.AddMethod; return ei.AddMethod;
} }
public override ConstructorInfo[] GetConstructors(Type type) public override ConstructorInfo[] GetConstructors(Type type)
{ {
return SafeArray(GetTypeInfoFromType(type).DeclaredConstructors); return SafeArray(GetTypeInfoFromType(type).DeclaredConstructors);
} }
public override EventInfo[] GetEvents(Type type) public override EventInfo[] GetEvents(Type type)
{ {
return SafeArray(GetTypeInfoFromType(type).DeclaredEvents); return SafeArray(GetTypeInfoFromType(type).DeclaredEvents);
} }
public override FieldInfo[] GetFields(Type type) public override FieldInfo[] GetFields(Type type)
{ {
return SafeArray(GetTypeInfoFromType(type).DeclaredFields); return SafeArray(GetTypeInfoFromType(type).DeclaredFields);
} }
public override Type[] GetGenericArguments(Type type) public override Type[] GetGenericArguments(Type type)
{ {
return type.GetTypeInfo().GenericTypeArguments; return type.GetTypeInfo().GenericTypeArguments;
} }
public override MethodInfo GetGetMethod(PropertyInfo pi) public override MethodInfo GetGetMethod(PropertyInfo pi)
{ {
return pi.GetMethod; return pi.GetMethod;
} }
public override Type GetInterface(Type type, string name) public override Type GetInterface(Type type, string name)
{ {
return type.GetTypeInfo().ImplementedInterfaces.FirstOrDefault(t => t.Name == name); return type.GetTypeInfo().ImplementedInterfaces.FirstOrDefault(t => t.Name == name);
} }
public override Type[] GetInterfaces(Type t) public override Type[] GetInterfaces(Type t)
{ {
return SafeArray(GetTypeInfoFromType(t).ImplementedInterfaces); return SafeArray(GetTypeInfoFromType(t).ImplementedInterfaces);
} }
public override MethodInfo GetMethod(Type type, string name) public override MethodInfo GetMethod(Type type, string name)
{ {
return GetTypeInfoFromType(type).GetDeclaredMethod(name); return GetTypeInfoFromType(type).GetDeclaredMethod(name);
} }
public override MethodInfo[] GetMethods(Type type) public override MethodInfo[] GetMethods(Type type)
{ {
return SafeArray(GetTypeInfoFromType(type).DeclaredMethods); return SafeArray(GetTypeInfoFromType(type).DeclaredMethods);
} }
public override Type[] GetNestedTypes(Type type) public override Type[] GetNestedTypes(Type type)
{ {
return SafeArray(GetTypeInfoFromType(type).DeclaredNestedTypes.Select(ti => ti.AsType())); return SafeArray(GetTypeInfoFromType(type).DeclaredNestedTypes.Select(ti => ti.AsType()));
} }
public override PropertyInfo[] GetProperties(Type type) public override PropertyInfo[] GetProperties(Type type)
{ {
return SafeArray(GetTypeInfoFromType(type).DeclaredProperties); return SafeArray(GetTypeInfoFromType(type).DeclaredProperties);
} }
public override PropertyInfo GetProperty(Type type, string name) public override PropertyInfo GetProperty(Type type, string name)
{ {
return GetTypeInfoFromType(type).GetDeclaredProperty(name); return GetTypeInfoFromType(type).GetDeclaredProperty(name);
} }
public override MethodInfo GetRemoveMethod(EventInfo ei) public override MethodInfo GetRemoveMethod(EventInfo ei)
{ {
return ei.RemoveMethod; return ei.RemoveMethod;
} }
public override MethodInfo GetSetMethod(PropertyInfo pi) public override MethodInfo GetSetMethod(PropertyInfo pi)
{ {
return pi.SetMethod; return pi.SetMethod;
} }
public override bool IsAssignableFrom(Type current, Type toCompare) public override bool IsAssignableFrom(Type current, Type toCompare)
{ {
return current.GetTypeInfo().IsAssignableFrom(toCompare.GetTypeInfo()); return current.GetTypeInfo().IsAssignableFrom(toCompare.GetTypeInfo());
} }
public override bool IsDbNull(object o) public override bool IsDbNull(object o)
{ {
return o != null && o.GetType().FullName.StartsWith("System.DBNull"); return o != null && o.GetType().FullName.StartsWith("System.DBNull");
} }
public override bool IsInstanceOfType(Type t, object o) public override bool IsInstanceOfType(Type t, object o)
{ {
if (o == null) if (o == null)
return false; return false;
return t.GetTypeInfo().IsAssignableFrom(o.GetType().GetTypeInfo()); return t.GetTypeInfo().IsAssignableFrom(o.GetType().GetTypeInfo());
} }
public override bool StringContainsChar(string str, char chr) public override bool StringContainsChar(string str, char chr)
{ {
return str.Contains(chr); return str.Contains(chr);
} }
private static MethodInfo GetMethodEx(Type t, string name, Type[] parameters) private static MethodInfo GetMethodEx(Type t, string name, Type[] parameters)
{ {
var ti = t.GetTypeInfo(); var ti = t.GetTypeInfo();
var methods = ti.GetDeclaredMethods(name); var methods = ti.GetDeclaredMethods(name);
foreach (var m in methods) foreach (var m in methods)
{ {
var plist = m.GetParameters(); var plist = m.GetParameters();
bool match = true; bool match = true;
foreach (var param in plist) foreach (var param in plist)
{ {
bool valid = true; bool valid = true;
if (parameters != null) if (parameters != null)
{ {
foreach (var ptype in parameters) foreach (var ptype in parameters)
valid &= ptype == param.ParameterType; valid &= ptype == param.ParameterType;
} }
match &= valid; match &= valid;
} }
if (match) if (match)
return m; return m;
} }
return null; return null;
} }
public override MethodInfo GetMethod(Type resourcesType, string name, Type[] types) public override MethodInfo GetMethod(Type resourcesType, string name, Type[] types)
{ {
return GetMethodEx(resourcesType, name, types); return GetMethodEx(resourcesType, name, types);
} }
public override Type[] GetAssemblyTypes(Assembly asm) public override Type[] GetAssemblyTypes(Assembly asm)
{ {
return SafeArray(asm.ExportedTypes); return SafeArray(asm.ExportedTypes);
} }
} }
} }
#endif #endif

2
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/CoreLib/BasicModule.cs vendored

@ -61,7 +61,7 @@ namespace MoonSharp.Interpreter.CoreLib
string mode = opt.CastToString(); string mode = opt.CastToString();
if (mode == null || mode == "collect" || mode == "restart") if (mode == null || mode == "collect" || mode == "restart")
{ {
#if PCL || ENABLE_DOTNET #if PCL || ENABLE_DOTNET
GC.Collect(); GC.Collect();
#else #else

4
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/CoreLib/IO/FileUserDataBase.cs vendored

@ -1,8 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
namespace MoonSharp.Interpreter.CoreLib.IO namespace MoonSharp.Interpreter.CoreLib.IO
{ {
/// <summary> /// <summary>

6
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/CoreLib/IoModule.cs vendored

@ -1,12 +1,12 @@
// Disable warnings about XML documentation // Disable warnings about XML documentation
#pragma warning disable 1591 #pragma warning disable 1591
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
using MoonSharp.Interpreter.CoreLib.IO; using MoonSharp.Interpreter.CoreLib.IO;
using MoonSharp.Interpreter.Platforms; using MoonSharp.Interpreter.Platforms;

4
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/CoreLib/LoadModule.cs vendored

@ -22,8 +22,8 @@ namespace MoonSharp.Interpreter.CoreLib
else if (package.Type != DataType.Table) else if (package.Type != DataType.Table)
{ {
throw new InternalErrorException("'package' global variable was found and it is not a table"); throw new InternalErrorException("'package' global variable was found and it is not a table");
} }
#if PCL || ENABLE_DOTNET || NETFX_CORE #if PCL || ENABLE_DOTNET || NETFX_CORE
string cfg = "\\\n;\n?\n!\n-\n"; string cfg = "\\\n;\n?\n!\n-\n";
#else #else

4
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/CoreLib/OsTimeModule.cs vendored

@ -118,9 +118,9 @@ namespace MoonSharp.Interpreter.CoreLib
format = format.Substring(1); format = format.Substring(1);
} }
else else
{ {
#if !(PCL || ENABLE_DOTNET || NETFX_CORE) #if !(PCL || ENABLE_DOTNET || NETFX_CORE)
try try
{ {
reference = TimeZoneInfo.ConvertTimeFromUtc(reference, TimeZoneInfo.Local); reference = TimeZoneInfo.ConvertTimeFromUtc(reference, TimeZoneInfo.Local);

6
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/DataTypes/CallbackFunction.cs vendored

@ -87,10 +87,10 @@ namespace MoonSharp.Interpreter
public static CallbackFunction FromDelegate(Script script, Delegate del, InteropAccessMode accessMode = InteropAccessMode.Default) public static CallbackFunction FromDelegate(Script script, Delegate del, InteropAccessMode accessMode = InteropAccessMode.Default)
{ {
if (accessMode == InteropAccessMode.Default) if (accessMode == InteropAccessMode.Default)
accessMode = m_DefaultAccessMode; accessMode = m_DefaultAccessMode;
#if NETFX_CORE #if NETFX_CORE
MethodMemberDescriptor descr = new MethodMemberDescriptor(del.GetMethodInfo(), accessMode); MethodMemberDescriptor descr = new MethodMemberDescriptor(del.GetMethodInfo(), accessMode);
#else #else
MethodMemberDescriptor descr = new MethodMemberDescriptor(del.Method, accessMode); MethodMemberDescriptor descr = new MethodMemberDescriptor(del.Method, accessMode);
#endif #endif

20
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/DataTypes/UserData.cs vendored

@ -141,16 +141,16 @@ namespace MoonSharp.Interpreter
/// <param name="asm">The assembly.</param> /// <param name="asm">The assembly.</param>
/// <param name="includeExtensionTypes">if set to <c>true</c> extension types are registered to the appropriate registry.</param> /// <param name="includeExtensionTypes">if set to <c>true</c> extension types are registered to the appropriate registry.</param>
public static void RegisterAssembly(Assembly asm = null, bool includeExtensionTypes = false) public static void RegisterAssembly(Assembly asm = null, bool includeExtensionTypes = false)
{ {
if (asm == null) if (asm == null)
{ {
#if NETFX_CORE || DOTNET_CORE #if NETFX_CORE || DOTNET_CORE
throw new NotSupportedException("Assembly.GetCallingAssembly is not supported on target framework."); throw new NotSupportedException("Assembly.GetCallingAssembly is not supported on target framework.");
#else #else
asm = Assembly.GetCallingAssembly(); asm = Assembly.GetCallingAssembly();
#endif #endif
} }
TypeDescriptorRegistry.RegisterAssembly(asm, includeExtensionTypes); TypeDescriptorRegistry.RegisterAssembly(asm, includeExtensionTypes);
} }

8
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Errors/DynamicExpressionException.cs vendored

@ -1,13 +1,13 @@
 
using System; using System;
namespace MoonSharp.Interpreter namespace MoonSharp.Interpreter
{ {
/// <summary> /// <summary>
/// Exception thrown when a dynamic expression is invalid /// Exception thrown when a dynamic expression is invalid
/// </summary> /// </summary>
#if !(PCL || ((!UNITY_EDITOR) && (ENABLE_DOTNET)) || NETFX_CORE) #if !(PCL || ((!UNITY_EDITOR) && (ENABLE_DOTNET)) || NETFX_CORE)
[Serializable] [Serializable]
#endif #endif
public class DynamicExpressionException : ScriptRuntimeException public class DynamicExpressionException : ScriptRuntimeException
{ {

4
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Errors/InternalErrorException.cs vendored

@ -1,12 +1,12 @@
using System; using System;
namespace MoonSharp.Interpreter namespace MoonSharp.Interpreter
{ {
/// <summary> /// <summary>
/// Exception thrown when an inconsistent state is reached in the interpreter /// Exception thrown when an inconsistent state is reached in the interpreter
/// </summary> /// </summary>
#if !(PCL || ((!UNITY_EDITOR) && (ENABLE_DOTNET)) || NETFX_CORE) #if !(PCL || ((!UNITY_EDITOR) && (ENABLE_DOTNET)) || NETFX_CORE)
[Serializable] [Serializable]
#endif #endif
public class InternalErrorException : InterpreterException public class InternalErrorException : InterpreterException
{ {

4
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Errors/InterpreterException.cs vendored

@ -3,12 +3,12 @@ using System.Collections.Generic;
using MoonSharp.Interpreter.Debugging; using MoonSharp.Interpreter.Debugging;
namespace MoonSharp.Interpreter namespace MoonSharp.Interpreter
{ {
/// <summary> /// <summary>
/// Base type of all exceptions thrown in MoonSharp /// Base type of all exceptions thrown in MoonSharp
/// </summary> /// </summary>
#if !(PCL || ((!UNITY_EDITOR) && (ENABLE_DOTNET)) || NETFX_CORE) #if !(PCL || ((!UNITY_EDITOR) && (ENABLE_DOTNET)) || NETFX_CORE)
[Serializable] [Serializable]
#endif #endif
public class InterpreterException : Exception public class InterpreterException : Exception
{ {

4
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Errors/ScriptRuntimeException.cs vendored

@ -3,13 +3,13 @@ using MoonSharp.Interpreter.Interop;
using MoonSharp.Interpreter.Interop.BasicDescriptors; using MoonSharp.Interpreter.Interop.BasicDescriptors;
namespace MoonSharp.Interpreter namespace MoonSharp.Interpreter
{ {
/// <summary> /// <summary>
/// Exception for all runtime errors. In addition to constructors, it offers a lot of static methods /// Exception for all runtime errors. In addition to constructors, it offers a lot of static methods
/// generating more "standard" Lua errors. /// generating more "standard" Lua errors.
/// </summary> /// </summary>
#if !(PCL || ((!UNITY_EDITOR) && (ENABLE_DOTNET)) || NETFX_CORE) #if !(PCL || ((!UNITY_EDITOR) && (ENABLE_DOTNET)) || NETFX_CORE)
[Serializable] [Serializable]
#endif #endif
public class ScriptRuntimeException : InterpreterException public class ScriptRuntimeException : InterpreterException
{ {

2
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Errors/SyntaxErrorException.cs vendored

@ -8,7 +8,7 @@ namespace MoonSharp.Interpreter
/// Exception for all parsing/lexing errors. /// Exception for all parsing/lexing errors.
/// </summary> /// </summary>
#if !(PCL || ((!UNITY_EDITOR) && (ENABLE_DOTNET)) || NETFX_CORE) #if !(PCL || ((!UNITY_EDITOR) && (ENABLE_DOTNET)) || NETFX_CORE)
[Serializable] [Serializable]
#endif #endif
public class SyntaxErrorException : InterpreterException public class SyntaxErrorException : InterpreterException
{ {

8
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Execution/VM/ByteCode.cs vendored

@ -57,8 +57,8 @@ namespace MoonSharp.Interpreter.Execution.VM
{ {
m_SourceRefStack.RemoveAt(m_SourceRefStack.Count - 1); m_SourceRefStack.RemoveAt(m_SourceRefStack.Count - 1);
m_CurrentSourceRef = (m_SourceRefStack.Count > 0) ? m_SourceRefStack[m_SourceRefStack.Count - 1] : null; m_CurrentSourceRef = (m_SourceRefStack.Count > 0) ? m_SourceRefStack[m_SourceRefStack.Count - 1] : null;
} }
#if (!PCL) && ((!UNITY_5) || UNITY_STANDALONE) && (!(NETFX_CORE)) #if (!PCL) && ((!UNITY_5) || UNITY_STANDALONE) && (!(NETFX_CORE))
public void Dump(string file) public void Dump(string file)
{ {
@ -70,8 +70,8 @@ namespace MoonSharp.Interpreter.Execution.VM
sb.AppendFormat(" {0}\n", Code[i]); sb.AppendFormat(" {0}\n", Code[i]);
else else
sb.AppendFormat("{0:X8} {1}\n", i, Code[i]); sb.AppendFormat("{0:X8} {1}\n", i, Code[i]);
} }
File.WriteAllText(file, sb.ToString()); File.WriteAllText(file, sb.ToString());
} }
#endif #endif

14
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Execution/VM/Processor/Processor.cs vendored

@ -130,13 +130,13 @@ namespace MoonSharp.Interpreter.Execution.VM
} }
} }
int GetThreadId() int GetThreadId()
{ {
#if ENABLE_DOTNET || NETFX_CORE #if ENABLE_DOTNET || NETFX_CORE
return 1; return 1;
#else #else
return Thread.CurrentThread.ManagedThreadId; return Thread.CurrentThread.ManagedThreadId;
#endif #endif
} }
private void EnterProcessor() private void EnterProcessor()

12
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/IO/UndisposableStream.cs vendored

@ -19,8 +19,8 @@ namespace MoonSharp.Interpreter.IO
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
} }
#if !(PCL || ENABLE_DOTNET || NETFX_CORE) #if !(PCL || ENABLE_DOTNET || NETFX_CORE)
public override void Close() public override void Close()
{ {
@ -77,8 +77,8 @@ namespace MoonSharp.Interpreter.IO
public override void Write(byte[] buffer, int offset, int count) public override void Write(byte[] buffer, int offset, int count)
{ {
m_Stream.Write(buffer, offset, count); m_Stream.Write(buffer, offset, count);
} }
#if (!(NETFX_CORE)) #if (!(NETFX_CORE))
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state) public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
{ {
@ -88,7 +88,7 @@ namespace MoonSharp.Interpreter.IO
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state) public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
{ {
return m_Stream.BeginWrite(buffer, offset, count, callback, state); return m_Stream.BeginWrite(buffer, offset, count, callback, state);
} }
public override void EndWrite(IAsyncResult asyncResult) public override void EndWrite(IAsyncResult asyncResult)
{ {
@ -98,7 +98,7 @@ namespace MoonSharp.Interpreter.IO
public override int EndRead(IAsyncResult asyncResult) public override int EndRead(IAsyncResult asyncResult)
{ {
return m_Stream.EndRead(asyncResult); return m_Stream.EndRead(asyncResult);
} }
#endif #endif
public override bool CanTimeout public override bool CanTimeout
{ {

2
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/BasicDescriptors/DispatchingUserDataDescriptor.cs vendored

@ -1,7 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
using MoonSharp.Interpreter.Interop.Converters; using MoonSharp.Interpreter.Interop.Converters;
namespace MoonSharp.Interpreter.Interop.BasicDescriptors namespace MoonSharp.Interpreter.Interop.BasicDescriptors

4
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/BasicDescriptors/ParameterDescriptor.cs vendored

@ -1,8 +1,8 @@
using System; using System;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
namespace MoonSharp.Interpreter.Interop.BasicDescriptors namespace MoonSharp.Interpreter.Interop.BasicDescriptors
{ {
/// <summary> /// <summary>

12
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/Converters/ClrToScriptConversions.cs vendored

@ -81,15 +81,15 @@ namespace MoonSharp.Interpreter.Interop.Converters
if (obj is Delegate) if (obj is Delegate)
{ {
Delegate d = (Delegate)obj; Delegate d = (Delegate)obj;
#if NETFX_CORE #if NETFX_CORE
MethodInfo mi = d.GetMethodInfo(); MethodInfo mi = d.GetMethodInfo();
#else #else
MethodInfo mi = d.Method; MethodInfo mi = d.Method;
#endif #endif
if (CallbackFunction.CheckCallbackSignature(mi, false)) if (CallbackFunction.CheckCallbackSignature(mi, false))
return DynValue.NewCallback((Func<ScriptExecutionContext, CallbackArguments, DynValue>)d); return DynValue.NewCallback((Func<ScriptExecutionContext, CallbackArguments, DynValue>)d);
} }

4
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/Converters/ScriptToClrConversions.cs vendored

@ -1,6 +1,6 @@
using System; using System;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
namespace MoonSharp.Interpreter.Interop.Converters namespace MoonSharp.Interpreter.Interop.Converters
{ {
internal static class ScriptToClrConversions internal static class ScriptToClrConversions

4
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/Converters/TableConversions.cs vendored

@ -1,7 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
namespace MoonSharp.Interpreter.Interop.Converters namespace MoonSharp.Interpreter.Interop.Converters
{ {
internal static class TableConversions internal static class TableConversions

16
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/DescriptorHelpers.cs vendored

@ -3,8 +3,8 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
namespace MoonSharp.Interpreter.Interop namespace MoonSharp.Interpreter.Interop
{ {
/// <summary> /// <summary>
@ -42,16 +42,16 @@ namespace MoonSharp.Interpreter.Interop
return null; return null;
} }
public static bool IsDelegateType(this Type t) public static bool IsDelegateType(this Type t)
{ {
return Framework.Do.IsAssignableFrom(typeof(Delegate), t); return Framework.Do.IsAssignableFrom(typeof(Delegate), t);
} }
/// <summary> /// <summary>
/// Gets the visibility of the type as a string /// Gets the visibility of the type as a string
/// </summary> /// </summary>
public static string GetClrVisibility(this Type type) public static string GetClrVisibility(this Type type)
{ {
#if NETFX_CORE #if NETFX_CORE
var t = type.GetTypeInfo(); var t = type.GetTypeInfo();
#else #else
@ -66,7 +66,7 @@ namespace MoonSharp.Interpreter.Interop
if (t.IsNestedFamANDAssem || t.IsNestedFamily) if (t.IsNestedFamANDAssem || t.IsNestedFamily)
return "protected"; return "protected";
if (t.IsNestedPrivate) if (t.IsNestedPrivate)
return "private"; return "private";
return "unknown"; return "unknown";
} }
@ -165,7 +165,7 @@ namespace MoonSharp.Interpreter.Interop
public static Type[] SafeGetTypes(this Assembly asm) public static Type[] SafeGetTypes(this Assembly asm)
{ {
try try
{ {
return Framework.Do.GetAssemblyTypes(asm); return Framework.Do.GetAssemblyTypes(asm);
} }
catch (ReflectionTypeLoadException) catch (ReflectionTypeLoadException)

1088
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/LuaStateInterop/Tools.cs vendored

File diff suppressed because it is too large Load Diff

4
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/PropertyTableAssigner.cs vendored

@ -2,8 +2,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
namespace MoonSharp.Interpreter.Interop namespace MoonSharp.Interpreter.Interop
{ {
/// <summary> /// <summary>

2
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/AutoDescribingUserDataDescriptor.cs vendored

@ -1,5 +1,5 @@
using System; using System;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
using MoonSharp.Interpreter.Interop; using MoonSharp.Interpreter.Interop;
namespace MoonSharp.Interpreter namespace MoonSharp.Interpreter

4
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/CompositeUserDataDescriptor.cs vendored

@ -1,7 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
namespace MoonSharp.Interpreter.Interop namespace MoonSharp.Interpreter.Interop
{ {
/// <summary> /// <summary>

2
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/MemberDescriptors/FunctionMemberDescriptorBase.cs vendored

@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
using MoonSharp.Interpreter.Interop.BasicDescriptors; using MoonSharp.Interpreter.Interop.BasicDescriptors;
using MoonSharp.Interpreter.Interop.Converters; using MoonSharp.Interpreter.Interop.Converters;

4
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/ProxyUserDataDescriptor.cs vendored

@ -1,6 +1,6 @@
using System; using System;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
namespace MoonSharp.Interpreter.Interop namespace MoonSharp.Interpreter.Interop
{ {
/// <summary> /// <summary>

4
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/EventMemberDescriptor.cs vendored

@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
using MoonSharp.Interpreter.DataStructs; using MoonSharp.Interpreter.DataStructs;
using MoonSharp.Interpreter.Interop.BasicDescriptors; using MoonSharp.Interpreter.Interop.BasicDescriptors;
using MoonSharp.Interpreter.Interop.StandardDescriptors; using MoonSharp.Interpreter.Interop.StandardDescriptors;
@ -202,7 +202,7 @@ namespace MoonSharp.Interpreter.Interop
{ {
m_Delegates.GetOrCreate(o, () => m_Delegates.GetOrCreate(o, () =>
{ {
Delegate d = CreateDelegate(o); Delegate d = CreateDelegate(o);
#if NETFX_CORE #if NETFX_CORE
Delegate handler = d.GetMethodInfo().CreateDelegate(EventInfo.EventHandlerType, d.Target); Delegate handler = d.GetMethodInfo().CreateDelegate(EventInfo.EventHandlerType, d.Target);
#else #else

4
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/FieldMemberDescriptor.cs vendored

@ -2,7 +2,7 @@
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Reflection; using System.Reflection;
using System.Threading; using System.Threading;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
using MoonSharp.Interpreter.Diagnostics; using MoonSharp.Interpreter.Diagnostics;
using MoonSharp.Interpreter.Interop.BasicDescriptors; using MoonSharp.Interpreter.Interop.BasicDescriptors;
using MoonSharp.Interpreter.Interop.Converters; using MoonSharp.Interpreter.Interop.Converters;
@ -178,7 +178,7 @@ namespace MoonSharp.Interpreter.Interop
{ {
// optimized setters fall here // optimized setters fall here
throw ScriptRuntimeException.UserDataArgumentTypeMismatch(v.Type, FieldInfo.FieldType); throw ScriptRuntimeException.UserDataArgumentTypeMismatch(v.Type, FieldInfo.FieldType);
} }
#if !(PCL || ENABLE_DOTNET || NETFX_CORE) #if !(PCL || ENABLE_DOTNET || NETFX_CORE)
catch (FieldAccessException ex) catch (FieldAccessException ex)
{ {

2
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/MethodMemberDescriptor.cs vendored

@ -5,7 +5,7 @@ using System.Linq.Expressions;
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Threading; using System.Threading;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
using MoonSharp.Interpreter.Diagnostics; using MoonSharp.Interpreter.Diagnostics;
using MoonSharp.Interpreter.Interop.BasicDescriptors; using MoonSharp.Interpreter.Interop.BasicDescriptors;

6
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/OverloadedMethodMemberDescriptor.cs vendored

@ -1,9 +1,9 @@
//#define DEBUG_OVERLOAD_RESOLVER //#define DEBUG_OVERLOAD_RESOLVER
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
using MoonSharp.Interpreter.Interop.BasicDescriptors; using MoonSharp.Interpreter.Interop.BasicDescriptors;
using MoonSharp.Interpreter.Interop.Converters; using MoonSharp.Interpreter.Interop.Converters;

2
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/PropertyMemberDescriptor.cs vendored

@ -2,7 +2,7 @@
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Reflection; using System.Reflection;
using System.Threading; using System.Threading;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
using MoonSharp.Interpreter.Diagnostics; using MoonSharp.Interpreter.Diagnostics;
using MoonSharp.Interpreter.Interop.BasicDescriptors; using MoonSharp.Interpreter.Interop.BasicDescriptors;
using MoonSharp.Interpreter.Interop.Converters; using MoonSharp.Interpreter.Interop.Converters;

2
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/ValueTypeDefaultCtorMemberDescriptor.cs vendored

@ -1,5 +1,5 @@
using System; using System;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
using MoonSharp.Interpreter.Interop.BasicDescriptors; using MoonSharp.Interpreter.Interop.BasicDescriptors;
using MoonSharp.Interpreter.Interop.Converters; using MoonSharp.Interpreter.Interop.Converters;

2
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/StandardEnumUserDataDescriptor.cs vendored

@ -1,6 +1,6 @@
using System; using System;
using System.Linq; using System.Linq;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
using MoonSharp.Interpreter.Interop.BasicDescriptors; using MoonSharp.Interpreter.Interop.BasicDescriptors;
namespace MoonSharp.Interpreter.Interop namespace MoonSharp.Interpreter.Interop

8
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/StandardGenericsUserDataDescriptor.cs vendored

@ -1,6 +1,6 @@
using System; using System;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
namespace MoonSharp.Interpreter.Interop namespace MoonSharp.Interpreter.Interop
{ {
/// <summary> /// <summary>
@ -64,8 +64,8 @@ namespace MoonSharp.Interpreter.Interop
public bool IsTypeCompatible(Type type, object obj) public bool IsTypeCompatible(Type type, object obj)
{ {
return Framework.Do.IsInstanceOfType(type, obj); return Framework.Do.IsInstanceOfType(type, obj);
} }
/// <inheritdoc/> /// <inheritdoc/>
public IUserDataDescriptor Generate(Type type) public IUserDataDescriptor Generate(Type type)
{ {

28
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/StandardDescriptors/StandardUserDataDescriptor.cs vendored

@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
using MoonSharp.Interpreter.Interop.BasicDescriptors; using MoonSharp.Interpreter.Interop.BasicDescriptors;
namespace MoonSharp.Interpreter.Interop namespace MoonSharp.Interpreter.Interop
@ -56,19 +56,19 @@ namespace MoonSharp.Interpreter.Interop
if (AccessMode == InteropAccessMode.HideMembers) if (AccessMode == InteropAccessMode.HideMembers)
return; return;
if (!type.IsDelegateType()) if (!type.IsDelegateType())
{ {
// add declared constructors // add declared constructors
foreach (ConstructorInfo ci in Framework.Do.GetConstructors(type)) foreach (ConstructorInfo ci in Framework.Do.GetConstructors(type))
{ {
if (membersToIgnore.Contains("__new")) if (membersToIgnore.Contains("__new"))
continue; continue;
AddMember("__new", MethodMemberDescriptor.TryCreateIfVisible(ci, this.AccessMode)); AddMember("__new", MethodMemberDescriptor.TryCreateIfVisible(ci, this.AccessMode));
} }
// valuetypes don't reflect their empty ctor.. actually empty ctors are a perversion, we don't care and implement ours // valuetypes don't reflect their empty ctor.. actually empty ctors are a perversion, we don't care and implement ours
if (Framework.Do.IsValueType(type) && !membersToIgnore.Contains("__new")) if (Framework.Do.IsValueType(type) && !membersToIgnore.Contains("__new"))
AddMember("__new", new ValueTypeDefaultCtorMemberDescriptor(type)); AddMember("__new", new ValueTypeDefaultCtorMemberDescriptor(type));
} }

16
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/UserDataRegistries/ExtensionMethodsRegistry.cs vendored

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
using MoonSharp.Interpreter.DataStructs; using MoonSharp.Interpreter.DataStructs;
using MoonSharp.Interpreter.Interop.BasicDescriptors; using MoonSharp.Interpreter.Interop.BasicDescriptors;
@ -67,13 +67,13 @@ namespace MoonSharp.Interpreter.Interop.UserDataRegistries
if (changesDone) if (changesDone)
++s_ExtensionMethodChangeVersion; ++s_ExtensionMethodChangeVersion;
} }
} }
private static object FrameworkGetMethods() private static object FrameworkGetMethods()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
/// <summary> /// <summary>
/// Gets all the extension methods which can match a given name /// Gets all the extension methods which can match a given name
/// </summary> /// </summary>

192
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Interop/UserDataRegistries/TypeDescriptorRegistry.cs vendored

@ -4,12 +4,12 @@ using System.Linq;
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Threading; using System.Threading;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
using MoonSharp.Interpreter.Interop.BasicDescriptors; using MoonSharp.Interpreter.Interop.BasicDescriptors;
using MoonSharp.Interpreter.Interop.RegistrationPolicies; using MoonSharp.Interpreter.Interop.RegistrationPolicies;
namespace MoonSharp.Interpreter.Interop.UserDataRegistries namespace MoonSharp.Interpreter.Interop.UserDataRegistries
{ {
/// <summary> /// <summary>
/// Registry of all type descriptors. Use UserData statics to access these. /// Registry of all type descriptors. Use UserData statics to access these.
/// </summary> /// </summary>
@ -18,8 +18,8 @@ namespace MoonSharp.Interpreter.Interop.UserDataRegistries
private static object s_Lock = new object(); private static object s_Lock = new object();
private static Dictionary<Type, IUserDataDescriptor> s_TypeRegistry = new Dictionary<Type, IUserDataDescriptor>(); private static Dictionary<Type, IUserDataDescriptor> s_TypeRegistry = new Dictionary<Type, IUserDataDescriptor>();
private static Dictionary<Type, IUserDataDescriptor> s_TypeRegistryHistory = new Dictionary<Type, IUserDataDescriptor>(); private static Dictionary<Type, IUserDataDescriptor> s_TypeRegistryHistory = new Dictionary<Type, IUserDataDescriptor>();
private static InteropAccessMode s_DefaultAccessMode; private static InteropAccessMode s_DefaultAccessMode;
/// <summary> /// <summary>
/// Registers all types marked with a MoonSharpUserDataAttribute that ar contained in an assembly. /// Registers all types marked with a MoonSharpUserDataAttribute that ar contained in an assembly.
/// </summary> /// </summary>
@ -27,14 +27,14 @@ namespace MoonSharp.Interpreter.Interop.UserDataRegistries
/// <param name="includeExtensionTypes">if set to <c>true</c> extension types are registered to the appropriate registry.</param> /// <param name="includeExtensionTypes">if set to <c>true</c> extension types are registered to the appropriate registry.</param>
internal static void RegisterAssembly(Assembly asm = null, bool includeExtensionTypes = false) internal static void RegisterAssembly(Assembly asm = null, bool includeExtensionTypes = false)
{ {
if (asm == null) if (asm == null)
{ {
#if NETFX_CORE || DOTNET_CORE #if NETFX_CORE || DOTNET_CORE
throw new NotSupportedException("Assembly.GetCallingAssembly is not supported on target framework."); throw new NotSupportedException("Assembly.GetCallingAssembly is not supported on target framework.");
#else #else
asm = Assembly.GetCallingAssembly(); asm = Assembly.GetCallingAssembly();
#endif #endif
} }
if (includeExtensionTypes) if (includeExtensionTypes)
{ {
@ -62,9 +62,9 @@ namespace MoonSharp.Interpreter.Interop.UserDataRegistries
.First() .First()
.AccessMode); .AccessMode);
} }
} }
/// <summary> /// <summary>
/// Determines whether the specified type is registered. Note that this should be used only to check if a descriptor /// Determines whether the specified type is registered. Note that this should be used only to check if a descriptor
/// has been registered EXACTLY. For many types a descriptor can still be created, for example through the descriptor /// has been registered EXACTLY. For many types a descriptor can still be created, for example through the descriptor
@ -76,9 +76,9 @@ namespace MoonSharp.Interpreter.Interop.UserDataRegistries
{ {
lock (s_Lock) lock (s_Lock)
return s_TypeRegistry.ContainsKey(type); return s_TypeRegistry.ContainsKey(type);
} }
/// <summary> /// <summary>
/// Unregisters a type. /// Unregisters a type.
/// WARNING: unregistering types at runtime is a dangerous practice and may cause unwanted errors. /// WARNING: unregistering types at runtime is a dangerous practice and may cause unwanted errors.
@ -95,8 +95,8 @@ namespace MoonSharp.Interpreter.Interop.UserDataRegistries
PerformRegistration(t, null, s_TypeRegistry[t]); PerformRegistration(t, null, s_TypeRegistry[t]);
} }
} }
} }
/// <summary> /// <summary>
/// Gets or sets the default access mode to be used in the whole application /// Gets or sets the default access mode to be used in the whole application
/// </summary> /// </summary>
@ -114,8 +114,8 @@ namespace MoonSharp.Interpreter.Interop.UserDataRegistries
s_DefaultAccessMode = value; s_DefaultAccessMode = value;
} }
} }
/// <summary> /// <summary>
/// Registers a proxy type. /// Registers a proxy type.
/// </summary> /// </summary>
@ -127,9 +127,9 @@ namespace MoonSharp.Interpreter.Interop.UserDataRegistries
{ {
IUserDataDescriptor proxyDescriptor = RegisterType_Impl(proxyFactory.ProxyType, accessMode, friendlyName, null); IUserDataDescriptor proxyDescriptor = RegisterType_Impl(proxyFactory.ProxyType, accessMode, friendlyName, null);
return RegisterType_Impl(proxyFactory.TargetType, accessMode, friendlyName, new ProxyUserDataDescriptor(proxyFactory, proxyDescriptor, friendlyName)); return RegisterType_Impl(proxyFactory.TargetType, accessMode, friendlyName, new ProxyUserDataDescriptor(proxyFactory, proxyDescriptor, friendlyName));
} }
/// <summary> /// <summary>
/// Registers a type /// Registers a type
/// </summary> /// </summary>
@ -145,48 +145,48 @@ namespace MoonSharp.Interpreter.Interop.UserDataRegistries
lock (s_Lock) lock (s_Lock)
{ {
IUserDataDescriptor oldDescriptor = null; IUserDataDescriptor oldDescriptor = null;
s_TypeRegistry.TryGetValue(type, out oldDescriptor); s_TypeRegistry.TryGetValue(type, out oldDescriptor);
if (descriptor == null) if (descriptor == null)
{ {
if (IsTypeBlacklisted(type)) if (IsTypeBlacklisted(type))
return null; return null;
if (Framework.Do.GetInterfaces(type).Any(ii => ii == typeof(IUserDataType))) if (Framework.Do.GetInterfaces(type).Any(ii => ii == typeof(IUserDataType)))
{ {
AutoDescribingUserDataDescriptor audd = new AutoDescribingUserDataDescriptor(type, friendlyName); AutoDescribingUserDataDescriptor audd = new AutoDescribingUserDataDescriptor(type, friendlyName);
return PerformRegistration(type, audd, oldDescriptor); return PerformRegistration(type, audd, oldDescriptor);
} }
else if (Framework.Do.IsGenericTypeDefinition(type)) else if (Framework.Do.IsGenericTypeDefinition(type))
{ {
StandardGenericsUserDataDescriptor typeGen = new StandardGenericsUserDataDescriptor(type, accessMode); StandardGenericsUserDataDescriptor typeGen = new StandardGenericsUserDataDescriptor(type, accessMode);
return PerformRegistration(type, typeGen, oldDescriptor); return PerformRegistration(type, typeGen, oldDescriptor);
} }
else if (Framework.Do.IsEnum(type)) else if (Framework.Do.IsEnum(type))
{ {
var enumDescr = new StandardEnumUserDataDescriptor(type, friendlyName); var enumDescr = new StandardEnumUserDataDescriptor(type, friendlyName);
return PerformRegistration(type, enumDescr, oldDescriptor); return PerformRegistration(type, enumDescr, oldDescriptor);
} }
else else
{ {
StandardUserDataDescriptor udd = new StandardUserDataDescriptor(type, accessMode, friendlyName); StandardUserDataDescriptor udd = new StandardUserDataDescriptor(type, accessMode, friendlyName);
if (accessMode == InteropAccessMode.BackgroundOptimized) if (accessMode == InteropAccessMode.BackgroundOptimized)
{ {
#if NETFX_CORE #if NETFX_CORE
System.Threading.Tasks.Task.Run(() => ((IOptimizableDescriptor)udd).Optimize()); System.Threading.Tasks.Task.Run(() => ((IOptimizableDescriptor)udd).Optimize());
#else #else
ThreadPool.QueueUserWorkItem(o => ((IOptimizableDescriptor)udd).Optimize()); ThreadPool.QueueUserWorkItem(o => ((IOptimizableDescriptor)udd).Optimize());
#endif #endif
} }
return PerformRegistration(type, udd, oldDescriptor); return PerformRegistration(type, udd, oldDescriptor);
} }
} }
else else
{ {
PerformRegistration(type, descriptor, oldDescriptor); PerformRegistration(type, descriptor, oldDescriptor);
return descriptor; return descriptor;
} }
} }
} }
@ -209,8 +209,8 @@ namespace MoonSharp.Interpreter.Interop.UserDataRegistries
} }
return result; return result;
} }
/// <summary> /// <summary>
/// Resolves the default type of the access mode for the given type /// Resolves the default type of the access mode for the given type
/// </summary> /// </summary>
@ -233,10 +233,10 @@ namespace MoonSharp.Interpreter.Interop.UserDataRegistries
accessMode = s_DefaultAccessMode; accessMode = s_DefaultAccessMode;
return accessMode; return accessMode;
} }
/// <summary> /// <summary>
/// Gets the best possible type descriptor for a specified CLR type. /// Gets the best possible type descriptor for a specified CLR type.
/// </summary> /// </summary>
@ -247,22 +247,22 @@ namespace MoonSharp.Interpreter.Interop.UserDataRegistries
{ {
lock (s_Lock) lock (s_Lock)
{ {
IUserDataDescriptor typeDescriptor = null; IUserDataDescriptor typeDescriptor = null;
// if the type has been explicitly registered, return its descriptor as it's complete // if the type has been explicitly registered, return its descriptor as it's complete
if (s_TypeRegistry.ContainsKey(type)) if (s_TypeRegistry.ContainsKey(type))
return s_TypeRegistry[type]; return s_TypeRegistry[type];
if (RegistrationPolicy.AllowTypeAutoRegistration(type)) if (RegistrationPolicy.AllowTypeAutoRegistration(type))
{ {
// no autoreg of delegates // no autoreg of delegates
if (!Framework.Do.IsAssignableFrom((typeof(Delegate)), type)) if (!Framework.Do.IsAssignableFrom((typeof(Delegate)), type))
{ {
return RegisterType_Impl(type, DefaultAccessMode, type.FullName, null); return RegisterType_Impl(type, DefaultAccessMode, type.FullName, null);
} }
} }
// search for the base object descriptors // search for the base object descriptors
for (Type t = type; t != null; t = Framework.Do.GetBaseType(t)) for (Type t = type; t != null; t = Framework.Do.GetBaseType(t))
{ {
IUserDataDescriptor u; IUserDataDescriptor u;
@ -283,10 +283,10 @@ namespace MoonSharp.Interpreter.Interop.UserDataRegistries
} }
if (typeDescriptor is IGeneratorUserDataDescriptor) if (typeDescriptor is IGeneratorUserDataDescriptor)
typeDescriptor = ((IGeneratorUserDataDescriptor)typeDescriptor).Generate(type); typeDescriptor = ((IGeneratorUserDataDescriptor)typeDescriptor).Generate(type);
// we should not search interfaces (for example, it's just for statics..), no need to look further // we should not search interfaces (for example, it's just for statics..), no need to look further
if (!searchInterfaces) if (!searchInterfaces)
return typeDescriptor; return typeDescriptor;
@ -331,14 +331,14 @@ namespace MoonSharp.Interpreter.Interop.UserDataRegistries
else else
return new CompositeUserDataDescriptor(descriptors, type); return new CompositeUserDataDescriptor(descriptors, type);
} }
} }
private static bool FrameworkIsAssignableFrom(Type type) private static bool FrameworkIsAssignableFrom(Type type)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
/// <summary> /// <summary>
/// Determines whether the specified type is blacklisted. /// Determines whether the specified type is blacklisted.
/// Blacklisted types CANNOT be registered using default descriptors but they can still be registered /// Blacklisted types CANNOT be registered using default descriptors but they can still be registered
@ -353,8 +353,8 @@ namespace MoonSharp.Interpreter.Interop.UserDataRegistries
return true; return true;
return false; return false;
} }
/// <summary> /// <summary>
/// Gets the list of registered types. /// Gets the list of registered types.
/// </summary> /// </summary>
@ -364,8 +364,8 @@ namespace MoonSharp.Interpreter.Interop.UserDataRegistries
public static IEnumerable<KeyValuePair<Type, IUserDataDescriptor>> RegisteredTypes public static IEnumerable<KeyValuePair<Type, IUserDataDescriptor>> RegisteredTypes
{ {
get { lock (s_Lock) return s_TypeRegistry.ToArray(); } get { lock (s_Lock) return s_TypeRegistry.ToArray(); }
} }
/// <summary> /// <summary>
/// Gets the list of registered types, including unregistered types. /// Gets the list of registered types, including unregistered types.
/// </summary> /// </summary>
@ -375,9 +375,9 @@ namespace MoonSharp.Interpreter.Interop.UserDataRegistries
public static IEnumerable<KeyValuePair<Type, IUserDataDescriptor>> RegisteredTypesHistory public static IEnumerable<KeyValuePair<Type, IUserDataDescriptor>> RegisteredTypesHistory
{ {
get { lock (s_Lock) return s_TypeRegistryHistory.ToArray(); } get { lock (s_Lock) return s_TypeRegistryHistory.ToArray(); }
} }
/// <summary> /// <summary>
/// Gets or sets the registration policy. /// Gets or sets the registration policy.
/// </summary> /// </summary>

18
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Loaders/EmbeddedResourcesScriptLoader.cs vendored

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
@ -19,14 +19,14 @@ namespace MoonSharp.Interpreter.Loaders
/// </summary> /// </summary>
/// <param name="resourceAssembly">The assembly containing the scripts as embedded resources or null to use the calling assembly.</param> /// <param name="resourceAssembly">The assembly containing the scripts as embedded resources or null to use the calling assembly.</param>
public EmbeddedResourcesScriptLoader(Assembly resourceAssembly = null) public EmbeddedResourcesScriptLoader(Assembly resourceAssembly = null)
{ {
if (resourceAssembly == null) if (resourceAssembly == null)
{ {
#if NETFX_CORE || DOTNET_CORE #if NETFX_CORE || DOTNET_CORE
throw new NotSupportedException("Assembly.GetCallingAssembly is not supported on target framework."); throw new NotSupportedException("Assembly.GetCallingAssembly is not supported on target framework.");
#else #else
resourceAssembly = Assembly.GetCallingAssembly(); resourceAssembly = Assembly.GetCallingAssembly();
#endif #endif
} }
m_ResourceAssembly = resourceAssembly; m_ResourceAssembly = resourceAssembly;

348
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Loaders/UnityAssetsScriptLoader.cs vendored

@ -1,175 +1,175 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
namespace MoonSharp.Interpreter.Loaders namespace MoonSharp.Interpreter.Loaders
{ {
/// <summary> /// <summary>
/// A script loader which can load scripts from assets in Unity3D. /// A script loader which can load scripts from assets in Unity3D.
/// Scripts should be saved as .txt files in a subdirectory of Assets/Resources. /// Scripts should be saved as .txt files in a subdirectory of Assets/Resources.
/// ///
/// When MoonSharp is activated on Unity3D and the default script loader is used, /// When MoonSharp is activated on Unity3D and the default script loader is used,
/// scripts should be saved as .txt files in Assets/Resources/MoonSharp/Scripts. /// scripts should be saved as .txt files in Assets/Resources/MoonSharp/Scripts.
/// </summary> /// </summary>
public class UnityAssetsScriptLoader : ScriptLoaderBase public class UnityAssetsScriptLoader : ScriptLoaderBase
{ {
Dictionary<string, string> m_Resources = new Dictionary<string, string>(); Dictionary<string, string> m_Resources = new Dictionary<string, string>();
/// <summary> /// <summary>
/// The default path where scripts are meant to be stored (if not changed) /// The default path where scripts are meant to be stored (if not changed)
/// </summary> /// </summary>
public const string DEFAULT_PATH = "MoonSharp/Scripts"; public const string DEFAULT_PATH = "MoonSharp/Scripts";
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="UnityAssetsScriptLoader"/> class. /// Initializes a new instance of the <see cref="UnityAssetsScriptLoader"/> class.
/// </summary> /// </summary>
/// <param name="assetsPath">The path, relative to Assets/Resources. For example /// <param name="assetsPath">The path, relative to Assets/Resources. For example
/// if your scripts are stored under Assets/Resources/Scripts, you should /// if your scripts are stored under Assets/Resources/Scripts, you should
/// pass the value "Scripts". If null, "MoonSharp/Scripts" is used. </param> /// pass the value "Scripts". If null, "MoonSharp/Scripts" is used. </param>
public UnityAssetsScriptLoader(string assetsPath = null) public UnityAssetsScriptLoader(string assetsPath = null)
{ {
assetsPath = assetsPath ?? DEFAULT_PATH; assetsPath = assetsPath ?? DEFAULT_PATH;
#if UNITY_5 #if UNITY_5
LoadResourcesUnityNative(assetsPath); LoadResourcesUnityNative(assetsPath);
#else #else
LoadResourcesWithReflection(assetsPath); LoadResourcesWithReflection(assetsPath);
#endif #endif
} }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="UnityAssetsScriptLoader"/> class. /// Initializes a new instance of the <see cref="UnityAssetsScriptLoader"/> class.
/// </summary> /// </summary>
/// <param name="scriptToCodeMap">A dictionary mapping filenames to the proper Lua script code.</param> /// <param name="scriptToCodeMap">A dictionary mapping filenames to the proper Lua script code.</param>
public UnityAssetsScriptLoader(Dictionary<string, string> scriptToCodeMap) public UnityAssetsScriptLoader(Dictionary<string, string> scriptToCodeMap)
{ {
m_Resources = scriptToCodeMap; m_Resources = scriptToCodeMap;
} }
#if UNITY_5 #if UNITY_5
void LoadResourcesUnityNative(string assetsPath) void LoadResourcesUnityNative(string assetsPath)
{ {
try try
{ {
UnityEngine.Object[] array = UnityEngine.Resources.LoadAll(assetsPath, typeof(UnityEngine.TextAsset)); UnityEngine.Object[] array = UnityEngine.Resources.LoadAll(assetsPath, typeof(UnityEngine.TextAsset));
for (int i = 0; i < array.Length; i++) for (int i = 0; i < array.Length; i++)
{ {
UnityEngine.TextAsset o = (UnityEngine.TextAsset)array[i]; UnityEngine.TextAsset o = (UnityEngine.TextAsset)array[i];
string name = o.name; string name = o.name;
string text = o.text; string text = o.text;
m_Resources.Add(name, text); m_Resources.Add(name, text);
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
UnityEngine.Debug.LogErrorFormat("Error initializing UnityScriptLoader : {0}", ex); UnityEngine.Debug.LogErrorFormat("Error initializing UnityScriptLoader : {0}", ex);
} }
} }
#else #else
void LoadResourcesWithReflection(string assetsPath) void LoadResourcesWithReflection(string assetsPath)
{ {
try try
{ {
Type resourcesType = Type.GetType("UnityEngine.Resources, UnityEngine"); Type resourcesType = Type.GetType("UnityEngine.Resources, UnityEngine");
Type textAssetType = Type.GetType("UnityEngine.TextAsset, UnityEngine"); Type textAssetType = Type.GetType("UnityEngine.TextAsset, UnityEngine");
MethodInfo textAssetNameGet = Framework.Do.GetGetMethod(Framework.Do.GetProperty(textAssetType, "name")); MethodInfo textAssetNameGet = Framework.Do.GetGetMethod(Framework.Do.GetProperty(textAssetType, "name"));
MethodInfo textAssetTextGet = Framework.Do.GetGetMethod(Framework.Do.GetProperty(textAssetType, "text")); MethodInfo textAssetTextGet = Framework.Do.GetGetMethod(Framework.Do.GetProperty(textAssetType, "text"));
MethodInfo loadAll = Framework.Do.GetMethod(resourcesType, "LoadAll", MethodInfo loadAll = Framework.Do.GetMethod(resourcesType, "LoadAll",
new Type[] { typeof(string), typeof(Type) }); new Type[] { typeof(string), typeof(Type) });
Array array = (Array)loadAll.Invoke(null, new object[] { assetsPath, textAssetType }); Array array = (Array)loadAll.Invoke(null, new object[] { assetsPath, textAssetType });
for (int i = 0; i < array.Length; i++) for (int i = 0; i < array.Length; i++)
{ {
object o = array.GetValue(i); object o = array.GetValue(i);
string name = textAssetNameGet.Invoke(o, null) as string; string name = textAssetNameGet.Invoke(o, null) as string;
string text = textAssetTextGet.Invoke(o, null) as string; string text = textAssetTextGet.Invoke(o, null) as string;
m_Resources.Add(name, text); m_Resources.Add(name, text);
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
#if !(PCL || ENABLE_DOTNET || NETFX_CORE) #if !(PCL || ENABLE_DOTNET || NETFX_CORE)
Console.WriteLine("Error initializing UnityScriptLoader : {0}", ex); Console.WriteLine("Error initializing UnityScriptLoader : {0}", ex);
#endif #endif
System.Diagnostics.Debug.WriteLine(string.Format("Error initializing UnityScriptLoader : {0}", ex)); System.Diagnostics.Debug.WriteLine(string.Format("Error initializing UnityScriptLoader : {0}", ex));
} }
} }
#endif #endif
private string GetFileName(string filename) private string GetFileName(string filename)
{ {
int b = Math.Max(filename.LastIndexOf('\\'), filename.LastIndexOf('/')); int b = Math.Max(filename.LastIndexOf('\\'), filename.LastIndexOf('/'));
if (b > 0) if (b > 0)
filename = filename.Substring(b + 1); filename = filename.Substring(b + 1);
return filename; return filename;
} }
/// <summary> /// <summary>
/// Opens a file for reading the script code. /// Opens a file for reading the script code.
/// It can return either a string, a byte[] or a Stream. /// It can return either a string, a byte[] or a Stream.
/// If a byte[] is returned, the content is assumed to be a serialized (dumped) bytecode. If it's a string, it's /// If a byte[] is returned, the content is assumed to be a serialized (dumped) bytecode. If it's a string, it's
/// assumed to be either a script or the output of a string.dump call. If a Stream, autodetection takes place. /// assumed to be either a script or the output of a string.dump call. If a Stream, autodetection takes place.
/// </summary> /// </summary>
/// <param name="file">The file.</param> /// <param name="file">The file.</param>
/// <param name="globalContext">The global context.</param> /// <param name="globalContext">The global context.</param>
/// <returns> /// <returns>
/// A string, a byte[] or a Stream. /// A string, a byte[] or a Stream.
/// </returns> /// </returns>
/// <exception cref="System.Exception">UnityAssetsScriptLoader.LoadFile : Cannot load + file</exception> /// <exception cref="System.Exception">UnityAssetsScriptLoader.LoadFile : Cannot load + file</exception>
public override object LoadFile(string file, Table globalContext) public override object LoadFile(string file, Table globalContext)
{ {
file = GetFileName(file); file = GetFileName(file);
if (m_Resources.ContainsKey(file)) if (m_Resources.ContainsKey(file))
return m_Resources[file]; return m_Resources[file];
else else
{ {
var error = string.Format( var error = string.Format(
@"Cannot load script '{0}'. By default, scripts should be .txt files placed under a Assets/Resources/{1} directory. @"Cannot load script '{0}'. By default, scripts should be .txt files placed under a Assets/Resources/{1} directory.
If you want scripts to be put in another directory or another way, use a custom instance of UnityAssetsScriptLoader or implement If you want scripts to be put in another directory or another way, use a custom instance of UnityAssetsScriptLoader or implement
your own IScriptLoader (possibly extending ScriptLoaderBase).", file, DEFAULT_PATH); your own IScriptLoader (possibly extending ScriptLoaderBase).", file, DEFAULT_PATH);
throw new Exception(error); throw new Exception(error);
} }
} }
/// <summary> /// <summary>
/// Checks if a given file exists /// Checks if a given file exists
/// </summary> /// </summary>
/// <param name="file">The file.</param> /// <param name="file">The file.</param>
/// <returns></returns> /// <returns></returns>
public override bool ScriptFileExists(string file) public override bool ScriptFileExists(string file)
{ {
file = GetFileName(file); file = GetFileName(file);
return m_Resources.ContainsKey(file); return m_Resources.ContainsKey(file);
} }
/// <summary> /// <summary>
/// Gets the list of loaded scripts filenames (useful for debugging purposes). /// Gets the list of loaded scripts filenames (useful for debugging purposes).
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public string[] GetLoadedScripts() public string[] GetLoadedScripts()
{ {
return m_Resources.Keys.ToArray(); return m_Resources.Keys.ToArray();
} }
} }
} }

14
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Modules/ModuleRegister.cs vendored

@ -1,7 +1,7 @@
using System; using System;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
using MoonSharp.Interpreter.CoreLib; using MoonSharp.Interpreter.CoreLib;
using MoonSharp.Interpreter.Platforms; using MoonSharp.Interpreter.Platforms;
@ -93,15 +93,15 @@ namespace MoonSharp.Interpreter
MoonSharpModuleMethodAttribute attr = (MoonSharpModuleMethodAttribute)mi.GetCustomAttributes(typeof(MoonSharpModuleMethodAttribute), false).First(); MoonSharpModuleMethodAttribute attr = (MoonSharpModuleMethodAttribute)mi.GetCustomAttributes(typeof(MoonSharpModuleMethodAttribute), false).First();
if (!CallbackFunction.CheckCallbackSignature(mi, true)) if (!CallbackFunction.CheckCallbackSignature(mi, true))
throw new ArgumentException(string.Format("Method {0} does not have the right signature.", mi.Name)); throw new ArgumentException(string.Format("Method {0} does not have the right signature.", mi.Name));
#if NETFX_CORE #if NETFX_CORE
Delegate deleg = mi.CreateDelegate(typeof(Func<ScriptExecutionContext, CallbackArguments, DynValue>)); Delegate deleg = mi.CreateDelegate(typeof(Func<ScriptExecutionContext, CallbackArguments, DynValue>));
#else #else
Delegate deleg = Delegate.CreateDelegate(typeof(Func<ScriptExecutionContext, CallbackArguments, DynValue>), mi); Delegate deleg = Delegate.CreateDelegate(typeof(Func<ScriptExecutionContext, CallbackArguments, DynValue>), mi);
#endif #endif
Func<ScriptExecutionContext, CallbackArguments, DynValue> func = Func<ScriptExecutionContext, CallbackArguments, DynValue> func =
(Func<ScriptExecutionContext, CallbackArguments, DynValue>)deleg; (Func<ScriptExecutionContext, CallbackArguments, DynValue>)deleg;

98
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Platforms/DotNetCorePlatformAccessor.cs vendored

@ -1,18 +1,18 @@
#if DOTNET_CORE #if DOTNET_CORE
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.IO; using System.IO;
using System.Diagnostics; using System.Diagnostics;
namespace MoonSharp.Interpreter.Platforms namespace MoonSharp.Interpreter.Platforms
{ {
/// <summary> /// <summary>
/// Class providing the IPlatformAccessor interface for .NET Core builds /// Class providing the IPlatformAccessor interface for .NET Core builds
/// </summary> /// </summary>
public class DotNetCorePlatformAccessor : PlatformAccessorBase public class DotNetCorePlatformAccessor : PlatformAccessorBase
{ {
/// <summary> /// <summary>
/// Converts a Lua string access mode to a FileAccess enum /// Converts a Lua string access mode to a FileAccess enum
/// </summary> /// </summary>
@ -32,8 +32,8 @@ namespace MoonSharp.Interpreter.Platforms
return FileAccess.ReadWrite; return FileAccess.ReadWrite;
else else
return FileAccess.ReadWrite; return FileAccess.ReadWrite;
} }
/// <summary> /// <summary>
/// Converts a Lua string access mode to a ParseFileMode enum /// Converts a Lua string access mode to a ParseFileMode enum
/// </summary> /// </summary>
@ -53,9 +53,9 @@ namespace MoonSharp.Interpreter.Platforms
return FileMode.Truncate; return FileMode.Truncate;
else else
return FileMode.Append; return FileMode.Append;
} }
/// <summary> /// <summary>
/// A function used to open files in the 'io' module. /// A function used to open files in the 'io' module.
/// Can have an invalid implementation if 'io' module is filtered out. /// Can have an invalid implementation if 'io' module is filtered out.
@ -69,8 +69,8 @@ namespace MoonSharp.Interpreter.Platforms
public override Stream IO_OpenFile(Script script, string filename, Encoding encoding, string mode) public override Stream IO_OpenFile(Script script, string filename, Encoding encoding, string mode)
{ {
return new FileStream(filename, ParseFileMode(mode), ParseFileAccess(mode), FileShare.ReadWrite | FileShare.Delete); return new FileStream(filename, ParseFileMode(mode), ParseFileAccess(mode), FileShare.ReadWrite | FileShare.Delete);
} }
/// <summary> /// <summary>
/// Gets an environment variable. Must be implemented, but an implementation is allowed /// Gets an environment variable. Must be implemented, but an implementation is allowed
/// to always return null if a more meaningful implementation cannot be achieved or is /// to always return null if a more meaningful implementation cannot be achieved or is
@ -83,8 +83,8 @@ namespace MoonSharp.Interpreter.Platforms
public override string GetEnvironmentVariable(string envvarname) public override string GetEnvironmentVariable(string envvarname)
{ {
return Environment.GetEnvironmentVariable(envvarname); return Environment.GetEnvironmentVariable(envvarname);
} }
/// <summary> /// <summary>
/// Gets a standard stream (stdin, stdout, stderr). /// Gets a standard stream (stdin, stdout, stderr).
/// </summary> /// </summary>
@ -104,8 +104,8 @@ namespace MoonSharp.Interpreter.Platforms
default: default:
throw new ArgumentException("type"); throw new ArgumentException("type");
} }
} }
/// <summary> /// <summary>
/// Default handler for 'print' calls. Can be customized in ScriptOptions /// Default handler for 'print' calls. Can be customized in ScriptOptions
/// </summary> /// </summary>
@ -113,9 +113,9 @@ namespace MoonSharp.Interpreter.Platforms
public override void DefaultPrint(string content) public override void DefaultPrint(string content)
{ {
Console.WriteLine(content); Console.WriteLine(content);
} }
/// <summary> /// <summary>
/// Gets a temporary filename. Used in 'io' and 'os' modules. /// Gets a temporary filename. Used in 'io' and 'os' modules.
/// Can have an invalid implementation if 'io' and 'os' modules are filtered out. /// Can have an invalid implementation if 'io' and 'os' modules are filtered out.
@ -124,8 +124,8 @@ namespace MoonSharp.Interpreter.Platforms
public override string IO_OS_GetTempFilename() public override string IO_OS_GetTempFilename()
{ {
return Path.GetTempFileName(); return Path.GetTempFileName();
} }
/// <summary> /// <summary>
/// Exits the process, returning the specified exit code. /// Exits the process, returning the specified exit code.
/// Can have an invalid implementation if the 'os' module is filtered out. /// Can have an invalid implementation if the 'os' module is filtered out.
@ -134,8 +134,8 @@ namespace MoonSharp.Interpreter.Platforms
public override void OS_ExitFast(int exitCode) public override void OS_ExitFast(int exitCode)
{ {
Environment.Exit(exitCode); Environment.Exit(exitCode);
} }
/// <summary> /// <summary>
/// Checks if a file exists. Used by the 'os' module. /// Checks if a file exists. Used by the 'os' module.
/// Can have an invalid implementation if the 'os' module is filtered out. /// Can have an invalid implementation if the 'os' module is filtered out.
@ -147,8 +147,8 @@ namespace MoonSharp.Interpreter.Platforms
public override bool OS_FileExists(string file) public override bool OS_FileExists(string file)
{ {
return File.Exists(file); return File.Exists(file);
} }
/// <summary> /// <summary>
/// Deletes the specified file. Used by the 'os' module. /// Deletes the specified file. Used by the 'os' module.
/// Can have an invalid implementation if the 'os' module is filtered out. /// Can have an invalid implementation if the 'os' module is filtered out.
@ -157,8 +157,8 @@ namespace MoonSharp.Interpreter.Platforms
public override void OS_FileDelete(string file) public override void OS_FileDelete(string file)
{ {
File.Delete(file); File.Delete(file);
} }
/// <summary> /// <summary>
/// Moves the specified file. Used by the 'os' module. /// Moves the specified file. Used by the 'os' module.
/// Can have an invalid implementation if the 'os' module is filtered out. /// Can have an invalid implementation if the 'os' module is filtered out.
@ -166,12 +166,12 @@ namespace MoonSharp.Interpreter.Platforms
/// <param name="src">The source.</param> /// <param name="src">The source.</param>
/// <param name="dst">The DST.</param> /// <param name="dst">The DST.</param>
public override void OS_FileMove(string src, string dst) public override void OS_FileMove(string src, string dst)
{ {
#if (!PCL) && ((!UNITY_5) || UNITY_STANDALONE) #if (!PCL) && ((!UNITY_5) || UNITY_STANDALONE)
File.Move(src, dst); File.Move(src, dst);
#endif #endif
} }
/// <summary> /// <summary>
/// Executes the specified command line, returning the child process exit code and blocking in the meantime. /// Executes the specified command line, returning the child process exit code and blocking in the meantime.
/// Can have an invalid implementation if the 'os' module is filtered out. /// Can have an invalid implementation if the 'os' module is filtered out.
@ -179,18 +179,18 @@ namespace MoonSharp.Interpreter.Platforms
/// <param name="cmdline">The cmdline.</param> /// <param name="cmdline">The cmdline.</param>
/// <returns></returns> /// <returns></returns>
public override int OS_Execute(string cmdline) public override int OS_Execute(string cmdline)
{ {
// This is windows only! // This is windows only!
throw new NotSupportedException("Not supported on .NET core"); throw new NotSupportedException("Not supported on .NET core");
//ProcessStartInfo psi = new ProcessStartInfo("cmd.exe", string.Format("/C {0}", cmdline)); //ProcessStartInfo psi = new ProcessStartInfo("cmd.exe", string.Format("/C {0}", cmdline));
//psi.ErrorDialog = false; //psi.ErrorDialog = false;
//Process proc = Process.Start(psi); //Process proc = Process.Start(psi);
//proc.WaitForExit(); //proc.WaitForExit();
//return proc.ExitCode; //return proc.ExitCode;
} }
/// <summary> /// <summary>
/// Filters the CoreModules enumeration to exclude non-supported operations /// Filters the CoreModules enumeration to exclude non-supported operations
/// </summary> /// </summary>
@ -201,8 +201,8 @@ namespace MoonSharp.Interpreter.Platforms
public override CoreModules FilterSupportedCoreModules(CoreModules module) public override CoreModules FilterSupportedCoreModules(CoreModules module)
{ {
return module; return module;
} }
/// <summary> /// <summary>
/// Gets the platform name prefix /// Gets the platform name prefix
/// </summary> /// </summary>
@ -212,7 +212,7 @@ namespace MoonSharp.Interpreter.Platforms
{ {
return "core"; return "core";
} }
} }
} }
#endif #endif

156
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Platforms/PlatformAccessorBase.cs vendored

@ -27,15 +27,15 @@ namespace MoonSharp.Interpreter.Platforms
if (PlatformAutoDetector.IsRunningOnUnity) if (PlatformAutoDetector.IsRunningOnUnity)
{ {
if (PlatformAutoDetector.IsUnityNative) if (PlatformAutoDetector.IsUnityNative)
{ {
suffix = "unity." + GetUnityPlatformName().ToLower() + "." + GetUnityRuntimeName(); suffix = "unity." + GetUnityPlatformName().ToLower() + "." + GetUnityRuntimeName();
} }
else else
{ {
if (PlatformAutoDetector.IsRunningOnMono) if (PlatformAutoDetector.IsRunningOnMono)
suffix = "unity.dll.mono"; suffix = "unity.dll.mono";
else else
suffix = "unity.dll.unknown"; suffix = "unity.dll.unknown";
} }
} }
@ -50,84 +50,84 @@ namespace MoonSharp.Interpreter.Platforms
if (PlatformAutoDetector.IsRunningOnClr4) if (PlatformAutoDetector.IsRunningOnClr4)
suffix = suffix + ".clr4"; suffix = suffix + ".clr4";
else else
suffix = suffix + ".clr2"; suffix = suffix + ".clr2";
#if DOTNET_CORE #if DOTNET_CORE
suffix += ".netcore"; suffix += ".netcore";
#endif #endif
if (PlatformAutoDetector.IsRunningOnAOT) if (PlatformAutoDetector.IsRunningOnAOT)
suffix = suffix + ".aot"; suffix = suffix + ".aot";
return GetPlatformNamePrefix() + "." + suffix; return GetPlatformNamePrefix() + "." + suffix;
} }
private string GetUnityRuntimeName() private string GetUnityRuntimeName()
{ {
#if ENABLE_MONO #if ENABLE_MONO
return "mono"; return "mono";
#elif ENABLE_IL2CPP #elif ENABLE_IL2CPP
return "il2cpp"; return "il2cpp";
#elif ENABLE_DOTNET #elif ENABLE_DOTNET
return "dotnet"; return "dotnet";
#else #else
return "unknown"; return "unknown";
#endif #endif
} }
private string GetUnityPlatformName() private string GetUnityPlatformName()
{ {
#if UNITY_STANDALONE_OSX #if UNITY_STANDALONE_OSX
return "OSX"; return "OSX";
#elif UNITY_STANDALONE_WIN #elif UNITY_STANDALONE_WIN
return "WIN"; return "WIN";
#elif UNITY_STANDALONE_LINUX #elif UNITY_STANDALONE_LINUX
return "LINUX"; return "LINUX";
#elif UNITY_STANDALONE #elif UNITY_STANDALONE
return "STANDALONE"; return "STANDALONE";
#elif UNITY_WII #elif UNITY_WII
return "WII"; return "WII";
#elif UNITY_IOS #elif UNITY_IOS
return "IOS"; return "IOS";
#elif UNITY_IPHONE #elif UNITY_IPHONE
return "IPHONE"; return "IPHONE";
#elif UNITY_ANDROID #elif UNITY_ANDROID
return "ANDROID"; return "ANDROID";
#elif UNITY_PS3 #elif UNITY_PS3
return "PS3"; return "PS3";
#elif UNITY_PS4 #elif UNITY_PS4
return "PS4"; return "PS4";
#elif UNITY_SAMSUNGTV #elif UNITY_SAMSUNGTV
return "SAMSUNGTV"; return "SAMSUNGTV";
#elif UNITY_XBOX360 #elif UNITY_XBOX360
return "XBOX360"; return "XBOX360";
#elif UNITY_XBOXONE #elif UNITY_XBOXONE
return "XBOXONE"; return "XBOXONE";
#elif UNITY_TIZEN #elif UNITY_TIZEN
return "TIZEN"; return "TIZEN";
#elif UNITY_TVOS #elif UNITY_TVOS
return "TVOS"; return "TVOS";
#elif UNITY_WP_8_1 #elif UNITY_WP_8_1
return "WP_8_1"; return "WP_8_1";
#elif UNITY_WSA_10_0 #elif UNITY_WSA_10_0
return "WSA_10_0"; return "WSA_10_0";
#elif UNITY_WSA_8_1 #elif UNITY_WSA_8_1
return "WSA_8_1"; return "WSA_8_1";
#elif UNITY_WSA #elif UNITY_WSA
return "WSA"; return "WSA";
#elif UNITY_WINRT_10_0 #elif UNITY_WINRT_10_0
return "WINRT_10_0"; return "WINRT_10_0";
#elif UNITY_WINRT_8_1 #elif UNITY_WINRT_8_1
return "WINRT_8_1"; return "WINRT_8_1";
#elif UNITY_WINRT #elif UNITY_WINRT
return "WINRT"; return "WINRT";
#elif UNITY_WEBGL #elif UNITY_WEBGL
return "WEBGL"; return "WEBGL";
#else #else
return "UNKNOWNHW"; return "UNKNOWNHW";
#endif #endif
} }
/// <summary> /// <summary>
/// Default handler for 'print' calls. Can be customized in ScriptOptions /// Default handler for 'print' calls. Can be customized in ScriptOptions
/// </summary> /// </summary>

58
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Platforms/PlatformAutoDetector.cs vendored

@ -29,17 +29,17 @@ namespace MoonSharp.Interpreter.Platforms
/// <summary> /// <summary>
/// Gets a value indicating whether this instance has been built as a Portable Class Library /// Gets a value indicating whether this instance has been built as a Portable Class Library
/// </summary> /// </summary>
public static bool IsPortableFramework { get; private set; } public static bool IsPortableFramework { get; private set; }
/// <summary> /// <summary>
/// Gets a value indicating whether this instance has been compiled natively in Unity (as opposite to importing a DLL). /// Gets a value indicating whether this instance has been compiled natively in Unity (as opposite to importing a DLL).
/// </summary> /// </summary>
public static bool IsUnityNative { get; private set; } public static bool IsUnityNative { get; private set; }
/// <summary> /// <summary>
/// Gets a value indicating whether this instance has been compiled natively in Unity AND is using IL2CPP /// Gets a value indicating whether this instance has been compiled natively in Unity AND is using IL2CPP
/// </summary> /// </summary>
public static bool IsUnityIL2CPP { get; private set; } public static bool IsUnityIL2CPP { get; private set; }
/// <summary> /// <summary>
/// Gets a value indicating whether this instance is running a system using Ahead-Of-Time compilation /// Gets a value indicating whether this instance is running a system using Ahead-Of-Time compilation
/// and not supporting JIT. /// and not supporting JIT.
@ -48,11 +48,11 @@ namespace MoonSharp.Interpreter.Platforms
{ {
// We do a lazy eval here, so we can wire out this code by not calling it, if necessary.. // We do a lazy eval here, so we can wire out this code by not calling it, if necessary..
get get
{ {
#if UNITY_WEBGL || UNITY_IOS || UNITY_TVOS || ENABLE_IL2CPP #if UNITY_WEBGL || UNITY_IOS || UNITY_TVOS || ENABLE_IL2CPP
return true; return true;
#else #else
if (!m_IsRunningOnAOT.HasValue) if (!m_IsRunningOnAOT.HasValue)
{ {
try try
@ -76,7 +76,7 @@ namespace MoonSharp.Interpreter.Platforms
private static void AutoDetectPlatformFlags() private static void AutoDetectPlatformFlags()
{ {
if (m_AutoDetectionsDone) if (m_AutoDetectionsDone)
return; return;
#if PCL #if PCL
IsPortableFramework = true; IsPortableFramework = true;
#if ENABLE_DOTNET #if ENABLE_DOTNET
@ -95,10 +95,10 @@ namespace MoonSharp.Interpreter.Platforms
IsRunningOnUnity = AppDomain.CurrentDomain IsRunningOnUnity = AppDomain.CurrentDomain
.GetAssemblies() .GetAssemblies()
.SelectMany(a => a.SafeGetTypes()) .SelectMany(a => a.SafeGetTypes())
.Any(t => t.FullName.StartsWith("UnityEngine.")); .Any(t => t.FullName.StartsWith("UnityEngine."));
#endif #endif
#endif #endif
IsRunningOnMono = (Type.GetType("Mono.Runtime") != null); IsRunningOnMono = (Type.GetType("Mono.Runtime") != null);
IsRunningOnClr4 = (Type.GetType("System.Lazy`1") != null); IsRunningOnClr4 = (Type.GetType("System.Lazy`1") != null);
@ -110,36 +110,36 @@ namespace MoonSharp.Interpreter.Platforms
internal static IPlatformAccessor GetDefaultPlatform() internal static IPlatformAccessor GetDefaultPlatform()
{ {
AutoDetectPlatformFlags(); AutoDetectPlatformFlags();
#if PCL || ENABLE_DOTNET #if PCL || ENABLE_DOTNET
return new LimitedPlatformAccessor(); return new LimitedPlatformAccessor();
#else #else
if (IsRunningOnUnity) if (IsRunningOnUnity)
return new LimitedPlatformAccessor(); return new LimitedPlatformAccessor();
#if DOTNET_CORE #if DOTNET_CORE
return new DotNetCorePlatformAccessor(); return new DotNetCorePlatformAccessor();
#else #else
return new StandardPlatformAccessor(); return new StandardPlatformAccessor();
#endif #endif
#endif #endif
} }
internal static IScriptLoader GetDefaultScriptLoader() internal static IScriptLoader GetDefaultScriptLoader()
{ {
AutoDetectPlatformFlags(); AutoDetectPlatformFlags();
if (IsRunningOnUnity) if (IsRunningOnUnity)
return new UnityAssetsScriptLoader(); return new UnityAssetsScriptLoader();
else else
{ {
#if (DOTNET_CORE) #if (DOTNET_CORE)
return new FileSystemScriptLoader(); return new FileSystemScriptLoader();
#elif (PCL || ENABLE_DOTNET || NETFX_CORE) #elif (PCL || ENABLE_DOTNET || NETFX_CORE)
return new InvalidScriptLoader("Portable Framework"); return new InvalidScriptLoader("Portable Framework");
#else #else
return new FileSystemScriptLoader(); return new FileSystemScriptLoader();
#endif #endif
} }
} }

136
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Platforms/StandardPlatformAccessor.cs vendored

@ -1,76 +1,76 @@
#if (PCL) || (UNITY_5) || NETFX_CORE #if (PCL) || (UNITY_5) || NETFX_CORE
// Dummy implementation for PCL and Unity targets // Dummy implementation for PCL and Unity targets
using System; using System;
using System.IO; using System.IO;
using System.Text; using System.Text;
namespace MoonSharp.Interpreter.Platforms namespace MoonSharp.Interpreter.Platforms
{ {
/// <summary> /// <summary>
/// Class providing the IPlatformAccessor interface for standard full-feaured implementations. /// Class providing the IPlatformAccessor interface for standard full-feaured implementations.
/// </summary> /// </summary>
public class StandardPlatformAccessor : PlatformAccessorBase public class StandardPlatformAccessor : PlatformAccessorBase
{ {
public override void DefaultPrint(string content) public override void DefaultPrint(string content)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public override CoreModules FilterSupportedCoreModules(CoreModules module) public override CoreModules FilterSupportedCoreModules(CoreModules module)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public override string GetEnvironmentVariable(string envvarname) public override string GetEnvironmentVariable(string envvarname)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public override string GetPlatformNamePrefix() public override string GetPlatformNamePrefix()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public override Stream IO_GetStandardStream(StandardFileType type) public override Stream IO_GetStandardStream(StandardFileType type)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public override Stream IO_OpenFile(Script script, string filename, Encoding encoding, string mode) public override Stream IO_OpenFile(Script script, string filename, Encoding encoding, string mode)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public override string IO_OS_GetTempFilename() public override string IO_OS_GetTempFilename()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public override int OS_Execute(string cmdline) public override int OS_Execute(string cmdline)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public override void OS_ExitFast(int exitCode) public override void OS_ExitFast(int exitCode)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public override void OS_FileDelete(string file) public override void OS_FileDelete(string file)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public override bool OS_FileExists(string file) public override bool OS_FileExists(string file)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public override void OS_FileMove(string src, string dst) public override void OS_FileMove(string src, string dst)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
} }
} }
#else #else
using System; using System;
@ -238,9 +238,9 @@ namespace MoonSharp.Interpreter.Platforms
/// <param name="src">The source.</param> /// <param name="src">The source.</param>
/// <param name="dst">The DST.</param> /// <param name="dst">The DST.</param>
public override void OS_FileMove(string src, string dst) public override void OS_FileMove(string src, string dst)
{ {
#if (!PCL) && ((!UNITY_5) || UNITY_STANDALONE) #if (!PCL) && ((!UNITY_5) || UNITY_STANDALONE)
File.Move(src, dst); File.Move(src, dst);
#endif #endif
} }

22
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Script.cs vendored

@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using MoonSharp.Interpreter.CoreLib; using MoonSharp.Interpreter.CoreLib;
using MoonSharp.Interpreter.Debugging; using MoonSharp.Interpreter.Debugging;
using MoonSharp.Interpreter.Diagnostics; using MoonSharp.Interpreter.Diagnostics;
@ -725,16 +725,16 @@ namespace MoonSharp.Interpreter
{ {
get; get;
private set; private set;
} }
/// <summary> /// <summary>
/// Gets a banner string with copyright info, link to website, version, etc. /// Gets a banner string with copyright info, link to website, version, etc.
/// </summary> /// </summary>
public static string GetBanner(string subproduct = null) public static string GetBanner(string subproduct = null)
{ {
subproduct = (subproduct != null) ? (subproduct + " ") : ""; subproduct = (subproduct != null) ? (subproduct + " ") : "";
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.AppendLine(string.Format("MoonSharp {0}{1} [{2}]", subproduct, Script.VERSION, Script.GlobalOptions.Platform.GetPlatformName())); sb.AppendLine(string.Format("MoonSharp {0}{1} [{2}]", subproduct, Script.VERSION, Script.GlobalOptions.Platform.GetPlatformName()));
sb.AppendLine("Copyright (C) 2014-2016 Marco Mastropaolo"); sb.AppendLine("Copyright (C) 2014-2016 Marco Mastropaolo");
sb.AppendLine("http://www.moonsharp.org"); sb.AppendLine("http://www.moonsharp.org");

2
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Serialization/ObjectValueConverter.cs vendored

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
using MoonSharp.Interpreter.Interop.Converters; using MoonSharp.Interpreter.Interop.Converters;
namespace MoonSharp.Interpreter.Serialization namespace MoonSharp.Interpreter.Serialization

6
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Tree/Lexer/LexerUtils.cs vendored

@ -2,8 +2,8 @@
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Compatibility;
namespace MoonSharp.Interpreter.Tree namespace MoonSharp.Interpreter.Tree
{ {
internal static class LexerUtils internal static class LexerUtils
@ -283,7 +283,7 @@ namespace MoonSharp.Interpreter.Tree
} }
private static string ConvertUtf32ToChar(int i) private static string ConvertUtf32ToChar(int i)
{ {
#if PCL || ENABLE_DOTNET #if PCL || ENABLE_DOTNET
return ((char)i).ToString(); return ((char)i).ToString();
#else #else

14
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/MoonSharp/Interpreter/Tree/Statements/FunctionCallStatement.cs vendored

@ -1,4 +1,4 @@
using System; using System;
using MoonSharp.Interpreter.Execution; using MoonSharp.Interpreter.Execution;
using MoonSharp.Interpreter.Execution.VM; using MoonSharp.Interpreter.Execution.VM;
using MoonSharp.Interpreter.Tree.Expressions; using MoonSharp.Interpreter.Tree.Expressions;
@ -24,11 +24,11 @@ namespace MoonSharp.Interpreter.Tree.Statements
m_FunctionCallExpression.Compile(bc); m_FunctionCallExpression.Compile(bc);
RemoveBreakpointStop(bc.Emit_Pop()); RemoveBreakpointStop(bc.Emit_Pop());
} }
} }
private void RemoveBreakpointStop(Instruction instruction) private void RemoveBreakpointStop(Instruction instruction)
{ {
instruction.SourceCodeRef = null; instruction.SourceCodeRef = null;
} }
} }
} }

Loading…
Cancel
Save