diff --git a/BarcodeStandard/BarcodeStandard.csproj b/BarcodeStandard/BarcodeStandard.csproj
index 1bd6bb6..1180017 100644
--- a/BarcodeStandard/BarcodeStandard.csproj
+++ b/BarcodeStandard/BarcodeStandard.csproj
@@ -3,7 +3,7 @@
netstandard2.0
true
- 2.3.0
+ 2.4.0
BarcodeLib
Pnuema Productions
BarcodeLib
@@ -19,8 +19,8 @@
LICENSE.txt
upca.jpg
- 2.3.0.0
- 2.3.0.0
+ 2.4.0.0
+ 2.4.0.0
@@ -28,8 +28,8 @@
-
-
+
+
diff --git a/BarcodeStandard/Symbologies/EAN13.cs b/BarcodeStandard/Symbologies/EAN13.cs
index aefc415..8adb7fe 100644
--- a/BarcodeStandard/Symbologies/EAN13.cs
+++ b/BarcodeStandard/Symbologies/EAN13.cs
@@ -15,18 +15,20 @@ class EAN13 : BarcodeCommon, IBarcode
private readonly Hashtable _countryCodes = new Hashtable(); //is initialized by init_CountryCodes()
private string _countryAssigningManufacturerCode = "N/A";
- public EAN13(string input, bool disableCountryException = false)
+ public string CountryAssigningManufacturerCode { get => _countryAssigningManufacturerCode; set => _countryAssigningManufacturerCode = value; }
+
+ public EAN13(string input, bool disableCountryCode = false)
{
Raw_Data = input;
- DisableCountryException = disableCountryException;
+ DisableCountryCode = disableCountryCode;
CheckDigit();
}
///
- /// Disables EAN13 invalid country code exception.
+ /// Disables EAN13 country code parsing
///
- public bool DisableCountryException { get; set; } = false;
+ public bool DisableCountryCode { get; set; } = false;
///
/// Encode the raw data using the EAN-13 algorithm. (Can include the checksum already. If it doesnt exist in the data then it will calculate it for you. Accepted data lengths are 12 + 1 checksum or just the 12 data digits)
@@ -77,37 +79,42 @@ private string Encode_EAN13()
//add ending bars
result += "101";
- //get the manufacturer assigning country
- Init_CountryCodes();
- _countryAssigningManufacturerCode = "N/A";
- var twodigitCode = Raw_Data.Substring(0, 2);
- var threedigitCode = Raw_Data.Substring(0, 3);
+ if (!DisableCountryCode)
+ {
+ ParseCountryCode();
+ }
+
+ return result;
+ }//Encode_EAN13
+
+ private void ParseCountryCode()
+ {
+ //get the manufacturer assigning country
+ Init_CountryCodes();
+ CountryAssigningManufacturerCode = "N/A";
+ var twodigitCode = Raw_Data.Substring(0, 2);
+ var threedigitCode = Raw_Data.Substring(0, 3);
var cc = _countryCodes[threedigitCode];
if (cc == null)
- {
+ {
cc = _countryCodes[twodigitCode].ToString();
if (cc == null)
- {
- if (!DisableCountryException)
- {
- Error("EEAN13-3: Country assigning manufacturer code not found.");
- }
- }
+ {
+ Error("EEAN13-3: Country assigning manufacturer code not found.");
+ }
else
- {
- _countryAssigningManufacturerCode = cc.ToString();
+ {
+ CountryAssigningManufacturerCode = cc.ToString();
}
- }
+ }
else
- {
- _countryAssigningManufacturerCode = cc.ToString();
+ {
+ CountryAssigningManufacturerCode = cc.ToString();
}
-
- _countryCodes.Clear();
- return result;
- }//Encode_EAN13
+ _countryCodes.Clear();
+ }
private void Create_CountryCodeRange(int startingNumber, int endingNumber, string countryDescription)
{
diff --git a/BarcodeStandardExample/BarcodeStandardExample.csproj b/BarcodeStandardExample/BarcodeStandardExample.csproj
index 9ff54a5..72180a8 100644
--- a/BarcodeStandardExample/BarcodeStandardExample.csproj
+++ b/BarcodeStandardExample/BarcodeStandardExample.csproj
@@ -70,6 +70,7 @@
TestApp.cs
+
SettingsSingleFileGenerator
Settings.Designer.cs
diff --git a/BarcodeStandardExample/packages.config b/BarcodeStandardExample/packages.config
new file mode 100644
index 0000000..0f64e65
--- /dev/null
+++ b/BarcodeStandardExample/packages.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file