-
Notifications
You must be signed in to change notification settings - Fork 52
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
Change: Improve number parsing #544
base: master
Are you sure you want to change the base?
Conversation
{ | ||
Interface.AddMessage(MessageType.Error, false, "ValueInDegrees is invalid in " + Key + " in " + Section + " at line " + LineNumber.ToString(Culture) + " in " + FileName); | ||
} | ||
InitialAngle = NumberFormats.ParseDouble(Value, Key, Section, LineNumber, FileName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be converted to radians?
Nasty suspicion it should....
I'm busy this week, so I'd like to see it next week. |
No trouble. There are a lot more places and similar bits that can be added (color parser for one, used in the objects, panels etc), & I'd consider this low priority cleanup work at best. |
This PR is now about 50% of the way towards replacing the parse calls. A lot of the rest of these use the negative response to set some sort of default value. (where the standard double / int default of 0.0 doesn't apply) |
bad6395
to
438f090
Compare
5f23a6d
to
a53fd14
Compare
This branch attempts to unify & improve the number parsing code.
Most places parsing a Vector simply called the NumberFormats.TryParseDoubleVb6 method repeatedly on each component of the vector, and had their own Interface.AddMessage call with an appropriate error message.
This PR creates several new helper functions in the NumberFormats file which perform the function in a unified way.
It also adds an unconditional number parser, which adds an appropriate error,
Benefits:
Drawbacks / Issues
New: Error X is invalid in AddVertex - Coordinates at line 2 in B:\test\FCMB 2000\3D\Cabina\AgullaPressioB.csv
Old: Error Invalid argument vX in AddVertex at line 2 in file B:\test\FCMB 2000\3D\Cabina\AgullaPressioB.csv
TEST
@s520 any thoughts?
Ended up running this up as I looked in the Panel2 parser in preparation for adding the windscreen properties & decided I could get rid of some of the duplicated code.