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); }
/// <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> public T MakeMapped <T>(T instance) where T : class, IEntity { _readerMap[instance.Name] = instance.ID; _reader.MapInstance <T>(instance); if (!_recordingEnabled) { return(instance); } IXmlLogWriter <T> writer = new OpenSimLogWriter <T>(_writerMap, instance, _hostPrim.Pos, true, true); _writers[instance.ID] = writer; _writerMap[instance.ID] = instance.Name; if (_currentlyRecording) { writer.StartRecording(_baseWriter.Log); } return(writer.Instance); }