/* Function: MergeOutputTargets * * Merges the settings of the secondary output target into the primary one. The primary target will only adopt the secondary * settings which it does not already have set. When merging you should start with your most important target and merge * others into it in order of importance. * * It is assumed that the two targets are of the same class and match with <Targets.OutputBase.IsSameTarget()>. */ protected static void MergeOutputTargets(Targets.OutputBase primaryTarget, Targets.OutputBase secondaryTarget) { #if DEBUG if (primaryTarget.GetType() != secondaryTarget.GetType()) { throw new Exception("Cannot call MergeOutputTargets() on two different types."); } if (primaryTarget.IsSameTarget(secondaryTarget) == false) { throw new Exception("Cannot call MergeOutputTargets() when they do not match with IsSameTarget()."); } #endif MergeProjectInfo(primaryTarget.ProjectInfo, secondaryTarget.ProjectInfo); if (!primaryTarget.NumberPropertyLocation.IsDefined) { primaryTarget.Number = secondaryTarget.Number; primaryTarget.NumberPropertyLocation = secondaryTarget.NumberPropertyLocation; } if (primaryTarget is Targets.HTMLOutputFolder) { if (!(primaryTarget as Targets.HTMLOutputFolder).FolderPropertyLocation.IsDefined) { (primaryTarget as Targets.HTMLOutputFolder).Folder = (secondaryTarget as Targets.HTMLOutputFolder).Folder; (primaryTarget as Targets.HTMLOutputFolder).FolderPropertyLocation = (secondaryTarget as Targets.HTMLOutputFolder).FolderPropertyLocation; } } else { throw new NotImplementedException(); } }
public OutputBase(OutputBase toCopy) : base(toCopy) { projectInfo = new ProjectInfo(toCopy.projectInfo); number = toCopy.number; numberPropertyLocation = toCopy.numberPropertyLocation; }
override public bool IsSameTarget(OutputBase other) { if ((other is HTMLOutputFolder) == false) { return(false); } return(folder == (other as HTMLOutputFolder).folder); }
/* Function: CreateBuilder * Creates and returns an <Output.Builder> from the passed target config. */ protected virtual Output.Builder CreateBuilder(Targets.OutputBase target) { if (target is Targets.HTMLOutputFolder) { return(new Output.Builders.HTML(EngineInstance.Output, (Targets.HTMLOutputFolder)target)); } else { throw new NotImplementedException(); } }
/* Function: CreateOutputFilter * Creates and returns a <Files.Filter> from the passed output target so that the target's files are excluded from being * scanned with the source, or null if one isn't needed. */ protected virtual Files.Filter CreateOutputFilter(Targets.OutputBase target) { if (target is Targets.HTMLOutputFolder) { return(new Files.Filters.IgnoredSourceFolder((target as Targets.HTMLOutputFolder).Folder)); } else { throw new NotImplementedException(); } }
/* Function: IsSameTarget * Override to determine whether the two output targets are fundamentally the same. Only primary identifying properties * should be compared, so two <HTMLOutputFolders> should return true if they point to the same folder, and secondary * properties like those in <ProjectInfo> are ignored. */ public abstract bool IsSameTarget(OutputBase other);