Converting more functions to new style for REST/Console
parent
1c60ecf3ed
commit
d00df295d6
|
@ -133,12 +133,41 @@ namespace OpenSim.Services.IntegrationService
|
||||||
// Handle our console commands
|
// Handle our console commands
|
||||||
//
|
//
|
||||||
// Install plugin from registered repository
|
// Install plugin from registered repository
|
||||||
|
/// <summary>
|
||||||
|
/// Handles the console install plugin command. Attempts to install the selected plugin
|
||||||
|
/// and
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='module'>
|
||||||
|
/// Module.
|
||||||
|
/// </param>
|
||||||
|
/// <param name='cmd'>
|
||||||
|
/// Cmd.
|
||||||
|
/// </param>
|
||||||
private void HandleConsoleInstallPlugin(string module, string[] cmd)
|
private void HandleConsoleInstallPlugin(string module, string[] cmd)
|
||||||
{
|
{
|
||||||
|
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||||
|
|
||||||
if (cmd.Length == 2)
|
if (cmd.Length == 2)
|
||||||
{
|
{
|
||||||
int ndx = Convert.ToInt16(cmd[1]);
|
int ndx = Convert.ToInt16(cmd[1]);
|
||||||
MainConsole.Instance.Output(m_PluginManager.InstallPlugin(ndx));
|
if (m_PluginManager.InstallPlugin(ndx, out result) == true)
|
||||||
|
{
|
||||||
|
ArrayList s = new ArrayList();
|
||||||
|
s.AddRange(result.Keys);
|
||||||
|
s.Sort();
|
||||||
|
|
||||||
|
var list = result.Keys.ToList();
|
||||||
|
list.Sort();
|
||||||
|
foreach (var k in list)
|
||||||
|
{
|
||||||
|
Dictionary<string, object> plugin = (Dictionary<string, object>)result[k];
|
||||||
|
bool enabled = (bool)plugin["enabled"];
|
||||||
|
MainConsole.Instance.OutputFormat("{0}) {1} {2} rev. {3}",
|
||||||
|
k,
|
||||||
|
enabled == true ? "[ ]" : "[X]",
|
||||||
|
plugin["name"], plugin["version"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -291,7 +320,7 @@ namespace OpenSim.Services.IntegrationService
|
||||||
int ndx = Convert.ToInt16(cmd[2]);
|
int ndx = Convert.ToInt16(cmd[2]);
|
||||||
m_PluginManager.AddinInfo(ndx, out result);
|
m_PluginManager.AddinInfo(ndx, out result);
|
||||||
|
|
||||||
MainConsole.Instance.OutputFormat("Name: {0}\nURL: {1}\n{2}\n{3}",
|
MainConsole.Instance.OutputFormat("Name: {0}\nURL: {1}\nFile: {2}\nAuthor: {3}\nCategory: {4}\nDesc: {5}",
|
||||||
result["name"],
|
result["name"],
|
||||||
result["url"],
|
result["url"],
|
||||||
result["file_name"],
|
result["file_name"],
|
||||||
|
@ -380,9 +409,19 @@ namespace OpenSim.Services.IntegrationService
|
||||||
return Ux.DocToBytes(json);
|
return Ux.DocToBytes(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] HandleWebInstallPlugin (OSDMap request)
|
public byte[] HandleWebInstallPlugin(OSDMap request)
|
||||||
{
|
{
|
||||||
return Ux.FailureResult("Not Implemented");
|
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||||
|
int ndx = Convert.ToInt16(request["index"].ToString());
|
||||||
|
if (m_PluginManager.InstallPlugin(ndx, out result) == true)
|
||||||
|
{
|
||||||
|
string json = LitJson.JsonMapper.ToJson(result);
|
||||||
|
return Ux.DocToBytes(json);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Ux.FailureResult("No index supplied");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] HandleWebUnInstallPlugin (OSDMap request)
|
public byte[] HandleWebUnInstallPlugin (OSDMap request)
|
||||||
|
|
|
@ -65,8 +65,10 @@ namespace OpenSim.Services.IntegrationService
|
||||||
/// <param name='args'>
|
/// <param name='args'>
|
||||||
/// Arguments.
|
/// Arguments.
|
||||||
/// </param>
|
/// </param>
|
||||||
public string InstallPlugin(int ndx)
|
public bool InstallPlugin(int ndx, out Dictionary<string, object> result)
|
||||||
{
|
{
|
||||||
|
Dictionary<string, object> res = new Dictionary<string, object>();
|
||||||
|
|
||||||
PackageCollection pack = new PackageCollection();
|
PackageCollection pack = new PackageCollection();
|
||||||
PackageCollection toUninstall;
|
PackageCollection toUninstall;
|
||||||
DependencyCollection unresolved;
|
DependencyCollection unresolved;
|
||||||
|
@ -78,7 +80,8 @@ namespace OpenSim.Services.IntegrationService
|
||||||
if (ndx > (available.Length - 1))
|
if (ndx > (available.Length - 1))
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Output("Selection out of range");
|
MainConsole.Instance.Output("Selection out of range");
|
||||||
return "Error";
|
result = res;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AddinRepositoryEntry aentry = available[ndx];
|
AddinRepositoryEntry aentry = available[ndx];
|
||||||
|
@ -95,11 +98,14 @@ namespace OpenSim.Services.IntegrationService
|
||||||
Addin addin = m_Registry.GetAddin(aentry.Addin.Id);
|
Addin addin = m_Registry.GetAddin(aentry.Addin.Id);
|
||||||
m_Registry.DisableAddin(addin.Id);
|
m_Registry.DisableAddin(addin.Id);
|
||||||
addin.Enabled = false;
|
addin.Enabled = false;
|
||||||
return "Install";
|
ListInstalledAddins(out res);
|
||||||
|
result = res;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return "Bomb";
|
result = res;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,12 +416,7 @@ namespace OpenSim.Services.IntegrationService
|
||||||
res["url"] = addin.Description.Url;
|
res["url"] = addin.Description.Url;
|
||||||
res["file_name"] = addin.Description.FileName;
|
res["file_name"] = addin.Description.FileName;
|
||||||
|
|
||||||
// MainConsole.Instance.OutputFormat("Name: {0}\nURL: {1}\n{2}",
|
|
||||||
// addin.Name, addin.Description.Url,
|
|
||||||
// addin.Description.FileName);
|
|
||||||
|
|
||||||
result = res;
|
result = res;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue