Beispiel #1
0
        private ErrorProperty GetErrorProperty(Control control)
        {
            ErrorProperty ep = (ErrorProperty)controls[control];

            if (ep == null)
            {
                ep = new ErrorProperty(this, control);
                controls[control] = ep;
            }
            return(ep);
        }
        public object FileOperations([FromBody] FEParams args)
        {
            if (args.action == "Remove" || args.action == "Rename")
            {
                if ((args.targetPath == null) && (args.path == ""))
                {
                    FileManagerResponse response = new FileManagerResponse();
                    ErrorProperty       er       = new ErrorProperty
                    {
                        Code    = "403",
                        Message = "Restricted to modify the root folder."
                    };
                    response.Error = er;
                    return(this.operation.ToCamelCase(response));
                }
            }
            switch (args.action)
            {
            case "Read":
                return(this.operation.ToCamelCase(this.operation.GetFiles(args.path, args.showHiddenItems)));

            case "Remove":
                return(this.operation.ToCamelCase(this.operation.Remove(args.path, args.itemNames)));

            case "GetDetails":
                return(this.operation.ToCamelCase(this.operation.GetDetails(args.path, args.itemNames)));

            case "CreateFolder":
                return(this.operation.ToCamelCase(this.operation.CreateFolder(args.path, args.name)));

            case "Search":
                return(this.operation.ToCamelCase(this.operation.Search(args.path, args.searchString, args.showHiddenItems, args.caseSensitive)));

            case "Rename":
                return(this.operation.ToCamelCase(this.operation.Rename(args.path, args.name, args.itemNewName)));
            }
            return(null);
        }
Beispiel #3
0
        public Task Run(IMiddlewareContext context, FieldDelegate next)
        {
            var rootCtx = new FieldValidationContext(context.Field.Name);

            foreach (var inputField in context.Field.Arguments)
            {
                var directives = GetValidationDirectives(inputField.Directives);
                var value      = context.Argument <object>(inputField.Name);
                var ctx        = new FieldValidationContext(inputField.Name);
                HandleInput(value, inputField.Type, directives, ctx);
                rootCtx.AddErrored(ctx);
            }

            if (rootCtx.HasErrors())
            {
                var errorsProperty = new ErrorProperty("FieldValidationError", rootCtx);
                var error          = new QueryError("Invalid input data", errorsProperty);

                throw new QueryException(error);
            }

            return(next.Invoke(context));
        }
Beispiel #4
0
 get => GetValue(ErrorProperty); set => SetValue(ErrorProperty, value);
		private ErrorProperty GetErrorProperty(Control control) {
			ErrorProperty ep = (ErrorProperty)controls[control];
			if (ep == null) {
				ep = new ErrorProperty(this, control);
				controls[control] = ep;
			}
			return ep;
		}
Beispiel #6
0
        /// <summary>
        /// Serializes this instance of <see cref="Error" /> into a <see cref="Microsoft.Azure.AzConfig.Runtime.Json.JsonNode" />.
        /// </summary>
        /// <param name="container">The <see cref="Microsoft.Azure.AzConfig.Runtime.Json.JsonObject"/> container to serialize this object into. If the caller
        /// passes in <c>null</c>, a new instance will be created and returned to the caller.</param>
        /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Microsoft.Azure.AzConfig.Runtime.SerializationMode"/>.</param>
        /// <returns>
        /// a serialized instance of <see cref="Error" /> as a <see cref="Microsoft.Azure.AzConfig.Runtime.Json.JsonNode" />.
        /// </returns>
        public Microsoft.Azure.AzConfig.Runtime.Json.JsonNode ToJson(Microsoft.Azure.AzConfig.Runtime.Json.JsonObject container, Microsoft.Azure.AzConfig.Runtime.SerializationMode serializationMode)
        {
            container = container ?? new Microsoft.Azure.AzConfig.Runtime.Json.JsonObject();

            bool returnNow = false;

            BeforeToJson(ref container, ref returnNow);
            if (returnNow)
            {
                return(container);
            }
            AddIf(null != ErrorProperty ? (Microsoft.Azure.AzConfig.Runtime.Json.JsonNode)ErrorProperty.ToJson(null) : null, "error", container.Add);
            AfterToJson(ref container);
            return(container);
        }