public T Make <T>(T instance, bool recursive) where T : class { if (!_recordingEnabled) { _reader.MapInstance <T>(instance, !recursive); return(instance); } IXmlLogWriter <T> writer = new OpenSimLogWriter <T>(_writerMap, instance, _hostPrim.Pos, true, recursive);; if (_baseWriter == null) { _baseWriter = writer; } else { _writers.Add(UUID.Random(), writer); } if (_currentlyRecording) { writer.StartRecording(); } _reader.MapInstance <T>(writer.Instance, !recursive); return(writer.Instance); }
/// <summary> /// Map a string to an ID so it can be looked up when serializing and deserializing. /// </summary> /// <param name="id"></param> /// <param name="name"></param> private T MapID <T>(T instance) where T : class, ILogicEntity { if (_readerMap.ContainsKey(instance.Name)) { _readerMap[instance.Name] = instance.ID; } else { _readerMap.Add(instance.Name, instance.ID); } _reader.MapInstance <T>(instance); if (_recordingEnabled) { IXmlLogWriter <T> writer = new OpenSimLogWriter <T>(_writerMap, instance, HostPrim.Pos, true); _writers.Add(instance.ID, writer); _writerMap.Add(instance.ID, instance.Name); if (_currentlyRecording) { writer.StartRecording(_modelWriter.Log); } return(writer.Instance); } return(instance); }
public OriginalControl(IKeyTableFactory tableFactory, IAsynchQueueFactory queueFactory, IPrimFactory primFactory, IModel model, UUID hostID, IConfigSource config) : base(tableFactory, queueFactory) { _hostPrim = primFactory[hostID]; _readerMap = new Dictionary <string, UUID>(); _writerMap = tableFactory.MakeKeyTable <string>(); _paused = tableFactory.MakeKeyTable <bool>(); IConfig controlConfig = config.Configs["Control"]; IConfig commonConfig = config.Configs["Common"]; if (controlConfig == null) { controlConfig = config.Configs[0]; } if (commonConfig == null) { commonConfig = config.Configs[0]; } _wait = commonConfig.GetInt("Wait", 50); _userFolder = controlConfig.Get("UserFolder", "."); _recordingEnabled = controlConfig.GetBoolean("RecordingEnabled", false); _timing = controlConfig.GetBoolean("TimedPlayback", true); _schemaFile = controlConfig.GetString("TopologySchema", null); _reader = new OpenSimLogReader(_readerMap, model, HostPrim.Pos); _reader.MapInstance <IModule>(this); _writers = tableFactory.MakeKeyTable <IXmlLogWriter>(); _factory = primFactory; if (_recordingEnabled) { _modelWriter = new OpenSimLogWriter <IModel>(_writerMap, model, HostPrim.Pos, true, false); _model = _modelWriter.Instance; IXmlLogWriter <IModule> baseWriter = new OpenSimLogWriter <IModule>(_writerMap, this, HostPrim.Pos, true); _recordingBase = baseWriter.Instance; _writers.Add(hostID, baseWriter); } else { _model = model; } Namespace = controlConfig.Get("Namespace", Namespace); Logger.Info("Control started."); }
public SequenceManager(IModule control, IControlUtil controlUtil, IConfig controlConfig, IPrimFactory factory, IKeyTableFactory tableFactory, IAsynchQueue queue) : base(controlConfig) { _queue = queue; _controlUtil = controlUtil; _hostPrim = controlUtil.HostPrim; _readerMap = new Dictionary <string, UUID>(); _writerMap = tableFactory.MakeKeyTable <string>(); _recordingEnabled = controlConfig.GetBoolean("RecordingEnabled", false); _sequenceFolder = controlConfig.Get(FOLDER_KEY, "."); _timing = controlConfig.GetBoolean("TimedPlayback", true); _reader = new OpenSimLogReader(_readerMap, control, _hostPrim.Pos); _reader.MapInstance <IModule>(control); _writers = tableFactory.MakeKeyTable <IXmlLogWriter>(); _control = Make <IModule>(new RecordControl(control), true); }