private static void ReadRecords(Internal.ByteReader reader, IList <DNS.RR> records, int count) { for (int i = 0; i < count; i++) { DNS.RRBase rrbase = new DNS.RRBase(); ((Internal.IResponseReader)rrbase).ReadResponse(reader); DNS.RR rr = DNS.RR.CreateInstance(rrbase); rr.ReadRDATA(reader); records.Add(rr); } }
public bool Equals(RRBase rrbase) { if (object.ReferenceEquals(null, rrbase)) { return(false); } return (NAME.Equals(rrbase.NAME) && TypeValue.Equals(rrbase.TypeValue) && CLASS.Equals(rrbase.CLASS) && TTL.Equals(rrbase.TTL)); }
internal static RR CreateInstance(RRBase rrbase) { RR result; // Each RR type must have the same namespace and // the name of an RR type must coincide with a TYPE value. string typename; if (rrbase.TYPE != null) { typename = typeof(Records.Default).Namespace + '.' + rrbase.TYPE.ToString(); } else { typename = typeof(Records.Default).FullName; // unknown type } Assembly assembly = Assembly.GetExecutingAssembly(); try { // if the required type is not implemented, fall back to Defaulz Type type; if (null == (type = assembly.GetType(typename))) { type = typeof(Records.Default); } try { // Each RR type must provide an internal c'tor taking one RRBase argument. result = Activator.CreateInstance( type, BindingFlags.Instance | BindingFlags.NonPublic, null, new object[] { rrbase }, null) as RR; } catch (System.MissingMethodException ex) { throw new InvalidOperationException( "Each RR type must provide an internal c'tor taking one RRBase argument.", ex); } } catch (Exception ex) { throw new TypeLoadException(String.Format( "Instance of type '{0}' could not be created from assembly {1}.", typename, assembly.ToString()), ex); } return(result); }
private static void ReadRecords(Internal.ByteReader reader, IList<DNS.RR> records, int count) { for (int i = 0; i < count; i++) { DNS.RRBase rrbase = new DNS.RRBase(); ((Internal.IResponseReader)rrbase).ReadResponse(reader); DNS.RR rr = DNS.RR.CreateInstance(rrbase); rr.ReadRDATA(reader); records.Add(rr); } }
internal RR(RRBase rrbase) { _Base = rrbase; }
internal static RR CreateInstance(RRBase rrbase) { RR result; // Each RR type must have the same namespace and // the name of an RR type must coincide with a TYPE value. string typename; if (rrbase.TYPE != null) typename = typeof(Records.Default).Namespace + '.' + rrbase.TYPE.ToString(); else typename = typeof(Records.Default).FullName; // unknown type Assembly assembly = Assembly.GetExecutingAssembly(); try { // if the required type is not implemented, fall back to Defaulz Type type; if (null == (type = assembly.GetType(typename))) type = typeof(Records.Default); try { // Each RR type must provide an internal c'tor taking one RRBase argument. result = Activator.CreateInstance( type, BindingFlags.Instance | BindingFlags.NonPublic, null, new object[] { rrbase }, null) as RR; } catch (System.MissingMethodException ex) { throw new InvalidOperationException( "Each RR type must provide an internal c'tor taking one RRBase argument.", ex); } } catch (Exception ex) { throw new TypeLoadException(String.Format( "Instance of type '{0}' could not be created from assembly {1}.", typename, assembly.ToString()), ex); } return result; }
public bool Equals(RRBase rrbase) { if (object.ReferenceEquals(null, rrbase)) return false; return NAME.Equals(rrbase.NAME) && TypeValue.Equals(rrbase.TypeValue) && CLASS.Equals(rrbase.CLASS) && TTL.Equals(rrbase.TTL); }