Skip to content

Commit 712ad4f

Browse files
committed
up
1 parent 9c36bab commit 712ad4f

37 files changed

Lines changed: 1026 additions & 444 deletions

src/ColorMC.Core/Net/Apis/ModrinthAPI.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,26 @@ public static class ModrinthAPI
167167
}
168168
}
169169

170+
/// <summary>
171+
/// 获取团队列表
172+
/// </summary>
173+
/// <param name="pid"></param>
174+
/// <returns></returns>
175+
public static async Task<List<ModrinthTeamObj>?> GetTeamAsync(string pid)
176+
{
177+
string url = $"{UrlHelper.Modrinth}project/{pid}/members";
178+
try
179+
{
180+
using var stream = await SendAsync(url);
181+
return JsonUtils.ToObj(stream, JsonType.ListModrinthTeamObj);
182+
}
183+
catch (Exception e)
184+
{
185+
ColorMCCore.OnError(new ApiRequestErrorEventArgs(url, e));
186+
return null;
187+
}
188+
}
189+
170190
/// <summary>
171191
/// 获取指定项目的内容
172192
/// </summary>

src/ColorMC.Core/Objs/ConfigObj.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,6 @@ public record GameCheckObj
261261
/// </summary>
262262
public record ConfigObj
263263
{
264-
/// <summary>
265-
/// 语言
266-
/// </summary>
267-
public LanguageType Language { get; set; }
268264
/// <summary>
269265
/// 配置文件版本
270266
/// </summary>

src/ColorMC.Core/Objs/CurseForge/CurseForgeObj.cs

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,12 @@ public record CategoriesObj
4747
{
4848
//public long id { get; set; }
4949
//public long gameId { get; set; }
50-
//public string name { get; set; }
50+
[JsonPropertyName("name")]
51+
public string Name { get; set; }
5152
//public string slug { get; set; }
5253
//public string url { get; set; }
53-
//public string iconUrl { get; set; }
54+
[JsonPropertyName("iconUrl")]
55+
public string IconUrl { get; set; }
5456
//public string dateModified { get; set; }
5557
//public bool isClass { get; set; }
5658
[JsonPropertyName("classId")]
@@ -62,7 +64,8 @@ public record AuthorsObj
6264
//public long id { get; set; }
6365
[JsonPropertyName("name")]
6466
public string Name { get; set; }
65-
//public string url { get; set; }
67+
[JsonPropertyName("avatarUrl")]
68+
public string AvatarUrl { get; set; }
6669
}
6770
public record LogoObj
6871
{
@@ -74,15 +77,18 @@ public record LogoObj
7477
[JsonPropertyName("url")]
7578
public string Url { get; set; }
7679
}
77-
//public record Screenshots
78-
//{
79-
// public long id { get; set; }
80-
// public long modId { get; set; }
81-
// public string title { get; set; }
82-
// public string description { get; set; }
83-
// public string thumbnailUrl { get; set; }
84-
// public string url { get; set; }
85-
//}
80+
public record ScreenshotsObj
81+
{
82+
//public long id { get; set; }
83+
//public long modId { get; set; }
84+
[JsonPropertyName("title")]
85+
public string Title { get; set; }
86+
[JsonPropertyName("description")]
87+
public string Description { get; set; }
88+
//public string thumbnailUrl { get; set; }
89+
[JsonPropertyName("url")]
90+
public string Url { get; set; }
91+
}
8692
//public record LatestFilesIndexes
8793
//{
8894
// public string gameVersion { get; set; }
@@ -115,7 +121,8 @@ public record LogoObj
115121
public List<AuthorsObj> Authors { get; set; }
116122
[JsonPropertyName("logo")]
117123
public LogoObj Logo { get; set; }
118-
//public List<Screenshots> screenshots { get; set; }
124+
[JsonPropertyName("screenshots")]
125+
public List<ScreenshotsObj> Screenshots { get; set; }
119126
//public long mainFileId { get; set; }
120127
//public List<CurseForgeModObj.DataObj> latestFiles { get; set; }
121128
//public List<LatestFilesIndexes> latestFilesIndexes { get; set; }

src/ColorMC.Core/Objs/Enums.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,6 @@ public enum PackType
128128
ColorMC, CurseForge, Modrinth, MMC, HMCL, ZipPack
129129
}
130130

131-
/// <summary>
132-
/// 语言
133-
/// </summary>
134-
public enum LanguageType
135-
{
136-
zh_cn, en_us
137-
}
138-
139131
/// <summary>
140132
/// 下载源
141133
/// </summary>

src/ColorMC.Core/Objs/Modrinth/ModrinthProjectObj.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ public record ModrinthProjectObj
1414
public string Title { get; set; }
1515
[JsonPropertyName("description")]
1616
public string Description { get; set; }
17+
[JsonPropertyName("body")]
18+
public string Body { get; set; }
1719
//public string published { get; set; }
1820
[JsonPropertyName("updated")]
1921
public string Updated { get; set; }

src/ColorMC.Core/Objs/Modrinth/ModrinthSearchObj.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public record HitObj
1616
public string Title { get; set; }
1717
[JsonPropertyName("description")]
1818
public string Description { get; set; }
19+
//[JsonPropertyName("body")]
20+
//public string Body { get; set; }
1921
//public List<string> categories { get; set; }
2022
//public List<string> display_categories { get; set; }
2123
//public List<string> versions { get; set; }
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
using System.Text.Json.Serialization;
5+
6+
namespace ColorMC.Core.Objs.Modrinth;
7+
8+
public record ModrinthTeamObj
9+
{
10+
public record TeamserObj
11+
{
12+
[JsonPropertyName("username")]
13+
public string Username { get; set; }
14+
[JsonPropertyName("avatar_url")]
15+
public string AvatarUrl { get; set; }
16+
}
17+
18+
[JsonPropertyName("user")]
19+
public TeamserObj User { get; set; }
20+
}

src/ColorMC.Core/Utils/SourceGenerationContext.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ namespace ColorMC.Core.Utils;
9494
[JsonSerializable(typeof(List<LoginObj>))]
9595
[JsonSerializable(typeof(Dictionary<string, MavenItemObj>))]
9696
[JsonSerializable(typeof(ServerPackObj))]
97+
[JsonSerializable(typeof(List<ModrinthTeamObj>))]
9798
public partial class SourceGenerationContext : JsonSerializerContext
9899
{
99100

@@ -178,4 +179,5 @@ public static class JsonType
178179
public static JsonTypeInfo<Dictionary<string, MavenItemObj>> DictionaryStringMavenItemObj => SourceGenerationContext.Default.DictionaryStringMavenItemObj;
179180
public static JsonTypeInfo<ServerPackObj> ServerPackObj => SourceGenerationContext.Default.ServerPackObj;
180181
public static JsonTypeInfo<GameArgObj.GameArgumentsObj.GameJvmObj> GameJvmObj => SourceGenerationContext.Default.GameJvmObj;
182+
public static JsonTypeInfo<List<ModrinthTeamObj>> ListModrinthTeamObj => SourceGenerationContext.Default.ListModrinthTeamObj;
181183
}

src/ColorMC.Gui/App.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<Application.Styles>
2222
<FluentTheme />
2323
<dialog:DialogHostStyles />
24+
<StyleInclude Source="avares://MarkdownAIRender/Index.axaml" />
2425
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml" />
2526
<StyleInclude Source="avares://Avalonia.Controls.TreeDataGrid/Themes/Fluent.axaml" />
2627
<StyleInclude Source="avares://Avalonia.Controls.ColorPicker/Themes/Fluent/Fluent.xaml" />

src/ColorMC.Gui/ColorMC.Gui.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,12 +344,14 @@
344344
<PackageReference Include="Avalonia.Controls.DataGrid" Version="$(AvaloniaVersion)" />
345345
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
346346
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
347+
<PackageReference Include="Avalonia.HtmlRenderer" Version="11.2.0" />
347348
<PackageReference Include="Avalonia.Skia" Version="$(AvaloniaVersion)" />
348349
<PackageReference Include="Avalonia.Themes.Fluent" Version="$(AvaloniaVersion)" />
349350
<PackageReference Include="Avalonia.AvaloniaEdit" Version="11.3.0" />
350351
<PackageReference Include="Avalonia.Controls.TreeDataGrid" Version="11.1.1" />
351352
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
352353
<PackageReference Include="DialogHost.Avalonia" Version="0.9.3" />
354+
<PackageReference Include="MarkdownAIRender" Version="0.1.16" />
353355
<PackageReference Include="Silk.NET.SDL" Version="2.22.0" />
354356
<PackageReference Include="SkiaSharp" Version="2.88.9" />
355357
<PackageReference Include="DotNetty.Buffers" Version="0.7.6" />
@@ -364,6 +366,9 @@
364366
<ProjectReference Include="..\ColorMC.Core\ColorMC.Core.csproj" />
365367
</ItemGroup>
366368
<ItemGroup>
369+
<Compile Update="UI\Controls\Add\AddFileInfoControl.axaml.cs">
370+
<DependentUpon>AddFileInfoControl.axaml</DependentUpon>
371+
</Compile>
367372
<Compile Update="UI\Controls\Add\AddResourceControl.axaml.cs">
368373
<DependentUpon>AddResourceControl.axaml</DependentUpon>
369374
</Compile>

0 commit comments

Comments
 (0)