1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 05:22:54 +08:00

Use more verbatim strings

This commit is contained in:
Dan Balasescu 2022-10-28 16:32:17 +09:00
parent 2f731f86ba
commit efa8256911
10 changed files with 25 additions and 22 deletions

View File

@ -7,6 +7,6 @@ namespace osu.Game.Online.API.Requests
{
public class GetNotificationsRequest : APIRequest<APINotificationsBundle>
{
protected override string Target => "notifications";
protected override string Target => @"notifications";
}
}

View File

@ -10,28 +10,28 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonObject(MemberSerialization.OptIn)]
public class APINotification
{
[JsonProperty("id")]
[JsonProperty(@"id")]
public long Id { get; set; }
[JsonProperty("name")]
[JsonProperty(@"name")]
public string Name { get; set; } = null!;
[JsonProperty("created_at")]
[JsonProperty(@"created_at")]
public DateTimeOffset? CreatedAt { get; set; }
[JsonProperty("object_type")]
[JsonProperty(@"object_type")]
public string ObjectType { get; set; } = null!;
[JsonProperty("object_id")]
[JsonProperty(@"object_id")]
public string ObjectId { get; set; } = null!;
[JsonProperty("source_user_id")]
[JsonProperty(@"source_user_id")]
public long? SourceUserId { get; set; }
[JsonProperty("is_read")]
[JsonProperty(@"is_read")]
public bool IsRead { get; set; }
[JsonProperty("details")]
[JsonProperty(@"details")]
public Dictionary<string, string>? Details { get; set; }
}
}

View File

@ -8,13 +8,13 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonObject(MemberSerialization.OptIn)]
public class APINotificationsBundle
{
[JsonProperty("has_more")]
[JsonProperty(@"has_more")]
public bool HasMore { get; set; }
[JsonProperty("notifications")]
[JsonProperty(@"notifications")]
public APINotification[] Notifications { get; set; } = null!;
[JsonProperty("notification_endpoint")]
[JsonProperty(@"notification_endpoint")]
public string Endpoint { get; set; } = null!;
}
}

View File

@ -10,7 +10,7 @@ namespace osu.Game.Online.Notifications
{
public EndChatRequest()
{
Event = "chat.end";
Event = @"chat.end";
}
}
}

View File

@ -13,10 +13,10 @@ namespace osu.Game.Online.Notifications
[JsonObject(MemberSerialization.OptIn)]
public class NewChatMessageData
{
[JsonProperty("messages")]
[JsonProperty(@"messages")]
public List<Message> Messages { get; set; } = null!;
[JsonProperty("users")]
[JsonProperty(@"users")]
private List<APIUser> users { get; set; } = null!;
[OnDeserialized]

View File

@ -87,7 +87,7 @@ namespace osu.Game.Online.Notifications
{
try
{
await socket.CloseAsync(WebSocketCloseStatus.NormalClosure, "Disconnecting", CancellationToken.None).ConfigureAwait(false);
await socket.CloseAsync(WebSocketCloseStatus.NormalClosure, @"Disconnecting", CancellationToken.None).ConfigureAwait(false);
}
catch
{

View File

@ -48,7 +48,7 @@ namespace osu.Game.Online.Notifications
string endpoint = await tcs.Task;
ClientWebSocket socket = new ClientWebSocket();
socket.Options.SetRequestHeader("Authorization", $"Bearer {api.AccessToken}");
socket.Options.SetRequestHeader(@"Authorization", @$"Bearer {api.AccessToken}");
socket.Options.Proxy = WebRequest.DefaultWebProxy;
if (socket.Options.Proxy != null)
socket.Options.Proxy.Credentials = CredentialCache.DefaultCredentials;

View File

@ -27,6 +27,9 @@ namespace osu.Game.Online.Notifications
get => enableChat;
set
{
if (enableChat == value)
return;
enableChat = value;
Task.Run(startChatIfEnabledAsync);
}
@ -68,7 +71,7 @@ namespace osu.Game.Online.Notifications
{
switch (message.Event)
{
case "chat.message.new":
case @"chat.message.new":
Debug.Assert(message.Data != null);
NewChatMessageData? messageData = JsonConvert.DeserializeObject<NewChatMessageData>(message.Data.ToString());

View File

@ -9,13 +9,13 @@ namespace osu.Game.Online.Notifications
[JsonObject(MemberSerialization.OptIn)]
public class SocketMessage
{
[JsonProperty("event")]
[JsonProperty(@"event")]
public string Event { get; set; } = null!;
[JsonProperty("data")]
[JsonProperty(@"data")]
public JObject? Data { get; set; }
[JsonProperty("error")]
[JsonProperty(@"error")]
public string? Error { get; set; }
}
}

View File

@ -10,7 +10,7 @@ namespace osu.Game.Online.Notifications
{
public StartChatRequest()
{
Event = "chat.start";
Event = @"chat.start";
}
}
}