cathei / BakingSheet

Easy datasheet management for C# and Unity. Supports Excel, Google Sheet, JSON and CSV format.
MIT License
346 stars 34 forks source link

Make SheetContainerBase overridable, extendable #27

Open laicasaane opened 1 year ago

laicasaane commented 1 year ago

I'm working on a custom Editor tooling that depends on BakingSheet for intermediate steps. But I've found myself in need of overidding SheetContainerBase to support IProgress<float> in the async Bake and Store methods.

Could you make at least Bake and Store methods virtual to enable this use case?

One possible solution for better extending is extracting an ISheetContainer interface out of SheetContainerBase, and making SheetConvertingContext use this interface instead of the abstract class.

With either solutions, people can freely provide their own custom implementation of SheetContainerBase without the need of modifying your source code.

cathei commented 1 year ago

Hello! Thank you for raising the issue. Can your issue solved by extending converters instead? Converters are meant to be extended/customized for this kind of usage. It would be more reusable and can handle detailed import/export process.

laicasaane commented 1 year ago

I understand that Converters are to convert each cell value? If so, that might not be what I want. However, it's not a big deal. I've resorted to a simple popup without progress bar just to indicate that the process has yet to finish.

cathei commented 1 year ago

Sheet converters (e.g. JsonSheetConverter, GoogleSheetConverter) will manage container level import/export, and could be extended to report what file/sheet is being converted. While value converters will do cell level converting. Let me know if you need more info or patch about it!

laicasaane commented 1 year ago

Sheet converters (e.g. JsonSheetConverter, GoogleSheetConverter) will manage container level import/export, and could be extended to report what file/sheet is being converted.

Oh, could you draft up a sample to demonstrate that? Many thanks.