chr233 / ASFEnhance

ASF 扩展命令插件 / External commands for ASF
GNU Affero General Public License v3.0
516 stars 41 forks source link

ASF 5.2.x support #8

Closed felipe19930 closed 2 years ago

felipe19930 commented 2 years ago

Hi. First of all, thanks for this wonderful project :)

I was wondering if you have plans to support ASF 5.2.x, which now uses net6.0 by default.

Thanks

chr233 commented 2 years ago

The latest version of this plugin is compiled using .Net 5.0, and works fine with the ASF 5.2.0.10.

image

Actually I meet some problem when migrating to .Net 6, I am still trying to figure it out.

felipe19930 commented 2 years ago

Oh, my bad! I actually tried to use your plugin from the Releases page with the current master version of ASF, but apparently the method signature of OnLoaded() has changed slightly:

image

Although I'm not a C# developer that was an easy fix, but even then I couldn't compile this plugin with net6.0 because a lot of errors were popping up and I have no idea how to fix them :c

Hope you can figure this out soon

Cheers

felipe19930 commented 2 years ago

Never mind, I probably did something stupid before and that's why I got a bunch of errors. The plugin works now against ASF master and I was able to compile it with net6.0!

image

If you're interested in the diff:

diff --git a/ASFEnhance/ASFEnhance.cs b/ASFEnhance/ASFEnhance.cs
index 02e408f..5fb1663 100644
--- a/ASFEnhance/ASFEnhance.cs
+++ b/ASFEnhance/ASFEnhance.cs
@@ -17,11 +17,12 @@ namespace Chrxw.ASFEnhance
         public string Name => nameof(ASFEnhance);
         public Version Version => typeof(ASFEnhance).Assembly.GetName().Version ?? throw new ArgumentNullException(nameof(Version));

-        public void OnLoaded()
+        public Task OnLoaded()
         {
             Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
             ASF.ArchiLogger.LogGenericInfo(string.Format(CurrentCulture, Langs.PluginVer, version.Major, version.Minor, version.Build, version.Revision));
             ASF.ArchiLogger.LogGenericInfo(string.Format(CurrentCulture, Langs.PluginContact));
+            return Task.CompletedTask;
         }

         public async Task<string?> OnBotCommand(Bot bot, ulong steamID, string message, string[] args)
diff --git a/ASFEnhance/ASFEnhance.csproj b/ASFEnhance/ASFEnhance.csproj
index 40a9a87..28c3b75 100644
--- a/ASFEnhance/ASFEnhance.csproj
+++ b/ASFEnhance/ASFEnhance.csproj
@@ -9,7 +9,7 @@
     <Description>ASF增强插件 By Chr_</Description>
     <PackageProjectUrl>https://github.com/chr233/ASFEnhance</PackageProjectUrl>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
-    <TargetFramework>net5.0</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
     <PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
     <PackageLicenseExpression>AGPLv3</PackageLicenseExpression>
     <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
@@ -48,7 +48,7 @@
     <PackageReference Include="ConfigureAwaitChecker.Analyzer" Version="5.0.0">
       <PrivateAssets>all</PrivateAssets>
     </PackageReference>
-    <PackageReference Include="SteamKit2" Version="2.4.0-Alpha.3" />
+    <PackageReference Include="SteamKit2" Version="2.4.0" />
   </ItemGroup>

   <ItemGroup>
diff --git a/ArchiSteamFarm b/ArchiSteamFarm
index 4c52c43..457bacf 160000
--- a/ArchiSteamFarm
+++ b/ArchiSteamFarm
@@ -1 +1 @@
-Subproject commit 4c52c43526cda81c83de1ad2d585cb53e7e68164
+Subproject commit 457bacfef88575f86d61c984a5cb2eaa357c9b39

Feel free to close this if you want :)

chr233 commented 2 years ago

Oh you're using pre-release version of ASF, I see the changes of APIs.

chr233 commented 2 years ago

now support 5.1.2.5