当前位置: 首页>>代码示例>>C#>>正文


C# StreamWriterLevel.Constraint方法代码示例

本文整理汇总了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>");
        }
开发者ID:kia92798,项目名称:tinyasn1,代码行数:25,代码来源:ConstructedTypes.cs

示例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 ? "&#8734" : 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 ? "&#8734" : 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>");
        }
开发者ID:kia92798,项目名称:tinyasn1,代码行数:48,代码来源:ConstructedTypes.cs

示例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 ? "&#8734" : (itemNo + inc).ToString());
            o.WriteLine("<td class=\"field\">Item #{0}</td>", (itemNo) == -1 ? "&#8734" : 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 ? "&#8734" : pThis.minItemBitsInPER(cns).ToString()));
                o.WriteLine("<td class=\"max\">{0}</td>", (pThis.maxItemBitsInPER(cns) == -1 ? "&#8734" : pThis.maxItemBitsInPER(cns).ToString()));
            }
            o.WriteLine("</tr>");
        }
开发者ID:kia92798,项目名称:tinyasn1,代码行数:35,代码来源:ConstructedTypes.cs

示例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 &#8658 extension(s) is present");
                    bitStart++;
                }
                for (int i = 0; i < tmp.Count; i++)
                    comment += string.Format("<li>bit{0} == 1 &#8658 <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>");
        }
开发者ID:kia92798,项目名称:tinyasn1,代码行数:37,代码来源:ConstructedTypes.cs

示例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} &#8658 <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>");
        }
开发者ID:kia92798,项目名称:tinyasn1,代码行数:27,代码来源:ConstructedTypes.cs

示例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>");
        }
开发者ID:kia92798,项目名称:tinyasn1,代码行数:15,代码来源:ConstructedTypes.cs


注:本文中的StreamWriterLevel.Constraint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。