2012-08-09 09:45:04 +00:00
|
|
|
using System;
|
2011-10-31 05:36:24 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Reflection;
|
|
|
|
|
2012-08-09 09:45:04 +00:00
|
|
|
// This file is part of the ANX.Framework created by the
|
|
|
|
// "ANX.Framework developer group" and released under the Ms-PL license.
|
|
|
|
// For details see: http://anxframework.codeplex.com/license
|
2011-11-15 06:46:22 +00:00
|
|
|
|
2011-10-31 05:36:24 +00:00
|
|
|
namespace ANXStatusComparer.Data
|
|
|
|
{
|
|
|
|
public class EventElement : BaseObjectElement
|
|
|
|
{
|
|
|
|
public EventInfo Handle
|
|
|
|
{
|
|
|
|
get;
|
|
|
|
private set;
|
|
|
|
}
|
|
|
|
|
|
|
|
public MethodInfo AddMethod
|
|
|
|
{
|
|
|
|
get;
|
|
|
|
private set;
|
|
|
|
}
|
|
|
|
|
|
|
|
public MethodInfo RemoveMethod
|
|
|
|
{
|
|
|
|
get;
|
|
|
|
private set;
|
|
|
|
}
|
|
|
|
|
|
|
|
public EventElement(EventInfo method, string setKeyName)
|
|
|
|
: base(setKeyName)
|
|
|
|
{
|
|
|
|
Handle = method;
|
|
|
|
AddMethod = Handle.GetAddMethod();
|
|
|
|
RemoveMethod = Handle.GetRemoveMethod();
|
|
|
|
}
|
|
|
|
|
|
|
|
public override bool IsCorrect(BaseObjectElement otherElement)
|
|
|
|
{
|
|
|
|
EventElement other = otherElement as EventElement;
|
|
|
|
bool isCorrect = true;
|
|
|
|
|
|
|
|
if (otherElement.KeyName != KeyName)
|
|
|
|
{
|
|
|
|
isCorrect = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (AddMethod != null &&
|
|
|
|
other.AddMethod != null)
|
|
|
|
{
|
|
|
|
if (AddMethod.IsPublic != other.AddMethod.IsPublic)
|
|
|
|
{
|
|
|
|
isCorrect = false;
|
|
|
|
}
|
|
|
|
if (AddMethod.IsFamily != other.AddMethod.IsFamily)
|
|
|
|
{
|
|
|
|
isCorrect = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (RemoveMethod != null &&
|
|
|
|
other.RemoveMethod != null)
|
|
|
|
{
|
|
|
|
if (RemoveMethod.IsPublic != other.RemoveMethod.IsPublic)
|
|
|
|
{
|
|
|
|
isCorrect = false;
|
|
|
|
}
|
|
|
|
if (RemoveMethod.IsFamily != other.RemoveMethod.IsFamily)
|
|
|
|
{
|
|
|
|
isCorrect = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return isCorrect;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override string GetDescription()
|
|
|
|
{
|
|
|
|
string result = "";
|
|
|
|
if (AddMethod != null)
|
|
|
|
{
|
|
|
|
result += (AddMethod.IsPublic ? "[PUBLIC ADD] " : "") +
|
|
|
|
(AddMethod.IsFamily ? "[PROTECTED ADD] " : "");
|
|
|
|
}
|
|
|
|
if (RemoveMethod != null)
|
|
|
|
{
|
|
|
|
result += (RemoveMethod.IsPublic ? "[PUBLIC REMOVE] " : "") +
|
|
|
|
(RemoveMethod.IsFamily ? "[PROTECTED REMOVE] " : "");
|
|
|
|
}
|
|
|
|
|
|
|
|
result += Handle.ToString();
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|