コード例 #1
0
 public string[] GetUnsavedItems(Plugin plugin)
 {
     try
     {
         var service = plugin.GetService <IUnsavedData>();
         if (service == null)
         {
             return(null);
         }
         return(service.GetNamesOfUnsavedItems());
     }
     catch (Exception ex)
     {
         _errorHandlingService.LogError("Error getting unsaved data from " + plugin.Title, ex);
         return(null);
     }
 }
コード例 #2
0
        public void Dispose()
        {
            if (RemotePlugin != null)
            {
                try
                {
                    RemotePlugin.Dispose();
                }
                catch (Exception ex)
                {
                    _errorHandlingService.LogError("Error disposing remote plugin for " + _startupInfo.Name, ex);
                }
            }

            if (_pluginLoader != null)
            {
                try
                {
                    _pluginLoader.Dispose();
                }
                catch (Exception ex)
                {
                    _errorHandlingService.LogError("Error disposing plugin loader for " + _startupInfo.Name, ex);
                }
            }

            // this can take some time if we have many plugins; should be made asynchronous
            if (Process != null)
            {
                Process.WaitForExit(5000);
                if (!Process.HasExited)
                {
                    _errorHandlingService.LogError("Remote process for " + _startupInfo.Name + " did not exit within timeout period and will be terminated", null);
                    Process.Kill();
                }
            }
        }