Commit graph

48 commits

Author SHA1 Message Date
Łukasz Domeradzki
06185d5f7d
Misc 2024-08-17 22:19:17 +02:00
Łukasz Domeradzki
dd1dfdcf34
Closes #3221 2024-06-17 09:17:14 +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
Leet
17796c3466
Use gender neutral language (#3057) 2023-10-31 18:21:34 +01:00
Archi
c84366f9ba
Misc syntax improvements 2023-08-10 21:36:17 +02:00
Sebastian Göls
0c125db118
Happy new year! (#2809) 2023-01-25 15:43:12 +01:00
JustArchi
d338477e5c
Very important CatAPI fixes 2022-06-24 23:19:31 +02:00
Łukasz Domeradzki
4258fed873
Closes #2500 (#2501)
* Start work on #2500

* Update Bot.cs

* Misc refactor

* Update Bot.cs

* Add fallback for older plugins

* Misc

* Apply feedback
2022-01-23 00:14:14 +01:00
Archi
1809028c77
Rider cleanup 2022-01-06 20:22:38 +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
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
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
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
aed11c59ee Cleanup round 2021-05-06 20:44:17 +02:00
JustArchi
b6772b9b1e Resolve CA1034 2021-05-06 20:16:06 +02:00
JustArchi
ae591d3ea8 Remove no-longer-needed warning suppressions 2021-03-22 23:35:44 +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
14f58d5aec Code cleanup 2020-11-29 16:15:20 +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
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
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
9703336e81 Update ExamplePlugin.cs 2020-04-13 13:39:22 +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
JustArchi
0370168b02 Happy new year 2020-02-01 23:33:35 +01:00
JustArchi
74fd861b87 R# code review 2019-07-10 16:35:18 +02:00
JustArchi
514599390f Misc 2019-06-25 12:37:22 +02:00
JustArchi
b98268a465 R# cleanup, small code improvements 2019-05-19 15:38:06 +02:00
JustArchi
b677ba8202 Code/style cleanup 2019-02-16 17:34:17 +01:00
JustArchi
10dc572b43 Misc 2019-01-31 04:54:35 +01:00
JustArchi
95356af9d3 Add IBotFriendRequest plugin interface 2019-01-31 04:45:17 +01:00
JustArchi
371de1ec40 Misc 2019-01-17 18:50:14 +01:00
JustArchi
e1e9a9f457 Rider cleanup 2019-01-14 19:11:17 +01:00
JustArchi
92431c1d3e Update public API of access 2019-01-12 18:48:00 +01:00
Łukasz Domeradzki
0f2a816b92
Implement plugin system (#1020)
* Implement basic plugin system

* The dawn of new era

* Add plugins warning

* Move more members to PublicAPI

* Open commands for the plugins

* Add IBotHackNewChat

* Run plugin events in parallel

* Use properties in IPlugin

* Hook our custom plugin into CI to ensure it compiles

* Fix dotnet brain damage

* Add IBotsComparer

* Add code documentation

* Add IBotTradeOffer

* Add IBotTradeOffer example

* Add IBotTradeOfferResults

* Final bulletproofing

* Final renaming
2019-01-10 22:33:07 +01:00