protected void SaveImageFolder(Targets.ImageFolder target, BinaryFile output) { // [String: Identifier="Image Folder"] // [String: Absolute Path] // [String: Number] output.WriteString("Image Folder"); output.WriteString(target.Folder); output.WriteInt32(target.Number); }
protected void LoadImageFolder() { // [String: Absolute Path] // [Int32: Number] var target = new Targets.ImageFolder(PropertySource.PreviousRun); target.Folder = binaryFile.ReadString(); target.FolderPropertyLocation = PropertySource.PreviousRun; target.Number = binaryFile.ReadInt32(); target.NumberPropertyLocation = PropertySource.PreviousRun; projectConfig.InputTargets.Add(target); }
/* Function: AppendImageFolder * Appends an image folder target and all its settings to the StringBuilder. */ protected void AppendImageFolder(Targets.ImageFolder target, StringBuilder output, Path projectFolder) { if (target.PropertyLocation.Source == PropertySource.SystemDefault) { return; } output.Append("Image Folder"); if (target.NumberPropertyLocation.IsDefined && target.NumberPropertyLocation.Source != PropertySource.SystemDefault && target.Number != 1) { output.Append(" " + target.Number); } output.Append(": "); Path relativePath = target.Folder.MakeRelativeTo(projectFolder); output.AppendLine((relativePath != null ? relativePath : target.Folder)); }
/* Function: GetTargetHeader * If the passed identifier starts a target like "Source Folder", adds a new target for it in <projectConfig> and returns true. If * it is a recognized target header but there is a syntax error in the value, it will add an error to <errorList> and still return true. * It only returns false for unrecognized identifiers. */ protected bool GetTargetHeader(string lcIdentifier, string value, PropertyLocation propertyLocation, out Target newTarget) { // Source folder System.Text.RegularExpressions.Match match = sourceFolderRegex.Match(lcIdentifier); if (match.Success) { var target = new Targets.SourceFolder(propertyLocation); target.Folder = value; target.FolderPropertyLocation = propertyLocation; if (target.Folder.IsRelative) { target.Folder = propertyLocation.FileName.ParentFolder + "/" + target.Folder; } int number = 0; if (int.TryParse(match.Groups[1].Value, out number)) { target.Number = number; target.NumberPropertyLocation = propertyLocation; } projectConfig.InputTargets.Add(target); newTarget = target; return(true); } // Image folder match = imageFolderRegex.Match(lcIdentifier); if (match.Success) { var target = new Targets.ImageFolder(propertyLocation); target.Folder = value; target.FolderPropertyLocation = propertyLocation; if (target.Folder.IsRelative) { target.Folder = propertyLocation.FileName.ParentFolder + "/" + target.Folder; } int number = 0; if (int.TryParse(match.Groups[1].Value, out number)) { target.Number = number; target.NumberPropertyLocation = propertyLocation; } projectConfig.InputTargets.Add(target); newTarget = target; return(true); } // HTML output folder else if (htmlOutputFolderRegex.IsMatch(lcIdentifier)) { var target = new Targets.HTMLOutputFolder(propertyLocation); target.Folder = value; target.FolderPropertyLocation = propertyLocation; if (target.Folder.IsRelative) { target.Folder = propertyLocation.FileName.ParentFolder + "/" + target.Folder; } projectConfig.OutputTargets.Add(target); newTarget = target; return(true); } // Ignored source folder else if (ignoredSourceFolderRegex.IsMatch(lcIdentifier)) { var target = new Targets.IgnoredSourceFolder(propertyLocation); target.Folder = value; target.FolderPropertyLocation = propertyLocation; if (target.Folder.IsRelative) { target.Folder = propertyLocation.FileName.ParentFolder + "/" + target.Folder; } projectConfig.FilterTargets.Add(target); newTarget = target; return(true); } // Ignored source folder pattern else if (ignoredSourceFolderPatternRegex.IsMatch(lcIdentifier)) { var target = new Targets.IgnoredSourceFolderPattern(propertyLocation); target.Pattern = value; target.PatternPropertyLocation = propertyLocation; projectConfig.FilterTargets.Add(target); newTarget = target; return(true); } else { newTarget = null; return(false); } }
public ImageFolder(ImageFolder toCopy) : base(toCopy) { folder = toCopy.folder; folderPropertyLocation = toCopy.folderPropertyLocation; }