Пример #1
0
        public async Task <TResult> Perform <TResult>(Func <IGrainContext, Task <TResult> > fn, RequestMode mode = RequestMode.Unspecified)
        {
            try {
                await _sm.WaitAsync();

                try {
                    if (_status == ActivationStatus.Deactivated)
                    {
                        throw new DeactivatedException();
                    }

                    if (_ctx == null)
                    {
                        _ctx = await _ctxFac();

                        await _runner.Perform(async() => {
                            await _ctx.Grain.OnActivateAsync();
                            _status = ActivationStatus.Activated;
                            return(true);
                        }, RequestMode.Isolated);
                    }
                }
                finally {
                    _sm.Release();
                }

                return(await _runner.Perform(() => fn(_ctx), mode));
            }
            catch (RequestRunnerClosedException) {
                throw new DeactivatedException();
            }
        }
Пример #2
0
        public Func <ActivationStatus> QueryForActivation()
        {
            return(delegate() {
                if (activationStatus == ActivationStatus.Unknown)
                {
                    activationStatus = ActivationStatus.Checking;

                    string bundleIdentifier = PlayerSettings.bundleIdentifier;
                    string organization = Settings.Instance.Organization.Name;
                    BuildTarget buildTarget = EditorUserBuildSettings.activeBuildTarget;

                    API.AsyncV1.Fetch <App> (600, new TimeSpan(0, 0, 10), ActivationSuccessful, ActivationTimedOut, (API.V1 api) => {
                        foreach (App app in api.ApplicationsFor(organization, api.Organizations()))
                        {
                            bool matchesBundleId = app.BundleIdentifier.Equals(bundleIdentifier, StringComparison.OrdinalIgnoreCase);
                            bool matchesSdk = app.SdkKits.Exists(k => k.Name.Equals(kit.Name, StringComparison.OrdinalIgnoreCase));
                            bool matchesPlatform = app.Platform == buildTarget;

                            if (matchesBundleId && matchesSdk && matchesPlatform)
                            {
                                return app;
                            }
                        }

                        throw new API.V1.ApiException("");
                    });
                }

                return activationStatus;
            });
        }
Пример #3
0
        private void EstimateInjectorActivationState(ActivationStatus status)
        {
            switch (status)
            {
            case ActivationStatus.NotRetrievable:
                ActivationState.Set(StatusType.Failed, Localization.Localization.Current.Get("ActivationStatusNotRetrievable"));
                break;

            case ActivationStatus.NotRunning:
                ActivationState.Set(StatusType.Failed, Localization.Localization.Current.Get("ActivationStatusNotRunning"));
                break;

            case ActivationStatus.Running:
                ActivationState.Set(StatusType.Information, Localization.Localization.Current.Get("ActivationStatusRunning"));
                break;

            case ActivationStatus.PluginLoaded:
                ActivationState.Set(StatusType.Ok, Localization.Localization.Current.Get("ActivationStatusPluginLoaded"));
                break;

            case ActivationStatus.PluginActivationPending:
            case ActivationStatus.PluginActivated:
            case ActivationStatus.PluginActivationFailed:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(status), status, null);
            }
        }
        public static ActivationStatus[] CalculateStopProtectChains(ActivationStatus[] initialActivationStatus, Skill leftAbility, Skill rightAbility, Skill leftBonus, Skill rightBonus)
        {
            StopProtectLink[] Links = GenerateInitialChainLinks(initialActivationStatus, leftAbility, rightAbility, leftBonus, rightBonus);

            // If there are 4 stops, or none, we can end this right here
            if (Links[(int)SkillIndex.LA].Action.HasFlag(ActivationCases.Stop) &&
                Links[(int)SkillIndex.RA].Action.HasFlag(ActivationCases.Stop) &&
                Links[(int)SkillIndex.LB].Action.HasFlag(ActivationCases.Stop) &&
                Links[(int)SkillIndex.RB].Action.HasFlag(ActivationCases.Stop))
            {
                return(CreateActivationStatusArray(ActivationStatus.Stopped));
            }

            if (!Links[(int)SkillIndex.LA].Action.HasFlag(ActivationCases.Stop) &&
                !Links[(int)SkillIndex.RA].Action.HasFlag(ActivationCases.Stop) &&
                !Links[(int)SkillIndex.LB].Action.HasFlag(ActivationCases.Stop) &&
                !Links[(int)SkillIndex.RB].Action.HasFlag(ActivationCases.Stop))
            {
                return(CreateActivationStatusArray(ActivationStatus.Normal));
            }

            SetStopChains(Links);

            ApplyStops(Links);

            ApplyProtects(Links);

            ActivationStatus[] result = new ActivationStatus[4];
            for (int i = 0; i < 4; i++)
            {
                result[i] = Links[i].Status;
            }

            return(result);
        }
 private static ActivationStatus[] CreateActivationStatusArray(ActivationStatus status)
 {
     ActivationStatus[] result = new ActivationStatus[4];
     for (int i = 0; i < 4; i++)
     {
         result[i] = status;
     }
     return(result);
 }
Пример #6
0
        public void Start()
        {
            if (_isInitialised.CompareAndSet(false, true))
            {
                Logging.Logger.Debug(this, String.Format("Starting component {0}", _componentName));
                StartCore();
                _status = ActivationStatus.ACTIVE;
                Logging.Logger.Debug(this, String.Format("Started component {0}", _componentName));
            }

        }
Пример #7
0
 private void OnActivationStatusChanged(ActivationStatus _oldValue, ActivationStatus _activationStatus)
 {
     if (_activationStatus == Primitives.ActivationStatus.Active)
     {
         base.SetValue(IsActiveProperty, true);
     }
     else if (_activationStatus == Primitives.ActivationStatus.Inactive)
     {
         base.SetValue(IsActiveProperty, false);
     }
 }
Пример #8
0
        public void Shutdown()
        {
            if (_isInitialised.CompareAndSet(true, false))
            {
                Logging.Logger.Debug(this, String.Format("Shutting down component {0}", _componentName));
                ShutdownCore();
                _status = ActivationStatus.INACTIVE;
                Logging.Logger.Debug(this, String.Format("Shut down component {0}", _componentName));
            }

        }
Пример #9
0
    static private string ToString(ActivationStatus status)
    {
        switch (status)
        {
        case ActivationStatus.NONE: return("None");

        case ActivationStatus.TRIAL: return("Trial");

        case ActivationStatus.PRO: return("Pro");

        default: return("Unknown type");
        }
    }
Пример #10
0
        private void MarkKitAsInstalled()
        {
            Settings.Instance.Kit = null;
            Settings.InstalledKit installed = Settings.Instance.InstalledKits.Find(k => k.Name.Equals(kit.Name));
            installed.Installed = true;
            installed.Enabled   = true;

            Settings.Instance.IconUrl      = iconUrl;
            Settings.Instance.DashboardUrl = dashboardUrl;
            Settings.Instance.FlowSequence = 0;

            activationStatus = ActivationStatus.Unknown;
        }
Пример #11
0
        public Task Deactivate()
        {
            if (_status == ActivationStatus.Unactivated)
            {
                throw new NotImplementedException("Activation not yet activated!");
            }

            _runner.Close(() => {
                _status = ActivationStatus.Deactivated;
                return(_ctx.Grain.OnDeactivateAsync());
            });

            return(Task.CompletedTask);
        }
        void Awake()
        {
            _licensePath = Path.Combine(Application.persistentDataPath, Application.productName, "lock.lic");
            _apiPath     = Path.Combine(Application.persistentDataPath, Application.productName, "app.lic");

            _enumActiveStatus = ActivationStatus.Unknown;

            if (!File.Exists(_apiPath))
            {
                _enumActiveStatus = ActivationStatus.Unknown;
                throw new LicenseConfigurationException("Configuration invalid");
            }
            else
            {
                try
                {
                    //extended configuration options.
                    _lseo = new LicenseSpringExtendedOptions
                    {
                        HardwareID                = this.HardwareId,
                        LicenseFilePath           = _licensePath,
                        CollectHostNameAndLocalIP = true
                    };

                    //local config decryptor
                    _localKey = KeyStorage.ReadLocalKey();

                    //main configurations
                    LicenseSpringConfiguration lsConfig = new LicenseSpringConfiguration(_localKey.ApiKey,
                                                                                         _localKey.SharedKey,
                                                                                         _localKey.ProductCode,
                                                                                         _localKey.ApplicationName,
                                                                                         _localKey.ApplicationVersion,
                                                                                         _lseo);

                    _internalLicenseManager = (LicenseManager)LicenseManager.GetInstance();
                    _internalLicenseManager.Initialize(_lsConfig);

                    _installedLicense = (License)_internalLicenseManager.CurrentLicense();
                    SetLicenseStatus();
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex.Message);
                }
            }

            DontDestroyOnLoad(this);
        }
Пример #13
0
        public int Disqualification_is_processed_based_on_correct_bonus_redemptions(ActivationStatus status)
        {
            BonusRepository
            .Players
            .Single(p => p.Id == PlayerId)
            .Wallets
            .First()
            .BonusesRedeemed.Add(new BonusRedemption
            {
                Bonus           = _excludedBonus1,
                ActivationState = status
            });

            return(BonusQueries.GetDepositQualifiedBonuses(PlayerId).Count(b => b.Name == _bonus.Name));
        }
        private void SetLicenseStatus()
        {
            if (_installedLicense == null)
            {
                _enumLicenseStatus = LicenseStatus.Unknown;
                return;
            }

            if (_installedLicense.IsEnabled())
            {
                if (_installedLicense.IsActive())
                {
                    _enumLicenseStatus = LicenseStatus.Active;
                    _enumActiveStatus  = ActivationStatus.Registered;

                    if (_installedLicense.IsTrial())
                    {
                        _enumActiveStatus = ActivationStatus.Trial;
                    }

                    if (_installedLicense.IsExpired())
                    {
                        _enumActiveStatus = ActivationStatus.Expired;
                    }

                    if (_installedLicense.IsOfflineActivated())
                    {
                        _enumActiveStatus = ActivationStatus.Offline;
                    }
                }
                else
                {
                    _enumLicenseStatus = LicenseStatus.InActive;
                }
            }
            else
            {
                _enumActiveStatus  = ActivationStatus.Unknown;
                _enumLicenseStatus = LicenseStatus.Unknown;
                return;
            }
        }
Пример #15
0
        public bool Status_of_bonus_redemption_is_validated_during_cancellation(ActivationStatus status)
        {
            CreateFirstDepositBonus();

            MakeDeposit(PlayerId);
            var bonusRedemption = BonusRedemptions.First();

            bonusRedemption.ActivationState = status;

            var validationResult = BonusQueries.GetValidationResult(new ClaimBonusRedemption
            {
                PlayerId     = PlayerId,
                RedemptionId = bonusRedemption.Id
            });

            if (validationResult.IsValid == false)
            {
                validationResult.Errors.Single().ErrorMessage.Should().Be(ValidatorMessages.BonusRedemptionStatusIsIncorrectForClaim);
            }

            return(validationResult.IsValid);
        }
        public static void CalculateAndApplyStopProtectChains(CombatRoundSkillsHandler skillsHandler)
        {
            ActivationStatus[] status = new ActivationStatus[4];
            status[(int)SkillIndex.LA] = skillsHandler.GetStatus(SkillIndex.LA);
            status[(int)SkillIndex.LB] = skillsHandler.GetStatus(SkillIndex.LB);
            status[(int)SkillIndex.RA] = skillsHandler.GetStatus(SkillIndex.RA);
            status[(int)SkillIndex.RB] = skillsHandler.GetStatus(SkillIndex.RB);

            status = CalculateStopProtectChains(status,
                                                skillsHandler[SkillIndex.LA], skillsHandler[SkillIndex.RA],
                                                skillsHandler[SkillIndex.LB], skillsHandler[SkillIndex.RB]);

            for (int i = 0; i < 4; i++)
            {
                if (status[i] == ActivationStatus.Normal)
                {
                    skillsHandler.UnfreezeSkill(i);
                }
                else
                {
                    skillsHandler.FreezeSkill(i);
                }
            }
        }
		public Action ResetActivationStatus()
		{
			return delegate() {
				activationStatus = ActivationStatus.Unknown;
			};
		}
Пример #18
0
 private void ActivationTimedOut(string message)
 {
     activationStatus = ActivationStatus.TimedOut;
 }
Пример #19
0
 private void ActivationSuccessful(App activatedApp)
 {
     iconUrl          = activatedApp.IconUrl;
     dashboardUrl     = activatedApp.DashboardUrl;
     activationStatus = ActivationStatus.Activated;
 }
Пример #20
0
 public Action ResetActivationStatus()
 {
     return(delegate() {
         activationStatus = ActivationStatus.Unknown;
     });
 }
        private Types.SCTU.SctuWorkPlaceActivationStatuses ActivationWorkPlaceThreadWorker()
        {
            //считываем значение статуса активации
            ushort ActivationStatus;
            string Error = "";

            try
            {
                ActivationStatus = Cache.Net.ReadRegister(Types.ComplexParts.Sctu, REG_WORKPLACE_ACTIVATION_STATUS);
            }
            catch (Exception ex)
            {
                Error = string.Format("Error while reading register number {0}.", REG_WORKPLACE_ACTIVATION_STATUS.ToString());
                throw new Exception(Error + "\n" +
                                    ex.Message);
            }

            switch (ActivationStatus)
            {
            case ((ushort)Types.SCTU.SctuWorkPlaceActivationStatuses.WORKPLACE_IS_FREE):
                //рабочее место свободно, его можно активировать
                this.AddWorkPlaceIsFreeEvent();
                return(Types.SCTU.SctuWorkPlaceActivationStatuses.WORKPLACE_IS_FREE);

            case ((ushort)Types.SCTU.SctuWorkPlaceActivationStatuses.WORKPLACE_IN_USE):
                this.AddNavigateSctuPageEvent();
                return(Types.SCTU.SctuWorkPlaceActivationStatuses.WORKPLACE_IN_USE);

            case ((ushort)Types.SCTU.SctuWorkPlaceActivationStatuses.WORKPLACE_IS_BLOCKED):
                //рабочее место заблокировано
                this.AddWorkPlaceIsBlockedEvent();
                return(Types.SCTU.SctuWorkPlaceActivationStatuses.WORKPLACE_IS_BLOCKED);

            default:
                //случай, когда мы добавили новое значение во множество значений Types.SCTU.SctuWorkPlaceActivationStatuses, а в данной реализации не предусмотрели для него обработку
                Error = string.Format("In this implementation, there is no provision for processing the entire set of all values 'Types.SCTU.SctuWorkPlaceActivationStatuses'. Value={0}.", ActivationStatus.ToString());
                AddShowMessageEvent(Error);
                return(Types.SCTU.SctuWorkPlaceActivationStatuses.WORKPLACE_IS_FREE);
            }
        }
Пример #22
0
        void dlg_CodeFound(object sender, EventArgs e)
        {
            //Console.WriteLine("==============================");
            // Get the find dialog box that raised the event
            ActivateDialog dlg = (ActivateDialog)sender;

            // Get find results and select found text
            string           code = dlg.ActivateCode;
            string           sn;
            ActivationStatus status = VMProtect.SDK.ActivateLicense(code, out sn);

            //Console.WriteLine("==============================" + status);
            if (status == ActivationStatus.Ok)
            {
                string destPath = System.IO.Path.Combine(Environment.CurrentDirectory, @"sn.txt");
                File.WriteAllText(destPath, sn);

                var s = VMProtect.SDK.SetSerialNumber(sn);
                VMProtect.SerialNumberData sd;
                var res = VMProtect.SDK.GetSerialNumberData(out sd);
                if (res)
                {
                    //AppendResultLine("State = {0}", sd.State);
                    //AppendResultLine("User Name = {0}", sd.UserName);
                    //AppendResultLine("E-Mail = {0}", sd.EMail);
                    //AppendResultLine("Date of expiration = {0}", sd.Expires);
                    //AppendResultLine("Max date of build = {0}", sd.MaxBuild);
                    //AppendResultLine("Running time limit = {0} minutes", sd.RunningTime);
                    //AppendResultLine("Length of user data = {0} bytes", sd.UserData.Length);
                    ExpireDateTime.Content = sd.Expires.ToString();
                }
            }
            else if (status == ActivationStatus.NoConnection)
            {
                ExpireDateTime.Content = "网络连接失败,请检查网络";
            }
            else if (status == ActivationStatus.BadReply)
            {
                ExpireDateTime.Content = "激活服务器出现错误,请通知作者";
            }
            else if (status == ActivationStatus.Banned)
            {
                ExpireDateTime.Content = "此激活码已被禁止使用";
            }
            else if (status == ActivationStatus.Corrupted)
            {
                ExpireDateTime.Content = "激活服务出现异常,请通知作者";
            }
            else if (status == ActivationStatus.BadCode)
            {
                ExpireDateTime.Content = "激活失败,请检查激活码是否正确输入";
            }
            else if (status == ActivationStatus.AlreadyUsed)
            {
                ExpireDateTime.Content = "激活码已被使用";
            }
            else if (status == ActivationStatus.SerialUnknown)
            {
                ExpireDateTime.Content = "激活码不存在,请联系作者";
            }
            else if (status == ActivationStatus.Expired)
            {
                ExpireDateTime.Content = "激活码已过期";
            }
            else if (status == ActivationStatus.NotAvailable)
            {
                ExpireDateTime.Content = "激活服务失效了,请通知作者";
            }
            else
            {
                ExpireDateTime.Content = "激活失败,原因未知,请联系作者";
            }
        }
 public ProxyActivationStatusLoadedNotification(ActivationStatus status)
 {
     Status = status;
 }
Пример #24
0
 public DeviceActivationCommandResponse(ActivationStatus status)
 {
     Status = status;
 }
		private void MarkKitAsInstalled()
		{
			Settings.Instance.Kit = null;
			Settings.InstalledKit installed = Settings.Instance.InstalledKits.Find (k => k.Name.Equals (kit.Name));
			installed.Installed = true;
			installed.Enabled = true;
			
			Settings.Instance.IconUrl = iconUrl;
			Settings.Instance.DashboardUrl = dashboardUrl;
			Settings.Instance.FlowSequence = 0;
			
			activationStatus = ActivationStatus.Unknown;
		}
		public Func<ActivationStatus> QueryForActivation()
		{
			return delegate() {
				if (activationStatus == ActivationStatus.Unknown) {
					activationStatus = ActivationStatus.Checking;

					string bundleIdentifier = PlayerSettings.bundleIdentifier;
					string organization = Settings.Instance.Organization.Name;
					BuildTarget buildTarget = EditorUserBuildSettings.activeBuildTarget;

					API.AsyncV1.Fetch<App> (600, new TimeSpan (0, 0, 10), ActivationSuccessful, ActivationTimedOut, (API.V1 api) => {
						foreach (App app in api.ApplicationsFor (organization, api.Organizations ())) {
							bool matchesBundleId = app.BundleIdentifier.Equals (bundleIdentifier, StringComparison.OrdinalIgnoreCase);
							bool matchesSdk = app.SdkKits.Exists (k => k.Name.Equals (kit.Name, StringComparison.OrdinalIgnoreCase));
							bool matchesPlatform = app.Platform == buildTarget;

							if (matchesBundleId && matchesSdk && matchesPlatform) {
								return app;
							}
						}

						throw new API.V1.ApiException ("");
					});
				}

				return activationStatus;
			};
		}
Пример #27
0
 public ActivationException(ActivationStatus status)
 {
     StatusCode = status;
 }
Пример #28
0
 public ActivationException(ActivationStatus status, string message, Exception inner)
     : base(message, inner)
 {
     StatusCode = status;
 }
		private void ActivationSuccessful(App activatedApp)
		{
			iconUrl = activatedApp.IconUrl;
			dashboardUrl = activatedApp.DashboardUrl;
			activationStatus = ActivationStatus.Activated;
		}
		private void ActivationTimedOut(string message)
		{
			activationStatus = ActivationStatus.TimedOut;
		}
Пример #31
0
 public ProxyActivationStatusLoadedEvent(string applicationFilePath, ActivationStatus activationStatus)
 {
     ApplicationFilePath = applicationFilePath;
     ActivationStatus    = activationStatus;
 }