-
Notifications
You must be signed in to change notification settings - Fork 648
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
52 changed files
with
655 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,4 +35,3 @@ _NCrunch_NServiceBus/* | |
logs | ||
run-git.cmd | ||
src/Chocolatey/Build/* | ||
App_Packages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -283,7 +283,5 @@ public IBus Start() | |
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public event EventHandler Started; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/NServiceBus.Core/App_Packages/Particular.Licensing/License.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
namespace Particular.Licensing | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
class License | ||
{ | ||
public static License TrialLicense(DateTime trialStartDate) | ||
{ | ||
return new License | ||
{ | ||
LicenseType = "Trial", | ||
ExpirationDate = trialStartDate.AddDays(14), | ||
IsExtendedTrial = false, | ||
ValidApplications = new List<string> { "All"} | ||
}; | ||
} | ||
|
||
public License() | ||
{ | ||
ValidApplications = new List<string>(); | ||
} | ||
|
||
public DateTime? ExpirationDate { get; set; } | ||
|
||
public bool IsTrialLicense | ||
{ | ||
get { return !IsCommercialLicense; } | ||
} | ||
|
||
public bool IsExtendedTrial { get; set; } | ||
|
||
public bool IsCommercialLicense | ||
{ | ||
get { return LicenseType.ToLower() != "trial"; } | ||
} | ||
|
||
public string LicenseType { get; set; } | ||
|
||
public string RegisteredTo { get; set; } | ||
|
||
public DateTime? UpgradeProtectionExpiration { get; internal set; } | ||
|
||
public List<string> ValidApplications{ get; internal set; } | ||
|
||
public bool ValidForApplication(string applicationName) | ||
{ | ||
return ValidApplications.Contains(applicationName) || ValidApplications.Contains("All"); | ||
} | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
src/NServiceBus.Core/App_Packages/Particular.Licensing/LicenseDeserializer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
namespace Particular.Licensing | ||
{ | ||
using System; | ||
using System.Linq; | ||
using System.Xml; | ||
|
||
static class LicenseDeserializer | ||
{ | ||
public static License Deserialize(string licenseText) | ||
{ | ||
var license = new License(); | ||
var doc = new XmlDocument(); | ||
doc.LoadXml(licenseText); | ||
|
||
|
||
var applications = doc.SelectSingleNode("/license/@Applications"); | ||
|
||
|
||
if (applications != null) | ||
{ | ||
license.ValidApplications.AddRange(applications.Value.Split(';')); | ||
} | ||
|
||
var upgradeProtectionExpiration = doc.SelectSingleNode("/license/@UpgradeProtectionExpiration"); | ||
|
||
if (upgradeProtectionExpiration != null) | ||
{ | ||
license.UpgradeProtectionExpiration = Parse(upgradeProtectionExpiration.Value); | ||
} | ||
else | ||
{ | ||
var expirationDate = doc.SelectSingleNode("/license/@expiration"); | ||
|
||
if (expirationDate != null) | ||
{ | ||
license.ExpirationDate = Parse(expirationDate.Value); | ||
|
||
} | ||
} | ||
|
||
var licenseType = doc.SelectSingleNode("/license/@LicenseType"); | ||
|
||
if (licenseType == null) | ||
{ | ||
licenseType = doc.SelectSingleNode("/license/@type"); | ||
} | ||
|
||
if (licenseType != null) | ||
{ | ||
license.LicenseType = licenseType.Value; | ||
} | ||
|
||
var name = doc.SelectSingleNode("/license/name"); | ||
|
||
if (name != null) | ||
{ | ||
license.RegisteredTo = name.InnerText; | ||
} | ||
|
||
return license; | ||
} | ||
|
||
static DateTime Parse(string dateStringFromLicense) | ||
{ | ||
if (string.IsNullOrEmpty(dateStringFromLicense)) | ||
{ | ||
throw new Exception("Invalid datestring found in xml"); | ||
} | ||
|
||
return UniversalDateParser.Parse(dateStringFromLicense.Split('T').First()); | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.