-
-
Notifications
You must be signed in to change notification settings - Fork 7
feat(TcpSocket): add data type check prevent assign exception #548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
310cff4
test: 消除提示信息
ArgoZhang 5caf279
refactor: 使用扩展方法重构代码
ArgoZhang 55e3fcf
refactor: 增加赋值逻辑判断
ArgoZhang 3da1cc0
test: 更新单元测试
ArgoZhang dfe5e84
chore: bump version 9.0.3
ArgoZhang 7edc684
chore: bump version 9.0.2
ArgoZhang e39104d
refactor: 更正单词拼写错误
ArgoZhang e849181
refactor: 优化检查逻辑
ArgoZhang 8fcc69e
refactor: 更改绑定配置
ArgoZhang 4c1ed87
chore: 更新 Header 注释
ArgoZhang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
src/extensions/BootstrapBlazor.Socket/BootstrapBlazor.Socket.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/extensions/BootstrapBlazor.Socket/Extensions/ActivatorExtesnions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // Copyright (c) BootstrapBlazor & Argo Zhang (argo@live.ca). All rights reserved. | ||
| // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
| // Website: https://www.blazor.zone or https://argozhang.github.io/ | ||
|
|
||
| using System.Reflection; | ||
|
|
||
| namespace System; | ||
|
|
||
| /// <summary> | ||
| /// Activator 扩展方法 | ||
| /// </summary> | ||
| public static class ActivatorExtesnions | ||
|
ArgoZhang marked this conversation as resolved.
Outdated
ArgoZhang marked this conversation as resolved.
Outdated
|
||
| { | ||
| /// <summary> | ||
| /// 通过指定类型与参数创建实例方法 | ||
| /// </summary> | ||
| /// <param name="type"></param> | ||
| /// <param name="args"></param> | ||
| /// <returns></returns> | ||
| public static object? CreateInstance(this Type type, object?[]? args = null) | ||
| { | ||
| var bindings = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.Default; | ||
|
ArgoZhang marked this conversation as resolved.
Outdated
|
||
| return Activator.CreateInstance(type, bindings, null, args, null); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// 通过指定类型与参数创建实例方法 | ||
| /// </summary> | ||
| /// <param name="type"></param> | ||
| /// <param name="args"></param> | ||
| /// <returns></returns> | ||
| public static TType? CreateInstance<TType>(this Type type, object?[]? args = null) | ||
| { | ||
| TType? ret = default; | ||
| var value = type.CreateInstance(args); | ||
| if (value is TType v) | ||
| { | ||
| ret = v; | ||
| } | ||
| return ret; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/extensions/BootstrapBlazor.TcpSocket/BootstrapBlazor.TcpSocket.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.