private void onCaptchaUILoaded(GameObject captchaPrefab, CaptchaType captchaType, int?width = default(int?), int?height = default(int?))
    {
        GameObject        gameObject = Object.Instantiate(captchaPrefab);
        CaptchaController component  = gameObject.GetComponent <CaptchaController>();

        component.SetupCaptcha(captchaType, width, height);
    }
Exemplo n.º 2
0
        public static DirectSpException Convert(Exception ex, CaptchaController captchaController)
        {
            if (ex is DirectSpException exception)
            {
                return(exception);
            }

            //create invoker exception
            var ret = new DirectSpException(ex);

            // Convert to Sp* exceptions
            switch (ret.SpCallError.ErrorId)
            {
            case (int)SpCommonExceptionId.AccessDeniedOrObjectNotExists:
                return(new SpAccessDeniedOrObjectNotExistsException(ret));

            case (int)SpCommonExceptionId.InvalidCaptcha:
                return(new InvalidCaptchaException(captchaController.Create().Result, ret));

            case (int)SpCommonExceptionId.InvokerAppVersion:
                return(new SpInvokerAppVersionException(ret));

            case (int)SpCommonExceptionId.Maintenance:
                return(new SpMaintenanceException(ret));

            case (int)SpCommonExceptionId.MaintenanceReadOnly:
                return(new SpMaintenanceReadOnlyException(ret));

            case (int)SpCommonExceptionId.InvalidParamSignature:
                return(new SpInvalidParamSignatureException(ret));

            case (int)SpCommonExceptionId.ObjectAlreadyExists:
                return(new SpObjectAlreadyExists(ret));

            default:
                return(ret);
            }
        }
Exemplo n.º 3
0
        public static MvcHtmlString PSCaptcha(this HtmlHelper htmlHelper, string name)
        {
            var model = CaptchaController.GetCaptchaModel(name);

            return(htmlHelper.Partial("~/Controls/Captcha/Views/Captcha.cshtml", model));
        }