Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/License/DamLicense.cs
===================================================================
diff -u -r3899 -r4055
--- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/License/DamLicense.cs (.../DamLicense.cs) (revision 3899)
+++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/License/DamLicense.cs (.../DamLicense.cs) (revision 4055)
@@ -1,18 +1,18 @@
// Copyright (C) Stichting Deltares 2023. All rights reserved.
//
-// This file is part of the application DAM - UI.
+// This file is part of the application DAM - Live.
//
-// DAM - UI is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
+// DAM - Live is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// GNU Affero General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
+// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
//
// All names, logos, and references to "Deltares" are registered trademarks of
@@ -32,9 +32,7 @@
///
public class DamLicense
{
-
private static DAuthClient dAuthClient;
- private static DamLicenseType damLicenseType = DamLicenseType.None;
private static string checkedOutFeature;
///
@@ -43,13 +41,7 @@
///
/// The type of the dam license.
///
- public static DamLicenseType DamLicenseType
- {
- get
- {
- return damLicenseType;
- }
- }
+ public static DamLicenseType DamLicenseType { get; private set; } = DamLicenseType.None;
///
/// Checkouts the license.
@@ -60,22 +52,27 @@
/// The version.
public static void CheckoutLicense(string feature, string version)
{
- if (feature == null) throw new ArgumentNullException(nameof(feature));
+ if (feature == null)
+ {
+ throw new ArgumentNullException(nameof(feature));
+ }
+
IEnumerable featureNames = GetAllFeaturesStartingWith(feature);
if (featureNames == null)
{
checkedOutFeature = null;
- damLicenseType = DamLicenseType.None;
+ DamLicenseType = DamLicenseType.None;
return;
}
+
int majorVersion = GetMajorVersionFromVersionString(version);
- string versionString = majorVersion.ToString(CultureInfo.InvariantCulture);
- damLicenseType = DamLicenseType.None;
- foreach (var featureName in featureNames)
+ var versionString = majorVersion.ToString(CultureInfo.InvariantCulture);
+ DamLicenseType = DamLicenseType.None;
+ foreach (string featureName in featureNames)
{
if (DAuthClient.CheckOut(featureName, versionString))
{
- damLicenseType = DamLicenseType.LFM;
+ DamLicenseType = DamLicenseType.LFM;
checkedOutFeature = featureName;
break;
}
@@ -106,6 +103,7 @@
{
return null;
}
+
IEnumerable featureNames = features.Where(s => s.StartsWith(feature));
return featureNames;
}
@@ -118,6 +116,7 @@
{
return dAuthClient;
}
+
dAuthClient = new DAuthClient(false, true);
return dAuthClient;
}
@@ -129,7 +128,7 @@
{
'.'
};
- var versionNumbers = version.Split(seperator);
+ string[] versionNumbers = version.Split(seperator);
int majorVersion;
int.TryParse(versionNumbers[0], out majorVersion);
return majorVersion;