override public bool AfterAllModulesLoaded() { m_log.Log(LogLevel.DINIT, "entered AfterAllModulesLoaded()"); // m_baseURL = "http://127.0.0.1:PORT/" m_port = ModuleParams.ParamInt(m_moduleName + ".Port"); m_baseURL = ModuleParams.ParamString(m_moduleName + ".BaseURL"); m_baseURL = m_baseURL + ":" + m_port.ToString(); m_listener = new HttpListener(); m_listener.Prefixes.Add(m_baseURL + "/"); // m_baseUIDIR = "/.../bin/LookingGlassUI/" string baseUIDir = ModuleParams.ParamString(m_moduleName + ".UIContentDir"); if (!baseUIDir.EndsWith("/")) { baseUIDir += "/"; } // things referenced as static are from the skinning directory below the UI dir // m_staticDir = "/.../bin/LookingGlassUI/Default/" string staticDir = baseUIDir; if (ModuleParams.HasParameter(m_moduleName + ".Skin")) { string skinName = ModuleParams.ParamString(m_moduleName + ".Skin"); skinName.Replace("/", ""); // skin names shouldn't fool with directories skinName.Replace("\\", ""); skinName.Replace("..", ""); staticDir = staticDir + skinName; } if (!staticDir.EndsWith("/")) { staticDir += "/"; } // stdDir = "/.../bin/LookingGlassUI/std/"; string stdDir = baseUIDir + "std/"; m_log.Log(LogLevel.DINITDETAIL, "Registering FileHandler {0} -> {1}", "/static/", staticDir); m_staticHandler = new RestHandler("/static/", staticDir); m_log.Log(LogLevel.DINITDETAIL, "Registering FileHandler {0} -> {1}", "/std/", stdDir); m_stdHandler = new RestHandler("/std/", stdDir); m_faviconHandler = new RestHandler("/favicon.ico", baseUIDir); // some Framework structures that can be referenced m_log.Log(LogLevel.DINITDETAIL, "Registering work queue stats at 'api/stats/workQueues'"); m_workQueueRestHandler = new RestHandler("/stats/workQueues", WorkQueueManager.Instance); m_log.Log(LogLevel.DINITDETAIL, "Registering parmeters at 'api/params/Default' and 'Ini', 'User', 'Override'"); m_paramDefaultRestHandler = new RestHandler("/params/Default", m_lgb.AppParams.DefaultParameters); m_paramIniRestHandler = new RestHandler("/params/Ini", m_lgb.AppParams.IniParameters); m_paramUserRestHandler = new RestHandler("/params/User", m_lgb.AppParams.UserParameters); m_paramOverrideRestHandler = new RestHandler("/params/Override", m_lgb.AppParams.OverrideParameters); m_log.Log(LogLevel.DINIT, "exiting AfterAllModulesLoaded()"); return(true); }
public override void Start() { string commName = ModuleParams.ParamString(ModuleName + ".Comm.Name"); try { m_comm = (CommLLLP)ModuleManager.Instance.Module(commName); } catch (Exception e) { m_log.Log(LogLevel.DBADERROR, "CommLLLPRest COULD NOT CONNECT TO COMM MODULE NAMED " + commName); m_log.Log(LogLevel.DBADERROR, "CommLLLPRest error = " + e.ToString()); } try { m_apiName = ModuleParams.ParamString(ModuleName + ".APIName"); ParameterSet connParams = m_comm.ConnectionParams; m_paramGetHandler = new RestHandler("/" + m_apiName + "/status", ref connParams, false); m_actionHandler = new RestHandler("/" + m_apiName + "/connect", null, ProcessPost); } catch (Exception e) { m_log.Log(LogLevel.DBADERROR, "CommLLLPRest COULD NOT REGISTER REST OPERATION: " + e.ToString()); } }
override public bool AfterAllModulesLoaded() { m_log.Log(LogLevel.DINIT, "entered AfterAllModulesLoaded()"); Renderer = (IRenderProvider)ModuleManager.Instance.Module(ModuleParams.ParamString(m_moduleName + ".Renderer.Name")); if (Renderer == null) { m_log.Log(LogLevel.DBADERROR, "UNABLE TO FIND RENDERER!!!! "); return(false); } m_cameraSpeed = ModuleParams.ParamFloat(m_moduleName + ".Camera.Speed"); m_cameraRotationSpeed = ModuleParams.ParamFloat(m_moduleName + ".Camera.RotationSpeed"); m_agentCameraBehind = ModuleParams.ParamFloat(m_moduleName + ".Camera.BehindAgent"); m_agentCameraAbove = ModuleParams.ParamFloat(m_moduleName + ".Camera.AboveAgent"); m_mainCamera = new CameraControl(); m_mainCamera.GlobalPosition = new OMV.Vector3d(1000d, 1000d, 40d); // World coordinates (Z up) // camera starts pointing down Y axis m_mainCamera.Heading = new OMV.Quaternion(OMV.Vector3.UnitZ, Constants.PI / 2); m_mainCamera.Zoom = 1.0f; m_mainCamera.Far = ModuleParams.ParamFloat(m_moduleName + ".Camera.ServerFar"); m_cameraMode = CameraMode.TrackingAgent; m_cameraLookAt = new OMV.Vector3d(0d, 0d, 0d); // connect me to the world so I can know when things change in the world TheWorld.OnWorldRegionNew += new WorldRegionNewCallback(World_OnRegionNew); TheWorld.OnWorldRegionUpdated += new WorldRegionUpdatedCallback(World_OnRegionUpdated); TheWorld.OnWorldRegionRemoved += new WorldRegionRemovedCallback(World_OnRegionRemoved); TheWorld.OnWorldEntityNew += new WorldEntityNewCallback(World_OnEntityNew); TheWorld.OnWorldEntityUpdate += new WorldEntityUpdateCallback(World_OnEntityUpdate); TheWorld.OnWorldEntityRemoved += new WorldEntityRemovedCallback(World_OnEntityRemoved); TheWorld.OnAgentNew += new WorldAgentNewCallback(World_OnAgentNew); TheWorld.OnAgentUpdate += new WorldAgentUpdateCallback(World_OnAgentUpdate); TheWorld.OnAgentRemoved += new WorldAgentRemovedCallback(World_OnAgentRemoved); m_log.Log(LogLevel.DINIT, "exiting AfterAllModulesLoaded()"); return(true); }