Skip to content
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

Implement nullable feature #10

Merged
merged 15 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
41 changes: 32 additions & 9 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
root = true
# editorconfig.org

# top-most EditorConfig file
root = true

# Default settings:
# A newline ending every file
Expand All @@ -19,23 +19,24 @@ generated_code = true
# C# files
[*.cs]
# New line preferences
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_object_initializers = false
csharp_new_line_before_open_brace = all
csharp_new_line_between_query_expression_clauses = true

# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_case_contents_when_block = false
csharp_indent_switch_labels = true
csharp_indent_labels = one_less_than_current

# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
csharp_preferred_modifier_order = public, private, protected, internal, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, volatile, async:suggestion

# avoid this. unless absolutely necessary
Expand All @@ -44,15 +45,15 @@ dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion

# Types: use keywords instead of BCL types, and permit var only when the type is clear
# Types: use keywords instead of BCL types, and use explicit type instead of var
csharp_style_var_for_built_in_types = false:suggestion
csharp_style_var_when_type_is_apparent = false:none
csharp_style_var_when_type_is_apparent = false:suggestion
csharp_style_var_elsewhere = false:suggestion
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion

# name all constant fields using PascalCase
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = silent
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.constant_fields.applicable_kinds = field
Expand Down Expand Up @@ -81,7 +82,7 @@ dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
# Code style defaults
csharp_using_directive_placement = outside_namespace:suggestion
dotnet_sort_system_directives_first = true
csharp_prefer_braces = when_multiline:silent
csharp_prefer_braces = when_multiline:suggestion
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = false
csharp_prefer_static_local_function = true:suggestion
Expand Down Expand Up @@ -151,8 +152,30 @@ csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false

# ReSharper properties
resharper_braces_for_for = required_for_multiline
resharper_braces_for_while = required_for_multiline
resharper_constructor_or_destructor_body = block_body
resharper_indent_nested_fixed_stmt = true
resharper_indent_nested_foreach_stmt = true
resharper_indent_nested_for_stmt = true
resharper_indent_nested_lock_stmt = true
resharper_indent_nested_usings_stmt = true
resharper_indent_nested_while_stmt = true
resharper_indent_primary_constructor_decl_pars = inside
resharper_indent_raw_literal_string = indent
resharper_max_initializer_elements_on_line = 1
resharper_use_heuristics_for_body_style = true
resharper_wrap_before_primary_constructor_declaration_lpar = true
resharper_wrap_object_and_collection_initializer_style = chop_if_long

# ReSharper inspection severities
resharper_arrange_accessor_owner_body_highlighting = hint
resharper_arrange_constructor_or_destructor_body_highlighting = hint
resharper_arrange_method_or_operator_body_highlighting = hint

# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
[*.{csproj,vbproj,fsproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
indent_size = 2

[*.{csproj,vbproj,proj,nativeproj,locproj}]
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Kook.Net on Pull Request

on:
pull_request:
branches: [ master, dev ]

jobs:
build_and_test:
name: Build and Test
strategy:
matrix:
target: [ windows-latest, ubuntu-latest, macOS-latest ]
uses: ./.github/workflows/build-test.yml
with:
target: ${{ matrix.target }}
dotnet-version: 8.0.x
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: Kook.Net on Push or Pull Request
name: Kook.Net on Push

on:
push:
branches: [ master, dev ]
# pull_request:
# branches: [ master, dev ]

jobs:
build_and_test:
Expand Down
19 changes: 19 additions & 0 deletions Kook.Net.Sample.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<LangVersion>latest</LangVersion>
<NoWarn>NU1803</NoWarn>
<Configurations>Debug;Release</Configurations>
<Platforms>AnyCPU</Platforms>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Kook.Net\Kook.Net.csproj"/>
</ItemGroup>

</Project>
37 changes: 37 additions & 0 deletions Kook.Net.Test.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<RootNamespace>Kook.Net.Tests</RootNamespace>
<LangVersion>latest</LangVersion>
<NoWarn>NU1803</NoWarn>
<Configurations>Debug;Release</Configurations>
<Platforms>AnyCPU</Platforms>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="xunit" Version="2.8.0" />
</ItemGroup>

<ItemGroup Condition=" $([System.Text.RegularExpressions.Regex]::IsMatch($(TargetFramework), '^net\d\.\d$')) ">
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Kook.Net\Kook.Net.csproj"/>
<ProjectReference Include="..\..\src\Kook.Net.Experimental\Kook.Net.Experimental.csproj"/>
</ItemGroup>

</Project>
9 changes: 9 additions & 0 deletions Kook.Net.sln
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "SolutionItems", "{55F21D65-BA1A-4A4B-B370-FD2CA0204EB2}"
ProjectSection(SolutionItems) = preProject
Kook.Net.targets = Kook.Net.targets
.editorconfig = .editorconfig
.gitignore = .gitignore
global.json = global.json
CHANGELOG.md = CHANGELOG.md
LICENSE = LICENSE
README.md = README.md
THIRD-PARTY-NOTICES.txt = THIRD-PARTY-NOTICES.txt
Kook.Net.Test.targets = Kook.Net.Test.targets
Kook.Net.Sample.targets = Kook.Net.Sample.targets
EndProjectSection
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Kook.Net.Samples.VisualBasic", "samples\Kook.Net.Samples.VisualBasic\Kook.Net.Samples.VisualBasic.vbproj", "{43C91115-7D09-4A28-95CD-380C3B00EAE0}"
Expand Down
4 changes: 3 additions & 1 deletion Kook.Net.targets
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<Nullable>enable</Nullable>
<VersionPrefix>0.7.0</VersionPrefix>
<IsPackable>false</IsPackable>
<IsTrimmable>false</IsTrimmable>
Expand All @@ -26,6 +26,7 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<PropertyGroup>
<Version Condition=" '$(VersionSuffix)' == '' ">$(VersionPrefix)</Version>
<Version Condition=" '$(VersionSuffix)' != '' ">$(VersionPrefix)-$(VersionSuffix)</Version>
Expand All @@ -38,6 +39,7 @@
<ItemGroup>
<None Include="../../README.md" Pack="true" PackagePath="\"/>
<None Include="../../LICENSE" Pack="true" PackagePath="\"/>
<None Include="../../THIRD-PARTY-NOTICES.txt" Pack="true" PackagePath="\"/>
<None Include="../../docs/logo/Logo_Small.png" Pack="true" PackagePath=""/>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<img src="./docs/logo/Logo_Labeled.png" alt="logo" height="160"/>

![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/gehongyan/Kook.Net/push-or-pr.yml?branch=master)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/gehongyan/Kook.Net/push.yml?branch=master)
![GitHub Top Language](https://img.shields.io/github/languages/top/gehongyan/Kook.Net)
[![Nuget Version](https://img.shields.io/nuget/v/Kook.Net)](https://www.nuget.org/packages/Kook.Net)
[![Nuget](https://img.shields.io/nuget/dt/Kook.Net?color=%230099ff)](https://www.nuget.org/packages/Kook.Net)
Expand Down
52 changes: 51 additions & 1 deletion THIRD-PARTY-NOTICES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Kook.Net uses third-party libraries or other resources that may be
distributed under licenses different than the Kook.Net.
distributed under licenses different from the Kook.Net.

In the event that we accidentally failed to list a required notice, please
bring it to our attention. Post an issue or email us:
Expand Down Expand Up @@ -94,6 +94,31 @@ Licensed under the Apache License, Version 2.0.
Available at
https://github.com/fluentassertions/fluentassertions/blob/develop/LICENSE

License notice for Fluid
------------------------------------

MIT License

Copyright (c) 2017 Sébastien Ros

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
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
SOFTWARE.

License notice for Microsoft.NET.Test.Sdk
------------------------------------

Expand Down Expand Up @@ -157,6 +182,31 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

[ https://www.opensource.org/licenses/bsd-license.php ]

License notice for PolySharp
------------------------------------

MIT License

Copyright (c) 2022 Sergio Pedri

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
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
SOFTWARE.

License notice for Serilog
------------------------------------

Expand Down
3 changes: 3 additions & 0 deletions docs/_template/material/public/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
{
// Ugly hack to improve toc filter.
let target = document.getElementById("toc");

if(!target) return;

let config = { attributes: false, childList: true, subtree: true };
let observer = new MutationObserver((list) =>
{
Expand Down
19 changes: 4 additions & 15 deletions samples/Kook.Net.Samples.Audio/Kook.Net.Samples.Audio.csproj
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<IsPackable>false</IsPackable>
<LangVersion>latestmajor</LangVersion>
<RootNamespace>Kook.Net.Samples.Audio</RootNamespace>
<NoWarn>NU1803</NoWarn>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Kook.Net\Kook.Net.csproj"/>
</ItemGroup>
<Import Project="../../Kook.Net.Sample.targets" />

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading