Beispiel #1
0
        public static Promise <RunResult> RestoreAsync(string gameDataPath, CommandInput input)
        {
            if (gameDataPath == null)
            {
                throw new ArgumentNullException("gameDataPath");
            }
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            var runTask = RunInternal
                          (
                RunOptions.FlattenArguments(
                    "DATA", "RESTORE", gameDataPath,
                    "--input", input.Source,
                    "--inputFormat", input.Format,
                    "--inputFormattingOptions", input.FormattingOptions
                    )
                          );

            input.StickWith(runTask);
            return(runTask);
        }
Beispiel #2
0
        public static Promise <RunResult> ImportAsync(string gameDataPath, string[] entities, CommandInput input, ImportMode mode)
        {
            if (gameDataPath == null)
            {
                throw new ArgumentNullException("gameDataPath");
            }
            if (entities == null)
            {
                throw new ArgumentNullException("entities");
            }
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            if (Enum.IsDefined(typeof(ImportMode), mode) == false)
            {
                throw new ArgumentException("Unknown import mode.", "mode");
            }
            if (File.Exists(gameDataPath) == false)
            {
                throw new IOException(string.Format("GameData file '{0}' doesn't exists.", gameDataPath));
            }

            var runTask = RunInternal
                          (
                RunOptions.FlattenArguments(
                    "DATA", "IMPORT", gameDataPath,
                    "--entities", entities,
                    "--mode", mode,
                    "--input", input.Source,
                    "--inputFormat", input.Format,
                    "--inputFormattingOptions", input.FormattingOptions
                    )
                          );

            input.StickWith(runTask);
            return(runTask);
        }
Beispiel #3
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));
        }
Beispiel #4
0
 public static Promise <RunResult> ImportAsync(string gameDataPath, CommandInput input, ImportMode mode)
 {
     return(ImportAsync(gameDataPath, new string[0], input, mode));
 }
Beispiel #5
0
 public static Promise <RunResult> DeleteDocumentAsync(string gameDataPath, string entity, CommandInput input, CommandOutput output)
 {
     return(DeleteDocumentAsync(gameDataPath, entity, string.Empty, input, output));
 }