using System;
using System.Collections.Generic;
using System.Reflection;
using System.Windows.Forms;
namespace GetOcxState
{
class PropertyValueDictionary : Dictionary<string, object>
{
public const BindingFlags declaredFlags = BindingFlags.Instance |
BindingFlags.Public |
BindingFlags.DeclaredOnly;
public PropertyValueDictionary(Type ocxType, AxHost.State ocxState)
{
using (HelperForm Helper = new HelperForm(ocxType, ocxState))
{
foreach (PropertyInfo info in ocxType.GetProperties(declaredFlags))
{
if (info.CanWrite && info.CanRead)
{
if (!base.ContainsKey(info.Name))
{
object value = Helper.GetPropertyValue(info);
base.Add(info.Name, value);
}
}
}
}
}
}
}