public string[] Process(KraftBundle kraftBundle, ILogger logger) { #region Check validity if (kraftBundle == null) { throw new ArgumentNullException(nameof(kraftBundle)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (string.IsNullOrEmpty(kraftBundle.ContentRootPath)) { throw new ArgumentNullException(nameof(kraftBundle.ContentRootPath)); } if (string.IsNullOrEmpty(kraftBundle.StartDirPath)) { throw new ArgumentNullException(nameof(kraftBundle.StartDirPath)); } KraftBundleProfiles kraftBundleProfiles = kraftBundle as KraftBundleProfiles; if (kraftBundleProfiles == null) { return(null); } if (kraftBundleProfiles.ProfileFiles == null) { throw new ArgumentNullException(nameof(kraftBundleProfiles.ProfileFiles)); } #endregion Check validity List <string> outputFilesList = new List <string>(); DirectoryInfo scrRootDir = new DirectoryInfo(kraftBundle.StartDirPath); //start parsing from the script file of the builder object foreach (string profile in kraftBundleProfiles.ProfileFiles) { FileInfo bootstrapFile = new FileInfo(Path.Combine(kraftBundle.StartDirPath, profile)); ParseFilesForIncludesRecursive(bootstrapFile, scrRootDir, logger, outputFilesList); //outputFilesList.Add(bootstrapFile.ToString()); } outputFilesList = ProcessMappedFiles2VirtualPaths(outputFilesList, kraftBundle.ContentRootPath); return(outputFilesList.ToArray()); }
private ScriptKraftBundle ConstructScriptsBundle(KraftGlobalConfigurationSettings kraftGlobalConfigurationSettings, string resFolderPath, string resProfileFileName) { string resProfilePhysFileName = Path.Combine(resFolderPath, resProfileFileName); if (Directory.Exists(resFolderPath) && File.Exists(resProfilePhysFileName)) { ScriptKraftBundle resBundle = new ScriptKraftBundle(); resBundle.ContentRootPath = kraftGlobalConfigurationSettings.EnvironmentSettings.ContentRootPath; //KraftBundle resBundle = new StyleKraftBundle() { ContentRootPath = _KraftEnvironmentSettings.ContentRootPath }; KraftBundleProfiles resBundleProfile = resBundle as KraftBundleProfiles; resBundleProfile.ContentRootPath = kraftGlobalConfigurationSettings.EnvironmentSettings.ContentRootPath; if (resBundleProfile != null) { resBundleProfile.StartDirPath = resFolderPath; resBundleProfile.ProfileFiles = new List <string> { resProfileFileName }; return(resBundle); } } return(null); }
private StyleKraftBundle ConstructStyleBundle(KraftGlobalConfigurationSettings kraftGlobalConfigurationSettings, string resFolderPath, string resProfileFileName) { string resProfilePhysFileName = Path.Combine(resFolderPath, resProfileFileName); if (Directory.Exists(resFolderPath) && File.Exists(resProfilePhysFileName)) { StyleKraftBundle resBundle = new StyleKraftBundle(); resBundle.ContentRootPath = kraftGlobalConfigurationSettings.EnvironmentSettings.ContentRootPath; //KraftBundle resBundle = new StyleKraftBundle() { ContentRootPath = _KraftEnvironmentSettings.ContentRootPath }; KraftBundleProfiles resBundleProfile = resBundle as KraftBundleProfiles; resBundleProfile.ContentRootPath = kraftGlobalConfigurationSettings.EnvironmentSettings.ContentRootPath; if (resBundleProfile != null) { resBundleProfile.StartDirPath = resFolderPath; resBundleProfile.ProfileFiles = new List <string> { resProfileFileName, RESOURCEDEPENDENCY_FILE_NAME }; //The default should be last return(resBundle); } } return(null); }