Пример #1
0
        public override void ExecuteResource(string resourceName, Type type)
        {
            VerifyNotDisposed();

            if (resourceName == null)
            {
                throw new ArgumentNullException(
                          "resourceName", string.Format(CoreStrings.Common_ArgumentIsNull, "resourceName"));
            }

            if (type == null)
            {
                throw new ArgumentNullException(
                          "type", string.Format(CoreStrings.Common_ArgumentIsNull, "type"));
            }

            if (string.IsNullOrWhiteSpace(resourceName))
            {
                throw new ArgumentException(
                          string.Format(CoreStrings.Common_ArgumentIsEmpty, "resourceName"), "resourceName");
            }

            try
            {
                _jsEngine.ExecuteResource(resourceName, type);
            }
            catch (OriginalJsRuntimeException e)
            {
                throw ConvertMsieJsRuntimeExceptionToJsRuntimeException(e);
            }
        }
        public override void ExecuteResource(string resourceName, Type type)
        {
            VerifyNotDisposed();

            if (resourceName == null)
            {
                throw new ArgumentNullException(
                          nameof(resourceName),
                          string.Format(CoreStrings.Common_ArgumentIsNull, nameof(resourceName))
                          );
            }

            if (type == null)
            {
                throw new ArgumentNullException(
                          nameof(type),
                          string.Format(CoreStrings.Common_ArgumentIsNull, nameof(type))
                          );
            }

            if (string.IsNullOrWhiteSpace(resourceName))
            {
                throw new ArgumentException(
                          string.Format(CoreStrings.Common_ArgumentIsEmpty, nameof(resourceName)),
                          nameof(resourceName)
                          );
            }

            if (!ValidationHelpers.CheckDocumentNameFormat(resourceName))
            {
                throw new ArgumentException(
                          string.Format(CoreStrings.Usage_InvalidResourceNameFormat, resourceName),
                          nameof(resourceName)
                          );
            }

            try
            {
                _jsEngine.ExecuteResource(resourceName, type);
            }
            catch (OriginalException e)
            {
                throw WrapJsException(e);
            }
            catch (NullReferenceException)
            {
                throw;
            }
        }