dannyhaak / TagDataTranslation

TagDataTranslation according to the GS1 EPC TDT 1.11 standard (for RAIN RFID)
https://www.mimasu.nl/tdt
20 stars 20 forks source link

Init class TDTEngine for project TagDataTranslation-net #2

Closed Gaetan6511 closed 6 years ago

Gaetan6511 commented 6 years ago

In the foreach (string filename in assembly.GetManifestResourceNames()) for csv treatment, string scheme = filename.Split('-')[2].Split('.')[0]; the indice of spilt (filename.Split('-')[2]) is out of range.

the problem is in bold font versus bold italic font :

if NETSTANDARD1_4

        var assembly = typeof(TagDataTranslation.TDTEngine).GetTypeInfo().Assembly;
        var schemeFilenameStart = "**_TagDataTranslation-netstandard.Schemes._**";
        var filterFilenameStart = "**_TagDataTranslation-netstandard.FilterValueTables."_**;

else

        var assembly = Assembly.GetExecutingAssembly ();
        var schemeFilenameStart = "**TagDataTranslationnet.Schemes.**";
        var filterFilenameStart = "**TagDataTranslationnet.FilterValueTables.**";

endif

Possible solution: change string scheme = filename.Split('-')[2].Split('.')[0]; to

if NETSTANDARD1_4

                        string scheme = filename.Split('-')[2].Split('.')[0];

else

                        string scheme = filename.Split('-')[1].Split('.')[0];

endif

Best regard Gaetan

dannyhaak commented 6 years ago

Thanks for your feedback, and my extremely late reply. The issue has been fixed, thanks for reporting.