diff --git a/CatLib.sln b/CatLib.sln index 29547dd8..9aa96e55 100644 --- a/CatLib.sln +++ b/CatLib.sln @@ -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 diff --git a/build/CatLib.API.dll b/build/CatLib.API.dll index 9036ff6e..11e3bc4c 100644 Binary files a/build/CatLib.API.dll and b/build/CatLib.API.dll differ diff --git a/build/CatLib.API.pdb b/build/CatLib.API.pdb index 0541e7ff..2412e364 100644 Binary files a/build/CatLib.API.pdb and b/build/CatLib.API.pdb differ diff --git a/build/CatLib.API.xml b/build/CatLib.API.xml index db147082..79ef8923 100644 --- a/build/CatLib.API.xml +++ b/build/CatLib.API.xml @@ -376,7 +376,7 @@ 在几次后事件会被自动释放 事件句柄 - + 反注册一个事件 @@ -418,6 +418,18 @@ Crc32 + + + 哈希算法类型 + + 哈希算法名字 + + + + 字符串转Checksums + + 类型 + 哈希算法 @@ -433,11 +445,30 @@ Murmur Hash + + + 哈希算法类型 + + 哈希算法名字 + + + + 字符串转Hashes + + 类型 + 哈希 + + + 计算校验和 + + 字节数组 + 校验和 + 计算校验和 @@ -462,6 +493,13 @@ 哈希值 是否匹配 + + + 对输入值进行非加密哈希 + + 输入值 + 哈希值 + 对输入值进行非加密哈希 @@ -479,6 +517,13 @@ 使用的哈希算法 哈希值 + + + 对输入值进行非加密哈希 + + 输入值 + 哈希值 + 对输入值进行非加密哈希 @@ -2103,7 +2148,7 @@ 在几次后事件会被自动释放 事件句柄 - + 反注册一个事件 diff --git a/build/CatLib.dll b/build/CatLib.dll index c989f8bd..be610311 100644 Binary files a/build/CatLib.dll and b/build/CatLib.dll differ diff --git a/build/CatLib.pdb b/build/CatLib.pdb index e2f90574..3aecab61 100644 Binary files a/build/CatLib.pdb and b/build/CatLib.pdb differ diff --git a/build/CatLib.xml b/build/CatLib.xml index 54e1214f..b4a5e625 100644 --- a/build/CatLib.xml +++ b/build/CatLib.xml @@ -7669,6 +7669,11 @@ 通配符事件句柄 + + + Action对应Func映射 + + 同步锁 @@ -7727,13 +7732,20 @@ 在几次后事件会被自动释放 事件句柄 - + 反注册一个事件 事件名 事件句柄 + + + 遍历行为映射 + + 事件句柄 + 回调 + 移除一个事件 @@ -8479,6 +8491,16 @@ 哈希 + + + 校验类字典 + + + + + 非加密哈希字典 + + 校验类字典 @@ -8494,11 +8516,42 @@ 同步锁 - + + + 默认的校验算法 + + + + + 默认的哈希算法 + + + 哈希 + + + 注册校验算法 + + 校验类类型 + 构建器 + + + + 注册校验算法 + + 哈希类类型 + 构建器 + + + + 使用默认的校验算法计算校验和 + + 字节数组 + 校验和 + 计算校验和 @@ -8523,6 +8576,13 @@ 哈希值 是否匹配 + + + 对输入值进行非加密哈希 + + 输入值 + 哈希值 + 对输入值进行非加密哈希 @@ -8540,6 +8600,13 @@ 使用的哈希算法 哈希值 + + + 对输入值进行非加密哈希 + + 输入值 + 哈希值 + 对输入值进行非加密哈希 @@ -8553,6 +8620,21 @@ 哈希服务提供者 + + + 默认的校验类 + + + + + 默认的哈希类 + + + + + 哈希服务提供者 + + 服务提供者初始化 @@ -8883,12 +8965,6 @@ 算法类型 随机数算法 - - - 触发随机算法没有实现异常 - - 随机算法 - 请求(由于某些异常导致请求都无法被构建所以我们提供一个必定可以被构建的请求类) @@ -10613,7 +10689,7 @@ 在几次后事件会被自动释放 事件句柄 - + 反注册一个事件 diff --git a/projects/CatLib.API/CatLib/App.cs b/projects/CatLib.API/CatLib/App.cs index 6aeac344..9b4f3bc3 100644 --- a/projects/CatLib.API/CatLib/App.cs +++ b/projects/CatLib.API/CatLib/App.cs @@ -190,16 +190,6 @@ public static IEventHandler Listen(string eventName, Func handle return Handler.Listen(eventName, handler, life); } - /// - /// 反注册一个事件 - /// - /// 事件名 - /// 事件句柄 - public static void Off(string eventName, Func handler) - { - Handler.Off(eventName, handler); - } - /// /// 获取服务的绑定数据,如果绑定不存在则返回null /// diff --git a/projects/CatLib.API/Events/IDispatcher.cs b/projects/CatLib.API/Events/IDispatcher.cs index b70e664c..3d676096 100644 --- a/projects/CatLib.API/Events/IDispatcher.cs +++ b/projects/CatLib.API/Events/IDispatcher.cs @@ -51,12 +51,5 @@ public interface IDispatcher /// 在几次后事件会被自动释放 /// 事件句柄 IEventHandler Listen(string eventName, Func handler, int life = 0); - - /// - /// 反注册一个事件 - /// - /// 事件名 - /// 事件句柄 - void Off(string eventName, Func handler); } } diff --git a/projects/CatLib.Tests/Events/EventsProviderTests.cs b/projects/CatLib.Tests/Events/EventsProviderTests.cs index 3f6f77e5..7dfd356a 100644 --- a/projects/CatLib.Tests/Events/EventsProviderTests.cs +++ b/projects/CatLib.Tests/Events/EventsProviderTests.cs @@ -56,41 +56,9 @@ public void TestSimpleOnEvents() Assert.AreEqual(true, isCall); } - [TestMethod] - public void TestOffEvents() - { - var app = MakeEnv(); - var dispatcher = app.Make(); - - 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(); - - 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] diff --git a/projects/CatLib/CatLib.csproj b/projects/CatLib/CatLib.csproj index 9ab02065..c64ee33f 100644 --- a/projects/CatLib/CatLib.csproj +++ b/projects/CatLib/CatLib.csproj @@ -254,18 +254,6 @@ - - - - - - - - - - - - {5bf5d9dc-26f3-46ae-a735-fe37b0d4fe2e} diff --git a/projects/CatLib/CatLib/Application.cs b/projects/CatLib/CatLib/Application.cs index a2826ea1..184858e9 100644 --- a/projects/CatLib/CatLib/Application.cs +++ b/projects/CatLib/CatLib/Application.cs @@ -323,17 +323,6 @@ public IEventHandler Listen(string eventName, Func handler, int return Dispatcher.Listen(eventName, handler, life); } - /// - /// 反注册一个事件 - /// - /// 事件名 - /// 事件句柄 - public void Off(string eventName, Func handler) - { - GuardDispatcher(); - Dispatcher.Off(eventName, handler); - } - /// /// CatLib版本(遵循semver) /// diff --git a/projects/CatLib/CatLib/catlib.json b/projects/CatLib/CatLib/catlib.json deleted file mode 100644 index 2e2f1ce0..00000000 --- a/projects/CatLib/CatLib/catlib.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "source": "catlib/catlib", - "folder": "CatLib", - "require": { - "catlib/api": "~1.0", - "catlib/event": "~1.0", - "catlib/support": "~1.0" - } -} \ No newline at end of file diff --git a/projects/CatLib/Config/catlib.json b/projects/CatLib/Config/catlib.json deleted file mode 100644 index f8415401..00000000 --- a/projects/CatLib/Config/catlib.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "source": "catlib/config", - "folder": "Config", - "require": { - "catlib/support": "~1.0", - "catlib/api": "~1.0", - "catlib/converters": "~1.0" - } -} \ No newline at end of file diff --git a/projects/CatLib/Converters/catlib.json b/projects/CatLib/Converters/catlib.json deleted file mode 100644 index 9d32ea85..00000000 --- a/projects/CatLib/Converters/catlib.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "source": "catlib/converters", - "folder": "Converters", - "require": { - "catlib/api": "~1.0", - "catlib/support": "~1.0" - } -} \ No newline at end of file diff --git a/projects/CatLib/Debugger/catlib.json b/projects/CatLib/Debugger/catlib.json deleted file mode 100644 index f249282a..00000000 --- a/projects/CatLib/Debugger/catlib.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "source": "catlib/debugger", - "folder": "Debugger", - "require": { - "catlib/support": "~1.0", - "catlib/api": "~1.0", - "catlib/config": "~1.0", - "catlib/monodriver" : "~1.0", - "catlib/json" : "~1.0" - } -} \ No newline at end of file diff --git a/projects/CatLib/Events/Dispatcher.cs b/projects/CatLib/Events/Dispatcher.cs index 69f8accc..cf3a0cff 100644 --- a/projects/CatLib/Events/Dispatcher.cs +++ b/projects/CatLib/Events/Dispatcher.cs @@ -176,55 +176,6 @@ public IEventHandler Listen(string eventName, Func handler, int } } - /// - /// 反注册一个事件 - /// - /// 事件名 - /// 事件句柄 - public void Off(string eventName, Func handler) - { - Guard.Requires(eventName != null); - Guard.Requires(handler != null); - - var preRemove = new List(); - var handlers = new List(); - - lock (syncRoot) - { - if (this.handlers.TryGetValue(eventName, out handlers)) - { - foreach (var baseHandler in handlers) - { - if (baseHandler.Is(handler)) - { - preRemove.Add(baseHandler); - } - } - } - - eventName = eventName.IndexOf("*") != -1 ? Str.AsteriskWildcard(eventName) : eventName; - foreach (var regex in wildcardHandlers) - { - if (regex.Key.ToString() != eventName) - { - continue; - } - foreach (var baseHandler in regex.Value) - { - if (baseHandler.Is(handler)) - { - preRemove.Add(baseHandler); - } - } - } - } - - foreach (var removeHandler in preRemove) - { - removeHandler.Off(); - } - } - /// /// 移除一个事件 /// diff --git a/projects/CatLib/Events/catlib.json b/projects/CatLib/Events/catlib.json deleted file mode 100644 index 8af0d0ef..00000000 --- a/projects/CatLib/Events/catlib.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "source": "catlib/events", - "folder": "Events", - "require": { - "catlib/support": "~1.0", - "catlib/api": "~1.0" - } -} \ No newline at end of file diff --git a/projects/CatLib/Facade/catlib.json b/projects/CatLib/Facade/catlib.json deleted file mode 100644 index 74023983..00000000 --- a/projects/CatLib/Facade/catlib.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "source": "catlib/facade", - "folder": "Facade", - "require": { - "catlib/api": "~1.0", - } -} \ No newline at end of file diff --git a/projects/CatLib/FileSystem/catlib.json b/projects/CatLib/FileSystem/catlib.json deleted file mode 100644 index 71eb9341..00000000 --- a/projects/CatLib/FileSystem/catlib.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "source": "catlib/filesystem", - "folder": "FileSystem", - "require": { - "catlib/api": "~1.0", - "catlib/support": "~1.0", - "catlib/config": "~1.0", - "catlib/environment": "~1.0" - } -} \ No newline at end of file diff --git a/projects/CatLib/Json/catlib.json b/projects/CatLib/Json/catlib.json deleted file mode 100644 index 4e70a01e..00000000 --- a/projects/CatLib/Json/catlib.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "source": "catlib/json", - "folder": "Json", - "require": { - "catlib/api": "~1.0" - } -} diff --git a/projects/CatLib/Routing/catlib.json b/projects/CatLib/Routing/catlib.json deleted file mode 100644 index 6d2525ff..00000000 --- a/projects/CatLib/Routing/catlib.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "source": "catlib/routing", - "folder": "Routing", - "require": { - "catlib/api": "~1.0", - "catlib/support": "~1.0", - "catlib/config": "~1.0" - } -} \ No newline at end of file diff --git a/projects/CatLib/Translation/catlib.json b/projects/CatLib/Translation/catlib.json deleted file mode 100644 index f6f5ae55..00000000 --- a/projects/CatLib/Translation/catlib.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "source": "catlib/translation", - "folder" : "Translation", - "require": { - "catlib/api":"~1.0", - "catlib/support":"~1.0", - "catlib/config":"~1.0" - } -} \ No newline at end of file