scripts
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
using System;
|
||||
|
||||
namespace System.ComponentModel
|
||||
{
|
||||
/// <summary>Provides a simple list of delegates. This class cannot be inherited.</summary>
|
||||
// Token: 0x02000081 RID: 129
|
||||
public sealed class EventHandlerList : IDisposable
|
||||
{
|
||||
/// <summary>Gets or sets the delegate for the specified object.</summary>
|
||||
/// <returns>The delegate for the specified key, or null if a delegate does not exist.</returns>
|
||||
/// <param name="key">An object to find in the list. </param>
|
||||
// Token: 0x17000137 RID: 311
|
||||
public Delegate this[object key]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (key == null)
|
||||
{
|
||||
return this.null_entry;
|
||||
}
|
||||
ListEntry listEntry = this.FindEntry(key);
|
||||
if (listEntry != null)
|
||||
{
|
||||
return listEntry.value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.AddHandler(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Adds a delegate to the list.</summary>
|
||||
/// <param name="key">The object that owns the event. </param>
|
||||
/// <param name="value">The delegate to add to the list. </param>
|
||||
// Token: 0x060004A4 RID: 1188 RVA: 0x0000D6A8 File Offset: 0x0000B8A8
|
||||
public void AddHandler(object key, Delegate value)
|
||||
{
|
||||
if (key == null)
|
||||
{
|
||||
this.null_entry = Delegate.Combine(this.null_entry, value);
|
||||
return;
|
||||
}
|
||||
ListEntry listEntry = this.FindEntry(key);
|
||||
if (listEntry == null)
|
||||
{
|
||||
listEntry = new ListEntry();
|
||||
listEntry.key = key;
|
||||
listEntry.value = null;
|
||||
listEntry.next = this.entries;
|
||||
this.entries = listEntry;
|
||||
}
|
||||
listEntry.value = Delegate.Combine(listEntry.value, value);
|
||||
}
|
||||
|
||||
/// <summary>Adds a list of delegates to the current list.</summary>
|
||||
/// <param name="listToAddFrom">The list to add.</param>
|
||||
// Token: 0x060004A5 RID: 1189 RVA: 0x0000D718 File Offset: 0x0000B918
|
||||
public void AddHandlers(EventHandlerList listToAddFrom)
|
||||
{
|
||||
if (listToAddFrom == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (ListEntry next = listToAddFrom.entries; next != null; next = next.next)
|
||||
{
|
||||
this.AddHandler(next.key, next.value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Removes a delegate from the list.</summary>
|
||||
/// <param name="key">The object that owns the event. </param>
|
||||
/// <param name="value">The delegate to remove from the list. </param>
|
||||
// Token: 0x060004A6 RID: 1190 RVA: 0x0000D758 File Offset: 0x0000B958
|
||||
public void RemoveHandler(object key, Delegate value)
|
||||
{
|
||||
if (key == null)
|
||||
{
|
||||
this.null_entry = Delegate.Remove(this.null_entry, value);
|
||||
return;
|
||||
}
|
||||
ListEntry listEntry = this.FindEntry(key);
|
||||
if (listEntry == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
listEntry.value = Delegate.Remove(listEntry.value, value);
|
||||
}
|
||||
|
||||
/// <summary>Disposes the delegate list.</summary>
|
||||
// Token: 0x060004A7 RID: 1191 RVA: 0x0000D7A0 File Offset: 0x0000B9A0
|
||||
public void Dispose()
|
||||
{
|
||||
this.entries = null;
|
||||
}
|
||||
|
||||
// Token: 0x060004A8 RID: 1192 RVA: 0x0000D7AC File Offset: 0x0000B9AC
|
||||
private ListEntry FindEntry(object key)
|
||||
{
|
||||
for (ListEntry next = this.entries; next != null; next = next.next)
|
||||
{
|
||||
if (next.key == key)
|
||||
{
|
||||
return next;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Token: 0x0400017A RID: 378
|
||||
private ListEntry entries;
|
||||
|
||||
// Token: 0x0400017B RID: 379
|
||||
private Delegate null_entry;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user