public static XElement WriteDecelerationXML(Artifact item, DateTime AbsoluteStart) { Deceleration decItem = item.ArtifactData as Deceleration; int decelType = ArtifactsHelper.GetDecelType(item); var value = new XElement("event", new XAttribute("start", ((int)((item.StartTime - AbsoluteStart).TotalSeconds * 4)).ToString(CultureInfo.InvariantCulture)), new XAttribute("peak", ((int)((decItem.PeakTime - AbsoluteStart).TotalSeconds * 4)).ToString(CultureInfo.InvariantCulture)), new XAttribute("end", ((int)((item.EndTime - AbsoluteStart).TotalSeconds * 4)).ToString(CultureInfo.InvariantCulture)), new XAttribute("contraction", "-1"), new XAttribute("type", decelType.ToString()), new XAttribute("y1", "0.000"), new XAttribute("y2", "0.000")); return(value); }
public static string WriteDecelerationDAT(Artifact item, DateTime AbsoluteStart) { Deceleration decItem = item.ArtifactData as Deceleration; StringBuilder value = new StringBuilder(255); value.Append("EVT|"); /* 00 */ value.Append(ArtifactsHelper.GetDecelType(item).ToString(CultureInfo.InvariantCulture)); value.Append("|"); /* 01 */ value.Append(((int)((item.StartTime - AbsoluteStart).TotalSeconds * 4)).ToString(CultureInfo.InvariantCulture)); value.Append("|"); /* 02 */ value.Append(((int)((decItem.PeakTime - AbsoluteStart).TotalSeconds * 4)).ToString(CultureInfo.InvariantCulture)); value.Append("|"); /* 03 */ value.Append(((int)((item.EndTime - AbsoluteStart).TotalSeconds * 4)).ToString(CultureInfo.InvariantCulture)); value.Append("|"); /* 04 */ value.Append(string.Empty); // Y1 value.Append("|"); /* 05 */ value.Append(string.Empty); // Y2 value.Append("|"); /* 06 */ value.Append(decItem.ContractionStart.HasValue ? ((int)((decItem.ContractionStart.Value - AbsoluteStart).TotalSeconds * 4)).ToString(CultureInfo.InvariantCulture) : String.Empty); value.Append("|"); /* 07 */ value.Append("y"); // Final value.Append("|"); /* 08 */ value.Append(string.Empty); // Strikeout value.Append("|"); /* 09 */ value.Append(decItem.Confidence.ToString("0.000000", CultureInfo.InvariantCulture)); value.Append("|"); /* 10 */ value.Append(decItem.Repair.ToString("0.000000", CultureInfo.InvariantCulture)); value.Append("|"); /* 11 */ value.Append(decItem.Height.ToString("0.000000", CultureInfo.InvariantCulture)); value.Append("|"); /* 12 */ value.Append(string.Empty); // Baseline variability value.Append("|"); /* 13 */ value.Append(decItem.PeakValue.ToString("0.000000", CultureInfo.InvariantCulture)); value.Append("|"); /* 14 */ value.Append("|"); /* 15 */ if (decItem.DecelerationCategory.Equals("Variable")) { value.Append("y"); } value.Append("|"); /* 16 */ value.Append("-1"); // Lag value.Append("|"); /* 17 */ value.Append(ArtifactsHelper.GetDecelNonReassuring(item).ToString(CultureInfo.InvariantCulture)); value.Append("|"); /* 18 */ if (decItem.IsNonInterpretable) { value.Append("y"); } value.Append("|"); /* 19 */ value.Append(string.Empty); // Confirmed value.Append("|"); /* 20 */ value.Append(item.ArtifactData.Id.ToString(CultureInfo.InvariantCulture)); return(value.ToString()); }