/** * Utility method to return the highlight color given a change version label */ internal string GetColorStringForChange(string versionLabel) { Table table = GetChangeLog(); string color = Strings.HighlightColorNone; string tempVersionStampFix; //string pattern = "[a-zA-Z-]+"; //string replacement = ""; //Regex rgx = new Regex(pattern); //DateTime revisionDate;//from old style highlight fomratting DateTime date; if (versionLabel == null || versionLabel == "") { return(color); } versionLabel = Common.CleanupVersionLabel(versionLabel);//JDK ORIG //versionLabel = GetValidVersionString(table, Common.CleanupVersionLabel(versionLabel));//JDK added some extra validation; if (Common.ForcedStringVersionToDouble(versionLabel) > Common.ForcedStringVersionToDouble(GetLastChangeVersion())) { return(color); } //JDK This check will catch any fields with dates still in the hidden stamp fields if (versionLabel.Contains("/") && DateTime.TryParse(versionLabel, out date)) { tempVersionStampFix = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(date); //versionLabel = tempVersionStampFix; versionLabel = GetValidVersionString(table, tempVersionStampFix);//JDK added some extra validation //versionLabel = rgx.Replace(tempVersionStampFix, replacement); //return GetColorStringForChange(date);//will only do this for backward compatibility support } for (int r = 0; r < table.GetNumRows(); r++) { double decimalVal = 0; String revisionVersion = table.GetData(r, (int)TableColumns.ChangeLog.Version); decimalVal = Common.ForcedStringVersionToDouble(revisionVersion); if (decimalVal != 0) { if (decimalVal > Common.ForcedStringVersionToDouble(versionLabel)) { return(color); } else { color = table.GetData(r, (int)TableColumns.ChangeLog.Highlight); } } } return(color); }
public static void RedoAllHiddenPromptMarkers() { //the start step has globals and default confirmation prompts that must be modified as well Shadow startStep = PathMaker.LookupStartShadow(); ChangeLogShadow changeLogShadow = PathMaker.LookupChangeLogShadow(); DateTime triggerDate; DateTime.TryParse(Strings.StampFormatChangeDate, out triggerDate); //Common.WarningMessage("changeLogShadow.GetLastChangeDate() = " + changeLogShadow.GetLastChangeDate()); if ((startStep != null) && (changeLogShadow.GetLastChangeDate() <= triggerDate)) { string tmpAlertMsg = "* * * ALERT - CHANGE TRACKING FORMATS WILL BE UPDATED! * * *" + "\r\n\r\nHidden date stamps will now use version numbers instead." + "\r\n\r\nThis makes it INCOMPATIBLE with older versions of PathMaker." + "\r\n\r\nAdd a new Revision History line for this file update process with NO HIGHLIGHT COLOR." + " Then select SAVE AS and create a new .VUI file once the table update is complete." + " You may then add a new Revision Histroy record to begin documenting your design changes with highlights." + " Old colors should be fine if left on during this update process."; Common.WarningMessage(tmpAlertMsg); //scrub the version stamps in the ChangeLogShadow before any other processing takes place - we do not want any aplhas in the version strings for float comparisons later Table table = changeLogShadow.GetChangeLog(); String lastVersionStamp = ""; string tempScrubbedVer = ""; Boolean versionStampsUpdated = false; for (int r = 0; r < table.GetNumRows(); r++) { lastVersionStamp = table.GetData(r, (int)TableColumns.ChangeLog.Version); tempScrubbedVer = Common.CleanupVersionLabel(lastVersionStamp); if (!tempScrubbedVer.Equals(lastVersionStamp)) { table.SetData(r, (int)TableColumns.ChangeLog.Version, tempScrubbedVer); versionStampsUpdated = true; } } if (versionStampsUpdated) { changeLogShadow.SetChangeLog(table); } startStep.RedoHiddenDateMarkers(); List <Shadow> shadowList = PathMaker.LookupAllShadows(); //JDK added this to update old diagrams with hidden date stamps to new version stamp format foreach (Shadow s in shadowList) { StateShadow stateShadow = s as StateShadow; if (stateShadow != null && (stateShadow.GetShapeType().Equals(ShapeTypes.Play) || stateShadow.GetShapeType().Equals(ShapeTypes.Interaction))) { stateShadow.RedoHiddenDateMarkers(stateShadow); //Common.WarningMessage("Skipping RedoHiddenDateMarkers"); } if (stateShadow != null && (stateShadow.GetShapeType().Equals(ShapeTypes.Decision) || stateShadow.GetShapeType().Equals(ShapeTypes.Data))) { StateWithTransitionShadow stateTranShadow = s as StateWithTransitionShadow; //Common.WarningMessage("Starting RedoHiddenDateMarkers for Decision or Data State:" + stateTranShadow.GetStateId()); stateTranShadow.RedoHiddenDateMarkers(stateTranShadow); } } } }