/// <summary>
        /// Delete the assembly
        /// </summary>
        /// <param name="plugin">Plugin to delete</param>
        /// <returns>Result of this method</returns>
        private Boolean DeletePlugin(Core.IPlugin plugin)
        {
            if (plugin != null)
            {
                //delete the assembly file
                string filePath =
                    Properties.Settings.Default.pluginPath + Path.DirectorySeparatorChar +
                    Properties.Settings.Default.pluginFileBase + plugin.GetName() +
                    ".dll";
                if (System.IO.File.Exists(filePath))
                {
                    try
                    {
                        System.IO.File.Delete(filePath);
                    }
                    catch (System.IO.IOException e)
                    {
                        WorkstationLogger.Instance.WriteLog(ServerConnection.Instance.GetWorkstationName() + "_PluginManager_DeletePlugin: " + e.Message, LogType.Exception, true);
                        return(false);
                    }
                }
                else
                {
                    return(true);
                }
            }

            return(true);
        }
Example #2
0
        /// <summary>
        /// Stop all jobs of a plugin
        /// </summary>
        /// <param name="plugin"></param>
        public void StopPluginScheduling(Core.IPlugin plugin)
        {
            List <TimerJobBase> jobsToStop = new List <TimerJobBase>();

            foreach (TimerJobBase job in this.Jobs)
            {
                if (job.ID.Contains(plugin.GetName()))
                {
                    jobsToStop.Add(job);
                }
            }

            foreach (TimerJobBase job in jobsToStop)
            {
                job.Stop();
                job.Dispose();
                Jobs.Remove(job);
            }
        }
Example #3
0
        /// <summary>
        /// Delete the assembly
        /// </summary>
        /// <param name="plugin">Plugin to delete</param>
        /// <returns>Result of this method</returns>
        private Boolean DeletePlugin(Core.IPlugin plugin)
        {
            if (plugin != null)
            {
                //delete the assembly file
                string filePath =
                    pluginPath +
                    Path.DirectorySeparatorChar +
                    Properties.Settings.Default.pluginFileBase + plugin.GetName() +
                    ".dll";
                if (System.IO.File.Exists(filePath))
                {
                    try
                    {
                        System.IO.File.Delete(filePath);
                    }
                    catch (System.IO.IOException e)
                    {
                        //Logging
                        //Logging "Base 64 string is null."
                        var messageEx1 = new StringBuilder();
                        messageEx1.Append(ServerConnection.GetWorkstationName() + "_PluginManager_DeletePlugin: ");
                        messageEx1.Append("Can't delete the plugin. " + e.ToString());
                        ServerConnection.WriteLog(messageEx1.ToString(), LogType.Exception);
                        return(false);
                    }
                }
                else
                {
                    return(true);
                }
            }


            return(true);
        }