diff --git a/GFramework.Core.Tests/constants/GFrameworkConstantsTests.cs b/GFramework.Core.Tests/constants/GFrameworkConstantsTests.cs index 606e259..99f2894 100644 --- a/GFramework.Core.Tests/constants/GFrameworkConstantsTests.cs +++ b/GFramework.Core.Tests/constants/GFrameworkConstantsTests.cs @@ -52,7 +52,8 @@ public class GFrameworkConstantsTests // 如果常量不存在或不是公共的,编译会失败或抛出异常 Assert.DoesNotThrow(() => { - var name = GFrameworkConstants.FrameworkName; + const string name = GFrameworkConstants.FrameworkName; + Console.WriteLine(name); }); } diff --git a/GFramework.Game.Abstractions/storage/IFileStorage.cs b/GFramework.Game.Abstractions/storage/IFileStorage.cs new file mode 100644 index 0000000..f8b17f4 --- /dev/null +++ b/GFramework.Game.Abstractions/storage/IFileStorage.cs @@ -0,0 +1,9 @@ +using GFramework.Core.Abstractions.storage; + +namespace GFramework.Game.Abstractions.storage; + +/// +/// 文件存储接口,定义了文件存储操作的契约 +/// 继承自IStorage接口,提供专门针对文件的存储功能 +/// +public interface IFileStorage : IStorage; \ No newline at end of file diff --git a/GFramework.Game.Abstractions/storage/IScopedStorage.cs b/GFramework.Game.Abstractions/storage/IScopedStorage.cs new file mode 100644 index 0000000..148586f --- /dev/null +++ b/GFramework.Game.Abstractions/storage/IScopedStorage.cs @@ -0,0 +1,8 @@ +using GFramework.Core.Abstractions.storage; + +namespace GFramework.Game.Abstractions.storage; + +/// +/// 表示作用域存储接口,继承自基础存储接口 +/// +public interface IScopedStorage : IStorage; \ No newline at end of file diff --git a/GFramework.Game/storage/FileStorage.cs b/GFramework.Game/storage/FileStorage.cs index 826280f..b75ed8a 100644 --- a/GFramework.Game/storage/FileStorage.cs +++ b/GFramework.Game/storage/FileStorage.cs @@ -1,14 +1,14 @@ using System.Collections.Concurrent; using System.Text; -using GFramework.Core.Abstractions.storage; using GFramework.Game.Abstractions.serializer; +using GFramework.Game.Abstractions.storage; namespace GFramework.Game.storage; /// -/// 基于文件系统的存储实现,实现了IStorage接口,支持按key细粒度锁保证线程安全 +/// 基于文件系统的存储实现,实现了IFileStorage接口,支持按key细粒度锁保证线程安全 /// -public sealed class FileStorage : IStorage +public sealed class FileStorage : IFileStorage { private readonly string _extension; diff --git a/GFramework.Game/storage/ScopedStorage.cs b/GFramework.Game/storage/ScopedStorage.cs index ba85f19..2f9ca5b 100644 --- a/GFramework.Game/storage/ScopedStorage.cs +++ b/GFramework.Game/storage/ScopedStorage.cs @@ -1,4 +1,5 @@ using GFramework.Core.Abstractions.storage; +using GFramework.Game.Abstractions.storage; namespace GFramework.Game.storage; @@ -7,7 +8,7 @@ namespace GFramework.Game.storage; /// /// 内部的实际存储实现 /// 用于所有键的前缀字符串 -public sealed class ScopedStorage(IStorage inner, string prefix) : IStorage +public sealed class ScopedStorage(IStorage inner, string prefix) : IScopedStorage { /// /// 检查指定键是否存在