Skip to content

Commit

Permalink
Merge pull request #59 from CatLib/1.0
Browse files Browse the repository at this point in the history
1.0 pre version
  • Loading branch information
喵喵大人 authored Sep 8, 2017
2 parents 78c3d09 + e02adb2 commit dc5c51f
Show file tree
Hide file tree
Showing 23 changed files with 135 additions and 222 deletions.
2 changes: 1 addition & 1 deletion CatLib.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.13
VisualStudioVersion = 15.0.26430.16
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CatLib", "projects\CatLib\CatLib.csproj", "{BBB2DAE2-638B-4419-9591-3CECCA312E4E}"
EndProject
Expand Down
Binary file modified build/CatLib.API.dll
Binary file not shown.
Binary file modified build/CatLib.API.pdb
Binary file not shown.
49 changes: 47 additions & 2 deletions build/CatLib.API.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified build/CatLib.dll
Binary file not shown.
Binary file modified build/CatLib.pdb
Binary file not shown.
94 changes: 85 additions & 9 deletions build/CatLib.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7669,6 +7669,11 @@
通配符事件句柄
</summary>
</member>
<member name="F:CatLib.Events.Dispatcher.actionMapping">
<summary>
Action对应Func映射
</summary>
</member>
<member name="F:CatLib.Events.Dispatcher.syncRoot">
<summary>
同步锁
Expand Down Expand Up @@ -7727,13 +7732,20 @@
<param name="life">在几次后事件会被自动释放</param>
<returns>事件句柄</returns>
</member>
<member name="M:CatLib.Events.Dispatcher.Off(System.String,System.Func{System.Object,System.Object})">
<member name="M:CatLib.Events.Dispatcher.Off(System.String,System.Action{System.Object})">
<summary>
反注册一个事件
</summary>
<param name="eventName">事件名</param>
<param name="handler">事件句柄</param>
</member>
<member name="M:CatLib.Events.Dispatcher.WalkActionMapping(System.Action{System.Object},System.Action{System.Func{System.Object,System.Object}})">
<summary>
遍历行为映射
</summary>
<param name="handler">事件句柄</param>
<param name="callback">回调</param>
</member>
<member name="M:CatLib.Events.Dispatcher.Off(CatLib.Events.EventHandler)">
<summary>
移除一个事件
Expand Down Expand Up @@ -8479,6 +8491,16 @@
哈希
</summary>
</member>
<member name="F:CatLib.Hashing.Hashing.checksumsMaker">
<summary>
校验类字典
</summary>
</member>
<member name="F:CatLib.Hashing.Hashing.hashByteMaker">
<summary>
非加密哈希字典
</summary>
</member>
<member name="F:CatLib.Hashing.Hashing.checksumsDict">
<summary>
校验类字典
Expand All @@ -8494,11 +8516,42 @@
同步锁
</summary>
</member>
<member name="M:CatLib.Hashing.Hashing.#ctor">
<member name="F:CatLib.Hashing.Hashing.defaultChecksum">
<summary>
默认的校验算法
</summary>
</member>
<member name="F:CatLib.Hashing.Hashing.defaultHash">
<summary>
默认的哈希算法
</summary>
</member>
<member name="M:CatLib.Hashing.Hashing.#ctor(CatLib.API.Hashing.Checksums,CatLib.API.Hashing.Hashes)">
<summary>
哈希
</summary>
</member>
<member name="M:CatLib.Hashing.Hashing.RegisterChecksum(CatLib.API.Hashing.Checksums,System.Func{CatLib.Hashing.Checksum.IChecksum})">
<summary>
注册校验算法
</summary>
<param name="checksum">校验类类型</param>
<param name="builder">构建器</param>
</member>
<member name="M:CatLib.Hashing.Hashing.RegisterHash(CatLib.API.Hashing.Hashes,System.Func{System.Security.Cryptography.HashAlgorithm})">
<summary>
注册校验算法
</summary>
<param name="hash">哈希类类型</param>
<param name="builder">构建器</param>
</member>
<member name="M:CatLib.Hashing.Hashing.Checksum(System.Byte[])">
<summary>
使用默认的校验算法计算校验和
</summary>
<param name="buffer">字节数组</param>
<returns>校验和</returns>
</member>
<member name="M:CatLib.Hashing.Hashing.Checksum(System.Byte[],CatLib.API.Hashing.Checksums)">
<summary>
计算校验和
Expand All @@ -8523,6 +8576,13 @@
<param name="hash">哈希值</param>
<returns>是否匹配</returns>
</member>
<member name="M:CatLib.Hashing.Hashing.HashString(System.String)">
<summary>
对输入值进行非加密哈希
</summary>
<param name="input">输入值</param>
<returns>哈希值</returns>
</member>
<member name="M:CatLib.Hashing.Hashing.HashString(System.String,CatLib.API.Hashing.Hashes)">
<summary>
对输入值进行非加密哈希
Expand All @@ -8540,6 +8600,13 @@
<param name="hash">使用的哈希算法</param>
<returns>哈希值</returns>
</member>
<member name="M:CatLib.Hashing.Hashing.HashByte(System.Byte[])">
<summary>
对输入值进行非加密哈希
</summary>
<param name="input">输入值</param>
<returns>哈希值</returns>
</member>
<member name="M:CatLib.Hashing.Hashing.HashByte(System.Byte[],CatLib.API.Hashing.Hashes)">
<summary>
对输入值进行非加密哈希
Expand All @@ -8553,6 +8620,21 @@
哈希服务提供者
</summary>
</member>
<member name="P:CatLib.Hashing.HashingProvider.DefaultChecksum">
<summary>
默认的校验类
</summary>
</member>
<member name="P:CatLib.Hashing.HashingProvider.DefaultHash">
<summary>
默认的哈希类
</summary>
</member>
<member name="M:CatLib.Hashing.HashingProvider.#ctor">
<summary>
哈希服务提供者
</summary>
</member>
<member name="M:CatLib.Hashing.HashingProvider.Init">
<summary>
服务提供者初始化
Expand Down Expand Up @@ -8883,12 +8965,6 @@
<param name="type">算法类型</param>
<returns>随机数算法</returns>
</member>
<member name="M:CatLib.Random.RandomFactory.ThrowRandomTypesNotImplemented(CatLib.API.Random.RandomTypes)">
<summary>
触发随机算法没有实现异常
</summary>
<param name="type">随机算法</param>
</member>
<member name="T:CatLib.Routing.ExceptionRequest">
<summary>
请求(由于某些异常导致请求都无法被构建所以我们提供一个必定可以被构建的请求类)
Expand Down Expand Up @@ -10613,7 +10689,7 @@
<param name="life">在几次后事件会被自动释放</param>
<returns>事件句柄</returns>
</member>
<member name="M:CatLib.Application.Off(System.String,System.Func{System.Object,System.Object})">
<member name="M:CatLib.Application.Off(System.String,System.Action{System.Object})">
<summary>
反注册一个事件
</summary>
Expand Down
10 changes: 0 additions & 10 deletions projects/CatLib.API/CatLib/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,6 @@ public static IEventHandler Listen(string eventName, Func<object, object> handle
return Handler.Listen(eventName, handler, life);
}

/// <summary>
/// 反注册一个事件
/// </summary>
/// <param name="eventName">事件名</param>
/// <param name="handler">事件句柄</param>
public static void Off(string eventName, Func<object, object> handler)
{
Handler.Off(eventName, handler);
}

/// <summary>
/// 获取服务的绑定数据,如果绑定不存在则返回null
/// </summary>
Expand Down
7 changes: 0 additions & 7 deletions projects/CatLib.API/Events/IDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,5 @@ public interface IDispatcher
/// <param name="life">在几次后事件会被自动释放</param>
/// <returns>事件句柄</returns>
IEventHandler Listen(string eventName, Func<object, object> handler, int life = 0);

/// <summary>
/// 反注册一个事件
/// </summary>
/// <param name="eventName">事件名</param>
/// <param name="handler">事件句柄</param>
void Off(string eventName, Func<object, object> handler);
}
}
36 changes: 2 additions & 34 deletions projects/CatLib.Tests/Events/EventsProviderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,41 +56,9 @@ public void TestSimpleOnEvents()
Assert.AreEqual(true, isCall);
}

[TestMethod]
public void TestOffEvents()
{
var app = MakeEnv();
var dispatcher = app.Make<IDispatcher>();

dispatcher.On("event.faild", SimpleCallFunctionNoResult);
dispatcher.Listen("event.name", SimpleCallFunction);
dispatcher.Listen("event.name", SimpleCallFunction);
dispatcher.Off("event.name", SimpleCallFunction);
Assert.AreEqual(null, dispatcher.TriggerHalt("event.name"));
}

[TestMethod]
public void TestOffRegexEvents()
{
var app = MakeEnv();
var dispatcher = app.Make<IDispatcher>();

dispatcher.On("event.faild", SimpleCallFunctionNoResult);
dispatcher.Listen("event.*", SimpleCallFunction);
dispatcher.Listen("event.*", SimpleCallFunction);
dispatcher.Off("event.*", SimpleCallFunction);
Assert.AreEqual(null, dispatcher.TriggerHalt("event.name"));
Assert.AreEqual(null, dispatcher.TriggerHalt("event.*"));
}

private void SimpleCallFunctionNoResult(object payload)
{
Assert.Fail();
}

private object SimpleCallFunction(object payload)
public void SimpleCallFunctionVoid(object payload)
{
return "SimpleCallFunction";

}

[TestMethod]
Expand Down
12 changes: 0 additions & 12 deletions projects/CatLib/CatLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -254,18 +254,6 @@
<Compile Include="Translation\TranslationProvider.cs" />
<Compile Include="Translation\Translator.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Config\catlib.json" />
<None Include="Converters\catlib.json" />
<None Include="CatLib\catlib.json" />
<None Include="Debugger\catlib.json" />
<None Include="Events\catlib.json" />
<None Include="Facade\catlib.json" />
<None Include="FileSystem\catlib.json" />
<None Include="Json\catlib.json" />
<None Include="Routing\catlib.json" />
<None Include="Translation\catlib.json" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CatLib.API\CatLib.API.csproj">
<Project>{5bf5d9dc-26f3-46ae-a735-fe37b0d4fe2e}</Project>
Expand Down
11 changes: 0 additions & 11 deletions projects/CatLib/CatLib/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -323,17 +323,6 @@ public IEventHandler Listen(string eventName, Func<object, object> handler, int
return Dispatcher.Listen(eventName, handler, life);
}

/// <summary>
/// 反注册一个事件
/// </summary>
/// <param name="eventName">事件名</param>
/// <param name="handler">事件句柄</param>
public void Off(string eventName, Func<object, object> handler)
{
GuardDispatcher();
Dispatcher.Off(eventName, handler);
}

/// <summary>
/// CatLib版本(遵循semver)
/// </summary>
Expand Down
9 changes: 0 additions & 9 deletions projects/CatLib/CatLib/catlib.json

This file was deleted.

Loading

0 comments on commit dc5c51f

Please sign in to comment.