1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- using InABox.Configuration;
- using InABox.Core;
- using PRSServer;
- using PRSServices;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace PRSLicensing;
- internal class PRSLicensingService : PRSService
- {
- public PRSLicensingService(string serviceName) : base(serviceName)
- {
- }
- protected override ServerSettings GetSettings(string serviceName)
- {
- var configuration = GetConfiguration().Load();
- return new ServerSettings
- {
- Type = ServerType.Other,
- Properties = configuration.Properties
- };
- }
-
- public static IConfiguration<LicensingConfiguration> GetConfiguration()
- {
- return new LocalConfiguration<LicensingConfiguration>(CoreUtils.GetCommonAppData(), "");
- }
- protected override Server CreateServer(ServerSettings settings, string serviceName)
- {
- var result = new Server();
- result.Key = serviceName;
- result.Type = ServerType.Other;
- //result.Sequence = Sequence == 0 ? DateTime.Now.Ticks : Sequence;
- var properties = Serialization.Deserialize<LicensingEngineProperties>(settings.Properties);
- if (properties != null)
- {
- result.Properties = properties;
- result.Name = result.Properties.Name;
- }
- result.CommitChanges();
- return result;
- }
- protected override IEngine? CreateEngine(ServerSettings settings)
- {
- return new LicensingEngine();
- }
- }
|