示例#1
0
        public static Promise <RunResult> ValidateAsync(string gameDataPath, ValidationOptions validationOptions, CommandOutput output)
        {
            if (gameDataPath == null)
            {
                throw new ArgumentNullException("gameDataPath");
            }
            if (output == null)
            {
                throw new ArgumentNullException("output");
            }

            if (File.Exists(gameDataPath) == false)
            {
                throw new IOException(string.Format("GameData file '{0}' doesn't exists.", gameDataPath));
            }

            var runTask = RunInternal
                          (
                RunOptions.FlattenArguments(
                    "DATA", "VALIDATE", gameDataPath,
                    "--validationOptions", ((int)validationOptions).ToString(),
                    "--output", output.Target,
                    "--outputFormat", output.Format,
                    "--outputFormattingOptions", output.FormattingOptions
                    )
                          );

            return(output.Capture(runTask));
        }
示例#2
0
        public static Promise <RunResult> DeleteDocumentAsync(string gameDataPath, string entity, string id, CommandInput input, CommandOutput output)
        {
            if (gameDataPath == null)
            {
                throw new ArgumentNullException("gameDataPath");
            }
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            if (id == null)
            {
                throw new ArgumentNullException("id");
            }
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }
            if (output == null)
            {
                throw new ArgumentNullException("output");
            }

            if (File.Exists(gameDataPath) == false)
            {
                throw new IOException(string.Format("GameData file '{0}' doesn't exists.", gameDataPath));
            }

            var runTask = RunInternal
                          (
                RunOptions.FlattenArguments(
                    "DATA", "DELETE", gameDataPath,
                    "--entity", entity,
                    "--id", id,
                    "--input", input.Source,
                    "--inputFormat", input.Format,
                    "--inputFormattingOptions", input.FormattingOptions,
                    "--output", output.Target,
                    "--outputFormat", output.Format,
                    "--outputFormattingOptions", output.FormattingOptions
                    )
                          );

            input.StickWith(runTask);
            return(output.Capture(runTask));
        }