• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Integer32类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Integer32的典型用法代码示例。如果您正苦于以下问题:C# Integer32类的具体用法?C# Integer32怎么用?C# Integer32使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Integer32类属于命名空间,在下文中一共展示了Integer32类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Header

        /// <summary>
        /// Initializes a new instance of the <see cref="Header"/> class.
        /// </summary>
        /// <param name="messageId">The message id.</param>
        /// <param name="maxMessageSize">Size of the max message.</param>
        /// <param name="securityBits">The flags.</param>
        /// <param name="securityModel">The security model.</param>
        /// <remarks>If you want an empty header, please use <see cref="Empty"/>.</remarks>
        public Header(Integer32 messageId, Integer32 maxMessageSize, OctetString securityBits, Integer32 securityModel)
        {
            if (messageId == null)
            {
                throw new ArgumentNullException("messageId");
            }

            if (maxMessageSize == null)
            {
                throw new ArgumentNullException("maxMessageSize");
            }

            if (securityBits == null)
            {
                throw new ArgumentNullException("securityBits");
            }

            if (securityModel == null)
            {
                throw new ArgumentNullException("securityModel");
            }

            _messageId = messageId;
            _maxSize = maxMessageSize;
            _flags = securityBits;
            _securityModel = securityModel;
        }
开发者ID:moljac,项目名称:MonoMobile.SharpSNMP,代码行数:35,代码来源:Header.cs


示例2: SetRequestPdu

 /// <summary>
 /// Creates a <see cref="SetRequestPdu"/> instance with all contents.
 /// </summary>
 /// <param name="requestId">The request id.</param>
 /// <param name="errorStatus">Error status</param>
 /// <param name="errorIndex">Error index</param>
 /// <param name="variables">Variables</param>
 private SetRequestPdu(Integer32 requestId, Integer32 errorStatus, Integer32 errorIndex, IList<Variable> variables)
 {
     RequestId = requestId;
     ErrorStatus = errorStatus;
     ErrorIndex = errorIndex;
     Variables = variables;
     _varbindSection = Variable.Transform(Variables);
 }
开发者ID:moljac,项目名称:MonoMobile.SharpSNMP,代码行数:15,代码来源:SetRequestPdu.cs


示例3: InformRequestPdu

 /// <summary>
 /// Creates a <see cref="InformRequestPdu"/> instance for discovery.
 /// </summary>
 /// <param name="requestId">The request id.</param>
 public InformRequestPdu(int requestId)
 {
     Enterprise = null;
     RequestId = new Integer32(requestId);
     _time = new TimeTicks(0);
     Variables = new List<Variable>();
     _varbindSection = Variable.Transform(Variables);
 }
开发者ID:stubarr,项目名称:sharpsnmplib-1,代码行数:12,代码来源:InformRequestPdu.cs


示例4: GetRequestPdu

 public GetRequestPdu(int requestId, ErrorCode errorStatus, int errorIndex, IList<Variable> variables)
 {
     RequestId = new Integer32(requestId);
     ErrorStatus = new Integer32((int)errorStatus);
     ErrorIndex = new Integer32(errorIndex);
     Variables = variables;
     _varbindSection = Variable.Transform(variables);
 }
开发者ID:stubarr,项目名称:sharpsnmplib-1,代码行数:8,代码来源:GetRequestPdu.cs


示例5: TestNegative2

 public void TestNegative2()
 {
     // bug 7217 http://sharpsnmplib.codeplex.com/workitem/7217
     Integer32 i = new Integer32(-250);
     var result = DataFactory.CreateSnmpData(i.ToBytes());
     Assert.AreEqual(SnmpType.Integer32, result.TypeCode);
     Assert.AreEqual(-250, ((Integer32)result).ToInt32());
 }
开发者ID:moljac,项目名称:MonoMobile.SharpSNMP,代码行数:8,代码来源:TestByteTool.cs


示例6: TestNegative

 public void TestNegative()
 {
     const int i = -2147418240;
     Integer32 data = new Integer32(i);
     byte[] bytes = data.ToBytes();
     Integer32 other = (Integer32)DataFactory.CreateSnmpData(bytes);
     Assert.AreEqual(i, other.ToInt32());
 }
开发者ID:stubarr,项目名称:sharpsnmplib-1,代码行数:8,代码来源:Integer32TestFixture.cs


示例7: ResponsePdu

 /// <summary>
 /// Creates a <see cref="ResponsePdu"/> with all contents.
 /// </summary>
 /// <param name="requestId">The request ID.</param>
 /// <param name="errorStatus">Error status.</param>
 /// <param name="errorIndex">Error index.</param>
 /// <param name="variables">Variables.</param>
 public ResponsePdu(int requestId, ErrorCode errorStatus, int errorIndex, IList<Variable> variables)
 {
     RequestId = new Integer32(requestId);
     ErrorStatus = new Integer32((int)errorStatus);
     ErrorIndex = new Integer32(errorIndex);
     Variables = variables;
     _varbindSection = Variable.Transform(variables);
     ////_raw = ByteTool.ParseItems(_sequenceNumber, _errorStatus, _errorIndex, _varbindSection);
 }
开发者ID:moljac,项目名称:MonoMobile.SharpSNMP,代码行数:16,代码来源:ResponsePdu.cs


示例8: TestToInt32

 public void TestToInt32()
 {
     const int result = -26955;
     byte[] expected = new byte[] {0x96, 0xB5};
     Integer32 test = new Integer32(expected);
     Assert.AreEqual(result, test.ToInt32());
     
     Assert.AreEqual(255, new Integer32(new byte[] {0x00, 0xFF}).ToInt32());
 }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:9,代码来源:Integer32TestFixture.cs


示例9: GetNextRequestPdu

 private GetNextRequestPdu(Integer32 requestId, Integer32 errorStatus, Integer32 errorIndex, IList<Variable> variables)
 {
     RequestId = requestId;
     ErrorStatus = errorStatus;
     ErrorIndex = errorIndex;
     Variables = variables;
     _varbindSection = Variable.Transform(variables);
     ////_raw = ByteTool.ParseItems(_seq, _errorStatus, _errorIndex, _varbindSection);
 }
开发者ID:moljac,项目名称:MonoMobile.SharpSNMP,代码行数:9,代码来源:GetNextRequestPdu.cs


示例10: GetBulkRequestPdu

 private GetBulkRequestPdu(Integer32 requestId, Integer32 nonRepeaters, Integer32 maxRepetitions, IList<Variable> variables)
 {
     RequestId = requestId;
     ErrorStatus = nonRepeaters;
     ErrorIndex = maxRepetitions;
     Variables = variables;
     _varbindSection = Variable.Transform(variables);
     ////_raw = ByteTool.ParseItems(_seq, _nonRepeaters, _maxRepetitions, _varbindSection);
 }
开发者ID:moljac,项目名称:MonoMobile.SharpSNMP,代码行数:9,代码来源:GetBulkRequestPdu.cs


示例11: TestNegative3

 public void TestNegative3()
 {
 	// #7240
     const int i = -237053658;
     Integer32 data = new Integer32(i);
     byte[] bytes = data.ToBytes();
     Assert.AreEqual(6, bytes.Length);
     var exception = Assert.Throws<ArgumentException>(() => DataFactory.CreateSnmpData(new byte[] { 0x02, 0x05, 0xFF, 0xF1, 0xDE, 0xD9, 0x26 }));
     Assert.AreEqual("truncation error for 32-bit integer coding\r\nParameter name: length", exception.Message);
 }
开发者ID:stubarr,项目名称:sharpsnmplib-1,代码行数:10,代码来源:Integer32TestFixture.cs


示例12: TestToBytes

 public void TestToBytes()
 {
     byte[] bytes = new byte[] {0x02, 0x02, 0x96, 0xB5};
     Integer32 test = new Integer32(-26955);
     Assert.AreEqual(bytes, test.ToBytes());
     
     Assert.AreEqual(new byte[] {0x02, 0x02, 0x00, 0xFF}, new Integer32(255).ToBytes());
     
     Assert.AreEqual(6, new Integer32(2147483647).ToBytes().Length);
 }
开发者ID:moljac,项目名称:MonoMobile.SharpSNMP,代码行数:10,代码来源:TestInteger32.cs


示例13: TrapPdu

        /// <summary>Constructor</summary>
        public TrapPdu()
        {
            _asnType = (byte)PduType.Trap;
            _enterprise = new Oid();
            _agentAddr = new IpAddress();
            _generic = new Integer32();
            _specific = new Integer32();
            _timeStamp = new TimeTicks();

            _variables = new VbCollection();
        }
开发者ID:griffina,项目名称:SnmpSharpNet,代码行数:12,代码来源:TrapPdu.cs


示例14: TestConstructor

 public void TestConstructor()
 {
     Integer32 test = new Integer32(100);
     Assert.AreEqual(100, test.ToInt32());
     
     Integer32 test2 = new Integer32(new byte[] {0x00});
     Assert.AreEqual(0, test2.ToInt32());
     
     Integer32 test3 = new Integer32(new byte[] {0xFF});
     Assert.AreEqual(-1, test3.ToInt32());
 }
开发者ID:moljac,项目名称:MonoMobile.SharpSNMP,代码行数:11,代码来源:TestInteger32.cs


示例15: TrapV2Pdu

 public TrapV2Pdu(int requestId, ObjectIdentifier enterprise, uint time, IList<Variable> variables)
 {
     Enterprise = enterprise;
     RequestId = new Integer32(requestId);
     _time = new TimeTicks(time);
     Variables = variables;
     IList<Variable> full = new List<Variable>(variables);
     full.Insert(0, new Variable(new uint[] { 1, 3, 6, 1, 2, 1, 1, 3, 0 }, _time));
     full.Insert(1, new Variable(new uint[] { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 }, Enterprise));
     _varbindSection = Variable.Transform(full);
 }
开发者ID:moljac,项目名称:MonoMobile.SharpSNMP,代码行数:11,代码来源:TrapV2Pdu.cs


示例16: InformRequestPdu

 public InformRequestPdu(int requestId, ObjectIdentifier enterprise, uint time, IList<Variable> variables)
 {
     Enterprise = enterprise;
     RequestId = new Integer32(requestId);
     _time = new TimeTicks(time);
     Variables = variables;
     IList<Variable> full = new List<Variable>(variables);
     full.Insert(0, new Variable(new uint[] { 1, 3, 6, 1, 2, 1, 1, 3, 0 }, _time));
     full.Insert(1, new Variable(new uint[] { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 }, Enterprise));
     _varbindSection = Variable.Transform(full);
     ////_raw = ByteTool.ParseItems(_seq, new Integer32(0), new Integer32(0), _varbindSection);
 }        
开发者ID:moljac,项目名称:MonoMobile.SharpSNMP,代码行数:12,代码来源:InformRequestPdu.cs


示例17: TestConstructor

 public void TestConstructor()
 {
     Integer32 test = new Integer32(100);
     Assert.AreEqual(100, test.ToInt32());
     Assert.Throws<InvalidCastException>(() => test.ToErrorCode());
     Assert.Throws<InvalidCastException>(() => new Integer32(-1).ToErrorCode());
     
     Integer32 test2 = new Integer32(new byte[] {0x00});
     Assert.AreEqual(0, test2.ToInt32());
     
     Integer32 test3 = new Integer32(new byte[] {0xFF});
     Assert.AreEqual(-1, test3.ToInt32());
 }
开发者ID:stubarr,项目名称:sharpsnmplib-1,代码行数:13,代码来源:Integer32TestFixture.cs


示例18: Header

        /// <summary>
        /// Initializes a new instance of the <see cref="Header"/> class.
        /// </summary>
        /// <param name="messageId">The message id.</param>
        /// <param name="maxMessageSize">Size of the max message.</param>
        /// <param name="securityLevel">The security level.</param>
        /// <remarks>If you want an empty header, please use <see cref="Empty"/>.</remarks>
        public Header(Integer32 messageId, Integer32 maxMessageSize, Levels securityLevel)
        {
            if (maxMessageSize == null)
            {
                throw new ArgumentNullException("maxMessageSize");
            }

            _messageId = messageId;
            _maxSize = maxMessageSize;
            SecurityLevel = securityLevel;
            _flags = new OctetString(SecurityLevel);
            _securityModel = DefaultSecurityModel;
        }
开发者ID:bleissem,项目名称:sharpsnmplib,代码行数:20,代码来源:Header.cs


示例19: GetNextRequestPdu

        /// <summary>
        /// Creates a <see cref="GetNextRequestPdu"/> with all contents.
        /// </summary>
        /// <param name="requestId">The request id.</param>
        /// <param name="variables">Variables</param>
        public GetNextRequestPdu(int requestId, IList<Variable> variables)
        {
            if (variables == null)
            {
                throw new ArgumentNullException("variables");
            }

            RequestId = new Integer32(requestId);
            ErrorStatus = Integer32.Zero;
            ErrorIndex = Integer32.Zero;
            Variables = variables;
            _varbindSection = Variable.Transform(variables);
        }
开发者ID:bleissem,项目名称:sharpsnmplib,代码行数:18,代码来源:GetNextRequestPdu.cs


示例20: GetBulkRequestPdu

        /// <summary>
        /// Creates a <see cref="GetBulkRequestPdu"/> with all contents.
        /// </summary>
        /// <param name="requestId">The request id.</param>
        /// <param name="nonRepeaters">Non-repeaters.</param>
        /// <param name="maxRepetitions">Max repetitions.</param>
        /// <param name="variables">Variables.</param>
        public GetBulkRequestPdu(int requestId, int nonRepeaters, int maxRepetitions, IList<Variable> variables)
        {
            if (variables == null)
            {
                throw new ArgumentNullException("variables");
            }

            RequestId = new Integer32(requestId);
            ErrorStatus = new Integer32(nonRepeaters);
            ErrorIndex = new Integer32(maxRepetitions);
            Variables = variables;
            _varbindSection = Variable.Transform(variables);
        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:20,代码来源:GetBulkRequestPdu.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IntegerRangeSet类代码示例发布时间:2022-05-24
下一篇:
C# Integer类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap