2.12.8.0
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
namespace PCLCS;
|
||||
|
||||
/// <summary>
|
||||
/// 社区资源的类型。
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum ResourceTypes {
|
||||
/// <summary>Mod。</summary>
|
||||
Mod = 1,
|
||||
/// <summary>整合包。</summary>
|
||||
ModPack = 2,
|
||||
/// <summary>资源包。</summary>
|
||||
ResourcePack = 4,
|
||||
/// <summary>光影包。</summary>
|
||||
Shader = 8,
|
||||
/// <summary>数据包。</summary>
|
||||
DataPack = 16,
|
||||
/// <summary>服务端插件。</summary>
|
||||
Plugin = 32,
|
||||
/// <summary>同时包含数据包以及 Mod。</summary>
|
||||
ModOrDataPack = Mod | DataPack,
|
||||
/// <summary>允许任意种类,或种类未知。</summary>
|
||||
Any = Mod | ModPack | ResourcePack | Shader | DataPack | Plugin,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 社区资源的来源平台。
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum ResourcePlatforms {
|
||||
CurseForge = 1,
|
||||
Modrinth = 2,
|
||||
Any = CurseForge | Modrinth,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mod 加载器的类型。
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum ModLoaders {
|
||||
None = 0,
|
||||
Forge = 1,
|
||||
LiteLoader = 2,
|
||||
Fabric = 4,
|
||||
Quilt = 8,
|
||||
NeoForge = 16,
|
||||
All = Forge | LiteLoader | Fabric | Quilt | NeoForge,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 在爱发电中的赞助等级。
|
||||
/// </summary>
|
||||
public enum DonationRank {
|
||||
None = 0,
|
||||
Rank6 = 6,
|
||||
Rank12 = 12,
|
||||
Rank23 = 23,
|
||||
Rank54 = 54,
|
||||
Rank98 = 98,
|
||||
}
|
||||
|
||||
public static class Versions {
|
||||
/// <summary>
|
||||
/// 土豆码版本号。
|
||||
/// </summary>
|
||||
public const char POTATO_VERSION = '1';
|
||||
/// <summary>
|
||||
/// 版本管理中 Mod 信息缓存的版本号。
|
||||
/// </summary>
|
||||
public const int LOCAL_MOD_CACHE_VERSION = 17;
|
||||
/// <summary>
|
||||
/// Minecraft 本地实例信息缓存的版本号。
|
||||
/// </summary>
|
||||
public const int MCINSTANCE_CACHE_VERSION = 37;
|
||||
}
|
||||
+12
-19
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net462</TargetFramework>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
<OutputType>Library</OutputType>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<OutDir>bin\</OutDir>
|
||||
@@ -11,34 +11,22 @@
|
||||
<Deterministic>true</Deterministic>
|
||||
<LangVersion>13.0</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<AnalysisLevel>8.0</AnalysisLevel>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Nullable" Version="1.3.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.ValueTuple" Version="4.6.1" />
|
||||
<PackageReference Include="PolySharp" Version="1.15.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MeloongCore\Shared\MeloongCore.csproj" />
|
||||
<ProjectReference Include="..\MeloongCore\Wpf\MeloongCoreWpf.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="System" />
|
||||
<Using Include="System.ComponentModel" />
|
||||
<Using Include="System.Diagnostics.CodeAnalysis" />
|
||||
<Using Include="System.Collections" />
|
||||
<Using Include="System.Collections.Generic" />
|
||||
<Using Include="System.Diagnostics.CodeAnalysis" />
|
||||
<Using Include="System.Linq" />
|
||||
<Using Include="System.Text" />
|
||||
<Using Include="System.IO" />
|
||||
<Using Include="System.Net" />
|
||||
<Using Include="System.Threading" />
|
||||
<Using Include="System.Collections.Concurrent" />
|
||||
<Using Include="System.Runtime.CompilerServices" />
|
||||
<Using Include="System.Runtime.InteropServices" />
|
||||
<Using Include="MeloongCore" />
|
||||
@@ -47,6 +35,11 @@
|
||||
<Using Include="MeloongCore.Wpf.Extensions" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MeloongCore\Shared\MeloongCore.csproj" />
|
||||
<ProjectReference Include="..\MeloongCore\Wpf\MeloongCore.Wpf.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DefineConstants>$(DefineConstants);SNAPSHOT</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
namespace PCLCS;
|
||||
public static class Resource {
|
||||
|
||||
/// <summary>
|
||||
/// 将 CurseForge 的 ModLoaderType 映射为 <see cref="ModLoaders"/> 枚举。
|
||||
/// </summary>
|
||||
public static ModLoaders FromCurseForgeModLoaderType(int modLoaderType) => modLoaderType switch {
|
||||
// https://docs.curseforge.com/rest-api/#tocS_ModLoaderType
|
||||
1 => ModLoaders.Forge,
|
||||
3 => ModLoaders.LiteLoader,
|
||||
4 => ModLoaders.Fabric,
|
||||
5 => ModLoaders.Quilt,
|
||||
6 => ModLoaders.NeoForge,
|
||||
_ => ModLoaders.None,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 将 <see cref="ModLoaders"/> 映射为 CurseForge 的单一 ModLoaderType。
|
||||
/// </summary>
|
||||
public static int ToCurseForgeModLoaderType(ModLoaders loaders) {
|
||||
if (loaders == ModLoaders.None) return 0;
|
||||
if (!loaders.Flags().IsSingle()) throw new ArgumentException($"传入的枚举值 {loaders} 并非单个 Mod Loader", nameof(loaders));
|
||||
return loaders switch {
|
||||
ModLoaders.Forge => 1,
|
||||
ModLoaders.LiteLoader => 3,
|
||||
ModLoaders.Fabric => 4,
|
||||
ModLoaders.Quilt => 5,
|
||||
ModLoaders.NeoForge => 6,
|
||||
_ => 0,
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user