-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Would it be nice to use code generator to parse a json with all card's data and add a generation step? #50
Comments
I think that's a great idea. I created a scraper for the data here, it's github pages hosted. I created this cuz I want to add all other cards as well easily. If it helps you with source-gen. I am thinking of doing a simple placeholder replace like (won't source gen will be overkill?) internal record {{provider}} : {{base)}}
{
public {{provider}}() : base(CardType.{{provider}}, {{range}}, {{length}}) { }
} Obviously for base, length and IINrange I will use logic to determine which/how to put data according to current implementation. But, if you could use source-gens I will be curious to see how they work. |
Source gen may be a bit overkill, but is is nice way to experiment with it and it will be more contributor friendly. I create a bot on Cardizer to create issues on update of the page. We could go further but I think it was a nice first step. Your tool could be very useful to get from html to json. We wont write the C# directly though thanks to source code generator. I think I will handle the source gen issue. At least, I will start a POC in a branch. |
I changed my code to Wiki API now (I started getting CORS error otherwise) so now it is accessible. I usually use Reflection to generate C# or transpile C# to other stuff like we generate .dart files from our C# models. So, source-gen will be a pretty intresting thing for me. |
Here we are talking about compile time generation not runtime generation like reflection. I would like to transpile C# to js too btw (see #36). |
I know, compile time generation was possible too with Rosyln Compiler but it was a lot of work, let's see how good is source-code generators. I did checkout C# to JS, but I H5 doesn't have any documentation. I will give it a try later this week, hopefully will be able to work it up. |
Yeah. I plan to try it myself later on. If you want to try out before, go for it :) C# to js is not quite needed. It is a nice to have :) |
It's okay, you can go for it, I don't want to hang you guys up. H5 itself is a good to know library. I might try that up. I'm thinking of doing a Flutter wrapper of Cardidy though (as I work a lot on Flutter) not sure if dart-wise feasible because Flutter is bad in serialisation of data, but we'll see 🙈 |
.NET 5.0 adds Source Code Generator to the C# world: https://devblogs.microsoft.com/dotnet/introducing-c-source-generators/
The goal would be to move all the data into a json data file and to generate all the classes, the enum, etc. with source generator.
The text was updated successfully, but these errors were encountered: