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


C# ObjectIdentifier类代码示例

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


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


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