diff --git a/BililiveRecorder.Web.Schemas/BililiveRecorder.Web.Schemas.csproj b/BililiveRecorder.Web.Schemas/BililiveRecorder.Web.Schemas.csproj
deleted file mode 100644
index c6d2297..0000000
--- a/BililiveRecorder.Web.Schemas/BililiveRecorder.Web.Schemas.csproj
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
- net5.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/BililiveRecorder.Web/Api/ConfigController.cs b/BililiveRecorder.Web/Api/ConfigController.cs
index bfc31a6..5961078 100644
--- a/BililiveRecorder.Web/Api/ConfigController.cs
+++ b/BililiveRecorder.Web/Api/ConfigController.cs
@@ -3,7 +3,7 @@ using AutoMapper;
using BililiveRecorder.Core;
using BililiveRecorder.Core.Config.V2;
using BililiveRecorder.Web.Models;
-using BililiveRecorder.Web.Schemas.Types;
+using BililiveRecorder.Web.Models.Rest;
using Microsoft.AspNetCore.Mvc;
namespace BililiveRecorder.Web.Api
diff --git a/BililiveRecorder.Web/Api/DataMappingProfile.cs b/BililiveRecorder.Web/Api/DataMappingProfile.cs
index 6aae48b..9c9bbaf 100644
--- a/BililiveRecorder.Web/Api/DataMappingProfile.cs
+++ b/BililiveRecorder.Web/Api/DataMappingProfile.cs
@@ -2,6 +2,7 @@ using AutoMapper;
using BililiveRecorder.Core;
using BililiveRecorder.Core.Config.V2;
using BililiveRecorder.Web.Models;
+using BililiveRecorder.Web.Models.Rest;
namespace BililiveRecorder.Web.Api
{
diff --git a/BililiveRecorder.Web/Api/RoomController.cs b/BililiveRecorder.Web/Api/RoomController.cs
index 192c1bc..3deaea2 100644
--- a/BililiveRecorder.Web/Api/RoomController.cs
+++ b/BililiveRecorder.Web/Api/RoomController.cs
@@ -4,7 +4,7 @@ using System.Threading.Tasks;
using AutoMapper;
using BililiveRecorder.Core;
using BililiveRecorder.Web.Models;
-using BililiveRecorder.Web.Schemas.Types;
+using BililiveRecorder.Web.Models.Rest;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
diff --git a/BililiveRecorder.Web/Api/VersionController.cs b/BililiveRecorder.Web/Api/VersionController.cs
index 1d5bdaf..d1d40e1 100644
--- a/BililiveRecorder.Web/Api/VersionController.cs
+++ b/BililiveRecorder.Web/Api/VersionController.cs
@@ -1,3 +1,4 @@
+using BililiveRecorder.Web.Models;
using Microsoft.AspNetCore.Mvc;
namespace BililiveRecorder.Web.Api
@@ -10,6 +11,6 @@ namespace BililiveRecorder.Web.Api
///
///
[HttpGet]
- public Schemas.Types.RecorderVersion GetVersion() => Schemas.Types.RecorderVersion.Instance;
+ public RecorderVersion GetVersion() => RecorderVersion.Instance;
}
}
diff --git a/BililiveRecorder.Web/BililiveRecorder.Web.csproj b/BililiveRecorder.Web/BililiveRecorder.Web.csproj
index 4daca37..fca1543 100644
--- a/BililiveRecorder.Web/BililiveRecorder.Web.csproj
+++ b/BililiveRecorder.Web/BililiveRecorder.Web.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
True
1701;1702;1591
@@ -9,12 +9,20 @@
+
+
+
+
+
+
+
+
-
+
diff --git a/BililiveRecorder.Web.Schemas/RecorderMutation.cs b/BililiveRecorder.Web/Graphql/RecorderMutation.cs
similarity index 98%
rename from BililiveRecorder.Web.Schemas/RecorderMutation.cs
rename to BililiveRecorder.Web/Graphql/RecorderMutation.cs
index 243105e..e379a86 100644
--- a/BililiveRecorder.Web.Schemas/RecorderMutation.cs
+++ b/BililiveRecorder.Web/Graphql/RecorderMutation.cs
@@ -1,11 +1,12 @@
using System;
using System.Linq;
using BililiveRecorder.Core;
-using BililiveRecorder.Web.Schemas.Types;
+using BililiveRecorder.Web.Models;
+using BililiveRecorder.Web.Models.Graphql;
using GraphQL;
using GraphQL.Types;
-namespace BililiveRecorder.Web.Schemas
+namespace BililiveRecorder.Web.Graphql
{
internal class RecorderMutation : ObjectGraphType
{
@@ -50,9 +51,7 @@ namespace BililiveRecorder.Web.Schemas
return null;
}
else
- {
return this.recorder.AddRoom(roomid, enabled);
- }
});
this.Field("removeRoom",
diff --git a/BililiveRecorder.Web.Schemas/RecorderQuery.cs b/BililiveRecorder.Web/Graphql/RecorderQuery.cs
similarity index 93%
rename from BililiveRecorder.Web.Schemas/RecorderQuery.cs
rename to BililiveRecorder.Web/Graphql/RecorderQuery.cs
index f0fb7c8..431df89 100644
--- a/BililiveRecorder.Web.Schemas/RecorderQuery.cs
+++ b/BililiveRecorder.Web/Graphql/RecorderQuery.cs
@@ -2,11 +2,12 @@ using System;
using System.Linq;
using BililiveRecorder.Core;
using BililiveRecorder.Core.Config.V2;
-using BililiveRecorder.Web.Schemas.Types;
+using BililiveRecorder.Web.Models;
+using BililiveRecorder.Web.Models.Graphql;
using GraphQL;
using GraphQL.Types;
-namespace BililiveRecorder.Web.Schemas
+namespace BililiveRecorder.Web.Graphql
{
internal class RecorderQuery : ObjectGraphType
{
diff --git a/BililiveRecorder.Web.Schemas/RecorderSchema.cs b/BililiveRecorder.Web/Graphql/RecorderSchema.cs
similarity index 91%
rename from BililiveRecorder.Web.Schemas/RecorderSchema.cs
rename to BililiveRecorder.Web/Graphql/RecorderSchema.cs
index bcd632a..b123b99 100644
--- a/BililiveRecorder.Web.Schemas/RecorderSchema.cs
+++ b/BililiveRecorder.Web/Graphql/RecorderSchema.cs
@@ -2,7 +2,7 @@ using System;
using BililiveRecorder.Core;
using GraphQL.Types;
-namespace BililiveRecorder.Web.Schemas
+namespace BililiveRecorder.Web.Graphql
{
public class RecorderSchema : Schema
{
diff --git a/BililiveRecorder.Web.Schemas/RecorderSubscription.cs b/BililiveRecorder.Web/Graphql/RecorderSubscription.cs
similarity index 71%
rename from BililiveRecorder.Web.Schemas/RecorderSubscription.cs
rename to BililiveRecorder.Web/Graphql/RecorderSubscription.cs
index 883fa50..8635837 100644
--- a/BililiveRecorder.Web.Schemas/RecorderSubscription.cs
+++ b/BililiveRecorder.Web/Graphql/RecorderSubscription.cs
@@ -1,6 +1,6 @@
using GraphQL.Types;
-namespace BililiveRecorder.Web.Schemas
+namespace BililiveRecorder.Web.Graphql
{
internal class RecorderSubscription : ObjectGraphType
{
diff --git a/BililiveRecorder.Web.Schemas/Types/Config.gen.cs b/BililiveRecorder.Web/Models/Config.gen.cs
similarity index 86%
rename from BililiveRecorder.Web.Schemas/Types/Config.gen.cs
rename to BililiveRecorder.Web/Models/Config.gen.cs
index 26c32aa..4bdca78 100644
--- a/BililiveRecorder.Web.Schemas/Types/Config.gen.cs
+++ b/BililiveRecorder.Web/Models/Config.gen.cs
@@ -7,7 +7,135 @@ using BililiveRecorder.Core.Config.V2;
using GraphQL.Types;
using HierarchicalPropertyDefault;
#nullable enable
-namespace BililiveRecorder.Web.Schemas.Types
+namespace BililiveRecorder.Web.Models
+{
+ public class SetRoomConfig
+ {
+ public bool? AutoRecord { get; set; }
+ public Optional? OptionalRecordMode { get; set; }
+ public Optional? OptionalCuttingMode { get; set; }
+ public Optional? OptionalCuttingNumber { get; set; }
+ public Optional? OptionalRecordDanmaku { get; set; }
+ public Optional? OptionalRecordDanmakuRaw { get; set; }
+ public Optional? OptionalRecordDanmakuSuperChat { get; set; }
+ public Optional? OptionalRecordDanmakuGift { get; set; }
+ public Optional? OptionalRecordDanmakuGuard { get; set; }
+ public Optional? OptionalRecordingQuality { get; set; }
+
+ public void ApplyTo(RoomConfig config)
+ {
+ if (this.AutoRecord.HasValue) config.AutoRecord = this.AutoRecord.Value;
+ if (this.OptionalRecordMode.HasValue) config.OptionalRecordMode = this.OptionalRecordMode.Value;
+ if (this.OptionalCuttingMode.HasValue) config.OptionalCuttingMode = this.OptionalCuttingMode.Value;
+ if (this.OptionalCuttingNumber.HasValue) config.OptionalCuttingNumber = this.OptionalCuttingNumber.Value;
+ if (this.OptionalRecordDanmaku.HasValue) config.OptionalRecordDanmaku = this.OptionalRecordDanmaku.Value;
+ if (this.OptionalRecordDanmakuRaw.HasValue) config.OptionalRecordDanmakuRaw = this.OptionalRecordDanmakuRaw.Value;
+ if (this.OptionalRecordDanmakuSuperChat.HasValue) config.OptionalRecordDanmakuSuperChat = this.OptionalRecordDanmakuSuperChat.Value;
+ if (this.OptionalRecordDanmakuGift.HasValue) config.OptionalRecordDanmakuGift = this.OptionalRecordDanmakuGift.Value;
+ if (this.OptionalRecordDanmakuGuard.HasValue) config.OptionalRecordDanmakuGuard = this.OptionalRecordDanmakuGuard.Value;
+ if (this.OptionalRecordingQuality.HasValue) config.OptionalRecordingQuality = this.OptionalRecordingQuality.Value;
+ }
+ }
+
+ public class SetGlobalConfig
+ {
+ public Optional? OptionalRecordMode { get; set; }
+ public Optional? OptionalCuttingMode { get; set; }
+ public Optional? OptionalCuttingNumber { get; set; }
+ public Optional? OptionalRecordDanmaku { get; set; }
+ public Optional? OptionalRecordDanmakuRaw { get; set; }
+ public Optional? OptionalRecordDanmakuSuperChat { get; set; }
+ public Optional? OptionalRecordDanmakuGift { get; set; }
+ public Optional? OptionalRecordDanmakuGuard { get; set; }
+ public Optional? OptionalRecordingQuality { get; set; }
+ public Optional? OptionalRecordFilenameFormat { get; set; }
+ public Optional? OptionalWebHookUrls { get; set; }
+ public Optional? OptionalWebHookUrlsV2 { get; set; }
+ public Optional? OptionalWpfShowTitleAndArea { get; set; }
+ public Optional? OptionalCookie { get; set; }
+ public Optional? OptionalLiveApiHost { get; set; }
+ public Optional? OptionalTimingCheckInterval { get; set; }
+ public Optional? OptionalTimingStreamRetry { get; set; }
+ public Optional? OptionalTimingStreamRetryNoQn { get; set; }
+ public Optional? OptionalTimingStreamConnect { get; set; }
+ public Optional? OptionalTimingDanmakuRetry { get; set; }
+ public Optional? OptionalTimingWatchdogTimeout { get; set; }
+ public Optional? OptionalRecordDanmakuFlushInterval { get; set; }
+
+ public void ApplyTo(GlobalConfig config)
+ {
+ if (this.OptionalRecordMode.HasValue) config.OptionalRecordMode = this.OptionalRecordMode.Value;
+ if (this.OptionalCuttingMode.HasValue) config.OptionalCuttingMode = this.OptionalCuttingMode.Value;
+ if (this.OptionalCuttingNumber.HasValue) config.OptionalCuttingNumber = this.OptionalCuttingNumber.Value;
+ if (this.OptionalRecordDanmaku.HasValue) config.OptionalRecordDanmaku = this.OptionalRecordDanmaku.Value;
+ if (this.OptionalRecordDanmakuRaw.HasValue) config.OptionalRecordDanmakuRaw = this.OptionalRecordDanmakuRaw.Value;
+ if (this.OptionalRecordDanmakuSuperChat.HasValue) config.OptionalRecordDanmakuSuperChat = this.OptionalRecordDanmakuSuperChat.Value;
+ if (this.OptionalRecordDanmakuGift.HasValue) config.OptionalRecordDanmakuGift = this.OptionalRecordDanmakuGift.Value;
+ if (this.OptionalRecordDanmakuGuard.HasValue) config.OptionalRecordDanmakuGuard = this.OptionalRecordDanmakuGuard.Value;
+ if (this.OptionalRecordingQuality.HasValue) config.OptionalRecordingQuality = this.OptionalRecordingQuality.Value;
+ if (this.OptionalRecordFilenameFormat.HasValue) config.OptionalRecordFilenameFormat = this.OptionalRecordFilenameFormat.Value;
+ if (this.OptionalWebHookUrls.HasValue) config.OptionalWebHookUrls = this.OptionalWebHookUrls.Value;
+ if (this.OptionalWebHookUrlsV2.HasValue) config.OptionalWebHookUrlsV2 = this.OptionalWebHookUrlsV2.Value;
+ if (this.OptionalWpfShowTitleAndArea.HasValue) config.OptionalWpfShowTitleAndArea = this.OptionalWpfShowTitleAndArea.Value;
+ if (this.OptionalCookie.HasValue) config.OptionalCookie = this.OptionalCookie.Value;
+ if (this.OptionalLiveApiHost.HasValue) config.OptionalLiveApiHost = this.OptionalLiveApiHost.Value;
+ if (this.OptionalTimingCheckInterval.HasValue) config.OptionalTimingCheckInterval = this.OptionalTimingCheckInterval.Value;
+ if (this.OptionalTimingStreamRetry.HasValue) config.OptionalTimingStreamRetry = this.OptionalTimingStreamRetry.Value;
+ if (this.OptionalTimingStreamRetryNoQn.HasValue) config.OptionalTimingStreamRetryNoQn = this.OptionalTimingStreamRetryNoQn.Value;
+ if (this.OptionalTimingStreamConnect.HasValue) config.OptionalTimingStreamConnect = this.OptionalTimingStreamConnect.Value;
+ if (this.OptionalTimingDanmakuRetry.HasValue) config.OptionalTimingDanmakuRetry = this.OptionalTimingDanmakuRetry.Value;
+ if (this.OptionalTimingWatchdogTimeout.HasValue) config.OptionalTimingWatchdogTimeout = this.OptionalTimingWatchdogTimeout.Value;
+ if (this.OptionalRecordDanmakuFlushInterval.HasValue) config.OptionalRecordDanmakuFlushInterval = this.OptionalRecordDanmakuFlushInterval.Value;
+ }
+ }
+
+}
+
+namespace BililiveRecorder.Web.Models.Rest
+{
+ public class RoomConfigDto
+ {
+ public bool AutoRecord { get; set; }
+ public Optional OptionalRecordMode { get; set; }
+ public Optional OptionalCuttingMode { get; set; }
+ public Optional OptionalCuttingNumber { get; set; }
+ public Optional OptionalRecordDanmaku { get; set; }
+ public Optional OptionalRecordDanmakuRaw { get; set; }
+ public Optional OptionalRecordDanmakuSuperChat { get; set; }
+ public Optional OptionalRecordDanmakuGift { get; set; }
+ public Optional OptionalRecordDanmakuGuard { get; set; }
+ public Optional OptionalRecordingQuality { get; set; }
+ }
+
+ public class GlobalConfigDto
+ {
+ public Optional OptionalRecordMode { get; set; }
+ public Optional OptionalCuttingMode { get; set; }
+ public Optional OptionalCuttingNumber { get; set; }
+ public Optional OptionalRecordDanmaku { get; set; }
+ public Optional OptionalRecordDanmakuRaw { get; set; }
+ public Optional OptionalRecordDanmakuSuperChat { get; set; }
+ public Optional OptionalRecordDanmakuGift { get; set; }
+ public Optional OptionalRecordDanmakuGuard { get; set; }
+ public Optional OptionalRecordingQuality { get; set; }
+ public Optional OptionalRecordFilenameFormat { get; set; }
+ public Optional OptionalWebHookUrls { get; set; }
+ public Optional OptionalWebHookUrlsV2 { get; set; }
+ public Optional OptionalWpfShowTitleAndArea { get; set; }
+ public Optional OptionalCookie { get; set; }
+ public Optional OptionalLiveApiHost { get; set; }
+ public Optional OptionalTimingCheckInterval { get; set; }
+ public Optional OptionalTimingStreamRetry { get; set; }
+ public Optional OptionalTimingStreamRetryNoQn { get; set; }
+ public Optional OptionalTimingStreamConnect { get; set; }
+ public Optional OptionalTimingDanmakuRetry { get; set; }
+ public Optional OptionalTimingWatchdogTimeout { get; set; }
+ public Optional OptionalRecordDanmakuFlushInterval { get; set; }
+ }
+
+}
+
+namespace BililiveRecorder.Web.Models.Graphql
{
internal class RoomConfigType : ObjectGraphType
{
@@ -85,34 +213,6 @@ namespace BililiveRecorder.Web.Schemas.Types
}
}
- public class SetRoomConfig // TODO MOVE THIS TYPE
- {
- public bool? AutoRecord { get; set; }
- public Optional? OptionalRecordMode { get; set; }
- public Optional? OptionalCuttingMode { get; set; }
- public Optional? OptionalCuttingNumber { get; set; }
- public Optional? OptionalRecordDanmaku { get; set; }
- public Optional? OptionalRecordDanmakuRaw { get; set; }
- public Optional? OptionalRecordDanmakuSuperChat { get; set; }
- public Optional? OptionalRecordDanmakuGift { get; set; }
- public Optional? OptionalRecordDanmakuGuard { get; set; }
- public Optional? OptionalRecordingQuality { get; set; }
-
- public void ApplyTo(RoomConfig config)
- {
- if (this.AutoRecord.HasValue) config.AutoRecord = this.AutoRecord.Value;
- if (this.OptionalRecordMode.HasValue) config.OptionalRecordMode = this.OptionalRecordMode.Value;
- if (this.OptionalCuttingMode.HasValue) config.OptionalCuttingMode = this.OptionalCuttingMode.Value;
- if (this.OptionalCuttingNumber.HasValue) config.OptionalCuttingNumber = this.OptionalCuttingNumber.Value;
- if (this.OptionalRecordDanmaku.HasValue) config.OptionalRecordDanmaku = this.OptionalRecordDanmaku.Value;
- if (this.OptionalRecordDanmakuRaw.HasValue) config.OptionalRecordDanmakuRaw = this.OptionalRecordDanmakuRaw.Value;
- if (this.OptionalRecordDanmakuSuperChat.HasValue) config.OptionalRecordDanmakuSuperChat = this.OptionalRecordDanmakuSuperChat.Value;
- if (this.OptionalRecordDanmakuGift.HasValue) config.OptionalRecordDanmakuGift = this.OptionalRecordDanmakuGift.Value;
- if (this.OptionalRecordDanmakuGuard.HasValue) config.OptionalRecordDanmakuGuard = this.OptionalRecordDanmakuGuard.Value;
- if (this.OptionalRecordingQuality.HasValue) config.OptionalRecordingQuality = this.OptionalRecordingQuality.Value;
- }
- }
-
internal class SetRoomConfigType : InputObjectGraphType
{
public SetRoomConfigType()
@@ -130,58 +230,6 @@ namespace BililiveRecorder.Web.Schemas.Types
}
}
- public class SetGlobalConfig // TODO MOVE THIS TYPE
- {
- public Optional? OptionalRecordMode { get; set; }
- public Optional? OptionalCuttingMode { get; set; }
- public Optional? OptionalCuttingNumber { get; set; }
- public Optional? OptionalRecordDanmaku { get; set; }
- public Optional? OptionalRecordDanmakuRaw { get; set; }
- public Optional? OptionalRecordDanmakuSuperChat { get; set; }
- public Optional? OptionalRecordDanmakuGift { get; set; }
- public Optional? OptionalRecordDanmakuGuard { get; set; }
- public Optional? OptionalRecordingQuality { get; set; }
- public Optional? OptionalRecordFilenameFormat { get; set; }
- public Optional? OptionalWebHookUrls { get; set; }
- public Optional? OptionalWebHookUrlsV2 { get; set; }
- public Optional? OptionalWpfShowTitleAndArea { get; set; }
- public Optional? OptionalCookie { get; set; }
- public Optional? OptionalLiveApiHost { get; set; }
- public Optional? OptionalTimingCheckInterval { get; set; }
- public Optional? OptionalTimingStreamRetry { get; set; }
- public Optional? OptionalTimingStreamRetryNoQn { get; set; }
- public Optional? OptionalTimingStreamConnect { get; set; }
- public Optional? OptionalTimingDanmakuRetry { get; set; }
- public Optional? OptionalTimingWatchdogTimeout { get; set; }
- public Optional? OptionalRecordDanmakuFlushInterval { get; set; }
-
- public void ApplyTo(GlobalConfig config)
- {
- if (this.OptionalRecordMode.HasValue) config.OptionalRecordMode = this.OptionalRecordMode.Value;
- if (this.OptionalCuttingMode.HasValue) config.OptionalCuttingMode = this.OptionalCuttingMode.Value;
- if (this.OptionalCuttingNumber.HasValue) config.OptionalCuttingNumber = this.OptionalCuttingNumber.Value;
- if (this.OptionalRecordDanmaku.HasValue) config.OptionalRecordDanmaku = this.OptionalRecordDanmaku.Value;
- if (this.OptionalRecordDanmakuRaw.HasValue) config.OptionalRecordDanmakuRaw = this.OptionalRecordDanmakuRaw.Value;
- if (this.OptionalRecordDanmakuSuperChat.HasValue) config.OptionalRecordDanmakuSuperChat = this.OptionalRecordDanmakuSuperChat.Value;
- if (this.OptionalRecordDanmakuGift.HasValue) config.OptionalRecordDanmakuGift = this.OptionalRecordDanmakuGift.Value;
- if (this.OptionalRecordDanmakuGuard.HasValue) config.OptionalRecordDanmakuGuard = this.OptionalRecordDanmakuGuard.Value;
- if (this.OptionalRecordingQuality.HasValue) config.OptionalRecordingQuality = this.OptionalRecordingQuality.Value;
- if (this.OptionalRecordFilenameFormat.HasValue) config.OptionalRecordFilenameFormat = this.OptionalRecordFilenameFormat.Value;
- if (this.OptionalWebHookUrls.HasValue) config.OptionalWebHookUrls = this.OptionalWebHookUrls.Value;
- if (this.OptionalWebHookUrlsV2.HasValue) config.OptionalWebHookUrlsV2 = this.OptionalWebHookUrlsV2.Value;
- if (this.OptionalWpfShowTitleAndArea.HasValue) config.OptionalWpfShowTitleAndArea = this.OptionalWpfShowTitleAndArea.Value;
- if (this.OptionalCookie.HasValue) config.OptionalCookie = this.OptionalCookie.Value;
- if (this.OptionalLiveApiHost.HasValue) config.OptionalLiveApiHost = this.OptionalLiveApiHost.Value;
- if (this.OptionalTimingCheckInterval.HasValue) config.OptionalTimingCheckInterval = this.OptionalTimingCheckInterval.Value;
- if (this.OptionalTimingStreamRetry.HasValue) config.OptionalTimingStreamRetry = this.OptionalTimingStreamRetry.Value;
- if (this.OptionalTimingStreamRetryNoQn.HasValue) config.OptionalTimingStreamRetryNoQn = this.OptionalTimingStreamRetryNoQn.Value;
- if (this.OptionalTimingStreamConnect.HasValue) config.OptionalTimingStreamConnect = this.OptionalTimingStreamConnect.Value;
- if (this.OptionalTimingDanmakuRetry.HasValue) config.OptionalTimingDanmakuRetry = this.OptionalTimingDanmakuRetry.Value;
- if (this.OptionalTimingWatchdogTimeout.HasValue) config.OptionalTimingWatchdogTimeout = this.OptionalTimingWatchdogTimeout.Value;
- if (this.OptionalRecordDanmakuFlushInterval.HasValue) config.OptionalRecordDanmakuFlushInterval = this.OptionalRecordDanmakuFlushInterval.Value;
- }
- }
-
internal class SetGlobalConfigType : InputObjectGraphType
{
public SetGlobalConfigType()
diff --git a/BililiveRecorder.Web/Models/GlobalConfigDto.cs b/BililiveRecorder.Web/Models/GlobalConfigDto.cs
deleted file mode 100644
index 23330fa..0000000
--- a/BililiveRecorder.Web/Models/GlobalConfigDto.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace BililiveRecorder.Web.Models
-{
- public class GlobalConfigDto
- {
-
- }
-}
diff --git a/BililiveRecorder.Web.Schemas/Types/CuttingModeEnum.cs b/BililiveRecorder.Web/Models/Graphql/CuttingModeEnum.cs
similarity index 76%
rename from BililiveRecorder.Web.Schemas/Types/CuttingModeEnum.cs
rename to BililiveRecorder.Web/Models/Graphql/CuttingModeEnum.cs
index 968f01d..35be907 100644
--- a/BililiveRecorder.Web.Schemas/Types/CuttingModeEnum.cs
+++ b/BililiveRecorder.Web/Models/Graphql/CuttingModeEnum.cs
@@ -1,7 +1,7 @@
using BililiveRecorder.Core.Config.V2;
using GraphQL.Types;
-namespace BililiveRecorder.Web.Schemas.Types
+namespace BililiveRecorder.Web.Models.Graphql
{
public class CuttingModeEnum : EnumerationGraphType
{
diff --git a/BililiveRecorder.Web.Schemas/Types/HierarchicalOptionalInputType.cs b/BililiveRecorder.Web/Models/Graphql/HierarchicalOptionalInputType.cs
similarity index 93%
rename from BililiveRecorder.Web.Schemas/Types/HierarchicalOptionalInputType.cs
rename to BililiveRecorder.Web/Models/Graphql/HierarchicalOptionalInputType.cs
index a2a5c71..86b117a 100644
--- a/BililiveRecorder.Web.Schemas/Types/HierarchicalOptionalInputType.cs
+++ b/BililiveRecorder.Web/Models/Graphql/HierarchicalOptionalInputType.cs
@@ -1,7 +1,7 @@
using GraphQL.Types;
using HierarchicalPropertyDefault;
-namespace BililiveRecorder.Web.Schemas.Types
+namespace BililiveRecorder.Web.Models.Graphql
{
public class HierarchicalOptionalInputType : InputObjectGraphType>
{
diff --git a/BililiveRecorder.Web.Schemas/Types/HierarchicalOptionalType.cs b/BililiveRecorder.Web/Models/Graphql/HierarchicalOptionalType.cs
similarity index 93%
rename from BililiveRecorder.Web.Schemas/Types/HierarchicalOptionalType.cs
rename to BililiveRecorder.Web/Models/Graphql/HierarchicalOptionalType.cs
index b20aa8c..4635b66 100644
--- a/BililiveRecorder.Web.Schemas/Types/HierarchicalOptionalType.cs
+++ b/BililiveRecorder.Web/Models/Graphql/HierarchicalOptionalType.cs
@@ -1,7 +1,7 @@
using GraphQL.Types;
using HierarchicalPropertyDefault;
-namespace BililiveRecorder.Web.Schemas.Types
+namespace BililiveRecorder.Web.Models.Graphql
{
public class HierarchicalOptionalType : ObjectGraphType>
{
diff --git a/BililiveRecorder.Web.Schemas/Types/RecordModeEnum.cs b/BililiveRecorder.Web/Models/Graphql/RecordModeEnum.cs
similarity index 75%
rename from BililiveRecorder.Web.Schemas/Types/RecordModeEnum.cs
rename to BililiveRecorder.Web/Models/Graphql/RecordModeEnum.cs
index eb0fc9e..c0ba9a7 100644
--- a/BililiveRecorder.Web.Schemas/Types/RecordModeEnum.cs
+++ b/BililiveRecorder.Web/Models/Graphql/RecordModeEnum.cs
@@ -1,7 +1,7 @@
using BililiveRecorder.Core.Config.V2;
using GraphQL.Types;
-namespace BililiveRecorder.Web.Schemas.Types
+namespace BililiveRecorder.Web.Models.Graphql
{
public class RecordModeEnum : EnumerationGraphType
{
diff --git a/BililiveRecorder.Web.Schemas/Types/RecorderVersionType.cs b/BililiveRecorder.Web/Models/Graphql/RecorderVersionType.cs
similarity index 97%
rename from BililiveRecorder.Web.Schemas/Types/RecorderVersionType.cs
rename to BililiveRecorder.Web/Models/Graphql/RecorderVersionType.cs
index 65cfc14..36e2d71 100644
--- a/BililiveRecorder.Web.Schemas/Types/RecorderVersionType.cs
+++ b/BililiveRecorder.Web/Models/Graphql/RecorderVersionType.cs
@@ -1,6 +1,6 @@
using GraphQL.Types;
-namespace BililiveRecorder.Web.Schemas.Types
+namespace BililiveRecorder.Web.Models.Graphql
{
public class RecorderVersionType : ObjectGraphType
{
diff --git a/BililiveRecorder.Web.Schemas/Types/RecordingStatsType.cs b/BililiveRecorder.Web/Models/Graphql/RecordingStatsType.cs
similarity index 92%
rename from BililiveRecorder.Web.Schemas/Types/RecordingStatsType.cs
rename to BililiveRecorder.Web/Models/Graphql/RecordingStatsType.cs
index 97c00f0..71409bb 100644
--- a/BililiveRecorder.Web.Schemas/Types/RecordingStatsType.cs
+++ b/BililiveRecorder.Web/Models/Graphql/RecordingStatsType.cs
@@ -1,7 +1,7 @@
using BililiveRecorder.Core;
using GraphQL.Types;
-namespace BililiveRecorder.Web.Schemas.Types
+namespace BililiveRecorder.Web.Models.Graphql
{
public class RecordingStatsType : ObjectGraphType
{
diff --git a/BililiveRecorder.Web.Schemas/Types/RoomType.cs b/BililiveRecorder.Web/Models/Graphql/RoomType.cs
similarity index 94%
rename from BililiveRecorder.Web.Schemas/Types/RoomType.cs
rename to BililiveRecorder.Web/Models/Graphql/RoomType.cs
index 1f41285..e627793 100644
--- a/BililiveRecorder.Web.Schemas/Types/RoomType.cs
+++ b/BililiveRecorder.Web/Models/Graphql/RoomType.cs
@@ -1,7 +1,7 @@
using BililiveRecorder.Core;
using GraphQL.Types;
-namespace BililiveRecorder.Web.Schemas.Types
+namespace BililiveRecorder.Web.Models.Graphql
{
internal class RoomType : ObjectGraphType
{
diff --git a/BililiveRecorder.Web.Schemas/Types/RecorderVersion.cs b/BililiveRecorder.Web/Models/RecorderVersion.cs
similarity index 98%
rename from BililiveRecorder.Web.Schemas/Types/RecorderVersion.cs
rename to BililiveRecorder.Web/Models/RecorderVersion.cs
index 5b65b1e..2d84780 100644
--- a/BililiveRecorder.Web.Schemas/Types/RecorderVersion.cs
+++ b/BililiveRecorder.Web/Models/RecorderVersion.cs
@@ -1,4 +1,4 @@
-namespace BililiveRecorder.Web.Schemas.Types
+namespace BililiveRecorder.Web.Models
{
public class RecorderVersion
{
diff --git a/BililiveRecorder.Web/Models/CreateRoomDto.cs b/BililiveRecorder.Web/Models/Rest/CreateRoomDto.cs
similarity index 75%
rename from BililiveRecorder.Web/Models/CreateRoomDto.cs
rename to BililiveRecorder.Web/Models/Rest/CreateRoomDto.cs
index 593dc60..ae4633c 100644
--- a/BililiveRecorder.Web/Models/CreateRoomDto.cs
+++ b/BililiveRecorder.Web/Models/Rest/CreateRoomDto.cs
@@ -1,4 +1,4 @@
-namespace BililiveRecorder.Web.Models
+namespace BililiveRecorder.Web.Models.Rest
{
public class CreateRoomDto
{
diff --git a/BililiveRecorder.Web/Models/RestApiError.cs b/BililiveRecorder.Web/Models/Rest/RestApiError.cs
similarity index 78%
rename from BililiveRecorder.Web/Models/RestApiError.cs
rename to BililiveRecorder.Web/Models/Rest/RestApiError.cs
index 587646e..0becc73 100644
--- a/BililiveRecorder.Web/Models/RestApiError.cs
+++ b/BililiveRecorder.Web/Models/Rest/RestApiError.cs
@@ -1,4 +1,4 @@
-namespace BililiveRecorder.Web.Models
+namespace BililiveRecorder.Web.Models.Rest
{
public class RestApiError
{
diff --git a/BililiveRecorder.Web/Models/RestApiErrorCode.cs b/BililiveRecorder.Web/Models/Rest/RestApiErrorCode.cs
similarity index 92%
rename from BililiveRecorder.Web/Models/RestApiErrorCode.cs
rename to BililiveRecorder.Web/Models/Rest/RestApiErrorCode.cs
index 233d4c2..9417edc 100644
--- a/BililiveRecorder.Web/Models/RestApiErrorCode.cs
+++ b/BililiveRecorder.Web/Models/Rest/RestApiErrorCode.cs
@@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
-namespace BililiveRecorder.Web.Models
+namespace BililiveRecorder.Web.Models.Rest
{
[JsonConverter(typeof(JsonStringEnumConverter))]
public enum RestApiErrorCode
diff --git a/BililiveRecorder.Web/Models/RoomDto.cs b/BililiveRecorder.Web/Models/Rest/RoomDto.cs
similarity index 93%
rename from BililiveRecorder.Web/Models/RoomDto.cs
rename to BililiveRecorder.Web/Models/Rest/RoomDto.cs
index a6d1678..059afe9 100644
--- a/BililiveRecorder.Web/Models/RoomDto.cs
+++ b/BililiveRecorder.Web/Models/Rest/RoomDto.cs
@@ -1,6 +1,6 @@
using System;
-namespace BililiveRecorder.Web.Models
+namespace BililiveRecorder.Web.Models.Rest
{
public class RoomDto
{
diff --git a/BililiveRecorder.Web/Models/RoomStatsDto.cs b/BililiveRecorder.Web/Models/Rest/RoomStatsDto.cs
similarity index 90%
rename from BililiveRecorder.Web/Models/RoomStatsDto.cs
rename to BililiveRecorder.Web/Models/Rest/RoomStatsDto.cs
index 1a99499..2a675f5 100644
--- a/BililiveRecorder.Web/Models/RoomStatsDto.cs
+++ b/BililiveRecorder.Web/Models/Rest/RoomStatsDto.cs
@@ -1,6 +1,6 @@
using System;
-namespace BililiveRecorder.Web.Models
+namespace BililiveRecorder.Web.Models.Rest
{
public class RoomStatsDto
{
diff --git a/BililiveRecorder.Web/Models/RoomConfigDto.cs b/BililiveRecorder.Web/Models/RoomConfigDto.cs
deleted file mode 100644
index b9f228f..0000000
--- a/BililiveRecorder.Web/Models/RoomConfigDto.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace BililiveRecorder.Web.Models
-{
- public class RoomConfigDto
- {
- // TODO auto generate this
- }
-}
diff --git a/BililiveRecorder.Web/Startup.cs b/BililiveRecorder.Web/Startup.cs
index 03301dd..3f49aa0 100644
--- a/BililiveRecorder.Web/Startup.cs
+++ b/BililiveRecorder.Web/Startup.cs
@@ -3,7 +3,7 @@ using System.Diagnostics;
using System.IO;
using BililiveRecorder.Core;
using BililiveRecorder.Web.Api;
-using BililiveRecorder.Web.Schemas;
+using BililiveRecorder.Web.Graphql;
using GraphQL;
using GraphQL.Server;
using GraphQL.Types;
@@ -89,7 +89,8 @@ namespace BililiveRecorder.Web
{
})
- .AddApiExplorer();
+ .AddApiExplorer()
+ .AddNewtonsoftJson();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
diff --git a/BililiveRecorder.sln b/BililiveRecorder.sln
index bca5bc6..6b50305 100644
--- a/BililiveRecorder.sln
+++ b/BililiveRecorder.sln
@@ -29,9 +29,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BililiveRecorder.ToolBox",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BililiveRecorder.Flv.Tests", "test\BililiveRecorder.Flv.Tests\BililiveRecorder.Flv.Tests.csproj", "{32E554B1-0ECC-4145-85B8-3FC128FEBEA1}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BililiveRecorder.Web", "BililiveRecorder.Web\BililiveRecorder.Web.csproj", "{263EC584-AFD5-45C9-8347-127016B3B8F5}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BililiveRecorder.Web.Schemas", "BililiveRecorder.Web.Schemas\BililiveRecorder.Web.Schemas.csproj", "{4E72646D-8E25-49E5-B72C-E9749141DBF4}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BililiveRecorder.Web", "BililiveRecorder.Web\BililiveRecorder.Web.csproj", "{263EC584-AFD5-45C9-8347-127016B3B8F5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -71,10 +69,6 @@ Global
{263EC584-AFD5-45C9-8347-127016B3B8F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{263EC584-AFD5-45C9-8347-127016B3B8F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{263EC584-AFD5-45C9-8347-127016B3B8F5}.Release|Any CPU.Build.0 = Release|Any CPU
- {4E72646D-8E25-49E5-B72C-E9749141DBF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4E72646D-8E25-49E5-B72C-E9749141DBF4}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4E72646D-8E25-49E5-B72C-E9749141DBF4}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4E72646D-8E25-49E5-B72C-E9749141DBF4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -88,13 +82,12 @@ Global
{4FAAE8E7-AC4E-4E99-A7D1-53D20AD8A200} = {2D44A59D-E437-4FEE-8A2E-3FF00D53A64D}
{32E554B1-0ECC-4145-85B8-3FC128FEBEA1} = {623A2ACC-DAC6-4E6F-9242-B4B54381AAE1}
{263EC584-AFD5-45C9-8347-127016B3B8F5} = {2D44A59D-E437-4FEE-8A2E-3FF00D53A64D}
- {4E72646D-8E25-49E5-B72C-E9749141DBF4} = {2D44A59D-E437-4FEE-8A2E-3FF00D53A64D}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
- RESX_ShowErrorsInErrorList = False
- RESX_SaveFilesImmediatelyUponChange = True
- RESX_NeutralResourcesLanguage = zh-Hans
- SolutionGuid = {F3CB8B14-077A-458F-BD8E-1747ED0F5170}
RESX_SortFileContentOnSave = True
+ SolutionGuid = {F3CB8B14-077A-458F-BD8E-1747ED0F5170}
+ RESX_NeutralResourcesLanguage = zh-Hans
+ RESX_SaveFilesImmediatelyUponChange = True
+ RESX_ShowErrorsInErrorList = False
EndGlobalSection
EndGlobal
diff --git a/config_gen/generators/code.ts b/config_gen/generators/code.ts
index 51fc0d7..cc96887 100644
--- a/config_gen/generators/code.ts
+++ b/config_gen/generators/code.ts
@@ -34,7 +34,7 @@ const map: SectionInfoMap = {
build: builderCli
},
web: {
- path: './BililiveRecorder.Web.Schemas/Types/Config.gen.cs',
+ path: './BililiveRecorder.Web/Models/Config.gen.cs',
format: true,
header: true,
build: builderWeb
diff --git a/config_gen/generators/codeWeb.ts b/config_gen/generators/codeWeb.ts
index d0a0bde..3871b82 100644
--- a/config_gen/generators/codeWeb.ts
+++ b/config_gen/generators/codeWeb.ts
@@ -6,8 +6,6 @@ export default function (data: ConfigEntry[]): string {
using GraphQL.Types;
using HierarchicalPropertyDefault;
#nullable enable
-namespace BililiveRecorder.Web.Schemas.Types
-{
`;
function write_query_graphType_property(r: ConfigEntry) {
if (r.configType == "roomOnly") {
@@ -17,6 +15,14 @@ namespace BililiveRecorder.Web.Schemas.Types
}
}
+ function write_rest_dto_property(r: ConfigEntry) {
+ if (r.configType == "roomOnly") {
+ result += `public ${r.type} ${r.name} { get; set; }\n`;
+ } else {
+ result += `public Optional<${r.type}> Optional${r.name} { get; set; }\n`;
+ }
+ }
+
function write_mutation_graphType_property(r: ConfigEntry) {
if (r.configType == "roomOnly") {
result += `this.Field(x => x.${r.name}, nullable: true);\n`;
@@ -41,6 +47,62 @@ namespace BililiveRecorder.Web.Schemas.Types
}
}
+ // +++++++++++++++++ Shared +++++++++++++++++
+
+ result += 'namespace BililiveRecorder.Web.Models\n{\n'
+
+ { // ====== SetRoomConfig ======
+ result += "public class SetRoomConfig\n{\n"
+
+ data.filter(x => x.configType != "globalOnly" && !x.webReadonly)
+ .forEach(r => write_mutation_dataType_property(r));
+
+ result += "\npublic void ApplyTo(RoomConfig config)\n{\n";
+
+ data.filter(x => x.configType != "globalOnly" && !x.webReadonly)
+ .forEach(r => write_mutation_apply_method(r));
+
+ result += "}\n}\n\n";
+ }
+
+ { // ====== SetGlobalConfig ======
+ result += "public class SetGlobalConfig\n{\n"
+
+ data.filter(r => r.configType != "roomOnly" && !r.webReadonly)
+ .forEach(r => write_mutation_dataType_property(r));
+
+ result += "\npublic void ApplyTo(GlobalConfig config)\n{\n";
+
+ data.filter(r => r.configType != "roomOnly" && !r.webReadonly)
+ .forEach(r => write_mutation_apply_method(r));
+
+ result += "}\n}\n\n";
+ }
+
+ // +++++++++++++++++ REST +++++++++++++++++
+ result += '}\n\nnamespace BililiveRecorder.Web.Models.Rest\n{\n'
+
+ { // ====== RoomConfigDto ======
+ result += "public class RoomConfigDto\n{\n"
+
+ data.filter(x => x.configType != "globalOnly" && !x.webReadonly)
+ .forEach(r => write_rest_dto_property(r));
+
+ result += "}\n\n";
+ }
+
+ { // ====== GlobalConfigDto ======
+ result += "public class GlobalConfigDto\n{\n"
+
+ data.filter(r => r.configType != "roomOnly" && !r.webReadonly)
+ .forEach(r => write_rest_dto_property(r));
+
+ result += "}\n\n";
+ }
+
+ // +++++++++++++++++ Graphql +++++++++++++++++
+ result += '}\n\nnamespace BililiveRecorder.Web.Models.Graphql\n{\n'
+
{ // ====== RoomConfigType ======
result += "internal class RoomConfigType : ObjectGraphType\n{\n";
result += "public RoomConfigType()\n{\n"
@@ -72,20 +134,6 @@ namespace BililiveRecorder.Web.Schemas.Types
result += "}\n}\n\n";
}
- { // ====== SetRoomConfig ======
- result += "internal class SetRoomConfig\n{\n"
-
- data.filter(x => x.configType != "globalOnly" && !x.webReadonly)
- .forEach(r => write_mutation_dataType_property(r));
-
- result += "\npublic void ApplyTo(RoomConfig config)\n{\n";
-
- data.filter(x => x.configType != "globalOnly" && !x.webReadonly)
- .forEach(r => write_mutation_apply_method(r));
-
- result += "}\n}\n\n";
- }
-
{ // ====== SetRoomConfigType ======
result += "internal class SetRoomConfigType : InputObjectGraphType\n{\n"
result += "public SetRoomConfigType()\n{\n";
@@ -96,19 +144,6 @@ namespace BililiveRecorder.Web.Schemas.Types
result += "}\n}\n\n";
}
- { // ====== SetGlobalConfig ======
- result += "internal class SetGlobalConfig\n{\n"
-
- data.filter(r => r.configType != "roomOnly" && !r.webReadonly)
- .forEach(r => write_mutation_dataType_property(r));
-
- result += "\npublic void ApplyTo(GlobalConfig config)\n{\n";
-
- data.filter(r => r.configType != "roomOnly" && !r.webReadonly)
- .forEach(r => write_mutation_apply_method(r));
-
- result += "}\n}\n\n";
- }
{ // ====== SetGlobalConfigType ======
result += "internal class SetGlobalConfigType : InputObjectGraphType\n{\n"