Пример #1
0
        /// <summary>
        /// Starts this instance as a headless server
        /// </summary>
        /// <param name="startOptions">
        /// Server options
        /// </param>
        /// <param name="modDirectory">
        /// Optional<br/>The mod directory to be used<br/>
        /// Overrides the instances default mod directory</param>
        /// <param name="arguments">
        /// Optional command line arguments
        /// </param>
        /// <returns></returns>
        public static Process StartServer(this IFactorioInstance instance, FileInfo savegameFile, ServerStartOptions startOptions, DirectoryInfo modDirectory = null, params string[] arguments)
        {
            if (savegameFile is null)
            {
                throw new ArgumentNullException(nameof(savegameFile));
            }
            if (startOptions is null)
            {
                throw new ArgumentNullException(nameof(startOptions));
            }

            var fullArgs = startOptions.ToArgs(savegameFile);

            if (!(arguments is null) && (arguments.Length > 0))
            {
                fullArgs.AddRange(arguments);
            }

            return(instance.Start(modDirectory, null, fullArgs.ToArray()));
        }
Пример #2
0
        /// <summary>
        /// Starts this instance
        /// </summary>
        /// <param name="modDirectory">
        /// Optional<br/>The mod directory to be used<br/>
        /// Overrides the instances default mod directory
        /// </param>
        /// <param name="savegameFile">
        /// Optional<br/>The savegame to load
        /// </param>
        /// <param name="arguments">
        /// Optional command line arguments
        /// </param>
        public static Process Start(this IFactorioInstance instance, DirectoryInfo modDirectory = null, FileInfo savegameFile = null, params string[] arguments)
        {
            var builder = new ArgumentBuilder();

            if (!(modDirectory is null))
            {
                builder.AppendArgument("--mod-directory");
                builder.AppendArgument(modDirectory.FullName);
            }

            if (!(savegameFile is null))
            {
                builder.AppendArgument("--load-game");
                builder.AppendArgument(savegameFile.FullName);
            }

            if (!(arguments is null))
            {
                builder.AppendArguments(arguments);
            }

            return(instance.Start(builder.ToString()));
        }
Пример #3
0
 public void Start(string[] args) => _baseInstance.Start(args);
Пример #4
0
 /// <summary>
 /// Starts this instance
 /// </summary>
 /// <param name="arguments">Optional command line arguments</param>
 public static Process Start(this IFactorioInstance instance, params string[] arguments)
 => instance.Start(null, null, arguments);
 public Process Start(string arguments) => _baseInstance.Start(arguments);