Exemplo n.º 1
0
        public static Promise <RunResult> BackupAsync(string gameDataPath, 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", "Backup", gameDataPath,
                    "--output", output.Target,
                    "--outputFormat", output.Format,
                    "--outputFormattingOptions", output.FormattingOptions
                    )
                          );

            return(output.Capture(runTask));
        }
Exemplo n.º 2
0
        public static Promise <RunResult> ExportAsync(string gameDataPath, string[] entities, string[] attributes, CultureInfo[] languages, CommandOutput output, ExportMode mode)
        {
            if (gameDataPath == null)
            {
                throw new ArgumentNullException("gameDataPath");
            }
            if (entities == null)
            {
                throw new ArgumentNullException("entities");
            }
            if (attributes == null)
            {
                throw new ArgumentNullException("attributes");
            }
            if (languages == null)
            {
                throw new ArgumentNullException("languages");
            }
            if (output == null)
            {
                throw new ArgumentNullException("output");
            }

            if (Enum.IsDefined(typeof(ExportMode), mode) == false)
            {
                throw new ArgumentException("Unknown export 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", "EXPORT", gameDataPath,
                    "--entities", entities,
                    "--attributes", attributes,
                    "--languages", Array.ConvertAll(languages, l => l.Name),
                    "--mode", mode,
                    "--output", output.Target,
                    "--outputFormat", output.Format,
                    "--outputFormattingOptions", output.FormattingOptions
                    )
                          );

            return(runTask);
        }
Exemplo n.º 3
0
 public static Promise <RunResult> ExportAsync(string gameDataPath, string[] entities, string[] attributes, CommandOutput output, ExportMode mode)
 {
     return(ExportAsync(gameDataPath, entities, attributes, new CultureInfo[0], output, mode));
 }
Exemplo n.º 4
0
 public static Promise <RunResult> ExportAsync(string gameDataPath, CommandOutput output, ExportMode mode)
 {
     return(ExportAsync(gameDataPath, new string[0], output, mode));
 }
Exemplo n.º 5
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));
        }
Exemplo n.º 6
0
 public static Promise <RunResult> DeleteDocumentAsync(string gameDataPath, string entity, CommandInput input, CommandOutput output)
 {
     return(DeleteDocumentAsync(gameDataPath, entity, string.Empty, input, output));
 }
Exemplo n.º 7
0
        public static Promise <RunResult> CreatePatchAsync(string gameDataPath1, string gameDataPath2, CommandOutput output)
        {
            if (gameDataPath1 == null)
            {
                throw new ArgumentNullException("gameDataPath1");
            }
            if (gameDataPath2 == null)
            {
                throw new ArgumentNullException("gameDataPath2");
            }
            if (output == null)
            {
                throw new ArgumentNullException("output");
            }

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

            var runTask = RunInternal
                          (
                RunOptions.FlattenArguments(
                    "DATA", "CREATEPATCH", gameDataPath1, gameDataPath2,
                    "--output", output.Target,
                    "--outputFormat", output.Format,
                    "--outputFormattingOptions", output.FormattingOptions
                    )
                          );

            return(runTask);
        }