Convert to new namespace stuff and implicit usings

This commit is contained in:
AeonLucid
2022-01-07 06:07:05 +01:00
parent ce2ea7f295
commit 2f01cf7411
85 changed files with 2538 additions and 2696 deletions
+2 -3
View File
@@ -3,8 +3,8 @@ using System.Runtime.InteropServices;
using System.Text;
using Prospect.Launcher.Invoke;
namespace Prospect.Launcher
{
namespace Prospect.Launcher;
public static class Inject
{
const int PROCESS_CREATE_THREAD = 0x0002;
@@ -53,4 +53,3 @@ namespace Prospect.Launcher
return true;
}
}
}
+2 -3
View File
@@ -2,8 +2,8 @@
using System.Runtime.InteropServices;
using Prospect.Launcher.Invoke.Structs;
namespace Prospect.Launcher.Invoke
{
namespace Prospect.Launcher.Invoke;
internal static class Kernel32
{
[DllImport("kernel32.dll", SetLastError=true, CharSet=CharSet.Auto)]
@@ -50,4 +50,3 @@ namespace Prospect.Launcher.Invoke
[DllImport("kernel32.dll", SetLastError = true)]
public static extern uint ResumeThread(IntPtr hThread);
}
}
@@ -1,7 +1,7 @@
using System;
namespace Prospect.Launcher.Invoke.Structs
{
namespace Prospect.Launcher.Invoke.Structs;
[Flags]
internal enum ProcessCreationFlags : uint
{
@@ -23,4 +23,3 @@ namespace Prospect.Launcher.Invoke.Structs
EXTENDED_STARTUPINFO_PRESENT = 0x00080000,
INHERIT_PARENT_AFFINITY = 0x00010000
}
}
@@ -1,8 +1,8 @@
using System;
using System.Runtime.InteropServices;
namespace Prospect.Launcher.Invoke.Structs
{
namespace Prospect.Launcher.Invoke.Structs;
[StructLayout(LayoutKind.Sequential)]
internal struct ProcessInformation
{
@@ -11,4 +11,3 @@ namespace Prospect.Launcher.Invoke.Structs
public uint dwProcessId;
public uint dwThreadId;
}
}
@@ -1,8 +1,8 @@
using System;
using System.Runtime.InteropServices;
namespace Prospect.Launcher.Invoke.Structs
{
namespace Prospect.Launcher.Invoke.Structs;
[StructLayout(LayoutKind.Sequential)]
internal struct StartupInfo
{
@@ -25,4 +25,3 @@ namespace Prospect.Launcher.Invoke.Structs
public IntPtr hStdOutput;
public IntPtr hStdError;
}
}
+2 -3
View File
@@ -4,8 +4,8 @@ using System.IO;
using Prospect.Launcher.Invoke;
using Prospect.Launcher.Invoke.Structs;
namespace Prospect.Launcher
{
namespace Prospect.Launcher;
internal static class Program
{
/// <summary>
@@ -75,4 +75,3 @@ namespace Prospect.Launcher
Console.WriteLine("Resumed.");
}
}
}
@@ -1,8 +1,7 @@
namespace Prospect.Server.Api.Config
{
namespace Prospect.Server.Api.Config;
public class DatabaseSettings
{
public string ConnectionString { get; set; }
public string DatabaseName { get; set; }
}
}
@@ -1,8 +1,7 @@
namespace Prospect.Server.Api.Config
{
namespace Prospect.Server.Api.Config;
public class PlayFabSettings
{
public string PublisherId { get; set; }
public string TitleId { get; set; }
}
}
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Prospect.Server.Api.Config;
@@ -15,12 +12,15 @@ using Prospect.Server.Api.Services.Database.Models;
using Prospect.Server.Api.Services.UserData;
using Prospect.Server.Steam;
namespace Prospect.Server.Api.Controllers
{
namespace Prospect.Server.Api.Controllers;
[ApiController]
[Route("Client")]
public class ClientController : Controller
{
private const int AppIdDefault = 480;
private const int AppIdCycleBeta = 1600361;
private readonly PlayFabSettings _settings;
private readonly AuthTokenService _authTokenService;
private readonly DbUserService _userService;
@@ -51,7 +51,7 @@ namespace Prospect.Server.Api.Controllers
if (!string.IsNullOrEmpty(request.SteamTicket))
{
var ticket = AppTicket.Parse(request.SteamTicket);
if (ticket.IsValid && ticket.HasValidSignature)
if (ticket.IsValid && ticket.HasValidSignature && (ticket.AppId == AppIdDefault || ticket.AppId == AppIdCycleBeta))
{
var userSteamId = ticket.SteamId.ToString();
@@ -133,7 +133,7 @@ namespace Prospect.Server.Api.Controllers
{
Code = 200,
Status = "OK",
Data = new object()
Data = new {}
});
}
@@ -267,4 +267,3 @@ namespace Prospect.Server.Api.Controllers
});
}
}
}
@@ -1,16 +1,13 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Prospect.Server.Api.Models.Client;
using Prospect.Server.Api.Models.CloudScript;
using Prospect.Server.Api.Models.CloudScript.Data;
using Prospect.Server.Api.Services.Auth.Entity;
using Prospect.Server.Api.Services.Auth.Extensions;
namespace Prospect.Server.Api.Controllers
{
namespace Prospect.Server.Api.Controllers;
[Route("CloudScript")]
[ApiController]
[Authorize(AuthenticationSchemes = EntityAuthenticationOptions.DefaultScheme)]
@@ -303,4 +300,3 @@ namespace Prospect.Server.Api.Controllers
});
}
}
}
@@ -1,10 +1,9 @@
using System;
using System.Diagnostics;
using System.Diagnostics;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Converters
{
namespace Prospect.Server.Api.Converters;
// By default System.Text.Json outputs and we want:
// Output: 2021-11-04T04:58:20.4232184Z
// Want : 2021-10-24T02:54:56.652Z
@@ -21,4 +20,3 @@ namespace Prospect.Server.Api.Converters
writer.WriteStringValue(value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK"));
}
}
}
@@ -1,8 +1,7 @@
using System;
using System.Runtime.Serialization;
using System.Runtime.Serialization;
namespace Prospect.Server.Api.Exceptions;
namespace Prospect.Server.Api.Exceptions
{
public class ProspectException : Exception
{
public ProspectException()
@@ -21,4 +20,3 @@ namespace Prospect.Server.Api.Exceptions
{
}
}
}
@@ -1,13 +1,9 @@
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using System.Text;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
namespace Prospect.Server.Api.Middleware
{
namespace Prospect.Server.Api.Middleware;
public class RequestLoggerMiddleware
{
private readonly ILogger<RequestLoggerMiddleware> _logger;
@@ -61,4 +57,3 @@ namespace Prospect.Server.Api.Middleware
}
}
}
}
@@ -1,8 +1,8 @@
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.Client
{
namespace Prospect.Server.Api.Models.Client;
public class ClientLoginWithSteamRequest
{
[JsonPropertyName("CreateAccount")]
@@ -56,4 +56,3 @@ namespace Prospect.Server.Api.Models.Client
[JsonPropertyName("GetUserVirtualCurrency")]
public bool GetUserVirtualCurrency { get; set; }
}
}
@@ -1,7 +1,7 @@
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.Client
{
namespace Prospect.Server.Api.Models.Client;
public class ClientResponse
{
[JsonPropertyName("code")]
@@ -29,4 +29,3 @@ namespace Prospect.Server.Api.Models.Client
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public T Data { get; set; }
}
}
@@ -1,9 +1,8 @@
namespace Prospect.Server.Api.Models.Client.Data
{
namespace Prospect.Server.Api.Models.Client.Data;
public enum CloudScriptRevisionOption
{
Live,
Latest,
Specific
}
}
@@ -1,7 +1,7 @@
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.Client.Data
{
namespace Prospect.Server.Api.Models.Client.Data;
public class FEntityKey
{
/// <summary>
@@ -20,4 +20,3 @@ namespace Prospect.Server.Api.Models.Client.Data
[JsonPropertyName("TypeString")]
public string TypeString { get; set; }
}
}
@@ -1,8 +1,7 @@
using System;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.Client.Data;
namespace Prospect.Server.Api.Models.Client.Data
{
public class FEntityTokenResponse
{
/// <summary>
@@ -26,4 +25,3 @@ namespace Prospect.Server.Api.Models.Client.Data
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public DateTime? TokenExpiration { get; set; }
}
}
@@ -1,7 +1,7 @@
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.Client.Data
{
namespace Prospect.Server.Api.Models.Client.Data;
public class FFunctionExecutionError
{
/// <summary>
@@ -26,4 +26,3 @@ namespace Prospect.Server.Api.Models.Client.Data
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string StackTrace { get; set; }
}
}
@@ -1,7 +1,7 @@
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.Client.Data
{
namespace Prospect.Server.Api.Models.Client.Data;
public class FGenericServiceId
{
/// <summary>
@@ -16,4 +16,3 @@ namespace Prospect.Server.Api.Models.Client.Data
[JsonPropertyName("UserId")]
public string UserId { get; set; }
}
}
@@ -1,8 +1,7 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.Client.Data;
namespace Prospect.Server.Api.Models.Client.Data
{
public class FGetPlayerCombinedInfoResultPayload
{
// TSharedPtr<FUserAccountInfo> AccountInfo;
@@ -57,4 +56,3 @@ namespace Prospect.Server.Api.Models.Client.Data
// TMap<FString, FVirtualCurrencyRechargeTime> UserVirtualCurrencyRechargeTimes;
}
}
@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.Client.Data;
namespace Prospect.Server.Api.Models.Client.Data
{
public class FItemInstance
{
/// <summary>
@@ -113,4 +111,3 @@ namespace Prospect.Server.Api.Models.Client.Data
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public int? UsesIncrementedBy { get; set; }
}
}
@@ -1,7 +1,7 @@
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.Client.Data
{
namespace Prospect.Server.Api.Models.Client.Data;
public class FLogStatement
{
/// <summary>
@@ -25,4 +25,3 @@ namespace Prospect.Server.Api.Models.Client.Data
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string Message { get; set; }
}
}
@@ -1,7 +1,7 @@
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.Client.Data
{
namespace Prospect.Server.Api.Models.Client.Data;
public class FPlayerProfileModel
{
/// <summary>
@@ -32,4 +32,3 @@ namespace Prospect.Server.Api.Models.Client.Data
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string TitleId { get; set; }
}
}
@@ -1,7 +1,7 @@
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.Client.Data
{
namespace Prospect.Server.Api.Models.Client.Data;
public class FScriptExecutionError
{
/// <summary>
@@ -26,4 +26,3 @@ namespace Prospect.Server.Api.Models.Client.Data
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string StackTrace { get; set; }
}
}
@@ -1,8 +1,7 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.Client.Data
{
namespace Prospect.Server.Api.Models.Client.Data;
public class FTreatmentAssignment
{
/// <summary>
@@ -19,4 +18,3 @@ namespace Prospect.Server.Api.Models.Client.Data
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public List<string> Variants { get; set; }
}
}
@@ -1,8 +1,7 @@
using System;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.Client.Data;
namespace Prospect.Server.Api.Models.Client.Data
{
public class FUserDataRecord
{
/// <summary>
@@ -26,4 +25,3 @@ namespace Prospect.Server.Api.Models.Client.Data
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string Value { get; set; }
}
}
@@ -1,7 +1,7 @@
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.Client.Data
{
namespace Prospect.Server.Api.Models.Client.Data;
public class FUserSettings
{
/// <summary>
@@ -22,4 +22,3 @@ namespace Prospect.Server.Api.Models.Client.Data
[JsonPropertyName("NeedsAttribution")]
public bool NeedsAttribution { get; set; }
}
}
@@ -1,7 +1,7 @@
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.Client.Data
{
namespace Prospect.Server.Api.Models.Client.Data;
public class FVariable
{
/// <summary>
@@ -17,4 +17,3 @@ namespace Prospect.Server.Api.Models.Client.Data
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string Value { get; set; }
}
}
@@ -1,8 +1,7 @@
using System;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.Client.Data;
namespace Prospect.Server.Api.Models.Client.Data
{
public class FVirtualCurrencyRechargeTime
{
/// <summary>
@@ -25,4 +24,3 @@ namespace Prospect.Server.Api.Models.Client.Data
[JsonPropertyName("SecondsToRecharge")]
public int SecondsToRecharge { get; set; }
}
}
@@ -1,8 +1,7 @@
namespace Prospect.Server.Api.Models.Client.Data
{
namespace Prospect.Server.Api.Models.Client.Data;
public enum UserDataPermission
{
Public,
Private
}
}
@@ -1,11 +1,10 @@
using System.Text.Json.Serialization;
using Prospect.Server.Api.Models.Client.Data;
namespace Prospect.Server.Api.Models.Client
{
namespace Prospect.Server.Api.Models.Client;
public class FAddGenericIDRequest
{
[JsonPropertyName("GenericId")]
public FGenericServiceId GenericId { get; set; }
}
}
@@ -1,9 +1,8 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
using Prospect.Server.Api.Models.Client.Data;
namespace Prospect.Server.Api.Models.Client
{
namespace Prospect.Server.Api.Models.Client;
public class FExecuteCloudScriptResult
{
/// <summary>
@@ -82,4 +81,3 @@ namespace Prospect.Server.Api.Models.Client
[JsonPropertyName("Revision")]
public int Revision { get; set; }
}
}
@@ -1,9 +1,8 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
using Prospect.Server.Api.Models.Client.Data;
namespace Prospect.Server.Api.Models.Client
{
namespace Prospect.Server.Api.Models.Client;
public class FExecuteCloudScriptServerRequest
{
/// <summary>
@@ -57,4 +56,3 @@ namespace Prospect.Server.Api.Models.Client
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public int? SpecificRevision { get; set; }
}
}
@@ -1,9 +1,8 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
using Prospect.Server.Api.Models.Client.Data;
namespace Prospect.Server.Api.Models.Client
{
namespace Prospect.Server.Api.Models.Client;
public class FExecuteFunctionRequest
{
/// <summary>
@@ -41,4 +40,3 @@ namespace Prospect.Server.Api.Models.Client
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool? GeneratePlayStreamEvent { get; set; }
}
}
@@ -1,8 +1,8 @@
using System.Text.Json.Serialization;
using Prospect.Server.Api.Models.Client.Data;
namespace Prospect.Server.Api.Models.Client
{
namespace Prospect.Server.Api.Models.Client;
public class FExecuteFunctionResult
{
/// <summary>
@@ -38,4 +38,3 @@ namespace Prospect.Server.Api.Models.Client
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool? FunctionResultTooLarge { get; set; }
}
}
@@ -1,8 +1,7 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.Client;
namespace Prospect.Server.Api.Models.Client
{
public class FGetTitleDataRequest
{
/// <summary>
@@ -18,4 +17,3 @@ namespace Prospect.Server.Api.Models.Client
[JsonPropertyName("OverrideLabel")]
public string OverrideLabel { get; set; }
}
}
@@ -1,8 +1,7 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.Client;
namespace Prospect.Server.Api.Models.Client
{
public class FGetTitleDataResult
{
/// <summary>
@@ -11,4 +10,3 @@ namespace Prospect.Server.Api.Models.Client
[JsonPropertyName("Data")]
public Dictionary<string, string> Data { get; set; }
}
}
@@ -1,8 +1,7 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.Client;
namespace Prospect.Server.Api.Models.Client
{
public class FGetUserDataRequest
{
/// <summary>
@@ -25,4 +24,3 @@ namespace Prospect.Server.Api.Models.Client
[JsonPropertyName("PlayFabId")]
public string PlayFabId { get; set; }
}
}
@@ -1,9 +1,8 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
using Prospect.Server.Api.Models.Client.Data;
namespace Prospect.Server.Api.Models.Client
{
namespace Prospect.Server.Api.Models.Client;
public class FGetUserDataResult
{
/// <summary>
@@ -19,4 +18,3 @@ namespace Prospect.Server.Api.Models.Client
[JsonPropertyName("DataVersion")]
public uint DataVersion { get; set; }
}
}
@@ -1,8 +1,7 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.Client;
namespace Prospect.Server.Api.Models.Client
{
public class FGetUserInventoryRequest
{
/// <summary>
@@ -12,4 +11,3 @@ namespace Prospect.Server.Api.Models.Client
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public Dictionary<string, string> CustomTags { get; set; }
}
}
@@ -1,9 +1,8 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
using Prospect.Server.Api.Models.Client.Data;
namespace Prospect.Server.Api.Models.Client
{
namespace Prospect.Server.Api.Models.Client;
public class FGetUserInventoryResult
{
/// <summary>
@@ -27,4 +26,3 @@ namespace Prospect.Server.Api.Models.Client
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public Dictionary<string, FVirtualCurrencyRechargeTime> VirtualCurrencyRechargeTimes { get; set; }
}
}
@@ -1,9 +1,8 @@
using System;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
using Prospect.Server.Api.Models.Client.Data;
namespace Prospect.Server.Api.Models.Client
{
namespace Prospect.Server.Api.Models.Client;
public class FServerLoginResult
{
/// <summary>
@@ -61,4 +60,3 @@ namespace Prospect.Server.Api.Models.Client
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public FTreatmentAssignment TreatmentAssignment { get; set; }
}
}
@@ -1,9 +1,8 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
using Prospect.Server.Api.Models.Client.Data;
namespace Prospect.Server.Api.Models.Client
{
namespace Prospect.Server.Api.Models.Client;
public class FUpdateUserDataRequest
{
/// <summary>
@@ -35,4 +34,3 @@ namespace Prospect.Server.Api.Models.Client
/// </summary>
public string PlayFabId { get; set; }
}
}
@@ -1,5 +1,5 @@
namespace Prospect.Server.Api.Models.Client
{
namespace Prospect.Server.Api.Models.Client;
public class FUpdateUserDataResult
{
/// <summary>
@@ -8,4 +8,3 @@
/// </summary>
public uint DataVersion { get; set; }
}
}
@@ -1,8 +1,7 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.Client;
namespace Prospect.Server.Api.Models.Client
{
public class FUpdateUserTitleDisplayNameRequest
{
/// <summary>
@@ -18,4 +17,3 @@ namespace Prospect.Server.Api.Models.Client
[JsonPropertyName("DisplayName")]
public string DisplayName { get; set; }
}
}
@@ -1,5 +1,5 @@
namespace Prospect.Server.Api.Models.Client
{
namespace Prospect.Server.Api.Models.Client;
public class FUpdateUserTitleDisplayNameResult
{
/// <summary>
@@ -7,4 +7,3 @@
/// </summary>
public string DisplayName { get; set; }
}
}
@@ -1,8 +1,7 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.CloudScript.Data;
namespace Prospect.Server.Api.Models.CloudScript.Data
{
public class FYActiveContractPlayerData
{
[JsonPropertyName("contractId")]
@@ -11,4 +10,3 @@ namespace Prospect.Server.Api.Models.CloudScript.Data
[JsonPropertyName("progress")]
public List<int> Progress { get; set; }
}
}
@@ -1,7 +1,7 @@
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.CloudScript.Data
{
namespace Prospect.Server.Api.Models.CloudScript.Data;
public class FYFactionContractData
{
[JsonPropertyName("contractId")]
@@ -10,4 +10,3 @@ namespace Prospect.Server.Api.Models.CloudScript.Data
[JsonPropertyName("contractIsLockedDueToLowFactionReputation")]
public bool ContractIsLockedDueToLowFactionReputation { get; set; }
}
}
@@ -1,8 +1,7 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.CloudScript.Data;
namespace Prospect.Server.Api.Models.CloudScript.Data
{
public class FYFactionContractsData
{
[JsonPropertyName("factionId")]
@@ -11,4 +10,3 @@ namespace Prospect.Server.Api.Models.CloudScript.Data
[JsonPropertyName("contracts")]
public List<FYFactionContractData> Contracts { get; set; }
}
}
@@ -1,8 +1,7 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.CloudScript.Data;
namespace Prospect.Server.Api.Models.CloudScript.Data
{
public class FYFactionsContractsData
{
[JsonPropertyName("boards")]
@@ -11,4 +10,3 @@ namespace Prospect.Server.Api.Models.CloudScript.Data
[JsonPropertyName("lastBoardRefreshTimeUtc")]
public FYTimestamp LastBoardRefreshTimeUtc { get; set; }
}
}
@@ -1,7 +1,7 @@
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.CloudScript.Data
{
namespace Prospect.Server.Api.Models.CloudScript.Data;
public class FYItemCurrentlyBeingCrafted
{
[JsonPropertyName("itemId")]
@@ -16,4 +16,3 @@ namespace Prospect.Server.Api.Models.CloudScript.Data
[JsonPropertyName("utcTimestampWhenCraftingStarted")]
public FYTimestamp UtcTimestampWhenCraftingStarted { get; set; }
}
}
@@ -1,10 +1,9 @@
using System.Text.Json.Serialization;
namespace Prospect.Server.Api.Models.CloudScript.Data
{
namespace Prospect.Server.Api.Models.CloudScript.Data;
public class FYTimestamp
{
[JsonPropertyName("seconds")]
public int Seconds { get; set; }
}
}
@@ -1,8 +1,8 @@
using System.Text.Json.Serialization;
using Prospect.Server.Api.Models.CloudScript.Data;
namespace Prospect.Server.Api.Models.CloudScript
{
namespace Prospect.Server.Api.Models.CloudScript;
public class FYGetCraftingInProgressDataResult
{
[JsonPropertyName("userId")]
@@ -14,4 +14,3 @@ namespace Prospect.Server.Api.Models.CloudScript
[JsonPropertyName("itemCurrentlyBeingCrafted")]
public FYItemCurrentlyBeingCrafted ItemCurrentlyBeingCrafted { get; set; }
}
}
@@ -1,9 +1,8 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
using Prospect.Server.Api.Models.CloudScript.Data;
namespace Prospect.Server.Api.Models.CloudScript
{
namespace Prospect.Server.Api.Models.CloudScript;
public class FYGetPlayerContractsResult
{
[JsonPropertyName("userId")]
@@ -21,4 +20,3 @@ namespace Prospect.Server.Api.Models.CloudScript
[JsonPropertyName("refreshHours24UtcFromBackend")]
public int RefreshHours24UtcFromBackend { get; set; }
}
}
+2 -6
View File
@@ -1,11 +1,8 @@
using System;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Serilog;
using Serilog.Events;
namespace Prospect.Server.Api
{
namespace Prospect.Server.Api;
public static class Program
{
public static int Main(string[] args)
@@ -43,4 +40,3 @@ namespace Prospect.Server.Api
webBuilder.UseStartup<Startup>();
});
}
}
@@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>true</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
@@ -1,9 +1,8 @@
namespace Prospect.Server.Api.Services.Auth
{
namespace Prospect.Server.Api.Services.Auth;
public static class AuthClaimTypes
{
public const string UserId = "user_id";
public const string EntityId = "entity_id";
public const string Type = "type";
}
}
@@ -1,14 +1,12 @@
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Text;
using Microsoft.Extensions.Options;
using Microsoft.IdentityModel.Tokens;
using Prospect.Server.Api.Services.Database.Models;
namespace Prospect.Server.Api.Services.Auth
{
namespace Prospect.Server.Api.Services.Auth;
public class AuthTokenService
{
private const string DefaultIssuer = "ProspectApi";
@@ -80,4 +78,3 @@ namespace Prospect.Server.Api.Services.Auth
}
}
}
}
@@ -1,7 +1,6 @@
namespace Prospect.Server.Api.Services.Auth
{
namespace Prospect.Server.Api.Services.Auth;
public class AuthTokenSettings
{
public string Secret { get; set; }
}
}
@@ -1,8 +1,7 @@
namespace Prospect.Server.Api.Services.Auth
{
namespace Prospect.Server.Api.Services.Auth;
public static class AuthType
{
public const string User = "User";
public const string Entity = "Entity";
}
}
@@ -1,10 +1,9 @@
using System;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication;
using Prospect.Server.Api.Services.Auth.Entity;
using Prospect.Server.Api.Services.Auth.User;
namespace Prospect.Server.Api.Services.Auth
{
namespace Prospect.Server.Api.Services.Auth;
public static class AuthenticationBuilderExtensions
{
public static AuthenticationBuilder AddUserAuthentication(this AuthenticationBuilder authenticationBuilder, Action<UserAuthenticationOptions> options)
@@ -17,4 +16,3 @@ namespace Prospect.Server.Api.Services.Auth
return authenticationBuilder.AddScheme<EntityAuthenticationOptions, EntityAuthenticationHandler>(EntityAuthenticationOptions.DefaultScheme, options);
}
}
}
@@ -1,18 +1,13 @@
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Security.Claims;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Prospect.Server.Api.Models.Client;
using Prospect.Server.Api.Services.Auth.Extensions;
namespace Prospect.Server.Api.Services.Auth.Entity
{
namespace Prospect.Server.Api.Services.Auth.Entity;
public class EntityAuthenticationHandler : AuthenticationHandler<EntityAuthenticationOptions>
{
private const string Header = "X-EntityToken";
@@ -84,4 +79,3 @@ namespace Prospect.Server.Api.Services.Auth.Entity
await Response.WriteAsync(JsonSerializer.Serialize(Res));
}
}
}
@@ -1,11 +1,10 @@
using Microsoft.AspNetCore.Authentication;
namespace Prospect.Server.Api.Services.Auth.Entity
{
namespace Prospect.Server.Api.Services.Auth.Entity;
public class EntityAuthenticationOptions : AuthenticationSchemeOptions
{
public const string DefaultScheme = "EntityAuth";
public string Scheme => DefaultScheme;
public string AuthenticationType = DefaultScheme;
}
}
@@ -1,8 +1,8 @@
using System.Security.Claims;
using Prospect.Server.Api.Exceptions;
namespace Prospect.Server.Api.Services.Auth.Extensions
{
namespace Prospect.Server.Api.Services.Auth.Extensions;
public static class ClaimsPrincipalExtensions
{
public static string FindAuthUserId(this ClaimsPrincipal principal)
@@ -31,4 +31,3 @@ namespace Prospect.Server.Api.Services.Auth.Extensions
return claim.Value;
}
}
}
@@ -1,18 +1,13 @@
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Security.Claims;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Prospect.Server.Api.Models.Client;
using Prospect.Server.Api.Services.Auth.Extensions;
namespace Prospect.Server.Api.Services.Auth.User
{
namespace Prospect.Server.Api.Services.Auth.User;
public class UserAuthenticationHandler : AuthenticationHandler<UserAuthenticationOptions>
{
private const string Header = "X-Authorization";
@@ -82,4 +77,3 @@ namespace Prospect.Server.Api.Services.Auth.User
}));
}
}
}
@@ -1,11 +1,10 @@
using Microsoft.AspNetCore.Authentication;
namespace Prospect.Server.Api.Services.Auth.User
{
namespace Prospect.Server.Api.Services.Auth.User;
public class UserAuthenticationOptions : AuthenticationSchemeOptions
{
public const string DefaultScheme = "UserAuth";
public string Scheme => DefaultScheme;
public string AuthenticationType = DefaultScheme;
}
}
@@ -2,8 +2,8 @@
using MongoDB.Driver;
using Prospect.Server.Api.Config;
namespace Prospect.Server.Api.Services.Database
{
namespace Prospect.Server.Api.Services.Database;
public abstract class BaseDbService<T>
{
protected BaseDbService(IOptions<DatabaseSettings> options, string collection)
@@ -17,4 +17,3 @@ namespace Prospect.Server.Api.Services.Database
protected IMongoCollection<T> Collection { get; }
}
}
@@ -1,11 +1,10 @@
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Options;
using MongoDB.Driver;
using Prospect.Server.Api.Config;
using Prospect.Server.Api.Services.Database.Models;
namespace Prospect.Server.Api.Services.Database
{
namespace Prospect.Server.Api.Services.Database;
public class DbEntityService : BaseDbService<PlayFabEntity>
{
public DbEntityService(IOptions<DatabaseSettings> settings) : base(settings, nameof(PlayFabEntity))
@@ -35,4 +34,3 @@ namespace Prospect.Server.Api.Services.Database
await CreateAsync(userId);
}
}
}
@@ -1,12 +1,10 @@
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Options;
using MongoDB.Driver;
using Prospect.Server.Api.Config;
using Prospect.Server.Api.Services.Database.Models;
namespace Prospect.Server.Api.Services.Database
{
namespace Prospect.Server.Api.Services.Database;
public class DbUserDataService : BaseDbService<PlayFabUserData>
{
public DbUserDataService(IOptions<DatabaseSettings> options) : base(options, nameof(PlayFabUserData))
@@ -57,4 +55,3 @@ namespace Prospect.Server.Api.Services.Database
await Collection.UpdateOneAsync(data => data.Id == dataId, update);
}
}
}
@@ -1,13 +1,10 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Options;
using MongoDB.Driver;
using Prospect.Server.Api.Config;
using Prospect.Server.Api.Services.Database.Models;
namespace Prospect.Server.Api.Services.Database
{
namespace Prospect.Server.Api.Services.Database;
public class DbUserService : BaseDbService<PlayFabUser>
{
public DbUserService(IOptions<DatabaseSettings> settings) : base(settings, nameof(PlayFabUser))
@@ -47,4 +44,3 @@ namespace Prospect.Server.Api.Services.Database
await CreateAsync(type, key);
}
}
}
@@ -1,9 +1,8 @@
using System;
using System.Security.Cryptography;
using System.Security.Cryptography;
using MongoDB.Bson.Serialization;
namespace Prospect.Server.Api.Services.Database.Generator
{
namespace Prospect.Server.Api.Services.Database.Generator;
public class PlayFabIdGenerator : IIdGenerator
{
private static readonly RNGCryptoServiceProvider Random = new RNGCryptoServiceProvider();
@@ -20,4 +19,3 @@ namespace Prospect.Server.Api.Services.Database.Generator
return id is not string idStr || string.IsNullOrEmpty(idStr);
}
}
}
@@ -1,8 +1,8 @@
using MongoDB.Bson.Serialization.Attributes;
using Prospect.Server.Api.Services.Database.Generator;
namespace Prospect.Server.Api.Services.Database.Models
{
namespace Prospect.Server.Api.Services.Database.Models;
/// <summary>
/// title_player_account
/// </summary>
@@ -15,4 +15,3 @@ namespace Prospect.Server.Api.Services.Database.Models
[BsonElement("UserId")]
public string UserId { get; set; }
}
}
@@ -1,9 +1,8 @@
using System.Collections.Generic;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Bson.Serialization.Attributes;
using Prospect.Server.Api.Services.Database.Generator;
namespace Prospect.Server.Api.Services.Database.Models
{
namespace Prospect.Server.Api.Services.Database.Models;
/// <summary>
/// master_player_account
/// </summary>
@@ -20,4 +19,3 @@ namespace Prospect.Server.Api.Services.Database.Models
[BsonElement("Auth")]
public List<PlayFabUserAuth> Auth { get; set; }
}
}
@@ -1,7 +1,7 @@
using MongoDB.Bson.Serialization.Attributes;
namespace Prospect.Server.Api.Services.Database.Models
{
namespace Prospect.Server.Api.Services.Database.Models;
public class PlayFabUserAuth
{
[BsonElement("Type")]
@@ -10,4 +10,3 @@ namespace Prospect.Server.Api.Services.Database.Models
[BsonElement("Key")]
public string Key { get; set; }
}
}
@@ -1,8 +1,7 @@
namespace Prospect.Server.Api.Services.Database.Models
{
namespace Prospect.Server.Api.Services.Database.Models;
public enum PlayFabUserAuthType
{
Epic,
Steam
}
}
@@ -1,9 +1,8 @@
using System;
using MongoDB.Bson;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
namespace Prospect.Server.Api.Services.Database.Models
{
namespace Prospect.Server.Api.Services.Database.Models;
public class PlayFabUserData
{
[BsonId]
@@ -33,4 +32,3 @@ namespace Prospect.Server.Api.Services.Database.Models
[BsonElement("LastUpdated")]
public DateTime LastUpdated { get; set; }
}
}
File diff suppressed because one or more lines are too long
@@ -1,8 +1,5 @@
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
namespace Prospect.Server.Api.Services.UserData;
namespace Prospect.Server.Api.Services.UserData
{
public class TitleDataService
{
public TitleDataService(ILogger<TitleDataService> logger)
@@ -30,4 +27,3 @@ namespace Prospect.Server.Api.Services.UserData
return TitleDataDefault.Data;
}
}
}
@@ -1,12 +1,8 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Prospect.Server.Api.Models.Client.Data;
using Prospect.Server.Api.Models.Client.Data;
using Prospect.Server.Api.Services.Database;
namespace Prospect.Server.Api.Services.UserData
{
namespace Prospect.Server.Api.Services.UserData;
public class UserDataService
{
private readonly ILogger<UserDataService> _logger;
@@ -179,4 +175,3 @@ namespace Prospect.Server.Api.Services.UserData
}
}
}
}
+2 -9
View File
@@ -1,19 +1,13 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Prospect.Server.Api.Config;
using Prospect.Server.Api.Converters;
using Prospect.Server.Api.Middleware;
using Prospect.Server.Api.Services.Auth;
using Prospect.Server.Api.Services.Auth.User;
using Prospect.Server.Api.Services.Database;
using Prospect.Server.Api.Services.UserData;
using Serilog;
namespace Prospect.Server.Api
{
namespace Prospect.Server.Api;
public class Startup
{
public Startup(IConfiguration configuration)
@@ -69,4 +63,3 @@ namespace Prospect.Server.Api
});
}
}
}
+1 -4
View File
@@ -1,11 +1,8 @@
using System.Collections.Generic;
namespace Prospect.Server.Steam;
namespace Prospect.Server.Steam
{
public class AppDlc
{
public uint AppId { get; set; }
public List<uint> Licenses { get; set; }
}
}
+3 -7
View File
@@ -1,10 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net;
namespace Prospect.Server.Steam;
namespace Prospect.Server.Steam
{
public class AppTicket
{
private AppTicket()
@@ -164,4 +161,3 @@ namespace Prospect.Server.Steam
return result;
}
}
}
@@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>true</ImplicitUsings>
</PropertyGroup>
</Project>
+2 -3
View File
@@ -1,7 +1,7 @@
using System.Security.Cryptography;
namespace Prospect.Server.Steam
{
namespace Prospect.Server.Steam;
internal static class SteamCrypto
{
private const string SystemCertificate = "-----BEGIN PUBLIC KEY-----\n" +
@@ -29,4 +29,3 @@ namespace Prospect.Server.Steam
return dataVerified;
}
}
}