public override string GetTipString() { var type = GetType(); var fields = type.GetFields(); StringBuilder sb = new StringBuilder(); var color = GameStaticData.ITEM_COLOR_DICT[(ItemLevel)type.GetField("物品阶级").GetValue(this)].ToHtmlString(); System.Collections.Generic.SortedDictionary <int, string> dict = new System.Collections.Generic.SortedDictionary <int, string>(); foreach (var field in fields) { var tip_attribute = field.GetCustomAttribute(typeof(TipAttribute)); if (tip_attribute != null) { var attribute = (tip_attribute as TipAttribute); var valueStr = DreamerTool.Util.DreamerUtil.GetColorRichText(field.GetValue(this).ToString(), attribute.index == 2 || attribute.index == 1 ? color : attribute.valueColor); dict.Add(attribute.index, field.Name + ": " + valueStr + "\n"); } } foreach (var item in dict) { if (item.Key < 3) { sb.Append("\t\t\t\t\t"); } if (item.Key == 3) { sb.Append("\n"); } sb.Append(item.Value); } return(sb.ToString()); }
public static void SetParser(Version version, ParserFunction parser) { if (Parsers.ContainsKey(version)) { Parsers[version] = parser; } else { Parsers.Add(version, parser); } }
// //createListElement // private static void createListElement( ref System.Xml.XmlDocument pdoc, string pname, string pcore, System.Collections.Generic.List <pvMetadata.ListtemplateContenttype> ptypestable, System.Collections.Generic.List <pvMetadata.ListtemplateColumn> pfieldstable) { // // Insert ContentTypeRef // System.Xml.XmlNode contenttypes = pdoc.SelectSingleNode("//mha:List/mha:MetaData/mha:ContentTypes", s_nsMgr); foreach (ListtemplateContenttype typ in ptypestable) { string ContentTypeID; switch (typ.BasedOn) { case "Element": ContentTypeID = "0x01" + "00" + typ.typeGUID; break; case "Annoncering": ContentTypeID = "0x0104" + "00" + typ.typeGUID; break; case "Hyperlink": ContentTypeID = "0x0105" + "00" + typ.typeGUID; break; case "'Kontaktperson": ContentTypeID = "0x0106" + "00" + typ.typeGUID; break; case "'Meddelelse": ContentTypeID = "0x0107" + "00" + typ.typeGUID; break; case "'Opgave": ContentTypeID = "0x0108" + "00" + typ.typeGUID; break; case "'Problem": ContentTypeID = "0x0103" + "00" + typ.typeGUID; break; default: ContentTypeID = "Error" + "00" + typ.typeGUID; break; } System.Xml.XmlElement contenttyperef = pdoc.CreateElement("", "ContentTypeRef", s_ns); System.Xml.XmlComment contenttypescomment = pdoc.CreateComment(typ.SysName); contenttyperef.SetAttribute("ID", ContentTypeID); System.Xml.XmlNode ContentTypeRef0x01 = pdoc.SelectSingleNode("//mha:List/mha:MetaData/mha:ContentTypes/mha:ContentTypeRef[@ID=\"0x01\"]", s_nsMgr); if (ContentTypeRef0x01 == null) { System.Xml.XmlNode lastContentTypeRef = contenttypes.AppendChild(contenttyperef); contenttypes.InsertBefore(contenttypescomment, lastContentTypeRef); } else { System.Xml.XmlNode Folder = pdoc.SelectSingleNode("//mha:List/mha:MetaData/mha:ContentTypes/mha:ContentTypeRef[@ID=\"0x01\"]/mha:Folder", s_nsMgr); if (Folder != null) { System.Xml.XmlNode copyFolder = Folder.CloneNode(true); contenttyperef.AppendChild(copyFolder); } contenttypes.InsertBefore(contenttypescomment, ContentTypeRef0x01); contenttypes.ReplaceChild(contenttyperef, ContentTypeRef0x01); } } System.Collections.Generic.SortedDictionary <string, ListtemplateColumn> scol = new System.Collections.Generic.SortedDictionary <string, ListtemplateColumn>(); foreach (ListtemplateColumn col in pfieldstable) { scol.Add(col.Seqnr, col); } // // Insert Field in Fields // System.Xml.XmlNode fields = pdoc.SelectSingleNode("//mha:List/mha:MetaData/mha:Fields", s_nsMgr); foreach (ListtemplateColumn col in scol.Values) { if (!col.SysCol) { System.Xml.XmlElement fieldref = pdoc.CreateElement("", "Field", s_ns); fieldref.SetAttribute("Name", col.SysName); fieldref.SetAttribute("ID", col.colGUID); fieldref.SetAttribute("DisplayName", "$Resources:" + pcore + "," + col.SysName + ";"); switch (col.KolonneType) { case "Text": fieldref.SetAttribute("Type", "Text"); break; case "Note": fieldref.SetAttribute("Type", "Note"); fieldref.SetAttribute("NumLines", "3"); fieldref.SetAttribute("RichText", "TRUE"); break; case "Choice": fieldref.SetAttribute("Type", "Choice"); break; case "Number": fieldref.SetAttribute("Type", "Number"); fieldref.SetAttribute("Decimals", "0"); break; case "Percentage": fieldref.SetAttribute("Type", "Number"); fieldref.SetAttribute("Percentage", "TRUE"); fieldref.SetAttribute("Min", "0"); fieldref.SetAttribute("Max", "1"); break; case "Currency": fieldref.SetAttribute("Type", "Currency"); fieldref.SetAttribute("Decimals", "2"); break; case "DateOnly": fieldref.SetAttribute("Type", "DateTime"); fieldref.SetAttribute("Format", "DateOnly"); break; case "DateTime": fieldref.SetAttribute("Type", "DateTime"); break; case "Boolean": fieldref.SetAttribute("Type", "Boolean"); break; case "Counter": fieldref.SetAttribute("Type", "Counter"); break; case "Picture": fieldref.SetAttribute("Type", "Picture"); break; case "Hyperlink": fieldref.SetAttribute("Type", "Hyperlink"); break; default: break; } fields.AppendChild(fieldref); } } // // Insert FieldsRef in ViewFields // System.Xml.XmlNode viewfields = pdoc.SelectSingleNode("//mha:List/mha:MetaData/mha:Views/mha:View[@BaseViewID=\"1\"]/mha:ViewFields", s_nsMgr); foreach (ListtemplateColumn col in scol.Values) { if (!col.SysCol) { System.Xml.XmlElement fieldref = pdoc.CreateElement("", "FieldRef", s_ns); fieldref.SetAttribute("ID", col.colGUID); fieldref.SetAttribute("Name", col.SysName); viewfields.AppendChild(fieldref); } } }