Compare commits

...

1 Commits

Author SHA1 Message Date
zhiyang7 a975b0ad2a Upgrade to .net 6.0 2023-01-31 14:35:18 +08:00
13 changed files with 34 additions and 99 deletions

Binary file not shown.

View File

@ -110,7 +110,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SMAPI.Tests.ModApiProvider"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SMAPI.Tests.ModApiConsumer", "SMAPI.Tests.ModApiConsumer\SMAPI.Tests.ModApiConsumer.csproj", "{2A4DF030-E8B1-4BBD-AA93-D4DE68CB9D85}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SMAPI.Tests.ModApiConsumer", "SMAPI.Tests.ModApiConsumer\SMAPI.Tests.ModApiConsumer.csproj", "{2A4DF030-E8B1-4BBD-AA93-D4DE68CB9D85}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SMAPI", "SMAPI\SMAPI.csproj", "{EBD13EAB-E70B-4D9F-92C2-C34A21E1FA32}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SMAPI", "SMAPI\SMAPI.csproj", "{EBD13EAB-E70B-4D9F-92C2-C34A21E1FA32}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -212,5 +212,7 @@ Global
SMAPI.Internal.Patching\SMAPI.Internal.Patching.projitems*{6c16e948-3e5c-47a7-bf4b-07a7469a87a5}*SharedItemsImports = 13 SMAPI.Internal.Patching\SMAPI.Internal.Patching.projitems*{6c16e948-3e5c-47a7-bf4b-07a7469a87a5}*SharedItemsImports = 13
SMAPI.Internal\SMAPI.Internal.projitems*{85208f8d-6fd1-4531-be05-7142490f59fe}*SharedItemsImports = 13 SMAPI.Internal\SMAPI.Internal.projitems*{85208f8d-6fd1-4531-be05-7142490f59fe}*SharedItemsImports = 13
SMAPI.Internal\SMAPI.Internal.projitems*{cd53ad6f-97f4-4872-a212-50c2a0fd3601}*SharedItemsImports = 5 SMAPI.Internal\SMAPI.Internal.projitems*{cd53ad6f-97f4-4872-a212-50c2a0fd3601}*SharedItemsImports = 5
SMAPI.Internal.Patching\SMAPI.Internal.Patching.projitems*{ebd13eab-e70b-4d9f-92c2-c34a21e1fa32}*SharedItemsImports = 5
SMAPI.Internal\SMAPI.Internal.projitems*{ebd13eab-e70b-4d9f-92c2-c34a21e1fa32}*SharedItemsImports = 5
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@ -11,18 +11,10 @@ namespace StardewModdingAPI.Events
** Accessors ** Accessors
*********/ *********/
/// <summary>The asset names that were invalidated.</summary> /// <summary>The asset names that were invalidated.</summary>
#if SMAPI_FOR_MOBILE
public IReadOnlyCollection<IAssetName> Names { get; }
#else
public IReadOnlySet<IAssetName> Names { get; } public IReadOnlySet<IAssetName> Names { get; }
#endif
/// <summary>The <see cref="Names"/> with any locale codes stripped.</summary> /// <summary>The <see cref="Names"/> with any locale codes stripped.</summary>
/// <remarks>For example, if <see cref="Names"/> contains a locale like <c>Data/Bundles.fr-FR</c>, this will have the name without locale like <c>Data/Bundles</c>. If the name has no locale, this field is equivalent.</remarks> /// <remarks>For example, if <see cref="Names"/> contains a locale like <c>Data/Bundles.fr-FR</c>, this will have the name without locale like <c>Data/Bundles</c>. If the name has no locale, this field is equivalent.</remarks>
#if SMAPI_FOR_MOBILE
public IReadOnlyCollection<IAssetName> NamesWithoutLocale { get; }
#else
public IReadOnlySet<IAssetName> NamesWithoutLocale { get; } public IReadOnlySet<IAssetName> NamesWithoutLocale { get; }
#endif
/********* /*********

View File

@ -4,6 +4,7 @@ using StardewValley;
using StardewValley.Buildings; using StardewValley.Buildings;
using StardewValley.Objects; using StardewValley.Objects;
using StardewValley.TerrainFeatures; using StardewValley.TerrainFeatures;
using Object = StardewValley.Object;
namespace StardewModdingAPI.Framework.StateTracking.Snapshots namespace StardewModdingAPI.Framework.StateTracking.Snapshots
{ {

View File

@ -1,7 +0,0 @@
using System.ComponentModel;
namespace System.Runtime.CompilerServices
{
[EditorBrowsable(EditorBrowsableState.Never)]
internal class IsExternalInit{}
}

View File

@ -1,23 +0,0 @@
namespace System;
using Internal.Runtime.CompilerServices;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
public static class MobileMemoryExtension
{
/// <summary>Indicates whether a specified value is found in a read-only span. Values are compared using IEquatable{T}.Equals(T).</summary>
/// <param name="span">The span to search.</param>
/// <param name="value">The value to search for.</param>
/// <typeparam name="T">The type of the span.</typeparam>
/// <returns>
/// <see langword="true" /> if found, <see langword="false" /> otherwise.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool Contains<T>(this ReadOnlySpan<T> span, T value) where T : IEquatable<T>
{
return span.IndexOf(value) >= 0;
}
}

View File

@ -1,34 +0,0 @@
namespace System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
public static class MobileTypeExtension
{
/// <summary>Determines whether the current type can be assigned to a variable of the specified <paramref name="targetType" />.</summary>
/// <param name="targetType">The type to compare with the current type.</param>
/// <returns>
/// <see langword="true" /> if any of the following conditions is true:
///
/// - The current instance and <paramref name="targetType" /> represent the same type.
///
/// - The current type is derived either directly or indirectly from <paramref name="targetType" />. The current type is derived directly from <paramref name="targetType" /> if it inherits from <paramref name="targetType" />; the current type is derived indirectly from <paramref name="targetType" /> if it inherits from a succession of one or more classes that inherit from <paramref name="targetType" />.
///
/// - <paramref name="targetType" /> is an interface that the current type implements.
///
/// - The current type is a generic type parameter, and <paramref name="targetType" /> represents one of the constraints of the current type.
///
/// - The current type represents a value type, and <paramref name="targetType" /> represents <c>Nullable&lt;c&gt;</c> (<c>Nullable(Of c)</c> in Visual Basic).
///
/// <see langword="false" /> if none of these conditions are true, or if <paramref name="targetType" /> or <see langword="this" /> is <see langword="null" />.</returns>
public static bool IsAssignableTo(this Type type, [NotNullWhen(true)] Type? targetType) => (object) targetType != null && targetType.IsAssignableFrom(type);
}

View File

@ -8,6 +8,7 @@ using HarmonyLib;
using StardewModdingAPI.Framework; using StardewModdingAPI.Framework;
using StardewModdingAPI.Internal.Patching; using StardewModdingAPI.Internal.Patching;
using StardewValley; using StardewValley;
using Monitor = StardewModdingAPI.Framework.Monitor;
namespace StardewModdingAPI.Patches namespace StardewModdingAPI.Patches
{ {

View File

@ -6,6 +6,7 @@ using HarmonyLib;
using StardewModdingAPI.Framework; using StardewModdingAPI.Framework;
using StardewModdingAPI.Internal.Patching; using StardewModdingAPI.Internal.Patching;
using StardewValley; using StardewValley;
using Monitor = StardewModdingAPI.Framework.Monitor;
namespace StardewModdingAPI.Patches namespace StardewModdingAPI.Patches
{ {

View File

@ -7,6 +7,7 @@ using StardewModdingAPI.Framework;
using StardewModdingAPI.Framework.Events; using StardewModdingAPI.Framework.Events;
using StardewModdingAPI.Internal.Patching; using StardewModdingAPI.Internal.Patching;
using StardewValley; using StardewValley;
using Monitor = StardewModdingAPI.Framework.Monitor;
namespace StardewModdingAPI.Patches namespace StardewModdingAPI.Patches
{ {

View File

@ -11,6 +11,7 @@ using StardewModdingAPI.Framework;
using StardewModdingAPI.Internal.Patching; using StardewModdingAPI.Internal.Patching;
using StardewValley; using StardewValley;
using StardewValley.Menus; using StardewValley.Menus;
using Monitor = StardewModdingAPI.Framework.Monitor;
namespace StardewModdingAPI.Patches namespace StardewModdingAPI.Patches
{ {

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\build\define-constant.targets" /> <Import Project="..\..\build\define-constant.targets" />
<PropertyGroup Condition="'$(BUILD_FOR_MOBILE)' != ''"> <PropertyGroup Condition="'$(BUILD_FOR_MOBILE)' != ''">
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -18,8 +18,10 @@
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile> <AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies> <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk> <AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v12.0</TargetFrameworkVersion> <SupportedOSPlatformVersion>23</SupportedOSPlatformVersion>
<TargetFramework>net5.0-android</TargetFramework> <ImplicitUsings>enable</ImplicitUsings>
<TargetFramework>net6.0-android</TargetFramework>
<TargetFrameworkVersion>12.0</TargetFrameworkVersion>
<AndroidUseAapt2>true</AndroidUseAapt2> <AndroidUseAapt2>true</AndroidUseAapt2>
<DefineConstants>$(DefineConstants)</DefineConstants> <DefineConstants>$(DefineConstants)</DefineConstants>
</PropertyGroup> </PropertyGroup>
@ -133,16 +135,16 @@
<HintPath>..\..\..\Downloads\StardewValleyAndroidStuff\base_1.5.6.31\assemblies\MonoGame.Framework.dll</HintPath> <HintPath>..\..\..\Downloads\StardewValleyAndroidStuff\base_1.5.6.31\assemblies\MonoGame.Framework.dll</HintPath>
</Reference> </Reference>
<Reference Include="mscorlib" /> <!-- <Reference Include="mscorlib" />-->
<Reference Include="Mono.Android" /> <!-- <Reference Include="Mono.Android" />-->
<Reference Include="System" /> <!-- <Reference Include="System" />-->
<Reference Include="System.Core" /> <!-- <Reference Include="System.Core" />-->
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="0Harmony"> <Reference Include="0Harmony">
<HintPath>..\..\build\0Harmony.dll</HintPath> <HintPath>..\..\build\0Harmony.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.CSharp" /> <!-- <Reference Include="Microsoft.CSharp" />-->
<Reference Include="SMAPI.Toolkit"> <Reference Include="SMAPI.Toolkit">
<HintPath>..\SMAPI.Toolkit\bin\Debug\netstandard2.0\SMAPI.Toolkit.dll</HintPath> <HintPath>..\SMAPI.Toolkit\bin\Debug\netstandard2.0\SMAPI.Toolkit.dll</HintPath>
</Reference> </Reference>
@ -155,12 +157,12 @@
<PackageReference Include="SkiaSharp"> <PackageReference Include="SkiaSharp">
<Version>2.88.3</Version> <Version>2.88.3</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Xamarin.Android.Support.Compat"> <!-- <PackageReference Include="Xamarin.Android.Support.Compat">-->
<Version>28.0.0.3</Version> <!-- <Version>28.0.0.3</Version>-->
</PackageReference> <!-- </PackageReference>-->
<PackageReference Include="Xamarin.Android.Support.DocumentFile"> <!-- <PackageReference Include="Xamarin.Android.Support.DocumentFile">-->
<Version>28.0.0.3</Version> <!-- <Version>28.0.0.3</Version>-->
</PackageReference> <!-- </PackageReference>-->
<PackageReference Include="Mono.Cecil" Version="0.11.4" /> <PackageReference Include="Mono.Cecil" Version="0.11.4" />
<PackageReference Include="MonoMod.Common" Version="22.3.5.1" /> <PackageReference Include="MonoMod.Common" Version="22.3.5.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
@ -176,9 +178,6 @@
<!-- legacy package; remove in SMAPI 4.0.0 --> <!-- legacy package; remove in SMAPI 4.0.0 -->
<PackageReference Include="System.Runtime.Caching" Version="5.0.0" /> <PackageReference Include="System.Runtime.Caching" Version="5.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(BUILD_FOR_MOBILE)' != ''">
<Compile Include="**\*.cs" Exclude="**/.vshistory/**;obj/**" />
</ItemGroup>
<ItemGroup Condition="'$(BUILD_FOR_MOBILE)' != ''"> <ItemGroup Condition="'$(BUILD_FOR_MOBILE)' != ''">
<None Include="i18n\*.json" /> <None Include="i18n\*.json" />
@ -195,7 +194,10 @@
<PackageReference Include="System.Collections.Immutable" Version="5.0.0" /> <PackageReference Include="System.Collections.Immutable" Version="5.0.0" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" Condition="'$(BUILD_FOR_MOBILE)' != ''" /> <ItemGroup>
<Folder Include="Mobile" />
</ItemGroup>
<Import Project="..\SMAPI.Internal\SMAPI.Internal.projitems" Label="Shared" /> <Import Project="..\SMAPI.Internal\SMAPI.Internal.projitems" Label="Shared" />
<Import Project="..\SMAPI.Internal.Patching\SMAPI.Internal.Patching.projitems" Label="Shared" /> <Import Project="..\SMAPI.Internal.Patching\SMAPI.Internal.Patching.projitems" Label="Shared" />
</Project> </Project>

View File

@ -4,8 +4,6 @@ using Android.Content.PM;
using Android.OS; using Android.OS;
using Android.Provider; using Android.Provider;
using Android.Runtime; using Android.Runtime;
using Android.Support.V4.App;
using Android.Support.V4.Content;
using Android.Views; using Android.Views;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -68,10 +66,10 @@ namespace StardewModdingAPI
List<string> list = new List<string>(); List<string> list = new List<string>();
for (int i = 0; i < this.requiredPermissions.Length; i++) for (int i = 0; i < this.requiredPermissions.Length; i++)
{ {
if (ContextCompat.CheckSelfPermission(this, this.requiredPermissions[i]) != 0) // if (ContextCompat.CheckSelfPermission(this, this.requiredPermissions[i]) != 0)
{ // {
list.Add(this.requiredPermissions[i]); // list.Add(this.requiredPermissions[i]);
} // }
} }
return list.ToArray(); return list.ToArray();
@ -187,7 +185,7 @@ namespace StardewModdingAPI
public new void PromptForPermissions() public new void PromptForPermissions()
{ {
ActivityCompat.RequestPermissions(this, this.DeniedPermissionsArray, 0); // ActivityCompat.RequestPermissions(this, this.DeniedPermissionsArray, 0);
} }
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults) public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults)