Example #1
0
        override public bool IsSameTarget(InputBase other)
        {
            if ((other is SourceFolder) == false)
            {
                return(false);
            }

            return(folder == (other as SourceFolder).folder);
        }
Example #2
0
        public InputBase(InputBase toCopy) : base(toCopy)
        {
            name   = toCopy.name;
            number = toCopy.number;
            type   = toCopy.type;

            namePropertyLocation   = toCopy.namePropertyLocation;
            numberPropertyLocation = toCopy.numberPropertyLocation;
            typePropertyLocation   = toCopy.typePropertyLocation;
        }
Example #3
0
        // Group: Support Functions
        // __________________________________________________________________________


        /* Function: CreateFileSource
         * Creates and returns a <Files.FileSource> from the passed input target config.
         */
        protected virtual Files.FileSource CreateFileSource(Targets.InputBase target)
        {
            if (target is Targets.SourceFolder)
            {
                return(new Files.FileSources.Folder(EngineInstance.Files, (Targets.SourceFolder)target));
            }
            else
            {
                throw new NotImplementedException();
            }
        }
Example #4
0
        /* Function: MergeInputTargets
         *
         * Merges the settings of the secondary input 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.InputBase.IsSameTarget()>.
         */
        protected static void MergeInputTargets(Targets.InputBase primaryTarget, Targets.InputBase secondaryTarget)
        {
                        #if DEBUG
            if (primaryTarget.GetType() != secondaryTarget.GetType())
            {
                throw new Exception("Cannot call MergeInputTargets() on two different types.");
            }
            if (primaryTarget.IsSameTarget(secondaryTarget) == false)
            {
                throw new Exception("Cannot call MergeInputTargets() when they do not match with IsSameTarget().");
            }
                        #endif

            if (!primaryTarget.NamePropertyLocation.IsDefined)
            {
                primaryTarget.Name = secondaryTarget.Name;
                primaryTarget.NamePropertyLocation = secondaryTarget.NamePropertyLocation;
            }
            if (!primaryTarget.NumberPropertyLocation.IsDefined)
            {
                primaryTarget.Number = secondaryTarget.Number;
                primaryTarget.NumberPropertyLocation = secondaryTarget.NumberPropertyLocation;
            }
            if (!primaryTarget.TypePropertyLocation.IsDefined)
            {
                primaryTarget.Type = secondaryTarget.Type;
                primaryTarget.TypePropertyLocation = secondaryTarget.TypePropertyLocation;
            }


            if (primaryTarget is Targets.SourceFolder)
            {
                if (!(primaryTarget as Targets.SourceFolder).FolderPropertyLocation.IsDefined)
                {
                    (primaryTarget as Targets.SourceFolder).Folder = (secondaryTarget as Targets.SourceFolder).Folder;
                    (primaryTarget as Targets.SourceFolder).FolderPropertyLocation = (secondaryTarget as Targets.SourceFolder).FolderPropertyLocation;
                }
            }
            else
            {
                throw new NotImplementedException();
            }
        }
Example #5
0
 /* Function: IsSameTarget
  * Override to determine whether the two input targets are fundamentally the same.  Only primary identifying properties
  * should be compared, so two <SourceFolders> should return true if they point to the same folder, and secondary
  * properties such as <Name> and <Number> should be ignored.
  */
 public abstract bool IsSameTarget(InputBase other);