本文整理汇总了C#中StreamWriterLevel.Constraint方法的典型用法代码示例。如果您正苦于以下问题:C# StreamWriterLevel.Constraint方法的具体用法?C# StreamWriterLevel.Constraint怎么用?C# StreamWriterLevel.Constraint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StreamWriterLevel
的用法示例。
在下文中一共展示了StreamWriterLevel.Constraint方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrintSizeLengthHtml
private static void PrintSizeLengthHtml(SizeableType pThis, PEREffectiveConstraint cns, StreamWriterLevel o, int p, string additonalConstraints)
{
string cssClass = "OddRow";
long mnItems = pThis.minItems(cns);
long mxItems = pThis.maxItems(cns);
if (mnItems == mxItems)
return;
o.WriteLine("<tr class=\"" + cssClass + "\">");
o.WriteLine("<td class=\"no\">1</td>");
o.WriteLine("<td class=\"field\">Length</td>");
// if (mnItems!=mxItems)
o.WriteLine("<td class=\"comment\">Special field used by PER to indicate the number of items present in the array.</td>");
// else
// o.WriteLine("<td class=\"comment\">Special field used by PER to indicate the number of items present in the array.In this case however, the length field requires zero bits because its value ({0}) is known in advanced by its size constraint.</td>", mxItems);
o.WriteLine("<td class=\"type\">{0}</td>", "unsigned int");
o.WriteLine("<td class=\"constraint\">{0}</td>", o.Constraint(cns.ToString() + additonalConstraints));
o.WriteLine("<td class=\"min\">{0}</td>", pThis.minSizeBitsInPER(cns));
o.WriteLine("<td class=\"max\">{0}</td>", (pThis.maxSizeBitsInPER(cns) == -1 ? "16<a href=\"#ARRAYS_SIZE_EXPLAINED123\"><span style=\"vertical-align: super\">why?</span></a>" : pThis.maxSizeBitsInPER(cns).ToString()));
if (pThis.maxSizeBitsInPER(cns) == -1)
DefaultBackend.m_HtmlLengthSizeMustBeExplained = true;
o.WriteLine("</tr>");
}
示例2: PrintHtml
//Default implementation of PrintHtml for all types
public static void PrintHtml(Asn1Type pThis, PEREffectiveConstraint cns, StreamWriterLevel o, int lev, List<string> comment, TypeAssigment tas, List<IConstraint> additonalConstraints)
{
o.WriteLine("<a name=\"{0}\"></a>", "ICD_" + tas.m_name.Replace("-", "_"));
o.WriteLine("<table border=\"0\" width=\"100%\" >");
o.WriteLine("<tbody>");
o.WriteLine("<tr bgcolor=\"{0}\">", (tas.m_createdThroughTabulization ? "#379CEE" : "#FF8f00"));
o.WriteLine("<td height=\"35\" colspan=\"2\" >");
o.WriteLine("<font face=\"Verdana\" color=\"#FFFFFF\" size=\"4\">{0}</font><font face=\"Verdana\" color=\"#FFFFFF\" size=\"2\">({1}) </font>", tas.m_name, pThis.Name);
o.WriteLine("<font face=\"Verdana\" color=\"#FFFFFF\" size=\"2\"><a href=\"#{0}\">ASN.1</a></font>", "ASN1_" + tas.m_name.Replace("-", "_"));
o.WriteLine("</td>");
o.WriteLine("<td height=\"35\" align=\"center\">");
o.WriteLine(" <font face=\"Verdana\" color=\"#FFFFFF\" size=\"2\">min = {0} bytes</font>", (pThis.MinBytesInPER == -1 ? "∞" : pThis.MinBytesInPER.ToString()));
o.WriteLine("</td>");
o.WriteLine("<td height=\"35\" align=\"center\">");
o.WriteLine(" <font face=\"Verdana\" color=\"#FFFFFF\" size=\"2\">max = {0} bytes{1}</font>", (pThis.MaxBytesInPER == -1 ? "∞" : pThis.MaxBytesInPER.ToString()), pThis.MaxBitsInPER_Explained);
o.WriteLine("</td>");
o.WriteLine("</tr>");
IInternalContentsInHtml pICIH = pThis as IInternalContentsInHtml;
string tmp = string.Empty;
if (pICIH != null)
tmp = pICIH.InternalContentsInHtml(additonalConstraints);
if (comment.Count > 0 || tmp.Length > 0)
{
o.WriteLine("<tr class=\"CommentRow\">");
o.WriteLine("<td class=\"comment2\" colspan=\"4\">" + o.BR(comment) + tmp + "</td>");
o.WriteLine("</tr>");
}
o.WriteLine("<tr class=\"headerRow\">");
o.WriteLine("<td class=\"hrconstraint2\" colspan=\"2\">Constraints</td>");
o.WriteLine("<td class=\"hrMin2\">Min Length (bits)</td>");
o.WriteLine("<td class=\"hrMax2\">Max Length (bits)</td>");
o.WriteLine("</tr>");
o.WriteLine("<tr class=\"OddRow\">");
o.WriteLine(" <td class=\"constraint\" colspan=\"2\">{0}</td>", o.Constraint(pThis.Constraints + BaseConstraint.AsString(additonalConstraints)));
o.WriteLine(" <td class=\"min\" >{0}</td>", pThis.MinBitsInPER);
o.WriteLine(" <td class=\"max\" >{0}{1}</td>", pThis.MaxBitsInPER, pThis.MaxBitsInPER_Explained);
o.WriteLine("</tr>");
o.WriteLine("</tbody>");
o.WriteLine("</table>");
}
示例3: PrintItemHtml
private static void PrintItemHtml(SizeableType pThis, PEREffectiveConstraint cns, StreamWriterLevel o, long itemNo, IConstraint innerTypeConstraint)
{
int inc = ((pThis.minItems(cns) == pThis.maxItems(cns) ? 0 : 1));
string cssClass = "EvenRow";
o.WriteLine("<tr class=\"" + cssClass + "\">");
o.WriteLine("<td class=\"no\">{0}</td>", (itemNo) == -1 ? "∞" : (itemNo + inc).ToString());
o.WriteLine("<td class=\"field\">Item #{0}</td>", (itemNo) == -1 ? "∞" : itemNo.ToString());
o.WriteLine("<td class=\"comment\">{0}</td>", "");
o.WriteLine("<td class=\"type\">{0}</td>", InternalTypeName(pThis));
string withComponentPart = string.Empty;
if (innerTypeConstraint!=null)
{
withComponentPart = "<span style=\"color: yellow\">";
withComponentPart += " (" + innerTypeConstraint.ToString() + ")";
withComponentPart += "</span>" + ICDBType.WithComponentWhy;
ICDBackend.m_WithComponentMustBeExplained = true;
}
o.WriteLine("<td class=\"constraint\">{0}</td>", o.Constraint(pThis.ItemConstraint(cns) + withComponentPart));
ArrayType ppthis = pThis as ArrayType;
if (ppthis != null && ppthis.m_type.GetFinalType() is IntegerType && ppthis.m_type.MinBitsInPER == 0 && ppthis.m_type.MaxBitsInPER == 0)
{
o.WriteLine("<td class=\"min\">0{0}</td>", ICDBType.ZeroBitsWhy);
o.WriteLine("<td class=\"max\">0{0}</td>", ICDBType.ZeroBitsWhy);
ICDBackend.m_ZeroBitsMustBeExplained = true;
}
else
{
o.WriteLine("<td class=\"min\">{0}</td>", (pThis.minItemBitsInPER(cns) == -1 ? "∞" : pThis.minItemBitsInPER(cns).ToString()));
o.WriteLine("<td class=\"max\">{0}</td>", (pThis.maxItemBitsInPER(cns) == -1 ? "∞" : pThis.maxItemBitsInPER(cns).ToString()));
}
o.WriteLine("</tr>");
}
示例4: PrintPreambleHtml
public static void PrintPreambleHtml(SequenceOrSetType pThis, StreamWriterLevel o, int p)
{
string comment = "Special field used by PER to indicate the presence/absence of optional and default fields.";
if (pThis.IsPERExtensible())
comment = "Special field used by PER to (a) mark the presence of extension(s) and (b) to indicate the presence/absence of optional and default fields.";
List<ICDSequenceOrSetTypeChild> tmp = new List<ICDSequenceOrSetTypeChild>();
foreach (ICDSequenceOrSetTypeChild ch in pThis.m_children.Values)
{
if (ch.m_optional || ch.m_defaultValue != null)
tmp.Add(ch);
}
if (tmp.Count > 0 || pThis.IsPERExtensible())
{
comment += "<br/><ul type=\"square\">";
int bitStart = 0;
if (pThis.IsPERExtensible())
{
comment += string.Format("<li>bit0 == 1 ⇒ extension(s) is present");
bitStart++;
}
for (int i = 0; i < tmp.Count; i++)
comment += string.Format("<li>bit{0} == 1 ⇒ <font color=\"#5F9EA0\" >{1}</font> is present</li>", i + bitStart, tmp[i].m_childVarName);
comment += "</ul>";
}
string cssClass = "OddRow";
o.WriteLine("<tr class=\"" + cssClass + "\">");
o.WriteLine("<td class=\"no\">1</td>");
o.WriteLine("<td class=\"field\">Preamble</td>");
o.WriteLine("<td class=\"comment\">{0}</td>", comment);
o.WriteLine("<td class=\"optional\">No</td>");
o.WriteLine("<td class=\"type\">{0}</td>", "Bit mask");
o.WriteLine("<td class=\"constraint\">{0}</td>", o.Constraint("N.A."));
o.WriteLine("<td class=\"min\">{0}</td>", pThis.PreambleLength);
o.WriteLine("<td class=\"max\">{0}</td>", pThis.PreambleLength);
o.WriteLine("</tr>");
}
示例5: PrintChoiceIndexHtml
private void PrintChoiceIndexHtml(StreamWriterLevel o, int p, int index, int fieldNo)
{
string cssClass = "OddRow";
if (index % 2 == 0)
cssClass = "EvenRow";
int nBits = PER.GetNumberOfBitsForNonNegativeInteger((ulong)(m_children.Count - 1));
string commentFld = "Special field used by PER to indicate which choice alternative is present.<br/><ul type=\"square\">";
for (int i = 0; i < m_children.Values.Count; i++)
{
commentFld += string.Format("<li>{0} ⇒ <font color=\"#5F9EA0\" >{1}</font></li>", i, m_children.Values[i].m_childVarName);
}
commentFld += "</ul>";
o.WriteLine("<tr class=\"" + cssClass + "\">");
o.WriteLine("<td class=\"no\">{0}</td>", fieldNo);
o.WriteLine("<td class=\"field\">ChoiceIndex</td>");
o.WriteLine("<td class=\"comment\">{0}</td>", commentFld);
o.WriteLine("<td class=\"type\">{0}</td>", "unsigned int");
o.WriteLine("<td class=\"constraint\">{0}</td>", o.Constraint("N.A."));
o.WriteLine("<td class=\"min\">{0}</td>", nBits);
o.WriteLine("<td class=\"max\">{0}</td>", nBits);
o.WriteLine("</tr>");
}
示例6: PrintChoiceExtBitHtml
private void PrintChoiceExtBitHtml(StreamWriterLevel o, int index, int fieldNo)
{
string cssClass = "OddRow";
o.WriteLine("<tr class=\"" + cssClass + "\">");
o.WriteLine("<td class=\"no\">{0}</td>", fieldNo);
o.WriteLine("<td class=\"field\">Extension bit</td>");
o.WriteLine("<td class=\"comment\">{0}</td>", "If set, an extension, i.e. an unknown to this grammar alternative, is present");
o.WriteLine("<td class=\"type\">{0}</td>", "Bit");
o.WriteLine("<td class=\"constraint\">{0}</td>", o.Constraint("N.A."));
o.WriteLine("<td class=\"min\">{0}</td>", 1);
o.WriteLine("<td class=\"max\">{0}</td>", 1);
o.WriteLine("</tr>");
}