Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump new packages #772

Closed
wants to merge 52 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
c017130
Fix errors in Patch_SocketTaskExtensions
sunnamed434 Oct 20, 2023
10a5ff8
Mark PatchSocketTaskExtensions as UsedImplicitly
sunnamed434 Oct 20, 2023
531ffdb
Bump new packages and use only netstandard2.1 as a target framework
sunnamed434 Oct 20, 2023
b46c722
Use latest API
sunnamed434 Oct 20, 2023
bf88edc
Mark WithCulture obsolete, remove Contrib.Bcl.Ranges package
sunnamed434 Oct 20, 2023
ad19a31
BaseFrameworkPathOverrideForMono from SharedProjectProps.props
sunnamed434 Oct 20, 2023
11eb6ac
Get lifetime via GetRequiredService
sunnamed434 Oct 21, 2023
2cff366
Make reason in BadData nullable
sunnamed434 Oct 21, 2023
7b50850
Update csproj target frameworks
sunnamed434 Oct 21, 2023
4bf1c4d
Use old Pomelo v3
sunnamed434 Oct 21, 2023
6e567bd
Update OpenMod.Rust.Oxide.PermissionLink.csproj
sunnamed434 Oct 21, 2023
3918721
Use Microsoft.Extensions v7.*
sunnamed434 Oct 21, 2023
fc56ac2
Use Microsoft.EntityFrameworkCore as before v3.1.32
sunnamed434 Oct 21, 2023
7dc85c2
Fix Unnecessarily complex Boolean expression
sunnamed434 Oct 21, 2023
12d7027
`om plugins` command refactoring
sunnamed434 Oct 21, 2023
71a797c
Remove ServerVersion because it doesn't exists anymore
sunnamed434 Oct 21, 2023
c52012b
CommandOpenModPlugins name GetPageNumber as GetPageNumberAsync
sunnamed434 Oct 21, 2023
82df38f
Make target framework of OpenMod.Rust.Oxide.Tests as net7.0
sunnamed434 Oct 21, 2023
2a356d9
Remove obsolete WithCulture
sunnamed434 Oct 21, 2023
327fdf2
Fix Bootstrapper
DiFFoZ Oct 21, 2023
cd11068
Revert "Remove ServerVersion because it doesn't exists anymore"
DiFFoZ Oct 21, 2023
d4d09de
Upgrade Pomelo to 5.0.4 and remove resolve MySqlConnector
DiFFoZ Oct 21, 2023
1c62302
Update `Microsoft.EntityFrameworkCore` to 5.0.17
DiFFoZ Oct 21, 2023
6e73e4d
Fix exception of `string.Equals` used in expression
DiFFoZ Oct 21, 2023
5468560
Bump some packages
DiFFoZ Oct 21, 2023
6f3347e
Use Harmony 2.3-prerelease.3
sunnamed434 Oct 27, 2023
841d762
Remove 0Harmony.dll files from runtimelibs
sunnamed434 Oct 28, 2023
8f4f2d6
Update OpenMod.Core.csproj
sunnamed434 Oct 28, 2023
9dc7ba1
Fix formatting in OpenMod.Core.csproj
sunnamed434 Oct 28, 2023
3102bdf
Don't use extern alias of monomod, use the .net standard API instead
sunnamed434 Oct 28, 2023
d4d7396
Reuse StringBuilder
CyberAndrii Oct 30, 2023
83ec0ab
Install Harmony from NuGet
CyberAndrii Oct 30, 2023
ea36d11
Update templates
CyberAndrii Oct 30, 2023
884efd0
Use facades for System.Reflection.* libs
CyberAndrii Oct 30, 2023
1690704
Merge 2 runtimelibs folders into one
CyberAndrii Oct 30, 2023
5c558ca
Use interpolated string as before for string builder in CommandOpenMo…
sunnamed434 Nov 5, 2023
3c622dc
Merge branch 'main' into pr/772
sunnamed434 Nov 5, 2023
9c3d55e
Merge branch 'main' into feature/bump-new-packages
sunnamed434 Nov 7, 2023
fc645cd
Fix NRA errors
sunnamed434 Nov 7, 2023
332b1f2
Update Runtime.cs
sunnamed434 Nov 7, 2023
23dfa18
Merge branch 'main' into pr/772
sunnamed434 Nov 8, 2023
646be8d
Fix NRA errors
sunnamed434 Nov 8, 2023
caa2d89
Merge branch 'main' into feature/bump-new-packages
sunnamed434 Nov 11, 2023
c50884c
Fix NRA
sunnamed434 Nov 12, 2023
e9281f9
Merge branch 'main' into pr/772
sunnamed434 Dec 4, 2023
c20c697
Update OpenMod.Standalone.csproj
sunnamed434 Dec 4, 2023
ed289c4
Merge branch 'revert_to_fix_reload' into pr/772
sunnamed434 Dec 4, 2023
e351807
Merge branch 'main' into pr/772
DiFFoZ Feb 26, 2024
c4976db
Fix building failing
DiFFoZ Feb 26, 2024
b818292
Update Harmony to use Thin version
DiFFoZ Feb 26, 2024
0d72325
Use instead Fat version of Harmony
DiFFoZ Feb 26, 2024
6346227
Merge branch 'main' into pr/772
rube200 May 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ indent_style = space
indent_size = 2
tab_width = 2

[*.props]
indent_style = space
indent_size = 2
tab_width = 2

# C# files
[*.cs]

Expand Down
2 changes: 1 addition & 1 deletion OpenMod.sln
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
props\UnityEngineDependentProjectProps.props = props\UnityEngineDependentProjectProps.props
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenMod.EntityFrameworkCore.MySql", "framework\OpenMod.EntityFrameworkCore.MySql\OpenMod.EntityFrameworkCore.MySql.csproj", "{2D901FA0-D969-42D4-B730-1BD073553DC4}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenMod.EntityFrameworkCore.MySql", "framework\OpenMod.EntityFrameworkCore.MySql\OpenMod.EntityFrameworkCore.MySql.csproj", "{2D901FA0-D969-42D4-B730-1BD073553DC4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
CyberAndrii marked this conversation as resolved.
Show resolved Hide resolved

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net461</TargetFrameworks>
<TargetFramework>netstandard2.1</TargetFramework>
<PackageDescription>Games abstractions for OpenMod</PackageDescription>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net461</TargetFrameworks>
<TargetFramework>netstandard2.1</TargetFramework>
<PackageDescription>Games abstractions for OpenMod</PackageDescription>
</PropertyGroup>

Expand Down
15 changes: 5 additions & 10 deletions framework/OpenMod.API/OpenMod.API.csproj
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net461</TargetFrameworks>
<TargetFramework>netstandard2.1</TargetFramework>
<PackageDescription>API abstractions for OpenMod</PackageDescription>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)..\..\props\SharedProjectProps.props" />

<ItemGroup>
<PackageReference Include="Autofac" Version="7.1.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="JetBrains.Annotations" Version="2023.2.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="3.1.32" />
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="3.1.32" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="7.0.12" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Semver" Version="2.3.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<!-- Provides the IAsyncEnumerable<T> and IAsyncDisposable interfaces and helper types for .NET Standard 2.0. -->
<!-- This package is not required starting with .NET Standard 2.1 and .NET Core 3.0. -->
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="1.1.1" />
</ItemGroup>

</Project>
6 changes: 4 additions & 2 deletions framework/OpenMod.API/Users/BanData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ public BanData()

}

public BanData(string reason, IPermissionActor? instigator = null, DateTime? expireDate = null)
public BanData(string? reason = null, IPermissionActor? instigator = null, DateTime? expireDate = null)
{
ExpireDate = expireDate ?? DateTime.MaxValue;

InstigatorType = instigator?.Type;
InstigatorId = instigator?.Id;

Reason = reason;
Reason = !string.IsNullOrWhiteSpace(reason)
? reason
: "None";
}
}
}
2 changes: 1 addition & 1 deletion framework/OpenMod.Analyzers/OpenMod.Analyzers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<Import Project="$(MSBuildThisFileDirectory)..\..\props\SharedProjectProps.props" />

<ItemGroup>
<ProjectReference Include="..\OpenMod.API\OpenMod.API.csproj" />
<PackageReference Include="JetBrains.Annotations" Version="2023.2.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.7.0" PrivateAssets="all" />
<PackageReference Update="NETStandard.Library" PrivateAssets="all" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion framework/OpenMod.Bootstrapper/OpenMod.Bootstrapper.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net461</TargetFrameworks>
<TargetFramework>netstandard2.1</TargetFramework>
<PackageDescription>Dynamic bootstrapping support for OpenMod</PackageDescription>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion framework/OpenMod.Common/OpenMod.Common.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net461</TargetFrameworks>
<TargetFramework>netstandard2.1</TargetFramework>
<PackageDescription>Shared code for OpenMod</PackageDescription>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion framework/OpenMod.Core/Commands/CommandStoreOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public IReadOnlyCollection<ICommandSource> CreateCommandSources(IServiceProvider
throw new ArgumentNullException(nameof(serviceProvider));
}

var lifetime = serviceProvider.GetService<ILifetimeScope>();
var lifetime = serviceProvider.GetRequiredService<ILifetimeScope>();
var sources = new List<ICommandSource>();
sources.AddRange(m_CommandSources);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
Expand All @@ -16,43 +17,77 @@ public class CommandOpenModPlugins : Command
{
private readonly IPluginActivator m_PluginActivator;

public CommandOpenModPlugins(IPluginActivator pluginActivator, IServiceProvider serviceProvider) : base(serviceProvider)
public CommandOpenModPlugins(IPluginActivator pluginActivator, IServiceProvider serviceProvider)
: base(serviceProvider)
{
m_PluginActivator = pluginActivator;
}

protected override async Task OnExecuteAsync()
{
var pageNumber = Context.Parameters.Length > 0 ? await Context.Parameters.GetAsync<int>(0) : 1;
const int itemsPerPage = 10;

var pageNumber = await GetPageNumberAsync();
var totalCount = m_PluginActivator.ActivatedPlugins.Count;
var pageCount = (int) Math.Ceiling((double) totalCount / itemsPerPage);
var plugins = m_PluginActivator.ActivatedPlugins
var pageCount = CalculatePageCount(totalCount, itemsPerPage);

var plugins = GetPluginsForPage(pageNumber, itemsPerPage);

await DisplayPluginsInfoAsync(pageNumber, pageCount, plugins);
}

private async Task<int> GetPageNumberAsync()
{
return Context.Parameters.Length > 0
? await Context.Parameters.GetAsync<int>(0)
: 1;
}

private int CalculatePageCount(int total, int perPage)
{
return (int) Math.Ceiling((double) total / perPage);
}

private List<IOpenModPlugin> GetPluginsForPage(int pageNumber, int itemsPerPage)
{
return m_PluginActivator.ActivatedPlugins
.Skip((pageNumber - 1) * itemsPerPage)
.Take(itemsPerPage)
.ToList();
}

private async Task DisplayPluginsInfoAsync(int pageNumber, int pageCount, List<IOpenModPlugin> plugins)
{
var sb = new StringBuilder();

sb.Append($"[{pageNumber}/{pageCount}] OpenMod Plugins");

await PrintAsync(sb.ToString(), Color.CornflowerBlue);

await PrintAsync($"[{pageNumber}/{pageCount}] OpenMod Plugins", Color.CornflowerBlue);

if (plugins.Count == 0)
{
await PrintAsync("No plugins found.", Color.Red);
return;
}

var sb = new StringBuilder();
sb.Clear();
foreach (var plugin in plugins)
{
sb.Clear();
sb.Append($"{plugin.DisplayName} v{plugin.Version}");
await PrintPluginInfoAsync(plugin, sb);
}
}

if (!string.IsNullOrEmpty(plugin.Author))
{
sb.Append($" by {plugin.Author}");
}
private Task PrintPluginInfoAsync(IOpenModPlugin plugin, StringBuilder sb)
{
sb.Clear();
sb.Append($"{plugin.DisplayName} v{plugin.Version}");

await PrintAsync(sb.ToString(), Color.Green);
if (!string.IsNullOrEmpty(plugin.Author))
{
sb.Append($" by {plugin.Author}");
}

return PrintAsync(sb.ToString(), Color.Green);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ private void GetAllStrings(IConfiguration configuration, List<LocalizedString> l
}
}

public IStringLocalizer WithCulture(CultureInfo culture)
{
return this; // no culture support
}

public LocalizedString this[string name]
{
get
Expand All @@ -66,7 +61,7 @@ public LocalizedString this[string name]
var formatter = m_Options.Value.GetSmartFormatter();

var found = configValue.Exists() && !string.IsNullOrEmpty(configValue.Value);
var value = formatter.Format(found ? configValue.Value : name, arguments);
var value = formatter.Format(found ? configValue.Value! : name, arguments);

return new LocalizedString(name, value, resourceNotFound: !found);
}
Expand Down
9 changes: 3 additions & 6 deletions framework/OpenMod.Core/Localization/NullStringLocalizer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using Microsoft.Extensions.Localization;
Expand All @@ -24,11 +26,6 @@ public IEnumerable<LocalizedString> GetAllStrings(bool includeParentCultures)
return Enumerable.Empty<LocalizedString>();
}

public IStringLocalizer WithCulture(CultureInfo culture)
{
return this;
}

DiFFoZ marked this conversation as resolved.
Show resolved Hide resolved
public LocalizedString this[string name]
{
get { return new(name, name, true); }
Expand Down
8 changes: 1 addition & 7 deletions framework/OpenMod.Core/Localization/ProxyStringLocalizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using OpenMod.API;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;

namespace OpenMod.Core.Localization
Expand All @@ -21,13 +22,6 @@ public IEnumerable<LocalizedString> GetAllStrings(bool includeParentCultures)
return m_StringLocalizer.GetAllStrings(includeParentCultures);
}

#pragma warning disable 618 // disable obsolete warning
public IStringLocalizer WithCulture(CultureInfo culture)
{
return m_StringLocalizer.WithCulture(culture);
}
#pragma warning restore 618

DiFFoZ marked this conversation as resolved.
Show resolved Hide resolved
public LocalizedString this[string name]
{
get { return m_StringLocalizer[name]; }
Expand Down
26 changes: 11 additions & 15 deletions framework/OpenMod.Core/OpenMod.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net461</TargetFrameworks>
<TargetFramework>netstandard2.1</TargetFramework>
<PackageDescription>Core service implementations for OpenMod</PackageDescription>
</PropertyGroup>

Expand All @@ -26,35 +26,31 @@
<PackageReference Include="Fody" Version="6.8.0">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Lib.Harmony" Version="2.2.2" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.32" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="3.1.32" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="3.1.32" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="3.1.32" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.32" />
<PackageReference Include="Lib.Harmony" Version="2.3.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="7.0.12" />
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.1" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="morelinq" Version="3.4.2" />
<PackageReference Include="NetEscapades.Configuration.Yaml" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="3.1.32" />
<PackageReference Include="Microsoft.Extensions.Options" Version="3.1.32" />
<PackageReference Include="Nito.AsyncEx.Context" Version="5.1.2" />
<PackageReference Include="Nito.AsyncEx.Tasks" Version="5.1.2" />
<PackageReference Include="RuntimeNullables.Fody" Version="1.0.6">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Serilog" Version="3.0.1" />
<PackageReference Include="ReadLine" Version="2.0.1" />
<PackageReference Include="SmartFormat" Version="3.3.0" />
<PackageReference Include="SmartFormat.Extensions.Time" Version="3.3.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' Or '$(TargetFramework)' == 'net461'">
<PackageReference Include="Contrib.Bcl.Ranges" Version="1.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\OpenMod.Analyzers\OpenMod.Analyzers.csproj">
<PrivateAssets>all</PrivateAssets>
Expand Down
Loading
Loading