Skip to content

Commit

Permalink
Bump Conari from 4f14cec to c4e75ee (#9)
Browse files Browse the repository at this point in the history
* Bump Conari from `4f14cec` to `c4e75ee`

Bumps [Conari](https://github.com/3F/Conari) from `4f14cec` to `c4e75ee`.
- [Release notes](https://github.com/3F/Conari/releases)
- [Commits](3F/Conari@4f14cec...c4e75ee)

Signed-off-by: dependabot-preview[bot] <[email protected]>

* Fixed code errors after upgrading to Conari 1.4

Co-authored-by: Denis Kuzmin <[email protected]>
  • Loading branch information
dependabot-preview[bot] and 3F committed Dec 19, 2019
1 parent 74003fa commit b22839d
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 38 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/LuNari/LuNari.xml


## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

Expand Down
2 changes: 1 addition & 1 deletion Conari
Submodule Conari updated 134 files
13 changes: 3 additions & 10 deletions LuNari/Lua.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using net.r_eg.Conari;
using net.r_eg.LuNari.API;
Expand All @@ -47,11 +46,10 @@ public Lua(string lib)
}
}

[SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly", Justification = "Bug. False positive. The IDisposable is already implemented correctly !")]
public class Lua<TAPI>: ConariL, ILua, IConari, IBinder, IDisposable
public class Lua<TAPI>: ConariL, ILua, IConari, IBinder
where TAPI : ILevel
{
private Dictionary<Type, ILevel> cacheL = new Dictionary<Type, ILevel>();
private readonly Dictionary<Type, ILevel> cacheL = new Dictionary<Type, ILevel>();

/// <summary>
/// Current API version.
Expand All @@ -65,12 +63,7 @@ public TAPI API
/// <summary>
/// Unspecified common interface to Lua C API Functions
/// </summary>
public ILuaCommon U
{
get {
return (ILuaCommon)bridge<ILuaN>();
}
}
public ILuaCommon U => (ILuaCommon)bridge<ILuaN>();

/// <summary>
/// Gets specific API version.
Expand Down
41 changes: 28 additions & 13 deletions LuNari/LuaConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ namespace net.r_eg.LuNari
public struct LuaConfig: IConfig
{
/// <summary>
/// The Lua library.
/// Module (.dll, .exe, or address).
/// </summary>
public string LibName
public string Module
{
get;
set;
Expand All @@ -49,7 +49,7 @@ public bool TransactionStrategy
}

/// <summary>
/// To load library only when it required.
/// To load library only when required.
/// </summary>
public bool LazyLoading
{
Expand All @@ -67,29 +67,44 @@ public bool CacheDLR
}

/// <summary>
/// Auto name-decoration to find entry points of exported functions.
/// Auto name-decoration to find entry points of exported proc.
/// </summary>
public bool Mangling
{
get;
set;
}

public static explicit operator String(LuaConfig cfg)
/// <summary>
/// https://github.com/3F/Conari/issues/15
/// Windows will prevent new loading and return the same handle as for the first loaded module due to used reference count for each trying to load the same module (dll or exe).
/// Actual new loading and its new handle is possible when reference count is less than 1.
///
/// Through Conari this means each decrementing when disposing is processed on implemented such as ConariL object.
/// That is, each new instance will increase total reference count by +1 and each disposing will decrease it by -1.
/// But it can produce the problem not only in multithreading but even between third processes.
///
/// This option will isolate module for a real new loading even if it was already loaded somewhere else.
/// </summary>
public bool IsolateLoadingOfModule
{
return cfg.LibName;
get;
set;
}

public static explicit operator LuaConfig(String lib)
{
return new LuaConfig() { LibName = lib };
}
public static explicit operator string(LuaConfig cfg) => cfg.Module;

/// <param name="lib">The Lua library.</param>
public LuaConfig(string lib)
public static explicit operator LuaConfig(string lib) => new LuaConfig(lib);

/// <param name="lib">Path to Lua library.</param>
/// <param name="isolate">Initialize property {IsolateLoadingOfModule}.</param>
public LuaConfig(string lib, bool isolate = false)
: this()
{
LibName = lib;
Module = lib;
CacheDLR = true;

IsolateLoadingOfModule = isolate;
}
}
}
2 changes: 1 addition & 1 deletion LuNariTest/API/BridgeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public void providerTest1()
}
catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentException), ex.GetType().ToString()); }

var bridge = new Bridge<ILua51>(new _Provider());
var bridge = new Bridge<ILua51>(new _Lua());
}
}
}
1 change: 0 additions & 1 deletion LuNariTest/LuNariTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
<Compile Include="LuaTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="_Lua.cs" />
<Compile Include="_Provider.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Conari\Conari\Conari.csproj">
Expand Down
6 changes: 3 additions & 3 deletions LuNariTest/LuaTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void loadTest1()
new Lua(null);
Assert.Fail("1");
}
catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentException), ex.GetType().ToString()); }
catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentNullException), ex.GetType().ToString()); }

try {
new Lua(STUB_LIB_NAME);
Expand All @@ -39,7 +39,7 @@ public void loadTest2()
new Lua("");
Assert.Fail("2");
}
catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentException), ex.GetType().ToString()); }
catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentNullException), ex.GetType().ToString()); }
}

/// <summary>
Expand Down Expand Up @@ -117,7 +117,7 @@ public void castingTest4()
[TestMethod]
public void funcNameTest1()
{
var l = new _Provider();
var l = new _Lua();

try {
l.procName("");
Expand Down
9 changes: 0 additions & 9 deletions LuNariTest/_Provider.cs

This file was deleted.

0 comments on commit b22839d

Please sign in to comment.