doc: 更新头文件

This commit is contained in:
Argo Zhang 2025-11-21 13:14:42 +08:00
parent ad84da7d3c
commit 14d2332483
17 changed files with 75 additions and 19 deletions

View File

@ -19,8 +19,7 @@ indent_size = 2
end_of_line = lf end_of_line = lf
[*.cs] [*.cs]
dotnet_analyzer_diagnostic.category-Style.severity = none
csharp_style_namespace_declarations = file_scoped:silent csharp_style_namespace_declarations = file_scoped:silent
[*.cs] [*.cs]
file_header_template = Copyright 2023 The Ip2Region Authors. All rights reserved.\nUse of this source code is governed by a Apache2.0-style\nlicense that can be found in the LICENSE file.\n@Author Alan <lzh.shap@gmail.com>\n@Date 2023/07/25\nUpdated by Argo Zhang <argo@live.ca> at 2025/11/21 file_header_template = Copyright 2025 The Ip2Region Authors. All rights reserved.\nUse of this source code is governed by a Apache2.0-style\nlicense that can be found in the LICENSE file.\n@Author Alan <lzh.shap@gmail.com>\n@Date 2023/07/25\nUpdated by Argo Zhang <argo@live.ca> at 2025/11/21

View File

@ -1,4 +1,4 @@
// Copyright 2023 The Ip2Region Authors. All rights reserved. // Copyright 2025 The Ip2Region Authors. All rights reserved.
// Use of this source code is governed by a Apache2.0-style // Use of this source code is governed by a Apache2.0-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// @Author Alan <lzh.shap@gmail.com> // @Author Alan <lzh.shap@gmail.com>

View File

@ -1,3 +1,10 @@
// Copyright 2025 The Ip2Region Authors. All rights reserved.
// Use of this source code is governed by a Apache2.0-style
// license that can be found in the LICENSE file.
// @Author Alan <lzh.shap@gmail.com>
// @Date 2023/07/25
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
using BenchmarkDotNet.Running; using BenchmarkDotNet.Running;
using IP2Region.Net.BenchMark; using IP2Region.Net.BenchMark;

View File

@ -1,3 +1,10 @@
// Copyright 2025 The Ip2Region Authors. All rights reserved.
// Use of this source code is governed by a Apache2.0-style
// license that can be found in the LICENSE file.
// @Author Alan <lzh.shap@gmail.com>
// @Date 2023/07/25
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
using IP2Region.Net.Abstractions; using IP2Region.Net.Abstractions;
using IP2Region.Net.XDB; using IP2Region.Net.XDB;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;

View File

@ -1,3 +1,10 @@
// Copyright 2025 The Ip2Region Authors. All rights reserved.
// Use of this source code is governed by a Apache2.0-style
// license that can be found in the LICENSE file.
// @Author Alan <lzh.shap@gmail.com>
// @Date 2023/07/25
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
using Xunit; using Xunit;
namespace IP2Region.Net.Test; namespace IP2Region.Net.Test;

View File

@ -1,3 +1,10 @@
// Copyright 2025 The Ip2Region Authors. All rights reserved.
// Use of this source code is governed by a Apache2.0-style
// license that can be found in the LICENSE file.
// @Author Alan <lzh.shap@gmail.com>
// @Date 2023/07/25
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
using Xunit; using Xunit;
namespace IP2Region.Net.Test; namespace IP2Region.Net.Test;

View File

@ -1,8 +1,9 @@
// Copyright 2023 The Ip2Region Authors. All rights reserved. // Copyright 2025 The Ip2Region Authors. All rights reserved.
// Use of this source code is governed by a Apache2.0-style // Use of this source code is governed by a Apache2.0-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// @Author Alan <lzh.shap@gmail.com> // @Author Alan <lzh.shap@gmail.com>
// @Date 2023/07/25 // @Date 2023/07/25
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
using System.Net; using System.Net;

View File

@ -1,8 +1,9 @@
// Copyright 2023 The Ip2Region Authors. All rights reserved. // Copyright 2025 The Ip2Region Authors. All rights reserved.
// Use of this source code is governed by a Apache2.0-style // Use of this source code is governed by a Apache2.0-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// @Author Alan <lzh.shap@gmail.com> // @Author Alan <lzh.shap@gmail.com>
// @Date 2023/07/25 // @Date 2023/07/25
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
using IP2Region.Net.Abstractions; using IP2Region.Net.Abstractions;
using IP2Region.Net.XDB; using IP2Region.Net.XDB;

View File

@ -1,8 +1,9 @@
// Copyright 2023 The Ip2Region Authors. All rights reserved. // Copyright 2025 The Ip2Region Authors. All rights reserved.
// Use of this source code is governed by a Apache2.0-style // Use of this source code is governed by a Apache2.0-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// @Author Alan <lzh.shap@gmail.com> // @Author Alan <lzh.shap@gmail.com>
// @Date 2023/07/25 // @Date 2023/07/25
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
using System.Buffers; using System.Buffers;

View File

@ -1,8 +1,9 @@
// Copyright 2023 The Ip2Region Authors. All rights reserved. // Copyright 2025 The Ip2Region Authors. All rights reserved.
// Use of this source code is governed by a Apache2.0-style // Use of this source code is governed by a Apache2.0-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// @Author Alan <lzh.shap@gmail.com> // @Author Alan <lzh.shap@gmail.com>
// @Date 2023/07/25 // @Date 2023/07/25
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
using IP2Region.Net.Internal.Abstractions; using IP2Region.Net.Internal.Abstractions;
using IP2Region.Net.XDB; using IP2Region.Net.XDB;

View File

@ -1,8 +1,9 @@
// Copyright 2023 The Ip2Region Authors. All rights reserved. // Copyright 2025 The Ip2Region Authors. All rights reserved.
// Use of this source code is governed by a Apache2.0-style // Use of this source code is governed by a Apache2.0-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// @Author Alan <lzh.shap@gmail.com> // @Author Alan <lzh.shap@gmail.com>
// @Date 2023/07/25 // @Date 2023/07/25
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
using IP2Region.Net.Internal.Abstractions; using IP2Region.Net.Internal.Abstractions;
@ -10,7 +11,7 @@ namespace IP2Region.Net.Internal;
class ContentCacheStrategy : AbstractCacheStrategy class ContentCacheStrategy : AbstractCacheStrategy
{ {
ReadOnlyMemory<byte> _cacheData = default; readonly ReadOnlyMemory<byte> _cacheData = default;
public ContentCacheStrategy(string xdbPath) : base(xdbPath) public ContentCacheStrategy(string xdbPath) : base(xdbPath)
{ {

View File

@ -1,8 +1,9 @@
// Copyright 2023 The Ip2Region Authors. All rights reserved. // Copyright 2025 The Ip2Region Authors. All rights reserved.
// Use of this source code is governed by a Apache2.0-style // Use of this source code is governed by a Apache2.0-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// @Author Alan <lzh.shap@gmail.com> // @Author Alan <lzh.shap@gmail.com>
// @Date 2023/07/25 // @Date 2023/07/25
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
using IP2Region.Net.Internal.Abstractions; using IP2Region.Net.Internal.Abstractions;

View File

@ -1,8 +1,9 @@
// Copyright 2023 The Ip2Region Authors. All rights reserved. // Copyright 2025 The Ip2Region Authors. All rights reserved.
// Use of this source code is governed by a Apache2.0-style // Use of this source code is governed by a Apache2.0-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// @Author Alan <lzh.shap@gmail.com> // @Author Alan <lzh.shap@gmail.com>
// @Date 2023/07/25 // @Date 2023/07/25
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
using IP2Region.Net.Internal.Abstractions; using IP2Region.Net.Internal.Abstractions;
@ -10,12 +11,12 @@ namespace IP2Region.Net.Internal;
internal class VectorIndexCacheStrategy : AbstractCacheStrategy internal class VectorIndexCacheStrategy : AbstractCacheStrategy
{ {
ReadOnlyMemory<byte> _vectorCahe = default; readonly ReadOnlyMemory<byte> _vectorCache = default;
public VectorIndexCacheStrategy(string xdbPath) : base(xdbPath) public VectorIndexCacheStrategy(string xdbPath) : base(xdbPath)
{ {
_vectorCahe = base.GetData(256, 256 * 256 * 8); _vectorCache = base.GetData(256, 256 * 256 * 8);
} }
public override ReadOnlyMemory<byte> GetVectorIndexStartPos(int offset) => _vectorCahe.Slice(offset, 8); public override ReadOnlyMemory<byte> GetVectorIndexStartPos(int offset) => _vectorCache.Slice(offset, 8);
} }

View File

@ -1,3 +1,10 @@
// Copyright 2025 The Ip2Region Authors. All rights reserved.
// Use of this source code is governed by a Apache2.0-style
// license that can be found in the LICENSE file.
// @Author Alan <lzh.shap@gmail.com>
// @Date 2023/07/25
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
namespace IP2Region.Net.XDB; namespace IP2Region.Net.XDB;
/// <summary> /// <summary>

View File

@ -1,8 +1,9 @@
// Copyright 2023 The Ip2Region Authors. All rights reserved. // Copyright 2025 The Ip2Region Authors. All rights reserved.
// Use of this source code is governed by a Apache2.0-style // Use of this source code is governed by a Apache2.0-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// @Author Alan Lee <lzh.shap@gmail.com> // @Author Alan <lzh.shap@gmail.com>
// @Date 2023/07/23 // @Date 2023/07/25
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
using IP2Region.Net.Abstractions; using IP2Region.Net.Abstractions;
using IP2Region.Net.Internal; using IP2Region.Net.Internal;
@ -57,7 +58,7 @@ public class Searcher : ISearcher
public string? Search(uint ipAddress) public string? Search(uint ipAddress)
{ {
var bytes = BitConverter.GetBytes(ipAddress); var bytes = BitConverter.GetBytes(ipAddress);
bytes.Reverse(); Array.Reverse(bytes);
return SearchCore(bytes); return SearchCore(bytes);
} }

View File

@ -1,3 +1,10 @@
// Copyright 2025 The Ip2Region Authors. All rights reserved.
// Use of this source code is governed by a Apache2.0-style
// license that can be found in the LICENSE file.
// @Author Alan <lzh.shap@gmail.com>
// @Date 2023/07/25
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
using System.Buffers; using System.Buffers;
using System.Buffers.Binary; using System.Buffers.Binary;
using System.Net; using System.Net;
@ -35,7 +42,7 @@ public static class Util
if (!File.Exists(dbPath)) if (!File.Exists(dbPath))
{ {
throw new FileNotFoundException("xdb file not fould.", dbPath); throw new FileNotFoundException("xdb file not found.", dbPath);
} }
using var reader = File.OpenRead(dbPath); using var reader = File.OpenRead(dbPath);

View File

@ -1,3 +1,10 @@
// Copyright 2025 The Ip2Region Authors. All rights reserved.
// Use of this source code is governed by a Apache2.0-style
// license that can be found in the LICENSE file.
// @Author Alan <lzh.shap@gmail.com>
// @Date 2023/07/25
// Updated by Argo Zhang <argo@live.ca> at 2025/11/21
namespace IP2Region.Net.XDB; namespace IP2Region.Net.XDB;
/// <summary> /// <summary>