Beispiel #1
0
        public string ExecuteCommand(string commandLine)
        {
            String  bundleIdStr = commandLine.Substring(GetCommandName().Length).Trim();
            var     bundleId    = int.Parse(bundleIdStr);
            IBundle bundle      = framework.GetBundleContext().GetBundle(bundleId);

            if (bundle == null)
            {
                return(String.Format("未找到Index为[{0}]的Bundle", bundleId));
            }
            bundle.Stop();
            bundle.UnInstall();
            return(String.Format("插件[{0} ({1})]已卸载.", bundle.GetSymbolicName(), bundle.GetVersion()));
        }
        public string ExecuteCommand(string commandLine)
        {
            String  location = commandLine.Substring(GetCommandName().Length).Trim();
            IBundle bundle   = null;

            try
            {
                bundle = framework.GetBundleContext().InstallBundle(location);
            }
            catch (Exception ex)
            {
                return(String.Format("安装插件出错,原因:{0}", ex.Message));
            }
            return(String.Format("插件[{0} ({1})]已安装.", bundle.GetSymbolicName(), bundle.GetVersion()));
        }
        public string ExecuteCommand(string commandLine)
        {
            String args = commandLine.Substring(GetCommandName().Length).Trim();

            int    bundleId = 0;
            string location = null;

            if (args.Contains(" "))
            {
                Int32 spaceIndex = args.IndexOf(" ");
                bundleId = int.Parse(args.Substring(0, spaceIndex));
                location = args.Substring(spaceIndex).Trim();
            }
            else
            {
                return("输入内容有误!");
            }

            IBundle bundle = null;

            try
            {
                bundle = framework.GetBundleContext().GetBundle(bundleId);
                if (bundle == null)
                {
                    return(String.Format("未找到Index为[{0}]的插件", bundleId));
                }
                if (!File.Exists(location))
                {
                    return(String.Format("无法找到路径[{0}]对应的文件", location));
                }

                bundle.Update(location);
            }
            catch (Exception ex)
            {
                return(String.Format("更新插件出错,原因:{0}", ex.Message));
            }
            return(String.Format("插件[{0} ({1})]已更新.", bundle.GetSymbolicName(), bundle.GetVersion()));
        }
Beispiel #4
0
        public string ExecuteCommand(string commandLine)
        {
            String  bundleIdStr = commandLine.Substring(GetCommandName().Length).Trim();
            var     bundleId    = int.Parse(bundleIdStr);
            IBundle bundle      = framework.GetBundleContext().GetBundle(bundleId);

            if (bundle == null)
            {
                return(String.Format("未找到Index为[{0}]的插件", bundleId));
            }
            bundle.Start();
            return(String.Format("启动插件[{0} ({1})]完成,当前状态为:{2}", bundle.GetSymbolicName(), bundle.GetVersion(), BundleUtils.GetBundleStateString(bundle.GetState())));
        }
Beispiel #5
0
        public string ExecuteCommand(string commandLine)
        {
            String  bundleIdStr = commandLine.Substring(GetCommandName().Length).Trim();
            var     bundleId    = int.Parse(bundleIdStr);
            IBundle bundle      = context.GetBundle(bundleId);

            if (bundle == null)
            {
                return(String.Format("未找到ID为[{0}]的Bundle", bundleId));
            }
            bundle.Stop();
            return(String.Format("插件[{0} ({1})]已停止.当前状态为:{2}", bundle.GetSymbolicName(), bundle.GetVersion(), BundleUtils.GetBundleStateString(bundle.GetState())));
        }