Closed iFuSiiOnzZ closed 5 months ago
@RiddleTime As a side note: My C# knowledge is basic, from what I have understood 32-bit integers are atomic, but I think strings are not, can you confirm this? Probably _lfmLicense
should be protected by mutex.
@RiddleTime As a side note: My C# knowledge is basic, from what I have understood 32-bit integers are atomic, but I think strings are not, can you confirm this? Probably
_lfmLicense
should be protected by mutex.
The String is a reference type in c# and integers for example are value types(depending on 32/64 bit) so the string should not be atomic. You can use a lock on some kind of lock object if you like to.
Though I would prefer a different solution, which would be to make Record classes or structs from the LFM License object as well as the next race one instead of using a string. https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/record#immutability
Take a look at the Sector Data overlay, it uses a record to store periodically collected information. https://github.com/RiddleTime/Race-Element/blob/dev/Race_Element.HUD.ACC/Overlays/Driving/SectorData/SectorDataJob.cs I start the data job and subscribe to it's event handler in the BeforeStart override: https://github.com/RiddleTime/Race-Element/blob/6e05bbb993851861637a52ac42e4f3229709ab9f/Race_Element.HUD.ACC/Overlays/Driving/SectorData/SectorDataOverlay.cs#L127C1-L129C24 Don't forget to stop it in BeforeStop.
If you need any help, or if you've got ideas don't feel free to ask, I am willing to do some refactors 😄
You're also welcome to join the discord if you like discuss a bit more.
maybe it is much easyer adding those drvier cards:
Big Card https://api.lowfuelmotorsport.de/lfmlicense/81594
Small Card https://api.lowfuelmotorsport.de/lfmlicense/81594?size=sm
Is it also possible counting track cuts or incidents which results in a car damage? This could be helpfull? In LFM you got 1 point for cutting the track and 4 points for Damage (per Contact with a 5seconds deadtime)
@soonic6 It's not that easy to add that, those are HTMLs (not images). You would have to render everything from scratch (not that it's not possible, but it's a lot of work because of all the logic behind it, besides, I don't know if the result will be the same).
PS: on the cuts, incidents, etc. no idea, the API doesn't report that. Don't know if they have another API for that. Which makes these a bit test and fail because don't have documentation for it.
PS2: I tried to render the HTML and it was an epic fail, the stile was totally broken.
It's not that easy to add that,...
okay, was just an idea. if someone want to use those images, maybe for streaming, it is very easy to add this with OBS or other streaming software.
Because they have some kind of built-in browser, or this software is based on electron (web application).
@RiddleTime I accept style suggestion! :)
Because they have some kind of built-in browser, or this software is based on electron (web application).
@RiddleTime I accept style suggestion! :)
I will add some slight refactors and add some 2d styling but for now I'll merge it as the 1.0.4.0 release will include a few other things as well.
Also I am curious which language were you using before?
Just a note, I reverted the AbstractLoopJob change. The abstract class is written so it tries to use the least amount of cpu so it can also be used for loop mechanisms that are high frequency.
There is an IJob interface that I use in general, which can be implemented in a maybe more sophisticated job that allows for greater control.
So @iFuSiiOnzZ I've done some small changes as a refactor, nothing big. But thanks for the refactor, if you want to discuss maybe more about the app, there is a discord: https://discord.gg/26AAEW5mUq
The changes: https://github.com/RiddleTime/Race-Element/compare/fec491567933...dev
Add information about the LFM license, next race and countdown to the next race.
Output example:
Configuration: