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

C# ObjectIdentifier类代码示例

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

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



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

示例1: TryLock

        //public string DoWork(string value)
        //{
        //    ILockServiceCallback callback = OperationContext.Current.GetCallbackChannel<ILockServiceCallback>();
        //    new Thread(NewMethod).Start(callback);
        //    return "Welcome " + value;
        //}
        //private void NewMethod(object ooo)
        //{
        //    ILockServiceCallback callback = ooo as ILockServiceCallback;
        //    callback.LockIsAvailable(ObjectIdentifier.ERROR_OID);
        //}
        public TryLockResult TryLock(ObjectIdentifier objectId, bool tellWhenAvailable = false)
        {
            m_objectLock.EnterUpgradeableReadLock();
            try
            {
                Lock currentLock = null;
                if (m_object.TryGetValue(objectId, out currentLock))
                {
                    // если время блокировки закончилось, то блокируем
                }
                else
                {
                    m_subscribersLock.EnterWriteLock();
                    try
                    {
                        // установить блокировку
                    }
                    finally
                    {
                        m_subscribersLock.ExitWriteLock();
                    }
                }
            }
            finally
            {
                m_objectLock.ExitUpgradeableReadLock();
            }

            return new TryLockResult(true);
        }
开发者ID:Ne4to,项目名称:DomainCommonSE,代码行数:41,代码来源:LockService.cs


示例2: SnmpTrapV2C

        /// <summary>
        /// Initializes a new instance of the <see cref="SnmpTrapV2C"/> class.
        /// </summary>
        /// <param name="snmpDatagram">The snmp datagram.</param>
        public SnmpTrapV2C(SnmpDatagram snmpDatagram)
        {
            if(snmpDatagram.Header.Version != SnmpVersion.V2C || snmpDatagram.PduV2c.PduType == PduType.Trap)
            {
                throw new InvalidDataException("Not a Valid V2c Trap");
            }

            ObjectIdentifier trapOid = new ObjectIdentifier("1.3.6.1.6.3.1.1.4.1.0");
            ObjectIdentifier sysUpTimeOid = new ObjectIdentifier("1.3.6.1.2.1.1.3.0");

            PduV2c = snmpDatagram.PduV2c;
            Header = snmpDatagram.Header;
            TrapOid = default(ObjectIdentifier);
            SysUpTime = 0;
            VarBind varBind;
            if (PduV2c.VarBinds.SearchFirstSubOidWith(sysUpTimeOid, out varBind) && varBind.Asn1TypeInfo.Asn1SnmpTagType == Asn1SnmpTag.TimeTicks)
            {
                SysUpTime = (uint)varBind.Value;
            }

            if (PduV2c.VarBinds.SearchFirstSubOidWith(trapOid, out varBind) && varBind.Asn1TypeInfo.Asn1TagType == Asn1Tag.ObjectIdentifier)
            {
                TrapOid = (ObjectIdentifier)varBind.Value;
            }
        }
开发者ID:xornand,项目名称:Tx,代码行数:29,代码来源:SnmpTrapV2C.cs


示例3: DomainObject

 /// <summary>
 /// Constructor for load object from DB
 /// It must be used ONLY by EntityObjectFactory inherited class
 /// </summary>
 /// <param name="sessionId">Session identifier</param>
 /// <param name="objectId">Object identifier</param>
 public DomainObject(SessionIdentifier sessionId, ObjectIdentifier objectId)
 {
     // Save session identifier
     Session = sessionId;
     // Save object identifier
     ObjectId = objectId;
 }
开发者ID:Ne4to,项目名称:DomainCommonSE,代码行数:13,代码来源:DomainObject.cs


示例4: TestConstructor

 public void TestConstructor()
 {
     ObjectIdentifier oid = new ObjectIdentifier(new byte[] { 0x2B, 0x06, 0x99, 0x37 });
     Assert.AreEqual(new uint[] { 1, 3, 6, 3255 }, oid.ToNumerical());
     var o = ObjectIdentifier.Create(new uint[] {1, 3, 6}, 3255);
     Assert.AreEqual(oid, o);
 }
开发者ID:bleissem,项目名称:sharpsnmplib,代码行数:7,代码来源:ObjectIdentifierTestFixture.cs


示例5: Main

        public static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine(@"This application takes one parameter.");
                return;
            }

            IObjectRegistry registry = new ReloadableObjectRegistry("modules");
            IObjectTree tree = registry.Tree;
            if (args[0].Contains("::"))
            {
                string name = args[0];
                var oid = registry.Translate(name);
                var id = new ObjectIdentifier(oid);
                Console.WriteLine(id);
            }
            else
            {
                string oid = args[0];
                var o = tree.Search(ObjectIdentifier.Convert(oid));
                string textual = o.AlternativeText;
                Console.WriteLine(textual);
                if (o.GetRemaining().Count == 0)
                {
                    Console.WriteLine(o.Definition.Type.ToString());
                }
            }
        }
开发者ID:stubarr,项目名称:sharpsnmplib-1,代码行数:29,代码来源:Program.cs


示例6: PersistentObject

        private object _version; //optimistic support: store timestamp info.

        #endregion Fields

        #region Constructors

        public PersistentObject()
        {
            _me = null;
            _oid = new OID();
            _version = null;
            _inUse = null;
            _references = new Dictionary<string, ObjectIdentifier>();
        }
开发者ID:klod68,项目名称:kpsf,代码行数:14,代码来源:PersistentObject.cs


示例7: Test

 public void Test()
 {
     var table = new SysORTable();
     Assert.AreEqual(null, table.MatchGet(new ObjectIdentifier("1.3.6")));
     var id = new ObjectIdentifier("1.3.6.1.2.1.1.9.1.1.1");
     Assert.AreEqual(id, table.MatchGet(id).Variable.Id);
     Assert.AreEqual(new ObjectIdentifier("1.3.6.1.2.1.1.9.1.1.2"), table.MatchGetNext(id).Variable.Id);
 }
开发者ID:bleissem,项目名称:sharpsnmplib,代码行数:8,代码来源:SysORTableTestFixture.cs


示例8: SnmpTrapAttribute

        public SnmpTrapAttribute(string objectIdentifier)
        {
            if (string.IsNullOrWhiteSpace(objectIdentifier))
            {
                throw new ArgumentNullException("objectIdentifier");
            }

            this.SnmpTrapOid = new ObjectIdentifier(objectIdentifier);
        }
开发者ID:Reactive-Extensions,项目名称:Tx,代码行数:9,代码来源:SnmpTrapAttribute.cs


示例9: TestValidateTable

 public void TestValidateTable()
 {
     ObjectIdentifier table = new ObjectIdentifier(new uint[] { 1, 3, 6, 1, 2, 1, 1, 9 });
     ObjectIdentifier entry = new ObjectIdentifier(new uint[] { 1, 3, 6, 1, 2, 1, 1, 9, 1 });
     ObjectIdentifier unknown = new ObjectIdentifier(new uint[] { 1, 3, 6, 8, 18579, 111111});
     Assert.IsTrue(DefaultObjectRegistry.Instance.ValidateTable(table));
     Assert.IsFalse(DefaultObjectRegistry.Instance.ValidateTable(entry));
     Assert.IsFalse(DefaultObjectRegistry.Instance.ValidateTable(unknown));
 }
开发者ID:moljac,项目名称:MonoMobile.SharpSNMP,代码行数:9,代码来源:TestObjectRegistry.cs


示例10: ValidateTable

 /// <summary>
 /// Validates if an <see cref="ObjectIdentifier"/> is a table.
 /// </summary>
 /// <param name="identifier">The object identifier.</param>
 /// <returns></returns>
 public bool ValidateTable(ObjectIdentifier identifier)
 {
     if (identifier == null)
     {
         throw new ArgumentNullException("identifier");
     }
         
     return IsTableId(identifier.ToNumerical());
 }
开发者ID:moljac,项目名称:MonoMobile.SharpSNMP,代码行数:14,代码来源:ObjectRegistryBase.cs


示例11: GetResultSetFor

 /// <summary>
 /// Returns a ResultSet containing the data with for the given identifier
 /// with the given parameters. For example a call for identifier
 /// Library and with a parameter called 'id' would return a
 /// MySqlDataReader with one row containing the data for the
 /// queried library.
 /// 
 /// You can find the necessary parameters for a query in the class
 /// corresponding to the identifier, as these classes are responsible
 /// to have the queries ready, that selects them from the database.
 /// </summary>
 /// <param name="ident">The identifier for the requested object class</param>
 /// <param name="parameters">The parameters for the query</param>
 /// <returns>A ResultSet containing the requested data</returns>
 public ResultSet GetResultSetFor(ObjectIdentifier ident, Dictionary<string, string> parameters)
 {
     if (this.Server != null)
     {
         return new ResultSet(this.Server.GetDataReaderFor(ident, parameters));
     } else
     {
         throw new NoServerConnectionException("Could not fetch result set because no server was set.");
     }
 }
开发者ID:eott,项目名称:featherlib,代码行数:24,代码来源:ServerConnector.cs


示例12: SetObjectIdentifier

        internal void SetObjectIdentifier(ObjectIdentifier identifier)
        {
            if (identifier == null)
                throw new ArgumentNullException("identifier");

            VaultName = identifier.VaultName;
            Name = identifier.Name;
            Version = identifier.Version;
            Id = identifier.Id;
        }
开发者ID:shuainie,项目名称:azure-powershell,代码行数:10,代码来源:ObjectIdentifier.cs


示例13: Variable

        /// <summary>
        /// Creates a <see cref="Variable"/> instance with a specific object identifier and data.
        /// </summary>
        /// <param name="id">Object identifier</param>
        /// <param name="data">Data</param>
        /// <remarks>If you set <c>null</c> to <paramref name="data"/>, you get a <see cref="Variable"/> instance whose <see cref="Data"/> is a <see cref="Null"/> instance.</remarks>
        public Variable(ObjectIdentifier id, ISnmpData data)
        {
            if (id == null)
            {
                throw new ArgumentNullException("id");
            }

            Id = id;
            Data = data ?? new Null();
        }
开发者ID:ekona,项目名称:sharpsnmplib,代码行数:16,代码来源:Variable.cs


示例14: GetAllOidsStartingWith

 /// <summary>
 /// Gets all oids starting with.
 /// </summary>
 /// <param name="subOid">The sub oid.</param>
 ///  <param name="varBinds">The variable bind List.</param>
 /// <returns>IEnumerable of VarBind</returns>
 public static IEnumerable<VarBind> GetAllOidsStartingWith(this ReadOnlyCollection<VarBind> varBinds, ObjectIdentifier subOid)
 {
     for (int i = 0; i < varBinds.Count; i++)
     {
         if (varBinds[i].Oid.IsSubOid(subOid))
         {
             yield return varBinds[i];
         }
     }
 }
开发者ID:xornand,项目名称:Tx,代码行数:16,代码来源:VarBindExtensions.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: IsGuidFormat

 private static bool IsGuidFormat(string strTest)
 {
     try
     {
         var guidTest = new ObjectIdentifier(new Guid(strTest));
         return true;
     }
     catch
     {
         return false;
     }
 }
开发者ID:mohearn,项目名称:jics-simple-query,代码行数:12,代码来源:Export_Data.aspx.cs


示例17: 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


示例18: GetLiteralType

        public static LiteralType GetLiteralType(ObjectIdentifier name)
        {

            switch (name.GetName())
            {
                case "bigint":
                case "smallint":
                case "tinyint":
                case "int":
                case "bit":
                    return LiteralType.Integer;

                case "numeric":
                case "decimal":
                case "float":
                case "real":
                    return LiteralType.Numeric;


                case "money":
                case "smallmoney":
                    return LiteralType.Money;

                case "date":
                case "datetimeoffset":
                case "datetime2":
                case "smalldatetime":
                case "datetime":
                case "time":
                case "char":
                case "varchar":
                case "text":
                case "nchar":
                case "nvarchar":
                case "ntext":
                case "timestamp":
                case "uniqueidentifier":
                case "sql_variant":
                case "xml":

                    return LiteralType.String;

                case "binary":
                case "varbinary":
                case "image":
                    return LiteralType.Binary;

            }


            return LiteralType.String;
        }
开发者ID:japj,项目名称:SSDT-DevPack,代码行数:52,代码来源:LiteralConverter.cs


示例19: IsNText

        public static bool IsNText(ObjectIdentifier name)
        {
            switch (name.GetName())
            {
                case "nchar":
                case "nvarchar":
                case "ntext":
                case "xml":
                    return true;
            }

            return false;
        }
开发者ID:japj,项目名称:SSDT-DevPack,代码行数:13,代码来源:LiteralConverter.cs


示例20: CheckSNMPDeviceAvailable

		/// <summary>
		/// Check the SNMP devices in the Devices.ini are available or not.
		/// If some devices are unavailable, the Devices.ini should be changed to give
		/// tester all available devices.
		/// </summary>
		/// <returns>list</returns>
		public static List<String> CheckSNMPDeviceAvailable(){			
			
		    List<string> notAvailable = new List<string>();
			int timeout = 3;
			VersionCode version = VersionCode.V1;
			IPEndPoint endpoint = new IPEndPoint(IPAddress.Parse("1.1.1.1"),161);
			OctetString community = new OctetString("public");
            
            ObjectIdentifier objectId = new ObjectIdentifier("1.3.6.1.2.1.11.1.0");
            Variable var = new Variable(objectId);   
            IList<Variable> varlist = new System.Collections.Generic.List<Variable>();
            varlist.Add(var);
            Variable data;
            IList<Variable> resultdata;
            IDictionary<string, string> AllDeviceInfo = new Dictionary<string, string> ();
            IDictionary<string, string> SNMPDeviceInfo = new Dictionary<string, string> ();
            
            AllDeviceInfo = AppConfigOper.mainOp.DevConfigs;

			foreach(string key in AllDeviceInfo.Keys)
			{
				if(key.ToUpper().StartsWith("SNMP"))
				{
					SNMPDeviceInfo.Add(key, AllDeviceInfo[key]);
				}
			}
			
			foreach (KeyValuePair<string, string>device in SNMPDeviceInfo)
			{ 
				Console.WriteLine("SNMPDeviceInfo: key={0},value={1}", device.Key, device.Value);
			}
			
            foreach(string deviceIp in SNMPDeviceInfo.Values)
            {
            	try
            	{
            		endpoint.Address = IPAddress.Parse(deviceIp);
	            	resultdata = Messenger.Get(version,endpoint,community,varlist,timeout);
	            	data = resultdata[0];
	            	Console.WriteLine("The device:" + deviceIp + "is availabe");
            	}
            	catch(Exception ex)
	            {
	            	notAvailable.Add(deviceIp);
	            	Console.WriteLine("There is no device in this ip address."+ deviceIp);
	            	string log = ex.ToString();
	            	continue;
	            }	
            }
            return notAvailable;
	   }
开发者ID:YouwenYao,项目名称:NformTestMain,代码行数:57,代码来源:LxDeviceAvailable.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ObjectInfo类代码示例发布时间:2022-05-24
下一篇:
C# ObjectId类代码示例发布时间: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