Ejemplo n.º 1
0
        public string ExecuteCommand(string commandLine)
        {
            var           bundles = framework.GetBundleContext().GetBundles();
            StringBuilder sb      = new StringBuilder();

            sb.Append("Index".PadLeft(5));
            sb.Append("|");
            sb.Append("State".PadRight(12));
            sb.Append("|");
            sb.Append("Name");
            sb.AppendLine();
            var index = 0;

            foreach (IBundle bundle in bundles)
            {
                sb.Append(index.ToString().PadLeft(5));
                sb.Append("|");
                sb.Append(BundleUtils.GetBundleStateString(bundle.GetState()).PadRight(12));
                sb.Append("|");
                sb.Append(String.Format("{0} ({1}) \"{2}\"", bundle.GetSymbolicName(), bundle.GetVersion(), bundle.GetManifest()["Name"]));
                sb.AppendLine();
                index++;
            }
            return(sb.ToString());
        }
Ejemplo n.º 2
0
        public string ExecuteCommand(string commandLine)
        {
            Bundle[]      bundles = framework.getBundleContext().getBundles();
            StringBuilder sb      = new StringBuilder();

            sb.Append("ID".PadLeft(5));
            sb.Append("|");
            sb.Append("State".PadRight(12));
            sb.Append("|");
            sb.Append("Name");
            sb.AppendLine();
            foreach (Bundle bundle in bundles)
            {
                sb.Append(bundle.getBundleId().ToString().PadLeft(5));
                sb.Append("|");
                sb.Append(BundleUtils.GetBundleStateString(bundle.getState()).PadRight(12));
                sb.Append("|");
                sb.Append(String.Format("{0} ({1}) \"{2}\"", bundle.getSymbolicName(), bundle.getVersion(), bundle.getHeaders()["Name"]));
                sb.AppendLine();
            }
            return(sb.ToString());
        }
Ejemplo n.º 3
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())));
        }