Ejemplo n.º 1
0
 public StitchAdaptorFactory(CrossStitchCore core, StitchesConfiguration configuration, StitchFileSystem fileSystem, IModuleLog log, IStitchEventObserver observer)
 {
     _core          = core;
     _configuration = configuration;
     _fileSystem    = fileSystem;
     _log           = log;
     _observer      = observer;
 }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 public StitchAdaptorFactory(StitchesConfiguration configuration, StitchFileSystem fileSystem)
 {
     _configuration = configuration;
     _fileSystem    = fileSystem;
 }