Ejemplo n.º 1
0
        public static StateCapture CaptureState()
        {
            var stateCapture = new StateCapture();
            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) {
                var types = assembly.GetExportedTypes();
                foreach (var reloadable in types.Where(t => t.IsSubclassOf(typeof(Reloadable)))) {
                    var state = (byte[])reloadable.GetMethod("SaveState", BindingFlags.Public | BindingFlags.Static).Invoke(null, null);
                    stateCapture.stateCapture.Add(new Tuple<string, byte[]>(reloadable.FullName, state));
                }
            }

            return stateCapture;
        }
Ejemplo n.º 2
0
        public static StateCapture CaptureState()
        {
            var stateCapture = new StateCapture();

            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                var types = assembly.GetExportedTypes();
                foreach (var reloadable in types.Where(t => t.IsSubclassOf(typeof(Reloadable))))
                {
                    var state = (byte[])reloadable.GetMethod("SaveState", BindingFlags.Public | BindingFlags.Static).Invoke(null, null);
                    stateCapture.stateCapture.Add(new Tuple <string, byte[]>(reloadable.FullName, state));
                }
            }

            return(stateCapture);
        }