using System;
using System.Collections;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Activation;
namespace System.Runtime.Remoting.Contexts
{
/// Provides the default implementations of the and interfaces.
// Token: 0x020003BC RID: 956
[ComVisible(true)]
[AttributeUsage(AttributeTargets.Class)]
[Serializable]
public class ContextAttribute : Attribute, IContextAttribute, IContextProperty
{
/// Creates an instance of the class with the specified name.
/// The name of the context attribute.
// Token: 0x06002612 RID: 9746 RVA: 0x0007DC80 File Offset: 0x0007BE80
public ContextAttribute(string name)
{
this.AttributeName = name;
}
/// Gets the name of the context attribute.
/// The name of the context attribute.
///
///
///
// Token: 0x1700071E RID: 1822
// (get) Token: 0x06002613 RID: 9747 RVA: 0x0007DC90 File Offset: 0x0007BE90
public virtual string Name
{
get
{
return this.AttributeName;
}
}
/// Returns a Boolean value indicating whether this instance is equal to the specified object.
/// true if is not null and if the object names are equivalent; otherwise, false.
/// The object to compare with this instance.
///
///
///
// Token: 0x06002614 RID: 9748 RVA: 0x0007DC98 File Offset: 0x0007BE98
public override bool Equals(object o)
{
if (o == null)
{
return false;
}
if (!(o is ContextAttribute))
{
return false;
}
ContextAttribute contextAttribute = (ContextAttribute)o;
return !(contextAttribute.AttributeName != this.AttributeName);
}
/// Called when the context is frozen.
/// The context to freeze.
///
///
///
// Token: 0x06002615 RID: 9749 RVA: 0x0007DCDC File Offset: 0x0007BEDC
public virtual void Freeze(Context newContext)
{
}
/// Returns the hashcode for this instance of .
/// The hashcode for this instance of .
///
///
///
// Token: 0x06002616 RID: 9750 RVA: 0x0007DCE0 File Offset: 0x0007BEE0
public override int GetHashCode()
{
if (this.AttributeName == null)
{
return 0;
}
return this.AttributeName.GetHashCode();
}
/// Adds the current context property to the given message.
/// The to which to add the context property.
/// The parameter is null.
///
///
///
// Token: 0x06002617 RID: 9751 RVA: 0x0007DCFC File Offset: 0x0007BEFC
public virtual void GetPropertiesForNewContext(IConstructionCallMessage ctorMsg)
{
if (ctorMsg == null)
{
throw new ArgumentNullException("ctorMsg");
}
IList contextProperties = ctorMsg.ContextProperties;
contextProperties.Add(this);
}
/// Returns a Boolean value indicating whether the context parameter meets the context attribute's requirements.
/// true if the passed in context is okay; otherwise, false.
/// The context in which to check.
/// The to which to add the context property.
/// Either or is null.
///
///
///
// Token: 0x06002618 RID: 9752 RVA: 0x0007DD2C File Offset: 0x0007BF2C
public virtual bool IsContextOK(Context ctx, IConstructionCallMessage ctorMsg)
{
if (ctorMsg == null)
{
throw new ArgumentNullException("ctorMsg");
}
if (ctx == null)
{
throw new ArgumentNullException("ctx");
}
if (!ctorMsg.ActivationType.IsContextful)
{
return true;
}
IContextProperty property = ctx.GetProperty(this.AttributeName);
return property != null && this == property;
}
/// Returns a Boolean value indicating whether the context property is compatible with the new context.
/// true if the context property is okay with the new context; otherwise, false.
/// The new context in which the property has been created.
///
///
///
// Token: 0x06002619 RID: 9753 RVA: 0x0007DD8C File Offset: 0x0007BF8C
public virtual bool IsNewContextOK(Context newCtx)
{
return true;
}
/// Indicates the name of the context attribute.
// Token: 0x04000EDC RID: 3804
protected string AttributeName;
}
}