示例#1
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);
        }
示例#2
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);
        }