override public void resolveText(DataProcessor dproc, ValueScaler valueScaler) { base.resolveText(dproc, valueScaler); if (resolvedText != null) { if (strftime) { long timeStamp = dproc.getTimestamps(SrcName)[0]; DateTime dt = Util.ConvertToDateTime(timeStamp); resolvedText = string.Format("{0:yyyy}", dt);//dt.ToString(); } else { // Don't support old version GPRINT:vname:CF:format (deprecated) double value = dproc.getValues(SrcName)[0]; Regex regex = new Regex(UNIT_MARKER); Match matcher = regex.Match(resolvedText); // // ToDo: chek this up! // if (matcher.Groups.Count > 0) // { // // unit specified // Scaled scaled = valueScaler.scale(value, matcher.Groups[2].Value.CompareTo("s") == 0); // resolvedText = resolvedText.Substring(0, matcher.Index) + // matcher.Groups[1] + scaled.unit + resolvedText.Substring(matcher.Index + matcher.Length); // value = scaled.value; // } resolvedText = Util.sprintf(resolvedText, new object[] { value }); } trimIfGlue(); } }
override public void resolveText(DataProcessor dproc, ValueScaler valueScaler) { base.resolveText(dproc, valueScaler); if (resolvedText != null) { if (strftime) { long timeStamp = dproc.getTimestamps(SrcName)[0]; DateTime dt = Util.ConvertToDateTime(timeStamp); resolvedText = string.Format("{0:yyyy}",dt);//dt.ToString(); } else { // Don't support old version GPRINT:vname:CF:format (deprecated) double value = dproc.getValues(SrcName)[0]; Regex regex = new Regex(UNIT_MARKER); Match matcher = regex.Match(resolvedText); // // ToDo: chek this up! // if (matcher.Groups.Count > 0) // { // // unit specified // Scaled scaled = valueScaler.scale(value, matcher.Groups[2].Value.CompareTo("s") == 0); // resolvedText = resolvedText.Substring(0, matcher.Index) + // matcher.Groups[1] + scaled.unit + resolvedText.Substring(matcher.Index + matcher.Length); // value = scaled.value; // } resolvedText = Util.sprintf(resolvedText, new object[] { value }); } trimIfGlue(); } }
private void resolveTextElements() { ValueScaler valueScaler = new ValueScaler(gdef.scaleBase); foreach (CommentText comment in gdef.comments) { comment.resolveText(dproc, valueScaler); } }
public virtual void resolveText(DataProcessor dproc, ValueScaler valueScaler) { resolvedText = text; marker = ""; if (resolvedText != null) { foreach (String aMARKERS in MARKERS) { if (resolvedText.EndsWith(aMARKERS)) { marker = aMARKERS; resolvedText = resolvedText.Substring(0, resolvedText.Length - marker.Length); trimIfGlue(); break; } } } enabled = resolvedText != null; }