Пример #1
0
        static void Main()
        {
            Console.WriteLine("Copy new versions into the Plugins folder, and the output below should change. Press [enter] to exit");

            IPluginWatcher <ISimpleTask> watcher = new PluginWatcher <ISimpleTask>("./Plugins");

            watcher.PluginsChanged += watcher_PluginsChanged;

            current = Latest(watcher.CurrentlyAvailable);

            Console.WriteLine("\r\nInitial startup\r\nLatest version:");
            Console.WriteLine(current.Version());

            // Here we set some state that should be maintained between versions
            current.SetGreets("Hello");

            do
            {
                while (!Console.KeyAvailable)
                {
                    Thread.Sleep(200);
                    lock (VersionLock)
                    {
                        Console.SetCursorPosition(0, 8);
                        Console.WriteLine(current.Greeting("world"));
                    }
                }
            }while (Console.ReadKey().Key != ConsoleKey.Enter);
        }
Пример #2
0
        static void Main()
        {
            Console.WriteLine("Copy new versions into the Plugins folder, and the output below should change. Press [enter] to exit");

            IPluginWatcher<ISimpleTask> watcher = new PluginWatcher<ISimpleTask>("./Plugins");
            watcher.PluginsChanged += watcher_PluginsChanged;

            current = Latest(watcher.CurrentlyAvailable);

            Console.WriteLine("\r\nInitial startup\r\nLatest version:");
            Console.WriteLine(current.Version());

            // Here we set some state that should be maintained between versions
            current.SetGreets("Hello");

            do
            {
                while (!Console.KeyAvailable)
                {
                    Thread.Sleep(200);
                    lock (VersionLock)
                    {
                        Console.SetCursorPosition(0, 8);
                        Console.WriteLine(current.Greeting("world"));
                    }
                }
            }
            while (Console.ReadKey().Key != ConsoleKey.Enter);
        }
Пример #3
0
        public Form1()
        {
            InitializeComponent();
            SingleSerializationPluginDecorator.SetPluginManager(PluginsManager);

            PluginWatcher.Add(this);
        }
Пример #4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            ControllersManager.Add(new DrawShapeController(this));
            ControllersManager.Add(new MoveShapeController(this));

            PluginsManager.LoadPlugins();
            PluginWatcher.Run(PluginsManager.PluginsFolder);

            G = panel1.CreateGraphics();

            LoadShapes();
        }
Пример #5
0
        /// <summary>
        /// 初始化。
        /// </summary>
        public static void Initialize()
        {
            //注册插件控制器工厂。
            ControllerBuilder.Current.SetControllerFactory(new PluginControllerFactory());

            //注册插件模板引擎。
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new PluginRazorViewEngine());

            //初始化插件。
            PluginManager.Initialize();

            //启动插件检测器。
            PluginWatcher.Start();
        }
Пример #6
0
        static void Main()
        {
            Console.WriteLine("As plugins are added and removed, you should see output below. Press [enter] to exit");

            IPluginWatcher <IWatchablePlugin> watcher = new PluginWatcher <IWatchablePlugin>("./Plugins");

            watcher.PluginsChanged += watcher_PluginsChanged;


            Console.WriteLine("\r\nPlugins loaded:");
            Console.WriteLine(string.Join(", ", watcher.CurrentlyAvailable.Select(p => p.Name())));

            do
            {
                while (!Console.KeyAvailable)
                {
                    Thread.Sleep(200);
                }
            }while (Console.ReadKey().Key != ConsoleKey.Enter);
        }
Пример #7
0
        static void Main()
        {
            Console.WriteLine("As plugins are added and removed, you should see output below. Press [enter] to exit");

            IPluginWatcher<IWatchablePlugin> watcher = new PluginWatcher<IWatchablePlugin>("./Plugins");
            watcher.PluginsChanged += watcher_PluginsChanged;


            Console.WriteLine("\r\nPlugins loaded:");
            Console.WriteLine(string.Join(", ", watcher.CurrentlyAvailable.Select(p => p.Name())));

            do
            {
                while (!Console.KeyAvailable)
                {
                    Thread.Sleep(200);
                }
            }
            while (Console.ReadKey().Key != ConsoleKey.Enter);
        }
Пример #8
0
        public static void Initialize()
        {
            AppDomain.CurrentDomain.SetupInformation.ShadowCopyFiles       = "true";
            AppDomain.CurrentDomain.SetupInformation.ShadowCopyDirectories = WebSettings.PluginBinPath;

            MoveFiles(new DirectoryInfo(WebSettings.PluginPath), new DirectoryInfo(WebSettings.PluginBinPath));

            DomainLoader loader = new DomainLoader("app", "loader", WebSettings.PluginBinPath.Substring(WebSettings.PluginBinPath.LastIndexOf(Path.DirectorySeparatorChar) + 1));

            loader.Load();
            loader.Unload();

            RegisterPlugins();
            //ObjectResolver.Init();


            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new SpiderViewEngine());
            ControllerBuilder.Current.SetControllerFactory(new SpiderControllerFactory());

            PluginWatcher watcher = new PluginWatcher();

            watcher.Watch();
        }