public ProcessParameters(StitchesConfiguration configuration, StitchFileSystem fileSystem, StitchInstance stitch, PackageFile packageFile)
        {
            var parameters = packageFile.Adaptor.Parameters;
            // Use the dir if specified, otherwise default to the running dir from the file system
            var defaultRunningDir = fileSystem.GetInstanceRunningDirectory(stitch.Id);

            RunningDirectory = parameters.GetOrAdd(Parameters.RunningDirectory, defaultRunningDir);

            var defaultDataDir = fileSystem.GetInstanceDataDirectoryPath(stitch.Id);

            DataDirectory = parameters.GetOrAdd(Parameters.DataDirectory, defaultDataDir);

            // Executable name must be specified. Get it and validate
            ExecutableName = parameters.GetOrDefault(Parameters.ExecutableName);
            if (string.IsNullOrEmpty(ExecutableName))
            {
                throw new Exception("Stitch executable name is not specified");
            }

            // Custom args are optional
            ExecutableArguments = parameters.GetOrAdd(Parameters.ExecutableArguments, "") ?? "";

            string executableExt = Path.GetExtension(ExecutableName).ToLower();
            var    extConfig     = configuration.Extensions.GetOrDefault(executableExt, new StitchesExtensionConfiguration());

            // Use the format from the StitchInstance if specified, otherwise the one configured
            // for the extension, otherwise fall back to the default.
            string executableFormat = "{DirectoryPath}\\{ExecutableName}";

            if (!string.IsNullOrEmpty(extConfig.ExecutableFormat))
            {
                executableFormat = extConfig.ExecutableFormat;
            }
            executableFormat = FileSystem.FixPath(executableFormat);
            ExecutableFormat = parameters.GetOrAdd(Parameters.ExecutableFormat, executableFormat);

            // Use the format from the StitchInstance if specified, otherwise the one configured
            // for the extension, otherwise fall back to the default.
            string argsFormat = "{CoreArgs} -- {CustomArgs}";

            if (!string.IsNullOrEmpty(extConfig.ArgumentsFormat))
            {
                argsFormat = extConfig.ArgumentsFormat;
            }
            argsFormat      = FileSystem.FixPath(argsFormat);
            ArgumentsFormat = parameters.GetOrAdd(Parameters.ArgumentsFormat, argsFormat);

            ChannelType    = packageFile.Adaptor.Channel;
            SerializerType = packageFile.Adaptor.Serializer;
        }
        public ProcessV1Parameters(StitchesConfiguration configuration, StitchFileSystem fileSystem, StitchInstance stitch, Dictionary <string, string> parameters)
        {
            // Use the dir if specified, otherwise default to the running dir from the file system
            var defaultRunningDir = fileSystem.GetInstanceRunningDirectory(stitch.Id);

            DirectoryPath = parameters.GetOrAdd(Parameters.DirectoryPath, defaultRunningDir);

            // Executable name must be specified. Get it and validate
            ExecutableName = parameters.GetOrDefault(Parameters.ExecutableName);
            if (string.IsNullOrEmpty(ExecutableName))
            {
                throw new Exception("Stitch executable name is not specified");
            }

            // Custom args are optional
            ExecutableArguments = parameters.GetOrAdd(Parameters.ExecutableArguments, "") ?? "";

            string executableExt = Path.GetExtension(ExecutableName).ToLower();
            var    extConfig     = configuration.Extensions.GetOrDefault(executableExt, new StitchesExtensionConfiguration());

            // Use the format from the StitchInstance if specified, otherwise the one configured
            // for the extension, otherwise fall back to the default.
            string executableFormat = "{DirectoryPath}\\{ExecutableName}";

            if (!string.IsNullOrEmpty(extConfig.ExecutableFormat))
            {
                executableFormat = extConfig.ExecutableFormat;
            }
            ExecutableFormat = parameters.GetOrAdd(Parameters.ExecutableFormat, executableFormat);

            // Use the format from the StitchInstance if specified, otherwise the one configured
            // for the extension, otherwise fall back to the default.
            string argsFormat = "{CoreArgs} -- {CustomArgs}";

            if (!string.IsNullOrEmpty(extConfig.ArgumentsFormat))
            {
                argsFormat = extConfig.ArgumentsFormat;
            }
            ArgumentsFormat = parameters.GetOrAdd(Parameters.ArgumentsFormat, argsFormat);
        }