本文整理汇总了C#中Tag类的典型用法代码示例。如果您正苦于以下问题:C# Tag类的具体用法?C# Tag怎么用?C# Tag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Tag类属于命名空间,在下文中一共展示了Tag类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Content
/*
* (non-Javadoc)
*
* @see
* com.itextpdf.tool.xml.ITagProcessor#content(com.itextpdf.tool.xml.Tag,
* java.util.List, com.itextpdf.text.Document, java.lang.String)
*/
public override IList<IElement> Content(IWorkerContext ctx, Tag tag, String content) {
List<Chunk> sanitizedChunks = HTMLUtils.Sanitize(content, false);
List<IElement> l = new List<IElement>(1);
foreach (Chunk sanitized in sanitizedChunks) {
HtmlPipelineContext myctx;
try {
myctx = GetHtmlPipelineContext(ctx);
} catch (NoCustomContextException e) {
throw new RuntimeWorkerException(e);
}
if (tag.CSS.ContainsKey(CSS.Property.TAB_INTERVAL)) {
TabbedChunk tabbedChunk = new TabbedChunk(sanitized.Content);
if (null != GetLastChild(tag) && GetLastChild(tag).CSS.ContainsKey(CSS.Property.XFA_TAB_COUNT)) {
tabbedChunk.TabCount = int.Parse(GetLastChild(tag).CSS[CSS.Property.XFA_TAB_COUNT]);
}
l.Add(GetCssAppliers().Apply(tabbedChunk, tag,myctx));
} else if (null != GetLastChild(tag) && GetLastChild(tag).CSS.ContainsKey(CSS.Property.XFA_TAB_COUNT)) {
TabbedChunk tabbedChunk = new TabbedChunk(sanitized.Content);
tabbedChunk.TabCount = int.Parse(GetLastChild(tag).CSS[CSS.Property.XFA_TAB_COUNT]);
l.Add(GetCssAppliers().Apply(tabbedChunk, tag, myctx));
} else {
l.Add(GetCssAppliers().Apply(sanitized, tag, myctx));
}
}
return l;
}
开发者ID:smartleos,项目名称:itextsharp,代码行数:33,代码来源:ParaGraph.cs
示例2: TestTag
public void TestTag()
{
Tag tag = new Tag();
tag.Initialize("tag", null, null);
Assert.AreEqual("tag", tag.Name);
Assert.AreEqual(string.Empty, tag.Render(new Context()));
}
开发者ID:Elph,项目名称:dotliquid,代码行数:7,代码来源:StandardTagTests.cs
示例3: MakeLayout
/// <summary>
/// Makes a layout from a layout guess.
/// </summary>
/// <param name="layout">The layout guess.</param>
/// <param name="name">The name of the final layout.</param>
/// <param name="groupTag">The group tag of the final layout. Can be <c>null</c>.</param>
/// <returns></returns>
public static TagLayout MakeLayout(TagLayoutGuess layout, string name, Tag groupTag)
{
var result = new TagLayout(name, layout.Size, groupTag);
var finalizer = new LayoutGuessFinalizer(result, 0);
finalizer.ProcessLayout(layout);
return result;
}
开发者ID:medsouz,项目名称:HaloOnlineTagTool,代码行数:14,代码来源:LayoutGuessFinalizer.cs
示例4: OnTagDeleted
public void OnTagDeleted(Tag tag)
{
if (TagDeleted != null)
{
TagDeleted(new SingleItemEventArgs<Tag>(tag));
}
}
开发者ID:Steinerd,项目名称:BetterCMS,代码行数:7,代码来源:TagEvents.cs
示例5: Process
public override string Process(Tag tag)
{
if (tag == null) return "";
float size = 0.0f;
bool do_not_process = false;
if (tag.Attributes.ContainsKey("")) {
try {
size = float.Parse(tag.Attributes[""]);
}
catch (System.FormatException) {
do_not_process = true;
}
}
else {
do_not_process = true;
}
if (size == 0.0) {
do_not_process = true;
}
if (do_not_process == true) {
return tag.Content;
}
else {
return "<span style=\"font-size:" + size + "pt;\">" + tag.Content + "</span>";
}
}
开发者ID:kmerenkov,项目名称:bbdiese,代码行数:26,代码来源:size.cs
示例6: SetUp
virtual public void SetUp() {
parent = new Tag("body");
parent.CSS[CSS.Property.FONT_FAMILY] = "Helvetica";
parent.CSS[CSS.Property.FONT_SIZE] = "12pt";
first = new Tag(null);
first.CSS[CSS.Property.FONT_FAMILY] = "Helvetica";
first.CSS[CSS.Property.FONT_SIZE] = "12pt";
second = new Tag(null);
second.CSS[CSS.Property.FONT_FAMILY] = "Helvetica";
second.CSS[CSS.Property.FONT_SIZE] = "12pt";
child = new Tag(null);
child.CSS[CSS.Property.FONT_FAMILY] = "Helvetica";
child.CSS[CSS.Property.FONT_SIZE] = "12pt";
parent.AddChild(first);
first.Parent = parent;
second.Parent = parent;
first.AddChild(child);
second.AddChild(child);
parent.CSS[CSS.Property.FONT_SIZE] = fst.TranslateFontSize(parent) + "pt";
first.CSS[CSS.Property.FONT_SIZE] = fst.TranslateFontSize(first) + "pt";
first.CSS[CSS.Property.TEXT_ALIGN] = CSS.Value.LEFT;
second.CSS[CSS.Property.FONT_SIZE] = fst.TranslateFontSize(second) + "pt";
child.CSS[CSS.Property.FONT_SIZE] = fst.TranslateFontSize(child) + "pt";
firstPara = new Paragraph(new Chunk("default text for chunk creation"));
secondPara = new Paragraph(new Chunk("default text for chunk creation"));
configuration = new HtmlPipelineContext(null);
applier.Apply(firstPara, first, configuration);
}
开发者ID:jagruti23,项目名称:itextsharp,代码行数:29,代码来源:ParagraphCssApplierTest.cs
示例7: End
public override IList<IElement> End(IWorkerContext ctx, Tag tag, IList<IElement> currentContent)
{
if (currentContent.Count > 0)
{
IDictionary<string, string> attributes = tag.Attributes;
var retval = base.End(ctx, tag, currentContent);
foreach (PdfPTable table in retval.OfType<PdfPTable>())
{
if (attributes.ContainsKey("summary") && attributes.ContainsKey("caption"))
{
table.SetAccessibleAttribute(PdfName.SUMMARY, new PdfString(attributes["summary"].ToString()));
table.SetAccessibleAttribute(PdfName.CAPTION, new PdfString(attributes["caption"].ToString()));
table.KeepRowsTogether(0);
}
else
{
throw new Exception("Table is missing attributes. Summary and Caption must be available.");
}
}
return retval;
}
return new List<IElement>();
}
开发者ID:sensusaps,项目名称:RoboBraille.Web.API,代码行数:27,代码来源:TableTagProcessor.cs
示例8: TagLayout
/// <summary>
/// Creates a tag layout with a name, a size in bytes, and a group tag.
/// </summary>
/// <param name="name">The name of the layout.</param>
/// <param name="size">The size of the layout.</param>
/// <param name="groupTag">The group tag.</param>
public TagLayout(string name, uint size, Tag groupTag)
{
Name = name;
Size = size;
GroupTag = groupTag;
Fields = _fields.AsReadOnly();
}
开发者ID:medsouz,项目名称:HaloOnlineTagTool,代码行数:13,代码来源:TagLayout.cs
示例9: FindGameObjectsWithTags
public static GameObject[] FindGameObjectsWithTags(Tag[] searchTags)
{
List<GameObject> searchResult = new List<GameObject> ();
foreach (MultiTags taggedObject in taggedObjects) {
bool tagsFound = true;
foreach(Tag searchTag in searchTags) {
bool tagFound = false;
foreach(Tag objectTag in taggedObject.tags) {
if(objectTag == searchTag) {
tagFound = true;
break;
}
}
if (!tagFound) {
tagsFound = false;
break;
}
}
if (tagsFound) {
searchResult.Add(taggedObject.gameObject);
}
}
return searchResult.ToArray();
}
开发者ID:aiden-deloryn,项目名称:ARAirHockey,代码行数:30,代码来源:MultiTags.cs
示例10: SomeTests
public void SomeTests()
{
Tag t1 = new Tag (null, 1, "tag1");
Tag t2 = new Tag (null, 2, "tag2");
Tag t3 = new Tag (null, 3, "tag3");
Tag t4 = new Tag (null, 4, "tag4");
Tag t5 = new Tag (null, 5, "tag5");
TagTerm tt1 = new TagTerm (t1);
TagTerm tt2 = new TagTerm (t2);
TagTerm tt3 = new TagTerm (t3);
TagTerm tt4 = new TagTerm (t4);
TagTerm tt5 = new TagTerm (t5);
object [] tests = {
" (photos.id IN (SELECT photo_id FROM photo_tags WHERE tag_id = 1)) ", tt1,
" (photos.id IN (SELECT photo_id FROM photo_tags WHERE tag_id IN (2, 3))) ", new OrTerm (tt2, tt3),
" (photos.id IN (SELECT photo_id FROM photo_tags WHERE tag_id IN (3, 4, 5))) ", new OrTerm (tt3, tt4, tt5),
};
for (int i=0; i < tests.Length; i+=2) {
//System.Console.WriteLine ((tests[i+1] as LogicalTerm).SqlClause ());
//System.Console.WriteLine (tests[i]);
Assert.AreEqual (tests[i] as string, (tests[i+1] as LogicalTerm).SqlClause ());
}
}
开发者ID:Yetangitu,项目名称:f-spot,代码行数:27,代码来源:LogicalTermTests.cs
示例11: Tag
public static IEnumerable<News> Tag(this IEnumerable<News> news, Tag tag)
{
Assertion.NotNull(news);
Assertion.NotNull(tag);
return news.Where(it => it != null && it.Tags.Contains(tag));
}
开发者ID:prokhor-ozornin,项目名称:Catharsis.NET.Domain,代码行数:7,代码来源:NewsExtensions.cs
示例12: End
/* (non-Javadoc)
* @see com.itextpdf.tool.xml.ITagProcessor#endElement(com.itextpdf.tool.xml.Tag, java.util.List, com.itextpdf.text.Document)
*/
public override IList<IElement> End(IWorkerContext ctx, Tag tag, IList<IElement> currentContent) {
TableRowElement row = null;
IList<IElement> l = new List<IElement>(1);
if (Util.EqualsIgnoreCase(tag.Parent.Name, HTML.Tag.THEAD)) {
row = new TableRowElement(currentContent, TableRowElement.Place.HEADER);
} else if (Util.EqualsIgnoreCase(tag.Parent.Name, HTML.Tag.TBODY)) {
row = new TableRowElement(currentContent, TableRowElement.Place.BODY);
} else if (Util.EqualsIgnoreCase(tag.Parent.Name, HTML.Tag.TFOOT)) {
row = new TableRowElement(currentContent, TableRowElement.Place.FOOTER);
} else {
row = new TableRowElement(currentContent, TableRowElement.Place.BODY);
}
int direction = GetRunDirection(tag);
if (direction != PdfWriter.RUN_DIRECTION_DEFAULT) {
foreach (HtmlCell cell in row.Content) {
if (cell.RunDirection == PdfWriter.RUN_DIRECTION_DEFAULT) {
cell.RunDirection = direction;
}
}
}
l.Add(row);
return l;
}
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:29,代码来源:TableRow.cs
示例13: Apply
/* (non-Javadoc)
* @see com.itextpdf.tool.xml.css.CssApplier#apply(com.itextpdf.text.Element, com.itextpdf.tool.xml.Tag)
*/
virtual public LineSeparator Apply(LineSeparator ls, Tag t, IPageSizeContainable psc) {
float lineWidth = 1;
IDictionary<String, String> css = t.CSS;
if (css.ContainsKey(CSS.Property.HEIGHT)) {
lineWidth = CssUtils.GetInstance().ParsePxInCmMmPcToPt(css[CSS.Property.HEIGHT]);
}
ls.LineWidth = lineWidth;
BaseColor lineColor = BaseColor.BLACK;
if (css.ContainsKey(CSS.Property.COLOR)) {
lineColor = HtmlUtilities.DecodeColor(css[CSS.Property.COLOR]);
} else if (css.ContainsKey(CSS.Property.BACKGROUND_COLOR)) {
lineColor = HtmlUtilities.DecodeColor(css[CSS.Property.BACKGROUND_COLOR]);
}
ls.LineColor = lineColor;
float percentage = 100;
String widthStr;
css.TryGetValue(CSS.Property.WIDTH, out widthStr);
if (widthStr != null) {
if (widthStr.Contains("%")) {
percentage = float.Parse(widthStr.Replace("%", ""), CultureInfo.InvariantCulture);
} else {
percentage = (CssUtils.GetInstance().ParsePxInCmMmPcToPt(widthStr)/psc.PageSize.Width)*100;
}
}
ls.Percentage = percentage;
ls.Offset = 9;
return ls;
}
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:31,代码来源:LineSeparatorCssApplier.cs
示例14: AddsNamespaceToOutput
public void AddsNamespaceToOutput(Namespaces namespaces, Tag tag)
{
sut.UseNamespaces(namespaces);
sut.WriteStartTagFor(tag);
Assert.Equal($"<{tag} {namespaces}>", sut.ToString());
}
开发者ID:baks,项目名称:Simple.Xml,代码行数:7,代码来源:StringXmlBuilderTests.cs
示例15: LoadFromStream
public static Tag LoadFromStream(Stream stream)
{
BinaryReader binaryReader = new BinaryReader(stream);
Tag tag = new Tag();
tag.ID = binaryReader.ReadByte();
byte b;
uint size;
b = binaryReader.ReadByte();
if (b < 0x80)
{
size = b;
}
else if (b == 0xFF)
{
size = binaryReader.ReadUInt32();
}
else
{
size = ((uint)b & 0x7F) << 8;
b = binaryReader.ReadByte();
size |= b;
}
tag.Data = binaryReader.ReadBytes((int)size);
return tag;
}
开发者ID:SlyvanGames,项目名称:ps2ls,代码行数:34,代码来源:Adr.cs
示例16: End
/* (non-Javadoc)
* @see com.itextpdf.tool.xml.ITagProcessor#endElement(com.itextpdf.tool.xml.Tag, java.util.List, com.itextpdf.text.Document)
*/
public override IList<IElement> End(IWorkerContext ctx, Tag tag, IList<IElement> currentContent) {
List<IElement> l = new List<IElement>(1);
if (currentContent.Count > 0) {
IList<IElement> currentContentToParagraph = CurrentContentToParagraph(currentContent, true, true, tag, ctx);
foreach (IElement p in currentContentToParagraph) {
((Paragraph) p).Role = (getHeaderRole(GetLevel(tag)));
}
ParentTreeUtil pt = new ParentTreeUtil();
try {
HtmlPipelineContext context = GetHtmlPipelineContext(ctx);
bool oldBookmark = context.AutoBookmark();
if (pt.GetParentTree(tag).Contains(HTML.Tag.TD))
context.AutoBookmark(false);
if (context.AutoBookmark()) {
Paragraph title = new Paragraph();
foreach (IElement w in currentContentToParagraph) {
title.Add(w);
}
l.Add(new WriteH(context, tag, this, title));
}
context.AutoBookmark(oldBookmark);
} catch (NoCustomContextException e) {
if (LOGGER.IsLogging(Level.ERROR)) {
LOGGER.Error(LocaleMessages.GetInstance().GetMessage(LocaleMessages.HEADER_BM_DISABLED), e);
}
}
l.AddRange(currentContentToParagraph);
}
return l;
}
开发者ID:yu0410aries,项目名称:itextsharp,代码行数:37,代码来源:Header.cs
示例17: Execute
/// <summary>
/// Executes the disconnect command by sending the closing stream tag and closing the socket.
/// </summary>
/// <param name="data">
/// No <see cref="Tag"/> needed so we pass null.
/// </param>
public override void Execute(Tag data = null)
{
if (ProtocolState.Socket.Connected)
{
ProtocolState.Socket.Write("</stream:stream>");
}
}
开发者ID:Coselding,项目名称:xmpp,代码行数:13,代码来源:DisconnectState.cs
示例18: Execute
/// <summary>
///
/// </summary>
/// <param name="data">
/// A <see cref="object"/>
/// </param>
public override void Execute(Tag data = null)
{
if (data != null && data.LocalName != "proceed") return;
ProtocolState.Socket.StartSecure();
ProtocolState.State = new ConnectedState();
ProtocolState.State.Execute();
}
开发者ID:nairaner,项目名称:xmpp,代码行数:13,代码来源:StartTLSState.cs
示例19: CreateButton_Click
private void CreateButton_Click(object sender, RoutedEventArgs e)
{
(Application.Current.RootVisual as MainPage).ClearStatus();
Tag task = new Tag()
{
Label = txtNewTag.Text.Trim()
};
TaskrAdminClient proxy =
new TaskrAdminClient(
new SaaSGridSilverlightCustomBinding(new SaaSGridContextInspector()),
new EndpointAddress(App.Current.Host.InitParams["taskrAdminAddress"])
);
proxy.SaveTagCompleted +=
(object s, SaveTagCompletedEventArgs args) =>
{
if (null == args.Error)
{
BindTagList();
(Application.Current.RootVisual as MainPage).SetStatus("Tag saved successfully.", MainPage.MessageStatus.Success);
}
else
{
(Application.Current.RootVisual as MainPage).SetStatus(args.Error.Message, MainPage.MessageStatus.Error);
}
};
proxy.SaveTagAsync(task);
}
开发者ID:ggros,项目名称:SilverTaskR,代码行数:30,代码来源:Admin.xaml.cs
示例20: Start
/*
* (non-Javadoc)
*
* @see com.itextpdf.tool.xml.ITagProcessor#startElement(com.itextpdf.tool.xml.Tag)
*/
public override IList<IElement> Start(IWorkerContext ctx, Tag tag) {
String enc;
tag.Attributes.TryGetValue("encoding", out enc);
if (null != enc) {
try {
Encoding encd = null;
try {
encd = Encoding.GetEncoding(enc);
}
catch (ArgumentException) {
}
if (encd != null) {
GetHtmlPipelineContext(ctx).CharSet(encd);
if (LOGGER.IsLogging(Level.DEBUG)) {
LOGGER.Debug(
String.Format(LocaleMessages.GetInstance().GetMessage(LocaleMessages.META_CC), enc));
}
}
else {
if (LOGGER.IsLogging(Level.DEBUG)) {
LOGGER.Debug(
String.Format(LocaleMessages.GetInstance().GetMessage(LocaleMessages.META_404), GetHtmlPipelineContext(ctx)
.CharSet() == null ? "" : GetHtmlPipelineContext(ctx).CharSet().WebName));
}
}
}
catch (NoCustomContextException) {
throw new RuntimeWorkerException(LocaleMessages.GetInstance().GetMessage(LocaleMessages.NO_CUSTOM_CONTEXT));
}
}
return new List<IElement>(0);
}
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:38,代码来源:XML.cs
注:本文中的Tag类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论