Commit graph

102 commits

Author SHA1 Message Date
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
Sebastian Göls
193f0e3c08
Use generic ProducesResponseTypeAttribute instead of typeof(...) (#3074) 2023-11-16 21:49:15 +01:00
Archi
3f04144e41
Use cancellation in more places 2023-11-14 21:20:51 +01:00
Archi
103c543eea
Closes #3067 2023-11-14 20:58:02 +01:00
Archi
f2ff2f4929
Closes #3060 2023-11-14 20:01:29 +01:00
Leet
17796c3466
Use gender neutral language (#3057) 2023-10-31 18:21:34 +01:00
Rudokhvist
9163b57c3e
Switch to different cat api in example plugin (#3006)
* switch to different cat api

* damn forgot json constructor

* check for empty array in responce

* revert meowresponse.cs

* use firstordefault()
2023-09-20 12:40:41 +02:00
Archi
c84366f9ba
Misc syntax improvements 2023-08-10 21:36:17 +02: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
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
JustArchi
0ceef1b7e2
Fix excessive madness declarations
Already covered by directory build props
2022-08-10 16:56:22 +02:00
JustArchi
be5a6bc27a
Misc 2022-06-27 12:28:06 +02:00
JustArchi
d338477e5c
Very important CatAPI fixes 2022-06-24 23:19:31 +02:00
Łukasz Domeradzki
715ed034df
Unify WebBrowser API in regards to nullable bodies (#2593)
* Unify logic for nullable bodies

* Update ArchiWebHandler.cs

* Misc
2022-06-01 21:13:40 +02:00
Archi
cc83222c3e
Use shorter syntax for json properties 2022-03-22 16:33:47 +01: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
71f4e16603
Misc 2021-12-14 23:10:11 +01:00
Archi
4f598d5c8f
Latest Rider cleanups 2021-12-12 01:12:54 +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
Ł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