private static void AddSingleFormHtml(XmlNode node, StringBuilder builder, string label) { var lang = node.GetStringAttribute("lang"); builder.AppendFormat("<tr><td><span class='fieldLabel'>{0}</span><span class='langid'>{1}</span></td>", label, lang); if (node.InnerText.Trim().EndsWith(".wav")) { builder.AppendFormat("<td>(a sound file)</td></tr>"); } else { builder.AppendFormat("<td><span class='{0}'>{1}</span><br/></td></tr>", lang, node.InnerText); } }
// // public void WriteXml(XmlWriter writer) // { // writer.WriteStartElement("MergeSituation"); // writer.WriteAttributeString("PathToFileInRepository",this.PathToFileInRepository); // writer.WriteEndElement(); // } public static MergeSituation FromXml(XmlNode node) { var modeLabel = node.GetOptionalStringAttribute("conflictHandlingMode", string.Empty); MergeOrder.ConflictHandlingModeChoices mode; try { mode = (MergeOrder.ConflictHandlingModeChoices) Enum.Parse(typeof (MergeOrder.ConflictHandlingModeChoices), modeLabel); } catch (Exception) { mode = MergeOrder.ConflictHandlingModeChoices.Unknown; } //Note, we can't use the normal construtor, because it switches who is alpha/beta //depending on the conflict handling mode. We don't want to switch them again //when we're re-constituting the situation var situation = new MergeSituation(node.GetStringAttribute("path"), mode); situation.AlphaUserId = node.GetStringAttribute("alphaUserId"); situation.AlphaUserRevision = node.GetStringAttribute("alphaUserRevision"); situation.BetaUserId = node.GetStringAttribute("betaUserId"); situation.BetaUserRevision = node.GetStringAttribute("betaUserRevision"); return situation; }