From 3a0fa89dd8db7950307ab1f45701e16805a84952 Mon Sep 17 00:00:00 2001 From: Brad Barnhill Date: Thu, 28 Jan 2021 23:20:48 -0600 Subject: [PATCH] remove useless try/catch --- BarcodeStandard/Symbologies/EAN13.cs | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/BarcodeStandard/Symbologies/EAN13.cs b/BarcodeStandard/Symbologies/EAN13.cs index 04f8c73..98b6d5b 100644 --- a/BarcodeStandard/Symbologies/EAN13.cs +++ b/BarcodeStandard/Symbologies/EAN13.cs @@ -76,30 +76,27 @@ private string Encode_EAN13() var twodigitCode = Raw_Data.Substring(0, 2); var threedigitCode = Raw_Data.Substring(0, 3); - try + var cc = _countryCodes[threedigitCode]; + if (cc == null) { - var cc = _countryCodes[threedigitCode]; + cc = _countryCodes[twodigitCode].ToString(); if (cc == null) { - cc = _countryCodes[twodigitCode].ToString(); - if (cc == null) - { - Error("EEAN13-3: Country assigning manufacturer code not found."); - } - else - { - _countryAssigningManufacturerCode = cc.ToString(); - } + Error("EEAN13-3: Country assigning manufacturer code not found."); } else { _countryAssigningManufacturerCode = cc.ToString(); } - - } - finally { _countryCodes.Clear(); } + } + else + { + _countryAssigningManufacturerCode = cc.ToString(); + } + + _countryCodes.Clear(); - return result; + return result; }//Encode_EAN13 private void Create_CountryCodeRange(int startingNumber, int endingNumber, string countryDescription)