コード例 #1
0
ファイル: Service.cs プロジェクト: virl/yttrium
        private void SetLicense(LicenseInfo license)
        {
            if (license == null)
            {
                lock (this)
                {
                    InvalidLicense();
                    _license = null;
                    _licensor.IsMonitoring = false;
                    _isValid = false;

                    return;
                }
            }

            lock (this)
            {
                if (!_validator.IsValid(license))
                {
                    InvalidLicense();
                    throw new System.ComponentModel.LicenseException(
                                            typeof(Service)
                                            );
                }

                _license = license;
                _isValid = true;

                _licensor.Key = Encoding.ASCII.GetBytes(
                    _license.GetHashCode().ToString()
                    );
                _licensor.MaxComputers = _license.Computers;
                _licensor.IsMonitoring = true;
            }
        }