Open redbaty opened 6 years ago
I managed to boot on secure mode, and found the problem! Added to the fork.
I have an idea, we can include a PreProcess step in conversion
[PreProcess("R\$(\d+)", "$")]
public int Price { get; set; }
from which the replacement will be fed into the converter. I'll think of other solutions and from next week I can become more involved in these things. Looks like you're in a similar situation so that time we can split up every feature and implement them.
@EdonGashi Yes that would be great beacause it opens up to more things, as for currency this should be fixed by passing NumberStyles to double.parse but this could happen on other types too, I'll check it out when I can.
@EdonGashi Hey I think you should open a issue to keep track of suggestions, cause I've got loads and when I get some free time I'd be glad to add them!
Opened #17 & started testing some approaches to field conversion
Added [Replace("regexpattern", "replacement")]
attribute which can be used to modify input string before being parsed. Currently this only works for converted fields. I'm not sure if this should also work for strings, since in them you can just define a custom setter to process the value.
This shouldn't be used for things like currency though, because I'm adding a new attribute [NumberStyle(NumberStyles.Currency)]
which can decorate numeric properties. Otherwise hard coding Currency number as fallback does not sound too flexible.
Note on Replace
since it accepts dynamic expressions you can do something like
[Replace("{StaticResource CurrencySymbol}(\d+)", "$1")]
Awesome!
Reopening so I don't forget about NumberStyles
Currency binding generates a invalid result.
The problem is located here:
on ConversionValidator.cs
The deserializer seems to validate correctly when the user input a value but when validation is called after (like a button) it fails because the string parsed contains special caractes like "R$" for brazillian currency. Example:
User inputs 7,75 and it validates OK and turns it into "R$7,75" then when I press the validation button it will fail saying the string contains invalid characters.
If you don't have time it's ok, I'll take a look at it when my graphics card arrives