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


C# StreamWriterLevel.WriteCodeBlock方法代码示例

本文整理汇总了C#中StreamWriterLevel.WriteCodeBlock方法的典型用法代码示例。如果您正苦于以下问题:C# StreamWriterLevel.WriteCodeBlock方法的具体用法?C# StreamWriterLevel.WriteCodeBlock怎么用?C# StreamWriterLevel.WriteCodeBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StreamWriterLevel的用法示例。


在下文中一共展示了StreamWriterLevel.WriteCodeBlock方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PrintCDecodeFragmentation

        public void PrintCDecodeFragmentation(PEREffectiveConstraint cns, StreamWriterLevel c, string varName, int lev,
            string arrName, long max, string prefix,
            string length, string curBlockSize, string nCount)
        {
            string i = "i1";
            c.P(lev); c.WriteLine("/* Fragmentation required since {0} is grater than 64K*/", max);
            c.WriteCodeBlock(lev,
            @"if (!BitStream_DecodeConstraintWholeNumber(pBitStrm, &{1}, 0, 0xFF))
            {{
            *pErrCode = ERR_INSUFFICIENT_DATA;
            return FALSE;
            }}
            while(({1} & 0xC0)==0xC0)
            {{
            if ({1} == 0xC4)
            {2} = 0x10000;
            else if ({1} == 0xC3)
            {2} = 0xC000;
            else if ({1} == 0xC2)
            {2} = 0x8000;
            else if ({1} == 0xC1)
            {2} = 0x4000;
            else {{
            *pErrCode = ERR_INCORRECT_PER_STREAM;
            return FALSE;
            }}
            if ({3}+{2}>{4})
            {{
            *pErrCode = ERR_INSUFFICIENT_DATA;
            return FALSE;
            }}

            ", i, length, curBlockSize, nCount,max);

            //            ((ISCCSizeable)pThis).PrintCDecodeItem(cns, c, prefix + arrName + "[" + i + "]", lev + 2);

            c.P(lev+1);
            c.WriteLine("if (!BitStream_ReadBits(pBitStrm, &{0}arr[{1}/8], {2})) {{", prefix, nCount, curBlockSize);
            c.P(lev + 2);
            c.WriteLine("*pErrCode = ERR_INSUFFICIENT_DATA;");
            c.P(lev + 2);
            c.WriteLine("return FALSE;");
            c.P(lev+1);
            c.WriteLine("}");

            c.WriteCodeBlock(lev,
            @"
            {3}+={2};

            if (!BitStream_DecodeConstraintWholeNumber(pBitStrm, &{1}, 0, 0xFF)) {{
            *pErrCode = ERR_INSUFFICIENT_DATA;
            return FALSE;
            }}
            }}
            if ( ({1} & 0x80)>0)
            {{
            asn1SccSint len2=0;
            {1}<<=8;
            if (!BitStream_DecodeConstraintWholeNumber(pBitStrm, &len2, 0, 0xFF)) {{
            *pErrCode = ERR_INSUFFICIENT_DATA;
            return FALSE;
            }}
            {1} |= len2;
            {1} &= 0x7FFF;
            }}

            if ({3}+{1}>{4})
            {{
            *pErrCode = ERR_INSUFFICIENT_DATA;
            return FALSE;
            }}
            ", i, length, curBlockSize, nCount,max);
            //            ((ISCCSizeable)pThis).PrintCDecodeItem(cns, c, prefix + arrName + "[" + i + "]", lev + 1);

            c.P(lev);
            c.WriteLine("if (!BitStream_ReadBits(pBitStrm, &{0}arr[{1}/8], {2})) {{", prefix, nCount, length);
            c.P(lev + 1);
            c.WriteLine("*pErrCode = ERR_INSUFFICIENT_DATA;");
            c.P(lev + 1);
            c.WriteLine("return FALSE;");
            c.P(lev);
            c.WriteLine("}");

            c.WriteCodeBlock(lev,
            @"
            {0}+=(long){1};", nCount, length);
            c.P(lev); c.WriteLine("{0}nCount = (long){1};", prefix, nCount);
        }
开发者ID:kia92798,项目名称:tinyasn1,代码行数:88,代码来源:SCCSingleTypes.cs


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