private void ReadComponent(MemoryStream stream, out ModSessionComponent com, out Ob_ModSessionComponent ob) { var code = stream.ReadInt32(); var desc = ModSessionComponentRegistry.Get(stream.ReadUInt64()); ob = desc.SerializeFromXml.Invoke(stream.ReadString()); com = desc.Activator.Invoke(); m_hashCodeToComponent.Add(code, com); Manager.FallbackLogger.Log(MyLogSeverity.Debug, "Read component of type {0} from bootstrapper. ID={1}", com.GetType().Name, code); }
private void WriteComponent(ModSessionComponent component, MemoryStream stream) { var code = CreateIdentifier(component); m_hashCodeToComponent[code] = component; stream.Write(code); var desc = ModSessionComponentRegistry.Get(component.GetType()); stream.Write(desc.TypeKey); stream.Write(MyAPIGateway.Utilities.SerializeToXML(component.SaveConfiguration())); Manager.FallbackLogger.Log(MyLogSeverity.Debug, "Wrote component of type {0} for bootstrapper. ID={1}", component.GetType().Name, code); }
public void AppendConfiguration(Ob_SessionManager config) { if (config.SessionComponents == null) { return; } TolerableLag = config.TolerableLag; foreach (var x in config.SessionComponents) { var desc = ModSessionComponentRegistry.Get(x); var module = desc.Activator(); FallbackLogger.Log(MyLogSeverity.Debug, "Registering module {0} from configuration", module.GetType()); Register(module, x); } }
public static void Register() { ModSessionComponentRegistry.Register <Equinox.Utils.Logging.VRageLogger, Equinox.Utils.Logging.Ob_VRageLogger>(); ModSessionComponentRegistry.Register <Equinox.Utils.Logging.CustomLogger, Equinox.Utils.Logging.Ob_CustomLogger>(); ModSessionComponentRegistry.Register <Equinox.Utils.Network.NetworkComponent, Equinox.Utils.Network.Ob_Network>(); ModSessionComponentRegistry.Register <Equinox.Utils.Network.RPCComponent, Equinox.Utils.Network.Ob_RPC>(); ModSessionComponentRegistry.Register <Equinox.Utils.Network.SyncComponent, Equinox.Utils.Network.Ob_Sync>(); ModSessionComponentRegistry.Register <Equinox.Utils.Session.SessionBootstrapper, Equinox.Utils.Session.Ob_SessionBootstrapper>(); ModSessionComponentRegistry.Register <Equinox.Utils.Command.CommandDispatchComponent, Equinox.Utils.Command.Ob_CommandDispatch>(); ModSessionComponentRegistry.Register <Equinox.ProceduralWorld.Names.CompositeNameGenerator, Equinox.ProceduralWorld.Names.Ob_CompositeNameGenerator>(); ModSessionComponentRegistry.Register <Equinox.ProceduralWorld.Buildings.BuildingControlCommands, Equinox.ProceduralWorld.Buildings.Ob_BuildingControlCommands>(); ModSessionComponentRegistry.Register <Equinox.ProceduralWorld.Buildings.BuildingDatabase, Equinox.ProceduralWorld.Buildings.Ob_BuildingDatabase>(); ModSessionComponentRegistry.Register <Equinox.ProceduralWorld.Manager.ProceduralWorldManager, Equinox.ProceduralWorld.Manager.Ob_ProceduralWorldManager>(); ModSessionComponentRegistry.Register <Equinox.ProceduralWorld.Voxels.Planets.InfinitePlanetsModule, Equinox.ProceduralWorld.Voxels.Planets.Ob_InfinitePlanets>(); ModSessionComponentRegistry.Register <Equinox.ProceduralWorld.Voxels.Asteroids.AsteroidFieldModule, Equinox.ProceduralWorld.Voxels.Asteroids.Ob_AsteroidField>(); ModSessionComponentRegistry.Register <Equinox.ProceduralWorld.Voxels.Asteroids.AutomaticAsteroidFieldsComponent, Equinox.ProceduralWorld.Voxels.Asteroids.Ob_AutomaticAsteroidFields>(); ModSessionComponentRegistry.Register <ExoticNameGenerator, Ob_ExoticNameGenerator>(); ModSessionComponentRegistry.Register <StatisticalNameGenerator, Ob_StatisticalNameGenerator>(); ModSessionComponentRegistry.Register <Equinox.ProceduralWorld.Buildings.Generation.StationGeneratorManager, Equinox.ProceduralWorld.Buildings.Generation.Ob_StationGeneratorManager>(); ModSessionComponentRegistry.Register <Equinox.ProceduralWorld.Buildings.Exporter.DesignTools, Equinox.ProceduralWorld.Buildings.Exporter.Ob_DesignTools>(); ModSessionComponentRegistry.Register <Equinox.ProceduralWorld.Buildings.Game.ProceduralStationModule, Equinox.ProceduralWorld.Buildings.Game.Ob_ProceduralStation>(); ModSessionComponentRegistry.Register <Equinox.ProceduralWorld.Buildings.Seeds.ProceduralFactions, Equinox.ProceduralWorld.Buildings.Seeds.Ob_ProceduralFactions>(); ModSessionComponentRegistry.Register <Equinox.ProceduralWorld.Buildings.Library.PartManager, Equinox.ProceduralWorld.Buildings.Library.Ob_PartManager>(); }