From 857c51e073de59858daf823869f25f3b7f5187d9 Mon Sep 17 00:00:00 2001 From: GZTime Date: Tue, 18 Oct 2022 18:50:57 +0800 Subject: [PATCH] wip: tidy up --- .editorconfig | 121 ++++++++++++++++++ GZCTF.Test/ContainerServiceTest.cs | 6 +- GZCTF.Test/SignatureTest.cs | 2 +- GZCTF.Test/TestMailSender.cs | 4 +- GZCTF.Test/TestWebAppFactory.cs | 4 +- GZCTF/Controllers/AccountController.cs | 4 +- GZCTF/Controllers/AdminController.cs | 4 +- GZCTF/Controllers/AssetsController.cs | 6 +- GZCTF/Controllers/EditController.cs | 4 +- GZCTF/Controllers/GameController.cs | 8 +- GZCTF/Controllers/TeamController.cs | 6 +- GZCTF/Extensions/RecaptchaExtension.cs | 4 +- GZCTF/Models/Data/Attachment.cs | 4 +- GZCTF/Models/Data/Challenge.cs | 8 +- GZCTF/Models/Data/FlagContext.cs | 4 +- GZCTF/Models/Data/Game.cs | 8 +- GZCTF/Models/Data/LocalFile.cs | 4 +- GZCTF/Models/Data/Post.cs | 4 +- GZCTF/Models/Data/Submission.cs | 4 +- GZCTF/Models/Data/Team.cs | 4 +- GZCTF/Models/Data/UserInfo.cs | 6 +- .../Request/Edit/ChallengeEditDetailModel.cs | 4 +- GZCTF/Models/Request/Game/ScoreboardModel.cs | 4 +- GZCTF/Pages/Error.cshtml.cs | 2 +- GZCTF/Program.cs | 8 +- GZCTF/Repositories/FileRepository.cs | 4 +- GZCTF/Repositories/GameRepository.cs | 4 +- GZCTF/Services/ConfigService.cs | 7 +- GZCTF/Services/DockerService.cs | 4 +- GZCTF/Services/FlagChecker.cs | 4 +- GZCTF/Services/K8sService.cs | 2 +- GZCTF/Services/MailSender.cs | 6 +- GZCTF/Utils/DigitalSignature.cs | 4 +- GZCTF/Utils/HubHelper.cs | 5 +- GZCTF/Utils/LogHelper.cs | 4 +- 35 files changed, 201 insertions(+), 80 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..76d216056 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,121 @@ +# C# files +[*.cs] +indent_style = space + +# Modifier preferences +dotnet_style_require_accessibility_modifiers = never:suggestion + +# 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_between_query_expression_clauses = true + +# Indentation preferences +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents = true +csharp_indent_switch_labels = true +csharp_indent_labels = one_less_than_current + +# avoid this. unless absolutely necessary +dotnet_style_qualification_for_field = false:suggestion +dotnet_style_qualification_for_property = false:suggestion +dotnet_style_qualification_for_method = false:suggestion +dotnet_style_qualification_for_event = false:suggestion + +# only use var when it's obvious what the variable type is +csharp_style_var_for_built_in_types = true:none +csharp_style_var_when_type_is_apparent = true:none +csharp_style_var_elsewhere = false:none + +# use language keywords instead of BCL types +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 = 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 +dotnet_naming_symbols.constant_fields.required_modifiers = const + +dotnet_naming_style.pascal_case_style.capitalization = pascal_case + +# static fields should be PascalCase +dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion +dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields +dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style + +dotnet_naming_symbols.static_fields.applicable_kinds = field +dotnet_naming_symbols.static_fields.required_modifiers = static + +dotnet_naming_style.static_prefix_style.capitalization = pascal_case + +# internal and private fields should be _camelCase +dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion +dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields +dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style + +dotnet_naming_symbols.private_internal_fields.applicable_kinds = field +dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal + +dotnet_naming_style.camel_case_underscore_style.required_prefix = _ +dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case + +# Code style defaults +dotnet_sort_system_directives_first = true +csharp_preserve_single_line_blocks = true +csharp_preserve_single_line_statements = false + +# Expression-level preferences +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_null_propagation = true:suggestion + +# Expression-bodied members +csharp_style_expression_bodied_methods = false:none +csharp_style_expression_bodied_constructors = false:none +csharp_style_expression_bodied_operators = false:none +csharp_style_expression_bodied_properties = true:none +csharp_style_expression_bodied_indexers = true:none +csharp_style_expression_bodied_accessors = true:none + +# Pattern matching +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion + +# Null checking preferences +csharp_style_throw_expression = true:suggestion +csharp_style_conditional_delegate_call = true:suggestion + +# Space preferences +csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_comma = true +csharp_space_after_dot = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_after_semicolon_in_for_statement = true +csharp_space_around_binary_operators = before_and_after +csharp_space_around_declaration_statements = do_not_ignore +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_before_comma = false +csharp_space_before_dot = false +csharp_space_before_open_square_brackets = false +csharp_space_before_semicolon_in_for_statement = false +csharp_space_between_empty_square_brackets = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_between_square_brackets = false diff --git a/GZCTF.Test/ContainerServiceTest.cs b/GZCTF.Test/ContainerServiceTest.cs index 2b4c2e6e2..fde82294d 100644 --- a/GZCTF.Test/ContainerServiceTest.cs +++ b/GZCTF.Test/ContainerServiceTest.cs @@ -1,10 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; using CTFServer.Models.Internal; using CTFServer.Services.Interface; using Microsoft.AspNetCore.Mvc.Testing; using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; using Xunit; using Xunit.Abstractions; diff --git a/GZCTF.Test/SignatureTest.cs b/GZCTF.Test/SignatureTest.cs index 9f046f9af..74912fa33 100644 --- a/GZCTF.Test/SignatureTest.cs +++ b/GZCTF.Test/SignatureTest.cs @@ -1,10 +1,10 @@ +using System.Text; using CTFServer.Utils; using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.Generators; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Security; using Org.BouncyCastle.Utilities.Encoders; -using System.Text; using Xunit; using Xunit.Abstractions; diff --git a/GZCTF.Test/TestMailSender.cs b/GZCTF.Test/TestMailSender.cs index 39150575c..fc982fe3f 100644 --- a/GZCTF.Test/TestMailSender.cs +++ b/GZCTF.Test/TestMailSender.cs @@ -1,5 +1,5 @@ -using CTFServer.Services.Interface; -using System.Threading.Tasks; +using System.Threading.Tasks; +using CTFServer.Services.Interface; namespace CTFServer.Test; diff --git a/GZCTF.Test/TestWebAppFactory.cs b/GZCTF.Test/TestWebAppFactory.cs index 245389e68..a257b55b9 100644 --- a/GZCTF.Test/TestWebAppFactory.cs +++ b/GZCTF.Test/TestWebAppFactory.cs @@ -1,8 +1,8 @@ -using CTFServer.Services.Interface; +using System.Linq; +using CTFServer.Services.Interface; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc.Testing; using Microsoft.Extensions.DependencyInjection; -using System.Linq; namespace CTFServer.Test; diff --git a/GZCTF/Controllers/AccountController.cs b/GZCTF/Controllers/AccountController.cs index 7cc02afb5..0ce45a1bf 100644 --- a/GZCTF/Controllers/AccountController.cs +++ b/GZCTF/Controllers/AccountController.cs @@ -1,4 +1,5 @@ -using CTFServer.Extensions; +using System.Net.Mime; +using CTFServer.Extensions; using CTFServer.Middlewares; using CTFServer.Models.Internal; using CTFServer.Models.Request.Account; @@ -8,7 +9,6 @@ using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; -using System.Net.Mime; namespace CTFServer.Controllers; diff --git a/GZCTF/Controllers/AdminController.cs b/GZCTF/Controllers/AdminController.cs index c8be84861..05d11f55e 100644 --- a/GZCTF/Controllers/AdminController.cs +++ b/GZCTF/Controllers/AdminController.cs @@ -1,4 +1,5 @@ -using CTFServer.Middlewares; +using System.Net.Mime; +using CTFServer.Middlewares; using CTFServer.Models.Internal; using CTFServer.Models.Request.Account; using CTFServer.Models.Request.Admin; @@ -10,7 +11,6 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Options; -using System.Net.Mime; namespace CTFServer.Controllers; diff --git a/GZCTF/Controllers/AssetsController.cs b/GZCTF/Controllers/AssetsController.cs index c33cad709..0cfb4f1a8 100644 --- a/GZCTF/Controllers/AssetsController.cs +++ b/GZCTF/Controllers/AssetsController.cs @@ -1,9 +1,9 @@ -using CTFServer.Middlewares; +using System.ComponentModel.DataAnnotations; +using System.Net.Mime; +using CTFServer.Middlewares; using CTFServer.Repositories.Interface; using CTFServer.Utils; using Microsoft.AspNetCore.Mvc; -using System.Net.Mime; -using System.ComponentModel.DataAnnotations; namespace CTFServer.Controllers; diff --git a/GZCTF/Controllers/EditController.cs b/GZCTF/Controllers/EditController.cs index 82e4cdd23..38990599f 100644 --- a/GZCTF/Controllers/EditController.cs +++ b/GZCTF/Controllers/EditController.cs @@ -1,4 +1,5 @@ -using CTFServer.Extensions; +using System.Net.Mime; +using CTFServer.Extensions; using CTFServer.Middlewares; using CTFServer.Models.Request.Edit; using CTFServer.Models.Request.Game; @@ -8,7 +9,6 @@ using CTFServer.Utils; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; -using System.Net.Mime; namespace CTFServer.Controllers; diff --git a/GZCTF/Controllers/GameController.cs b/GZCTF/Controllers/GameController.cs index 3755f9a72..692774356 100644 --- a/GZCTF/Controllers/GameController.cs +++ b/GZCTF/Controllers/GameController.cs @@ -1,4 +1,7 @@ -using CTFServer.Middlewares; +using System.Net.Mime; +using System.Security.Claims; +using System.Threading.Channels; +using CTFServer.Middlewares; using CTFServer.Models.Request.Admin; using CTFServer.Models.Request.Edit; using CTFServer.Models.Request.Game; @@ -6,9 +9,6 @@ using CTFServer.Utils; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; -using System.Net.Mime; -using System.Security.Claims; -using System.Threading.Channels; namespace CTFServer.Controllers; diff --git a/GZCTF/Controllers/TeamController.cs b/GZCTF/Controllers/TeamController.cs index 46ca49bda..1f6f639ac 100644 --- a/GZCTF/Controllers/TeamController.cs +++ b/GZCTF/Controllers/TeamController.cs @@ -1,3 +1,5 @@ +using System.Net.Mime; +using System.Text.RegularExpressions; using CTFServer.Middlewares; using CTFServer.Models.Request.Info; using CTFServer.Repositories.Interface; @@ -5,8 +7,6 @@ using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; -using System.Net.Mime; -using System.Text.RegularExpressions; namespace CTFServer.Controllers; @@ -358,7 +358,7 @@ public async Task Accept([FromBody] string code, CancellationToke var lastColon = preCode.LastIndexOf(':'); - if(!int.TryParse(preCode[(lastColon + 1)..], out var teamId)) + if (!int.TryParse(preCode[(lastColon + 1)..], out var teamId)) return BadRequest(new RequestResponse($"队伍 Id 转换错误:{preCode[(lastColon + 1)..]}")); var teamName = preCode[..lastColon]; diff --git a/GZCTF/Extensions/RecaptchaExtension.cs b/GZCTF/Extensions/RecaptchaExtension.cs index e470caf45..7aaa9dc01 100644 --- a/GZCTF/Extensions/RecaptchaExtension.cs +++ b/GZCTF/Extensions/RecaptchaExtension.cs @@ -1,6 +1,6 @@ -using CTFServer.Models.Internal; +using System.Text.Json; +using CTFServer.Models.Internal; using Microsoft.Extensions.Options; -using System.Text.Json; namespace CTFServer.Extensions; diff --git a/GZCTF/Models/Data/Attachment.cs b/GZCTF/Models/Data/Attachment.cs index 026cf8062..52388f722 100644 --- a/GZCTF/Models/Data/Attachment.cs +++ b/GZCTF/Models/Data/Attachment.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json; -using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using Newtonsoft.Json; namespace CTFServer.Models.Data; diff --git a/GZCTF/Models/Data/Challenge.cs b/GZCTF/Models/Data/Challenge.cs index a795274cd..87763715b 100644 --- a/GZCTF/Models/Data/Challenge.cs +++ b/GZCTF/Models/Data/Challenge.cs @@ -1,9 +1,9 @@ -using CTFServer.Models.Data; -using CTFServer.Models.Request.Edit; -using CTFServer.Utils; -using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Text.Json.Serialization; +using CTFServer.Models.Data; +using CTFServer.Models.Request.Edit; +using CTFServer.Utils; namespace CTFServer.Models; diff --git a/GZCTF/Models/Data/FlagContext.cs b/GZCTF/Models/Data/FlagContext.cs index 85197f012..1c98d9810 100644 --- a/GZCTF/Models/Data/FlagContext.cs +++ b/GZCTF/Models/Data/FlagContext.cs @@ -1,5 +1,5 @@ -using CTFServer.Models.Data; -using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations; +using CTFServer.Models.Data; namespace CTFServer.Models; diff --git a/GZCTF/Models/Data/Game.cs b/GZCTF/Models/Data/Game.cs index 56319db69..2bd5096ec 100644 --- a/GZCTF/Models/Data/Game.cs +++ b/GZCTF/Models/Data/Game.cs @@ -1,13 +1,13 @@ -using CTFServer.Models.Request.Edit; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text.Json.Serialization; +using CTFServer.Models.Request.Edit; using CTFServer.Utils; using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.Generators; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Security; using Org.BouncyCastle.Utilities.Encoders; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Text.Json.Serialization; namespace CTFServer.Models; diff --git a/GZCTF/Models/Data/LocalFile.cs b/GZCTF/Models/Data/LocalFile.cs index d9ba054d4..8853354ac 100644 --- a/GZCTF/Models/Data/LocalFile.cs +++ b/GZCTF/Models/Data/LocalFile.cs @@ -1,7 +1,7 @@ -using Microsoft.EntityFrameworkCore; -using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Text.Json.Serialization; +using Microsoft.EntityFrameworkCore; namespace CTFServer.Models; diff --git a/GZCTF/Models/Data/Post.cs b/GZCTF/Models/Data/Post.cs index 4a97bcd1c..2e71ab6c8 100644 --- a/GZCTF/Models/Data/Post.cs +++ b/GZCTF/Models/Data/Post.cs @@ -1,6 +1,6 @@ -using CTFServer.Models.Request.Edit; +using System.ComponentModel.DataAnnotations; +using CTFServer.Models.Request.Edit; using CTFServer.Utils; -using System.ComponentModel.DataAnnotations; namespace CTFServer.Models; diff --git a/GZCTF/Models/Data/Submission.cs b/GZCTF/Models/Data/Submission.cs index f7adf1829..ea3d7824f 100644 --- a/GZCTF/Models/Data/Submission.cs +++ b/GZCTF/Models/Data/Submission.cs @@ -1,6 +1,6 @@ -using Microsoft.EntityFrameworkCore; -using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; +using Microsoft.EntityFrameworkCore; namespace CTFServer.Models; diff --git a/GZCTF/Models/Data/Team.cs b/GZCTF/Models/Data/Team.cs index c73bad9f3..1bbf29830 100644 --- a/GZCTF/Models/Data/Team.cs +++ b/GZCTF/Models/Data/Team.cs @@ -1,6 +1,6 @@ -using CTFServer.Models.Request.Info; -using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using CTFServer.Models.Request.Info; namespace CTFServer.Models; diff --git a/GZCTF/Models/Data/UserInfo.cs b/GZCTF/Models/Data/UserInfo.cs index 6a35d618d..35825d700 100644 --- a/GZCTF/Models/Data/UserInfo.cs +++ b/GZCTF/Models/Data/UserInfo.cs @@ -1,8 +1,8 @@ -using CTFServer.Models.Request.Account; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using CTFServer.Models.Request.Account; using CTFServer.Models.Request.Admin; using Microsoft.AspNetCore.Identity; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; namespace CTFServer.Models; diff --git a/GZCTF/Models/Request/Edit/ChallengeEditDetailModel.cs b/GZCTF/Models/Request/Edit/ChallengeEditDetailModel.cs index f61fe03d3..e44de44d4 100644 --- a/GZCTF/Models/Request/Edit/ChallengeEditDetailModel.cs +++ b/GZCTF/Models/Request/Edit/ChallengeEditDetailModel.cs @@ -1,6 +1,6 @@ -using CTFServer.Models.Data; +using System.ComponentModel.DataAnnotations; +using CTFServer.Models.Data; using CTFServer.Models.Request.Game; -using System.ComponentModel.DataAnnotations; namespace CTFServer.Models.Request.Edit; diff --git a/GZCTF/Models/Request/Game/ScoreboardModel.cs b/GZCTF/Models/Request/Game/ScoreboardModel.cs index 5e08539dd..46df54caf 100644 --- a/GZCTF/Models/Request/Game/ScoreboardModel.cs +++ b/GZCTF/Models/Request/Game/ScoreboardModel.cs @@ -1,5 +1,5 @@ -using CTFServer.Models.Request.Info; -using System.Text.Json.Serialization; +using System.Text.Json.Serialization; +using CTFServer.Models.Request.Info; namespace CTFServer.Models.Request.Game; diff --git a/GZCTF/Pages/Error.cshtml.cs b/GZCTF/Pages/Error.cshtml.cs index ea8fc7944..379c8363b 100644 --- a/GZCTF/Pages/Error.cshtml.cs +++ b/GZCTF/Pages/Error.cshtml.cs @@ -1,6 +1,6 @@ +using System.Diagnostics; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using System.Diagnostics; namespace CTFServer.Pages; diff --git a/GZCTF/Program.cs b/GZCTF/Program.cs index 8310efe4d..028745ea2 100644 --- a/GZCTF/Program.cs +++ b/GZCTF/Program.cs @@ -1,4 +1,7 @@ global using CTFServer.Models; +using System.Reflection; +using System.Text; +using System.Text.Json; using AspNetCoreRateLimit; using CTFServer.Extensions; using CTFServer.Hubs; @@ -9,6 +12,7 @@ using CTFServer.Services; using CTFServer.Services.Interface; using CTFServer.Utils; +using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.ResponseCompression; @@ -16,10 +20,6 @@ using NJsonSchema.Generation; using Serilog; using Serilog.Events; -using System.Text; -using System.Text.Json; -using System.Reflection; -using Microsoft.AspNetCore.DataProtection; var builder = WebApplication.CreateBuilder(args); diff --git a/GZCTF/Repositories/FileRepository.cs b/GZCTF/Repositories/FileRepository.cs index 370e8b033..b042d1a8e 100644 --- a/GZCTF/Repositories/FileRepository.cs +++ b/GZCTF/Repositories/FileRepository.cs @@ -1,7 +1,7 @@ -using CTFServer.Repositories.Interface; +using System.Security.Cryptography; +using CTFServer.Repositories.Interface; using CTFServer.Utils; using Microsoft.EntityFrameworkCore; -using System.Security.Cryptography; namespace CTFServer.Repositories; diff --git a/GZCTF/Repositories/GameRepository.cs b/GZCTF/Repositories/GameRepository.cs index cd007add3..227a5f8a7 100644 --- a/GZCTF/Repositories/GameRepository.cs +++ b/GZCTF/Repositories/GameRepository.cs @@ -1,10 +1,10 @@ -using CTFServer.Models.Request.Game; +using System.Text; +using CTFServer.Models.Request.Game; using CTFServer.Models.Request.Info; using CTFServer.Repositories.Interface; using CTFServer.Utils; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Caching.Distributed; -using System.Text; namespace CTFServer.Repositories; diff --git a/GZCTF/Services/ConfigService.cs b/GZCTF/Services/ConfigService.cs index 362d4dbc9..464dbddbb 100644 --- a/GZCTF/Services/ConfigService.cs +++ b/GZCTF/Services/ConfigService.cs @@ -1,8 +1,8 @@ -using CTFServer.Models.Data; +using System.ComponentModel; +using CTFServer.Models.Data; using CTFServer.Services.Interface; using CTFServer.Utils; using Microsoft.EntityFrameworkCore; -using System.ComponentModel; namespace CTFServer.Services; @@ -94,7 +94,8 @@ private async Task SaveConfigInternal(HashSet configs, CancellationToken private static bool IsArrayLikeInterface(Type type) { - if (!type.IsInterface || !type.IsConstructedGenericType) { return false; } + if (!type.IsInterface || !type.IsConstructedGenericType) + { return false; } Type genericTypeDefinition = type.GetGenericTypeDefinition(); return genericTypeDefinition == typeof(IEnumerable<>) diff --git a/GZCTF/Services/DockerService.cs b/GZCTF/Services/DockerService.cs index 4d2100671..1e4ced5a7 100644 --- a/GZCTF/Services/DockerService.cs +++ b/GZCTF/Services/DockerService.cs @@ -1,10 +1,10 @@ -using CTFServer.Models.Internal; +using System.Net; +using CTFServer.Models.Internal; using CTFServer.Services.Interface; using CTFServer.Utils; using Docker.DotNet; using Docker.DotNet.Models; using Microsoft.Extensions.Options; -using System.Net; namespace CTFServer.Services; diff --git a/GZCTF/Services/FlagChecker.cs b/GZCTF/Services/FlagChecker.cs index 1d3c91e76..c5ddf9bdb 100644 --- a/GZCTF/Services/FlagChecker.cs +++ b/GZCTF/Services/FlagChecker.cs @@ -1,6 +1,6 @@ -using CTFServer.Repositories.Interface; +using System.Threading.Channels; +using CTFServer.Repositories.Interface; using CTFServer.Utils; -using System.Threading.Channels; namespace CTFServer.Services; diff --git a/GZCTF/Services/K8sService.cs b/GZCTF/Services/K8sService.cs index cc09f4f7f..6ec198162 100644 --- a/GZCTF/Services/K8sService.cs +++ b/GZCTF/Services/K8sService.cs @@ -1,3 +1,4 @@ +using System.Net; using CTFServer.Models.Internal; using CTFServer.Services.Interface; using CTFServer.Utils; @@ -5,7 +6,6 @@ using k8s.Autorest; using k8s.Models; using Microsoft.Extensions.Options; -using System.Net; namespace CTFServer.Services; diff --git a/GZCTF/Services/MailSender.cs b/GZCTF/Services/MailSender.cs index 879934d34..01ff69042 100644 --- a/GZCTF/Services/MailSender.cs +++ b/GZCTF/Services/MailSender.cs @@ -1,9 +1,9 @@ -using CTFServer.Models.Internal; +using System.Reflection; +using CTFServer.Models.Internal; using CTFServer.Services.Interface; using CTFServer.Utils; -using Microsoft.Extensions.Options; -using System.Reflection; using MailKit.Net.Smtp; +using Microsoft.Extensions.Options; using MimeKit; namespace CTFServer.Services; diff --git a/GZCTF/Utils/DigitalSignature.cs b/GZCTF/Utils/DigitalSignature.cs index dc73f3f0e..9b033b09b 100644 --- a/GZCTF/Utils/DigitalSignature.cs +++ b/GZCTF/Utils/DigitalSignature.cs @@ -1,7 +1,7 @@ -using Org.BouncyCastle.Crypto; +using System.Text; +using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Security; using Org.BouncyCastle.Utilities.Encoders; -using System.Text; namespace CTFServer.Utils; diff --git a/GZCTF/Utils/HubHelper.cs b/GZCTF/Utils/HubHelper.cs index 571e7a001..ebbacb378 100644 --- a/GZCTF/Utils/HubHelper.cs +++ b/GZCTF/Utils/HubHelper.cs @@ -1,6 +1,5 @@ -using Microsoft.EntityFrameworkCore; - -using System.Security.Claims; +using System.Security.Claims; +using Microsoft.EntityFrameworkCore; namespace CTFServer.Utils; diff --git a/GZCTF/Utils/LogHelper.cs b/GZCTF/Utils/LogHelper.cs index 18b50c758..837ae6302 100644 --- a/GZCTF/Utils/LogHelper.cs +++ b/GZCTF/Utils/LogHelper.cs @@ -1,4 +1,5 @@ -using CTFServer.Extensions; +using System.IO.Compression; +using CTFServer.Extensions; using NpgsqlTypes; using Serilog; using Serilog.Core; @@ -7,7 +8,6 @@ using Serilog.Sinks.PostgreSQL; using Serilog.Templates; using Serilog.Templates.Themes; -using System.IO.Compression; using LogLevel = Microsoft.Extensions.Logging.LogLevel; namespace CTFServer.Utils;