bool ISimulationDataEnvSettingsStorageInterface.TryGetValue(UUID regionID, out WindLightSettings settings) { byte[] data; if (m_EnvSettingsData.TryGetValue(regionID, out data)) { using (var ms = new MemoryStream(data)) { settings = WindLightSettings.Deserialize(ms); return(true); } } settings = null; return(false); }
bool ISimulationDataEnvSettingsStorageInterface.TryGetValue(UUID regionID, out WindLightSettings settings) { using (var conn = new MySqlConnection(m_ConnectionString)) { conn.Open(); using (var cmd = new MySqlCommand("SELECT EnvironmentSettings FROM environmentsettings WHERE RegionID = @regionid", conn)) { cmd.Parameters.AddParameter("@regionid", regionID); using (MySqlDataReader reader = cmd.ExecuteReader()) { if (reader.Read()) { using (var ms = new MemoryStream(reader.GetBytes("EnvironmentSettings"))) { settings = WindLightSettings.Deserialize(ms); return(true); } } } } } settings = null; return(false); }
public void EnumerateUsedAssets(Action <UUID> action) { using (var conn = new MySqlConnection(m_ConnectionString)) { conn.Open(); using (MySqlCommand cmd = new MySqlCommand("SELECT DISTINCT AssetId FROM primitems", conn)) { using (MySqlDataReader dbReader = cmd.ExecuteReader()) { while (dbReader.Read()) { action(dbReader.GetUUID("AssetId")); } } } using (var cmd = new MySqlCommand("SELECT EnvironmentSettings FROM environmentsettings", conn)) { using (MySqlDataReader dbReader = cmd.ExecuteReader()) { while (dbReader.Read()) { WindLightSettings settings; using (MemoryStream ms = new MemoryStream(dbReader.GetBytes("EnvironmentSettings"))) { settings = WindLightSettings.Deserialize(ms); } if (settings.WaterSettings.NormalMap != UUID.Zero) { action(settings.WaterSettings.NormalMap); } } } } using (var cmd = new MySqlCommand("SELECT DISTINCT NormalMapTexture FROM lightshare", conn)) { using (MySqlDataReader dbReader = cmd.ExecuteReader()) { while (dbReader.Read()) { UUID id = dbReader.GetUUID("NormalMapTexture"); if (id != UUID.Zero) { action(id); } } } } using (var cmd = new MySqlCommand("SELECT DISTINCT TerrainTexture1, TerrainTexture2, TerrainTexture3, TerrainTexture4 FROM regionsettings", conn)) { using (MySqlDataReader dbReader = cmd.ExecuteReader()) { while (dbReader.Read()) { UUID id; id = dbReader.GetUUID("TerrainTexture1"); if (id != UUID.Zero) { action(id); } id = dbReader.GetUUID("TerrainTexture2"); if (id != UUID.Zero) { action(id); } id = dbReader.GetUUID("TerrainTexture3"); if (id != UUID.Zero) { action(id); } id = dbReader.GetUUID("TerrainTexture4"); if (id != UUID.Zero) { action(id); } } } } using (var cmd = new MySqlCommand("SELECT PrimitiveShapeData, ParticleSystem, TextureEntryBytes, ProjectionData, LoopedSoundData, ImpactSoundData FROM prims", conn)) { using (MySqlDataReader dbReader = cmd.ExecuteReader()) { while (dbReader.Read()) { ObjectPart.PrimitiveShape shape = new ObjectPart.PrimitiveShape { Serialization = dbReader.GetBytes("PrimitiveShapeData") }; ParticleSystem particleSystem = new ParticleSystem(dbReader.GetBytes("ParticleSystem"), 0); TextureEntry te = new TextureEntry(dbReader.GetBytes("TextureEntryBytes")); ObjectPart.ProjectionParam proj = new ObjectPart.ProjectionParam { DbSerialization = dbReader.GetBytes("ProjectionData") }; ObjectPart.SoundParam sound = new ObjectPart.SoundParam { Serialization = dbReader.GetBytes("LoopedSoundData") }; ObjectPart.CollisionSoundParam colsound = new ObjectPart.CollisionSoundParam { Serialization = dbReader.GetBytes("ImpactSoundData") }; if (shape.SculptMap != UUID.Zero) { action(shape.SculptMap); } foreach (UUID refid in particleSystem.References) { if (refid != UUID.Zero) { action(refid); } } foreach (UUID refid in te.References) { if (refid != UUID.Zero) { action(refid); } } if (proj.ProjectionTextureID != UUID.Zero) { action(proj.ProjectionTextureID); } if (sound.SoundID != UUID.Zero) { action(sound.SoundID); } if (colsound.ImpactSound != UUID.Zero) { action(colsound.ImpactSound); } } } } } }