Exemplo n.º 1
0
        //public static Dictionary<string, object> ToDictionary() {
        //	return _GetThreadSingleton().data.ToDictionary(x => x.Key, x => x.Value);
        //}

        public static void LoadFrom(ReadOnlyHookData a)
        {
            foreach (var d in a.ToDictionary())
            {
                SetData(d.Key, d.Value);
            }
        }
Exemplo n.º 2
0
        //private Dictionary<string, object> _ToDictionary() {
        //	return data.ToDictionary(x => x.Key, x => x.Value);
        //}

        //private static HookData _FromDictionary(Dictionary<string, object> data) {
        //	var hd = new HookData();
        //	foreach (var d in data) {
        //		hd.SetData(d.Key, d.Value);
        //	}
        //	return hd;
        //}
        //[Untested("Unit test me")]
        //protected void SetThreadSingleton() {
        //	Thread.SetData(Thread.GetNamedDataSlot("HookData"),this);
        //}
        //[Untested("Unit test me")]
        //public static T GetData<T>(string key, T deflt = null) where T : class {
        //	return _GetThreadSingleton()._GetData(key, deflt);
        //}

        public static ReadOnlyHookData ToReadOnly()
        {
            return(ReadOnlyHookData.FromDictionary(_GetThreadSingleton().data));
        }