@@ -24,7 +24,7 @@ public class EPPlusLicense
2424 /// <summary>
2525 /// The name used for a commercial organization
2626 /// </summary>
27- public string LegalName
27+ public string LegalName
2828 {
2929 get ;
3030 private set ;
@@ -100,17 +100,17 @@ public void SetNonCommercialOrganization(string organizationName)
100100
101101 private bool ValidateName ( string name , out string msg )
102102 {
103- if ( name . Length < 3 )
103+ if ( name . Length < 3 )
104104 {
105105 msg = "The license holder name must be at least 3 characters." ;
106106 return false ;
107107 }
108- if ( name . Any ( c => c == '/' || c == '\\ ' || c == '*' || char . IsControl ( c ) || c == '\t ' ) )
108+ if ( name . Any ( c => c == '/' || c == '\\ ' || c == '*' || char . IsControl ( c ) || c == '\t ' ) )
109109 {
110110 msg = "The license holder name contains invalid characters" ;
111111 return false ;
112112 }
113- if ( name . Count ( x=> char . IsLetter ( x ) ) < 2 )
113+ if ( name . Count ( x => char . IsLetter ( x ) ) < 2 )
114114 {
115115 msg = "The license holder name contains to few letters." ;
116116 return false ;
@@ -136,9 +136,9 @@ public void SetCommercial(string licenseKey)
136136 LicenseKey = licenseKey ;
137137 LicenseType = EPPlusLicenseType . Commercial ;
138138 Source = EPPlusLicenseSource . Code ;
139- if ( _licenseSet == false )
139+ if ( _licenseSet == false )
140140 {
141- if ( licenseInfo . Status == EPPlusLicenseStatus . InvalidLicenseKey )
141+ if ( licenseInfo . Status == EPPlusLicenseStatus . InvalidLicenseKey )
142142 {
143143 throw new InvalidLicenseKeyException ( msg ) ;
144144 }
@@ -161,7 +161,7 @@ internal bool SetLicenseFromConfig(List<ExcelInitializationError> initErrors)
161161 else
162162 {
163163 v = v . Trim ( ) ;
164- var s = v . Split ( [ ':' , ',' ] ) ;
164+ var s = v . Split ( [ ':' , ',' ] ) ;
165165 if ( s [ 0 ] . Equals ( "noncommercialorganization" , StringComparison . OrdinalIgnoreCase ) )
166166 {
167167 if ( s . Length == 1 )
@@ -189,7 +189,7 @@ internal bool SetLicenseFromConfig(List<ExcelInitializationError> initErrors)
189189 {
190190 if ( s . Length > 1 && v . StartsWith ( "commercial" , StringComparison . OrdinalIgnoreCase ) )
191191 {
192- v = v . Substring ( v . IndexOfAny ( [ ':' , ',' ] ) + 1 ) ;
192+ v = v . Substring ( v . IndexOfAny ( [ ':' , ',' ] ) + 1 ) ;
193193 }
194194 SetCommercial ( v . Trim ( ) ) ;
195195 ExcelPackage . License . Source = inEnvironment ? EPPlusLicenseSource . EnvironmentVariable : EPPlusLicenseSource . ConfigFile ;
@@ -212,16 +212,14 @@ private static string GetConfigValue(string key, List<ExcelInitializationError>
212212 {
213213#if ( Core )
214214 v = ExcelConfigurationReader . GetJsonConfigValue ( $ "EPPlus:ExcelPackage:{ key } ", _configuration , initErrors ) ;
215- #endif
216- if ( string . IsNullOrEmpty ( v ) )
217- {
218215
216+ #else
219217 v = ExcelConfigurationReader . GetValueFromAppSettings ( $ "EPPlus:ExcelPackage:{ key } ", _configuration , initErrors ) ;
220- }
221- if ( string . IsNullOrEmpty ( v ) )
222- {
223- v = ExcelConfigurationReader . GetValueFromAppSettings ( $ "EPPlus:ExcelPackage. { key } " , _configuration , initErrors ) ;
224- }
218+ if ( string . IsNullOrEmpty ( v ) )
219+ {
220+ v = ExcelConfigurationReader . GetValueFromAppSettings ( $ "EPPlus:ExcelPackage. { key } " , _configuration , initErrors ) ;
221+ }
222+ #endif
225223 inEnvironment = false ;
226224 }
227225 else
@@ -239,7 +237,7 @@ public void RemoveActiveLicense()
239237 LicenseKey = null ;
240238 Source = null ;
241239 LegalName = null ;
242- LicenseInfo = null ;
240+ LicenseInfo = null ;
243241 _licenseSet = false ;
244242 }
245243 }
0 commit comments