Commit graph

37 commits

Author SHA1 Message Date
Łukasz Domeradzki
b664b85495
Remove ConfigureAwaitChecker.Analyzer
Appropriate detecion is now available in Roslyn
2024-07-20 01:01:45 +02:00
Łukasz Domeradzki
4c38de75ab
Further enhance plugin updates selection 2024-03-26 17:44:42 +01:00
Łukasz Domeradzki
53ec07a7f1
Correct plugin names we distribute outselves 2024-03-26 01:15:17 +01:00
Archi
48a14136a9
Update all file headers, again 2024-03-17 02:35:40 +01:00
Archi
f98a159799
File header update 2024-03-17 00:06:13 +01:00
Łukasz Domeradzki
6b0bf0f9c1
Closes #3061 (#3145)
* Good start

* Misc

* Make ApiAuthenticationMiddleware use new json

* Remove first newtonsoft dependency

* Pull latest ASFB json enhancements

* Start reimplementing newtonsoft!

* One thing at a time

* Keep doing all kind of breaking changes which need to be tested later

* Add back ShouldSerialize() support

* Misc

* Eradicate remaining parts of newtonsoft

* WIP

* Workaround STJ stupidity in regards to derived types

STJ can't serialize derived type properties by default, so we'll use another approach in our serializable file function

* Make CI happy

* Bunch of further fixes

* Fix AddFreeLicense() after rewrite

* Add full support for JsonDisallowNullAttribute

* Optimize our json utilities even further

* Misc

* Add support for fields in disallow null

* Misc optimization

* Fix deserialization of GlobalCache in STD

* Fix non-public [JsonExtensionData]

* Fix IM missing method exception, correct db storage helpers

* Fix saving into generic databases

Thanks STJ

* Make Save() function abstract to force inheritors to implement it properly

* Correct ShouldSerializeAdditionalProperties to be a method

* Misc cleanup

* Code review

* Allow JSON comments in configs, among other

* Allow trailing commas in configs

Users very often add them accidentally, no reason to throw on them

* Fix confirmation ID

Probably needs further fixes, will need to check later

* Correct confirmations deserialization

* Use JsonNumberHandling

* Misc

* Misc

* [JsonDisallowNull] corrections

* Forbid [JsonDisallowNull] on non-nullable structs

* Not really but okay

* Add and use ToJson() helpers

* Misc

* Misc
2024-02-21 03:09:36 +01:00
Sebastian Göls
dbf7148fbe
Happy new year! (#3121)
Co-authored-by: Sebastian Göls <sebastian.goels@salvagninigroup.com>
2024-01-08 11:33:28 +01:00
Archi
f2ff2f4929
Closes #3060 2023-11-14 20:01:29 +01:00
Archi
8008a04354
Code cleanups and improvements
- Make use of new UnixFileMode, always one native method we need to maintain less
- Add madness support for it, because new feature of course
- Add optional netstandard target and required compatibility for it, so I can test netf-oriented changes easier
2023-02-09 02:25:11 +01:00
Sebastian Göls
0c125db118
Happy new year! (#2809) 2023-01-25 15:43:12 +01:00
Archi
fc20b6cfc4
Final Rider inspections 2022-12-15 19:23:46 +01:00
Archi
4e382732d9
Misc refactor 2022-12-15 19:16:28 +01:00
JustArchi
cc55e386c9
Upgrade generic-netf to .NET Framework 4.8.1 2022-09-07 23:25:45 +02:00
JustArchi
adf83e5284
Try to avoid emitting Madness in netf plugins 2022-08-11 22:53:30 +02:00
Archi
1809028c77
Rider cleanup 2022-01-06 20:22:38 +01:00
Archi
71f4e16603
Misc 2021-12-14 23:10:11 +01:00
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
1e6ab11d9f
Use file-scoped namespaces 2021-11-10 21:23:24 +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
Archi
3dec189e14
Misc 2021-08-20 14:31:12 +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
e60b54e402 Refactor EVERYTHING
Directories structure + namespaces relevant to them
2021-05-08 01:37:22 +02:00
JustArchi
e7537ca996 Resolve CA2002 2021-05-07 19:04:38 +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
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
45a5fec95a Happy 2021
And let's hope it'll be better than 2020
2021-01-03 22:24:22 +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
a61ccc57a9 Misc 2020-11-16 00:46:08 +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
Ł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
80daf47f60 Unify common ASF csproj properties under Directory.Build.props 2020-05-23 20:11:31 +02:00
JustArchi
7c23250d83 Add ArchiSteamFarm.CustomPlugins.PeriodicGC 2020-05-22 11:48:02 +02:00