public void Initialize(IConfigSource config, IRegistryCore registry)
{
IConfig hgConfig = config.Configs["HyperGrid"];
if (hgConfig == null || !hgConfig.GetBoolean ("Enabled", false))
return;
m_Check4096 = hgConfig.GetBoolean ("Check4096", true);
m_MapTileDirectory = hgConfig.GetString ("MapTileDirectory", "hgmaptiles");
hgConfig = config.Configs["HyperGridLinker"];
if (hgConfig == null || !hgConfig.GetBoolean ("Enabled", false))
return;
registry.RegisterModuleInterface<HypergridLinker> (this);//Add the interface
hgConfig = config.Configs["GatekeeperService"];
IHttpServer server = MainServer.Instance;
m_ThisGatekeeperURI = new Uri (server.FullHostName + ":" + server.Port);
if (!string.IsNullOrEmpty (m_MapTileDirectory))
{
try
{
Directory.CreateDirectory (m_MapTileDirectory);
}
catch (Exception e)
{
MainConsole.Instance.WarnFormat ("[HYPERGRID LINKER]: Could not create map tile storage directory {0}: {1}", m_MapTileDirectory, e);
m_MapTileDirectory = string.Empty;
}
}
if (MainConsole.Instance != null)
{
MainConsole.Instance.Info("[HYPERGRID LINKER]: Enabled");
MainConsole.Instance.Commands.AddCommand("link-region",
"link-region <Xloc> <Yloc> <ServerURI> [<RemoteRegionName>]",
"Link a HyperGrid Region. Examples for <ServerURI>: http://grid.net:8002/ or http://example.org/path/foo.php", RunCommand);
MainConsole.Instance.Commands.AddCommand ("unlink-region",
"unlink-region <local name>",
"Unlink a hypergrid region", RunCommand);
MainConsole.Instance.Commands.AddCommand ("link-mapping", "link-mapping [<x> <y>]",
"Set local coordinate to map HG regions to", RunCommand);
MainConsole.Instance.Commands.AddCommand ("show hyperlinks", "show hyperlinks",
"List the HG regions", HandleShow);
}
}