More command work

Start working toward using list entry numbers to select instead of the plugin id
integration
BlueWall 2012-04-08 20:09:54 -04:00
parent 952ad59c1f
commit 74776c4ee0
1 changed files with 47 additions and 8 deletions

View File

@ -99,13 +99,13 @@ namespace OpenSim.Services.IntegrationService
// List instaled addins // List instaled addins
public void ListInstalledAddins() public void ListInstalledAddins()
{ {
int count = 0; Addin[] addins = GetSortedAddinList("IntegrationPlugin");
ArrayList list = new ArrayList();
list.AddRange(m_Registry.GetAddins());
MainConsole.Instance.Output("Installed Plugins"); MainConsole.Instance.Output("Installed Plugins");
foreach (Addin addin in list)
int count = 0;
foreach (Addin addin in addins)
{ {
if(addin.Description.Category == "IntegrationPlugin")
MainConsole.Instance.OutputFormat("{0}) {1} {2} rev. {3}", count.ToString(), MainConsole.Instance.OutputFormat("{0}) {1} {2} rev. {3}", count.ToString(),
addin.Enabled == false ? "[X]" : "[ ]", addin.Enabled == false ? "[X]" : "[ ]",
addin.Name, addin.Version ); addin.Name, addin.Version );
@ -292,7 +292,17 @@ namespace OpenSim.Services.IntegrationService
// return; // return;
// } // }
Addin addin = m_Registry.GetAddin(args[2]); Addin[] addins = GetSortedAddinList("IntegrationPlugin");
int n = Convert.ToInt16(args[2]);
if (n > (addins.Length -1))
{
MainConsole.Instance.Output("Selection out of range");
return;
}
Addin addin = addins[n];
// Addin addin = m_Registry.GetAddin(args[2]);
AddinManager.Registry.DisableAddin(addin.Id); AddinManager.Registry.DisableAddin(addin.Id);
addin.Enabled = false; addin.Enabled = false;
return; return;
@ -301,10 +311,39 @@ namespace OpenSim.Services.IntegrationService
// Enable plugin // Enable plugin
public void EnablePlugin(string[] args) public void EnablePlugin(string[] args)
{ {
Addin addin = m_Registry.GetAddin(args[2]); Addin[] addins = GetSortedAddinList("IntegrationPlugin");
AddinManager.Registry.EnableAddin(addin.Id);
int n = Convert.ToInt16(args[2]);
if (n > (addins.Length -1))
{
MainConsole.Instance.Output("Selection out of range");
return;
}
Addin addin = addins[n];
// Addin addin = m_Registry.GetAddin(args[2]);
addin.Enabled = true; addin.Enabled = true;
return; return;
} }
#region Util
private Addin[] GetSortedAddinList(string category)
{
ArrayList list = new ArrayList();
list.AddRange(m_Registry.GetAddins());
ArrayList xlist = new ArrayList();
foreach (Addin addin in list)
{
if (addin.Description.Category == category)
xlist.Add(addin);
}
Addin[] addins = xlist.ToArray(typeof(Addin)) as Addin[];
Array.Sort(addins,(r1,r2) => r1.Id.CompareTo(r2.Id));
return addins;
}
#endregion Util
} }
} }