Commit graph

79 commits

Author SHA1 Message Date
Archi
0eab358af9
Plugins breaking: Convert all synchronous interface methods to Task
Okay, I wish we had uncovered it earlier as part of V5.2 but it has bitten us in the back just now, so I'm addressing it as part of monthly cycle instead.

Previously used void methods did not allow async operations in plugins in a "nice way". If plugin didn't require synchronization with the ASF and just minded its own business, it wasn't half bad as it could use async void signature. However, if plugin by any chance had to do something BEFORE ASF continued with the rest of the logic, it had to explicitly leave non-async void signature and call its async-capable stuff in synchronous manner (usually with Wait() or .Result), which is vastly suboptimal.

This was visible even in our STD plugin, which previously had (and still has) GlobalCache initialization in OnASFInit(). If that cache initialization took a bit longer time, STD would hit InvalidOperationException() in OnLicenseList() callback as global cache didn't load yet while we were already long past OnASFInit().

Therefore, I've decided to make a breaking change for a very good reason - all previous methods were converted to tasks, which allows from plugin to do one of three things:

- If plugin is async and requires synchronization (like STD), it can declare itself as async await, and do its awaits as-needed, and ASF will wait for those.
- If plugin is truly synchronous (and not just a synchronous signature with awful Wait() or .Result, see above), it can simply return Task.CompletedTask and has exactly the same logic.
- Finally, if plugin calls some async stuff but doesn't need ASF synchronization, it can "offload" itself from it by calling e.g. ASF's Utilities.InBackground() with whole logic, while returning Task.CompletedTask from the main method. This will allow it to effectively do what async void previously did, by just hooking into the process without intention of slowing it down.

All in all I'm confident this approach, while a bit counter-intuitive at first, will result in better compatibility between ASF and the plugins, as if I wanted to fix my STD issue right now without that breaking change, I'd have to actually call .Result on my async global cache loader function, which is utterly stupid if we can fix ASF to do the right thing instead.

This "approach" can be commonly found in some other libs with similar to ASF's event-hook behaviour, e.g. Discord.Net.

You'll sadly need to do some method signature changes in all of your plugins, as the core OnLoaded() was also changed. See the ones I did in SteamTokenDumperPlugin.cs if you need a practical example, and see ExamplePlugin.cs if you need further explanation.
2021-12-08 16:52:27 +01:00
Archi
d1fc7ebb74
Use C# 10 string interpolation wherever possible 2021-11-11 01:53:34 +01:00
Archi
1e6ab11d9f
Use file-scoped namespaces 2021-11-10 21:23:24 +01:00
Sebastian Göls
fb4eb0b03a
Use Madness via global usings (#2447)
* Use Madness via global usings

* Apply feedback

* Disable false positive null warning
2021-11-09 16:33:09 +01:00
Łukasz Domeradzki
0eee21360d
.NET 6.0 (#2388)
* Bump non-source files to net6.0

* Correct .NET 6.0 warnings

* Correct CI

* Correct linking errors

Not much I can do about them ATM

* Remove TrimmerRoots

At least runtime is no longer needed for our STD plugin, not sure about the dictionary

* Correct cc.sh

* Revert "Remove TrimmerRoots"

This reverts commit 11f603d3d6.

* First round of cat & mice game

* Update Directory.Build.props

* Update Startup.cs

* Update Startup.cs

* Update Startup.cs

* Fix new warnings

* Update SDK

* Address netf error

* Update Directory.Packages.props
2021-11-08 23:41:02 +01:00
Archi
f2d3a2a894
Use string interpolation wherever possible
Majority of cases still need to go through string.Format() due to localization requirements
2021-09-27 19:59:00 +02:00
Łukasz Domeradzki
9f281c6055
Embrace madness (#2394)
* Embrace madness

* Remove unused code

* Misc

* Address Abry's note

* Update for Madness 0.3.0
2021-08-07 14:03:46 +02:00
Archi
37689f4de6
Misc XML cleanup 2021-07-15 23:06:16 +02:00
Archi
d479eb9f97
Address Rider EAP inspections/cleanup 2021-07-12 21:45:17 +02:00
JustArchi
b069bd3ecc Remove packages lock
Maybe it'd be a nice feature if it worked for once
2021-05-09 02:07:45 +02:00
JustArchi
33643bcaf2 CI: Add support for lock files 2021-05-09 01:57:49 +02:00
JustArchi
d21d2473fe RuntimeCompatibility -> Compatibility 2021-05-08 01:43:08 +02:00
JustArchi
e60b54e402 Refactor EVERYTHING
Directories structure + namespaces relevant to them
2021-05-08 01:37:22 +02:00
JustArchi
cbabde1b38 Reorganize Web directory 2021-05-08 01:03:08 +02:00
JustArchi
daf37c723c Document all the pragmas, final code corrections 2021-05-07 23:56:45 +02:00
JustArchi
4a91b997a2 Resolve CA1812 2021-05-07 18:02:21 +02:00
JustArchi
9a8a61e111 Resolve CA1054 2021-05-06 22:50:59 +02:00
JustArchi
aed11c59ee Cleanup round 2021-05-06 20:44:17 +02:00
JustArchi
b6772b9b1e Resolve CA1034 2021-05-06 20:16:06 +02:00
JustArchi
dfffc3384b More code inspections! 2021-05-06 17:14:03 +02:00
Łukasz Domeradzki
0808a38f48
Manage package versions centrally (#2317)
Closes #2316

The issue we're facing right now comes from the fact of desynchronization of packages between different projects. Since I didn't find any way to "fix" the package versions of our plugins to the main ASF project, we'll instead use centralized Directory.packages.props which specifies appropriate versions
2021-05-02 14:51:08 +02:00
JustArchi
ae591d3ea8 Remove no-longer-needed warning suppressions 2021-03-22 23:35:44 +01:00
dependabot-preview[bot]
cfa8b61f31 Bump ConfigureAwaitChecker.Analyzer from 4.0.0 to 5.0.0
Bumps [ConfigureAwaitChecker.Analyzer](https://github.com/cincuranet/ConfigureAwaitChecker) from 4.0.0 to 5.0.0.
- [Release notes](https://github.com/cincuranet/ConfigureAwaitChecker/releases)
- [Commits](https://github.com/cincuranet/ConfigureAwaitChecker/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-14 14:33:26 +00:00
JustArchi
4700ed2706 Further code cleanup 2021-01-04 17:42:31 +01:00
JustArchi
45a5fec95a Happy 2021
And let's hope it'll be better than 2020
2021-01-03 22:24:22 +01:00
JustArchi
2cddf69322 Misc 2020-12-30 21:34:56 +01:00
JustArchi
bc8ee3592d Cleanup some obsolete warnings 2020-12-05 21:53:18 +01:00
JustArchi
4e190b7dfd Misc code improvements 2020-12-05 20:30:15 +01:00
JustArchi
14f58d5aec Code cleanup 2020-11-29 16:15:20 +01:00
JustArchi
d9e3496e5e Optimize csprojs and STD plugin publishing
thanks to @Vital7 for the idea
2020-11-21 18:09:05 +01:00
JustArchi
c37d935a1d Final touches 2020-11-16 00:44:37 +01:00
JustArchi
76818e28d7 Fix deserialization mistakes 2020-11-15 00:30:20 +01:00
JustArchi
e82560259b Final code cleanup 2020-11-14 22:37:00 +01:00
Łukasz Domeradzki
35f4651ed6
.NET 5.0 (#1999)
* Initial work

* Fix CIs

* Fix warnings

* Update .travis.yml

* Update dockerfiles

* Update libraries to .NET 5.0

* Misc

* Remove workaround for #1812

* Update cc.sh

* CI updates

* CI updates

* Update .travis.yml
2020-11-10 23:22:57 +01:00
JustArchi
b3d476dea4 Round 2 of nullable checks 2020-08-23 20:45:24 +02:00
Łukasz Domeradzki
9fc1ea65a5
Closes #1543 (#1944)
* Start working on nullable checks

help me

* Update GlobalConfig.cs

* Finish initial fixup round

* nullability code review
2020-08-22 21:41:01 +02:00
JustArchi
69936d55b6 Add GET /Api/Plugins endpoint,
In regards to https://github.com/JustArchiNET/ASF-ui/issues/1015
2020-06-24 20:54:41 +02:00
JustArchi
80daf47f60 Unify common ASF csproj properties under Directory.Build.props 2020-05-23 20:11:31 +02:00
JustArchi
a3e8ed3df3 Update ExamplePlugin.cs 2020-04-18 18:47:49 +02:00
JustArchi
cd848bf2bb Update ExamplePlugin.cs 2020-04-18 17:05:29 +02:00
JustArchi
df8044ba74 Use RollForward policy 2020-04-18 15:23:07 +02:00
JustArchi
9703336e81 Update ExamplePlugin.cs 2020-04-13 13:39:22 +02:00
JustArchi
4b24c0e472 Update CatAPI.cs 2020-04-13 13:31:05 +02:00
JustArchi
08680fd359 Misc 2020-04-13 13:14:52 +02:00
JustArchi
027803a146 Misc #1736 2020-04-13 13:14:45 +02:00
Łukasz Domeradzki
87939fbe7e
Update ArchiSteamFarm.CustomPlugins.ExamplePlugin.csproj 2020-02-02 14:08:15 +01:00
JustArchi
0370168b02 Happy new year 2020-02-01 23:33:35 +01:00
Łukasz Domeradzki
44e062bce0
.NET Core 3.1 (#1535)
* .NET Core 3.1

* Misc
2019-12-04 18:33:51 +01:00
Łukasz Domeradzki
2605df8ac5
Enable Linux in travis again (#1491)
* Testing

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Keep trying

* Keep trying

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml
2019-11-07 21:01:14 +01:00
JustArchi
a0dfb28e59 R# cleanup 2019-10-13 17:21:40 +02:00