private static void _WriterSingleTable(DataTable dt, StringBuilder strb, GetValueMethod getvalue = null) { strb.Append($"<div><h4>{dt.TableName}</h4></div>"); //开始写表 strb.Append($"<table>"); //写入列标题 strb.Append($"<tr>"); foreach (System.Data.DataColumn dcol in dt.Columns) { strb.Append($"<td >{dcol.ColumnName}</td>"); } strb.Append($"</tr>"); var cols = dt.Columns; //写入数据行 foreach (System.Data.DataRow dr in dt.Rows) { strb.Append($"<tr>"); foreach (System.Data.DataColumn col in cols) { strb.Append($"<td>{getvalue(dr[col.ColumnName].ToString(), col)}</td>"); } strb.Append($"</tr>"); } strb.Append($"</table>"); }
/// <summary> /// /// </summary> /// <param name="dt"></param> /// <param name="getvalue">获取数据的方法</param> /// <returns></returns> public static string WriterSingleTable(DataTable dt, GetValueMethod getvalue = null) { getvalue = getvalue ?? GetValue; StringBuilder strb = new StringBuilder(); //开始写表 strb.Append($"<table>"); //写入列标题 strb.Append($"<tr>"); foreach (System.Data.DataColumn dcol in dt.Columns) { strb.Append($"<td >{dcol.ColumnName}</td>"); } strb.Append($"</tr>"); var cols = dt.Columns; //写入数据行 foreach (System.Data.DataRow dr in dt.Rows) { strb.Append($"<tr>"); foreach (System.Data.DataColumn col in cols) { strb.Append($"<td>{getvalue(dr[col.ColumnName].ToString(), col)}</td>"); } strb.Append($"</tr>"); } strb.Append($"</table>"); return(strb.ToString()); }
public PropertyMap(ISerializer serializer, PropertyDefinition propertyDefinition, ITypeMap typeMap, IEnumerable <string> availableFilters) { this.serializer = serializer; this.typeMap = typeMap is IContentTypeMap contentTypeMap && propertyDefinition.Content.UseXop ? contentTypeMap.GetOptimizedContentTypeMap() : typeMap; Definition = propertyDefinition; getValueMethod = Definition.PropertyInfo.CreateGetValueMethod(); setValueMethod = Definition.PropertyInfo.CreateSetValueMethod(); if (availableFilters == null) { return; } foreach (var availableFilter in availableFilters.Where(f => Definition.DeclaringTypeDefinition.Type.IsFilterableField(Definition.RuntimeName, f))) { filters.Add(availableFilter); } }
public void SetValue_GetValue_KnownCoseHeaderLabel(SetValueMethod setMethod, GetValueMethod getMethod) { var map = new CoseHeaderMap(); SetValue(map, CoseHeaderLabel.Algorithm, (int)ECDsaAlgorithm.ES256, setMethod); if (setMethod != SetValueMethod.AddShortcut) { SetEncodedValue(map, CoseHeaderLabel.CriticalHeaders, GetDummyCritHeaderValue(), setMethod); } SetValue(map, CoseHeaderLabel.ContentType, ContentTypeDummyValue, setMethod); SetValue(map, CoseHeaderLabel.KeyIdentifier, s_sampleContent, setMethod); Assert.Equal((int)ECDsaAlgorithm.ES256, GetValue <int>(map, CoseHeaderLabel.Algorithm, getMethod)); if (getMethod != GetValueMethod.GetValueShortcut) { AssertExtensions.SequenceEqual(GetDummyCritHeaderValue(), GetEncodedValue(map, CoseHeaderLabel.CriticalHeaders, getMethod)); } Assert.Equal(ContentTypeDummyValue, GetValue <string>(map, CoseHeaderLabel.ContentType, getMethod)); AssertExtensions.SequenceEqual(s_sampleContent, GetValue <byte[]>(map, CoseHeaderLabel.KeyIdentifier, getMethod)); }
public StructListProperty(string name, GetValueMethod getValue, SetValueMethod setValue, CreateInstanceMethod createInstance = null) : base(name, getValue, setValue) { m_CreateInstanceMethod = createInstance ?? DefaultCreateInstance; }
public void SetEncodedValue_GetEncodedValue_KnownCoseHeaderLabel(int knownHeader, byte[] encodedValue, SetValueMethod setMethod, GetValueMethod getMethod) { var map = new CoseHeaderMap(); var label = new CoseHeaderLabel(knownHeader); SetEncodedValue(map, label, encodedValue, setMethod); ReadOnlySpan <byte> returnedEncocedValue = GetEncodedValue(map, label, getMethod); AssertExtensions.SequenceEqual(encodedValue, returnedEncocedValue); }
public ValueClassProperty(string name, GetValueMethod getValue, SetValueMethod setValue) : base(name, getValue, setValue) { }
public EnumListProperty(string name, GetValueMethod getValue, SetValueMethod setValue, CreateInstanceMethod createInstance = null) : base(name, getValue, setValue, createInstance) { Assert.IsTrue(typeof(TItem).IsEnum); }
public StructContainerProperty(string name, GetValueMethod getValue, SetValueMethod setValue) : base(name, getValue, setValue) { }
protected DelegateValueClassPropertyBase(string name, GetValueMethod getValue, SetValueMethod setValue) : base(name) { m_GetValue = getValue; m_SetValue = setValue; }
/// <summary> /// /// </summary> /// <param name="dts"></param> /// <param name="title"></param> /// <param name="getvalue">获取数据的方法</param> /// <returns></returns> public static string WriterTableArray(System.Data.DataTable[] dts, string title, GetValueMethod getvalue = null) { getvalue = getvalue ?? GetValue; StringBuilder strb = new StringBuilder(); //写入网页标题 strb.Append($@"<!DOCTYPE html><html><head> <title>{title}</title> <style> div{{text-align:center}} table{{border-collapse:collapse;border-spacing:0;border-left:1px solid #888;border-top:1px solid #888;background:#efefef;width:100%;margin:0 auto; }} table tr:first-child{{text-align:center}} th,td{{border-right:1px solid #888;border-bottom:1px solid #888;padding:5px 15px;word-break:break-all}} th{{font-weight:bold;background:#ccc}} </style> </head><body>"); //写标题 strb.Append($"<div><h2>{title}</h2></div>"); foreach (var dt in dts) { _WriterSingleTable(dt, strb, getvalue); strb.Append("<br/><br/><br/>"); } strb.Append($@"</body></html>"); return(strb.ToString()); }
/// <summary> /// /// </summary> /// <param name="dt"></param> /// <param name="title"></param> /// <param name="size"></param> /// <param name="maxszie"></param> /// <param name="minsize"></param> /// <param name="getvalue">获取数据的方法</param> /// <returns></returns> public static string WriterTableInfo(System.Data.DataTable dt, string title, int[] size, int maxszie = 0, int minsize = 0, GetValueMethod getvalue = null) { getvalue = getvalue ?? GetValue; StringBuilder strb = new StringBuilder(); size = size ?? new int[0]; //写入网页标题 strb.Append($@"<!DOCTYPE html><html><head> <title>{title}</title> <style> div{{text-align:center}} table{{border-collapse:collapse;border-spacing:0;border-left:1px solid #888;border-top:1px solid #888;background:#efefef;width:100%;margin:0 auto; {(minsize <= 0 ? "" : $"min-width:{minsize}px;")}{(maxszie <= 0 ? "" : $"max-width:{maxszie}px;")} }} table tr:first-child{{text-align:center}} th,td{{border-right:1px solid #888;border-bottom:1px solid #888;padding:5px 15px;word-break:break-all}} th{{font-weight:bold;background:#ccc}} </style> </head><body>"); //写标题 strb.Append($"<div><h2>{title}</h2></div>"); //开始写表 strb.Append($"<table>"); //写入列标题 strb.Append($"<tr>"); int index = 0; foreach (System.Data.DataColumn dcol in dt.Columns) { strb.Append($"<td {(size.Length < index + 1 ? "" : $"style=\"width:{size[index++]}px\"")}>{dcol.ColumnName}</td>"); } strb.Append($"</tr>"); var cols = dt.Columns; //写入数据行 foreach (System.Data.DataRow dr in dt.Rows) { strb.Append($"<tr>"); foreach (System.Data.DataColumn col in cols) { strb.Append($"<td>{getvalue(dr[col.ColumnName].ToString(), col)}</td>"); } strb.Append($"</tr>"); } strb.Append($"</table>"); strb.Append($@"</body></html>"); return(strb.ToString()); }
public TypeIdStructProperty(GetValueMethod getValue) : base("$TypeId", getValue, null) { }
public TypeIdClassProperty(GetValueMethod getValue) : base("$TypeId", getValue, null) { }
public StructMutableContainerListProperty(string name, GetValueMethod getValue, SetValueMethod setValue, CreateInstanceMethod createInstanceMethod = null) : base(name, getValue, setValue, createInstanceMethod) { }
public StructValueStructProperty(string name, GetValueMethod getValue, SetValueMethod setValue, GetValueRefMethod getValueRef) : base(name, getValue, setValue) { Assert.IsNotNull(getValueRef); m_GetValueRef = getValueRef; }
public Property(string name, GetValueMethod getValue, SetValueMethod setValue) : this(name) { m_GetValue = getValue; m_SetValue = setValue; }
public ClassValueStructProperty(string name, GetValueMethod getValue, SetValueMethod setValue) : base(name, getValue, setValue) { }
public StructMutableContainerProperty(string name, GetValueMethod getValue, SetValueMethod setValue, RefAccessMethod refAccess) : base(name, getValue, setValue) { RefAccess = refAccess; }
public StructEnumProperty(string name, GetValueMethod getValue, SetValueMethod setValue) : base(name, getValue, setValue) { }