rcd/fo-dicom — pull request #63 by swalex (2014-05-09 10:22:29+00:00)
Title: Replace DicomVR.Parse by DicomVR.TryParse where appropriate

I had an issue with fo-dicom taking some unnecessarily long time to scan a set of about 90 DICOM CT volume slices each with an faulty tag inside of them (with an invalid VR representation code).

Because of the throw statement in the default switch case each slice caused an exception which was caught directly by the immediate caller of DicomVR.Parse and used just as a simple status result flag.

I've split the original Parse method into 3 separate methods:
- public DicomVR Parse(string), which retains the original functionality
- public bool TryParse(string, out DicomVR), which wraps the parsing code into a common TryParse method schema
- private DicomVR TryParse(string, out bool), which contains the original switch and will set or clear the second/out parameter on success or failure

and replaced two calls to DicomVR.Parse, where the exception was caught by the immediate caller, by matching calls to DicomVR.TryParse, which had improved the performance of the DicomFileScanner a bit on the set of the faulty CT slices.