29 using System.Collections.Generic;
33 using System.Reflection;
36 using Community.CsharpSqlite.Sqlite;
38 using Mono.Data.Sqlite;
41 using OpenMetaverse.StructuredData;
42 using OpenSim.Framework;
43 using OpenSim.Region.Framework.Interfaces;
44 using OpenSim.Region.Framework.Scenes;
46 namespace OpenSim.Data.SQLite
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54 private static readonly
string LogHeader =
"[REGION DB SQLITE]";
56 private const string primSelect =
"select * from prims";
57 private const string shapeSelect =
"select * from primshapes";
58 private const string itemsSelect =
"select * from primitems";
59 private const string terrainSelect =
"select * from terrain limit 1";
60 private const string landSelect =
"select * from land";
61 private const string landAccessListSelect =
"select distinct * from landaccesslist";
62 private const string regionbanListSelect =
"select * from regionban";
63 private const string regionSettingsSelect =
"select * from regionsettings";
64 private const string regionWindlightSelect =
"select * from regionwindlight";
65 private const string regionEnvironmentSelect =
"select * from regionenvironment";
66 private const string regionSpawnPointsSelect =
"select * from spawn_points";
69 private SqliteDataAdapter primDa;
70 private SqliteDataAdapter shapeDa;
71 private SqliteDataAdapter itemsDa;
72 private SqliteDataAdapter terrainDa;
73 private SqliteDataAdapter landDa;
74 private SqliteDataAdapter landAccessListDa;
75 private SqliteDataAdapter regionSettingsDa;
76 private SqliteDataAdapter regionWindlightDa;
77 private SqliteDataAdapter regionEnvironmentDa;
78 private SqliteDataAdapter regionSpawnPointsDa;
80 private SqliteConnection m_conn;
81 private String m_connectionString;
83 protected virtual Assembly Assembly
85 get {
return GetType().Assembly; }
94 Initialise(connectionString);
116 if (Util.IsWindows())
117 Util.LoadArchSpecificWindowsDll(
"sqlite3.dll");
119 m_connectionString = connectionString;
121 ds =
new DataSet(
"Region");
123 m_log.Info(
"[SQLITE REGION DB]: Sqlite - connecting: " + connectionString);
124 m_conn =
new SqliteConnection(m_connectionString);
127 SqliteCommand primSelectCmd =
new SqliteCommand(primSelect, m_conn);
128 primDa =
new SqliteDataAdapter(primSelectCmd);
130 SqliteCommand shapeSelectCmd =
new SqliteCommand(shapeSelect, m_conn);
131 shapeDa =
new SqliteDataAdapter(shapeSelectCmd);
134 SqliteCommand itemsSelectCmd =
new SqliteCommand(itemsSelect, m_conn);
135 itemsDa =
new SqliteDataAdapter(itemsSelectCmd);
137 SqliteCommand terrainSelectCmd =
new SqliteCommand(terrainSelect, m_conn);
138 terrainDa =
new SqliteDataAdapter(terrainSelectCmd);
140 SqliteCommand landSelectCmd =
new SqliteCommand(landSelect, m_conn);
141 landDa =
new SqliteDataAdapter(landSelectCmd);
143 SqliteCommand landAccessListSelectCmd =
new SqliteCommand(landAccessListSelect, m_conn);
144 landAccessListDa =
new SqliteDataAdapter(landAccessListSelectCmd);
146 SqliteCommand regionSettingsSelectCmd =
new SqliteCommand(regionSettingsSelect, m_conn);
147 regionSettingsDa =
new SqliteDataAdapter(regionSettingsSelectCmd);
149 SqliteCommand regionWindlightSelectCmd =
new SqliteCommand(regionWindlightSelect, m_conn);
150 regionWindlightDa =
new SqliteDataAdapter(regionWindlightSelectCmd);
152 SqliteCommand regionEnvironmentSelectCmd =
new SqliteCommand(regionEnvironmentSelect, m_conn);
153 regionEnvironmentDa =
new SqliteDataAdapter(regionEnvironmentSelectCmd);
155 SqliteCommand regionSpawnPointsSelectCmd =
new SqliteCommand(regionSpawnPointsSelect, m_conn);
156 regionSpawnPointsDa =
new SqliteDataAdapter(regionSpawnPointsSelectCmd);
164 ds.Tables.Add(createPrimTable());
165 setupPrimCommands(primDa, m_conn);
167 ds.Tables.Add(createShapeTable());
168 setupShapeCommands(shapeDa, m_conn);
170 ds.Tables.Add(createItemsTable());
171 setupItemsCommands(itemsDa, m_conn);
173 ds.Tables.Add(createTerrainTable());
174 setupTerrainCommands(terrainDa, m_conn);
176 ds.Tables.Add(createLandTable());
177 setupLandCommands(landDa, m_conn);
179 ds.Tables.Add(createLandAccessListTable());
180 setupLandAccessCommands(landAccessListDa, m_conn);
182 ds.Tables.Add(createRegionSettingsTable());
183 setupRegionSettingsCommands(regionSettingsDa, m_conn);
185 ds.Tables.Add(createRegionWindlightTable());
186 setupRegionWindlightCommands(regionWindlightDa, m_conn);
188 ds.Tables.Add(createRegionEnvironmentTable());
189 setupRegionEnvironmentCommands(regionEnvironmentDa, m_conn);
191 ds.Tables.Add(createRegionSpawnPointsTable());
192 setupRegionSpawnPointsCommands(regionSpawnPointsDa, m_conn);
200 primDa.Fill(ds.Tables[
"prims"]);
204 m_log.ErrorFormat(
"[SQLITE REGION DB]: Caught fill error on prims table :{0}", e.Message);
209 shapeDa.Fill(ds.Tables[
"primshapes"]);
213 m_log.ErrorFormat(
"[SQLITE REGION DB]: Caught fill error on primshapes table :{0}", e.Message);
218 itemsDa.Fill(ds.Tables[
"primitems"]);
222 m_log.ErrorFormat(
"[SQLITE REGION DB]: Caught fill error on primitems table :{0}", e.Message);
227 terrainDa.Fill(ds.Tables[
"terrain"]);
231 m_log.ErrorFormat(
"[SQLITE REGION DB]: Caught fill error on terrain table :{0}", e.Message);
236 landDa.Fill(ds.Tables[
"land"]);
240 m_log.ErrorFormat(
"[SQLITE REGION DB]: Caught fill error on land table :{0}", e.Message);
245 landAccessListDa.Fill(ds.Tables[
"landaccesslist"]);
249 m_log.ErrorFormat(
"[SQLITE REGION DB]: Caught fill error on landaccesslist table :{0}", e.Message);
254 regionSettingsDa.Fill(ds.Tables[
"regionsettings"]);
258 m_log.ErrorFormat(
"[SQLITE REGION DB]: Caught fill error on regionsettings table :{0}", e.Message);
263 regionWindlightDa.Fill(ds.Tables[
"regionwindlight"]);
267 m_log.ErrorFormat(
"[SQLITE REGION DB]: Caught fill error on regionwindlight table :{0}", e.Message);
272 regionEnvironmentDa.Fill(ds.Tables[
"regionenvironment"]);
276 m_log.ErrorFormat(
"[SQLITE REGION DB]: Caught fill error on regionenvironment table :{0}", e.Message);
281 regionSpawnPointsDa.Fill(ds.Tables[
"spawn_points"]);
285 m_log.ErrorFormat(
"[SQLITE REGION DB]: Caught fill error on spawn_points table :{0}", e.Message);
291 CreateDataSetMapping(primDa,
"prims");
292 CreateDataSetMapping(shapeDa,
"primshapes");
293 CreateDataSetMapping(itemsDa,
"primitems");
294 CreateDataSetMapping(terrainDa,
"terrain");
295 CreateDataSetMapping(landDa,
"land");
296 CreateDataSetMapping(landAccessListDa,
"landaccesslist");
297 CreateDataSetMapping(regionSettingsDa,
"regionsettings");
298 CreateDataSetMapping(regionWindlightDa,
"regionwindlight");
299 CreateDataSetMapping(regionEnvironmentDa,
"regionenvironment");
300 CreateDataSetMapping(regionSpawnPointsDa,
"spawn_points");
305 m_log.ErrorFormat(
"[SQLITE REGION DB]: {0} - {1}", e.Message, e.StackTrace);
306 Environment.Exit(23);
338 if (terrainDa != null)
348 if (landAccessListDa != null)
350 landAccessListDa.Dispose();
351 landAccessListDa = null;
353 if (regionSettingsDa != null)
355 regionSettingsDa.Dispose();
356 regionSettingsDa = null;
358 if (regionWindlightDa != null)
360 regionWindlightDa.Dispose();
361 regionWindlightDa = null;
363 if (regionEnvironmentDa != null)
365 regionEnvironmentDa.Dispose();
366 regionEnvironmentDa = null;
368 if (regionSpawnPointsDa != null)
370 regionSpawnPointsDa.Dispose();
371 regionWindlightDa = null;
379 DataTable regionsettings = ds.Tables[
"regionsettings"];
381 DataRow settingsRow = regionsettings.Rows.Find(rs.RegionUUID.ToString());
382 if (settingsRow == null)
384 settingsRow = regionsettings.NewRow();
385 fillRegionSettingsRow(settingsRow, rs);
386 regionsettings.Rows.Add(settingsRow);
390 fillRegionSettingsRow(settingsRow, rs);
393 StoreSpawnPoints(rs);
409 new SqliteCommand(
"delete from spawn_points where RegionID=:RegionID",
413 cmd.Parameters.Add(
new SqliteParameter(
":RegionID", rs.
RegionUUID.ToString()));
414 cmd.ExecuteNonQuery();
420 using (SqliteCommand cmd =
new SqliteCommand(
"insert into spawn_points(RegionID, Yaw, Pitch, Distance)" +
421 "values ( :RegionID, :Yaw, :Pitch, :Distance)", m_conn))
423 cmd.Parameters.Add(
new SqliteParameter(
":RegionID", rs.RegionUUID.ToString()));
424 cmd.Parameters.Add(
new SqliteParameter(
":Yaw", sp.
Yaw));
425 cmd.Parameters.Add(
new SqliteParameter(
":Pitch", sp.
Pitch));
426 cmd.Parameters.Add(
new SqliteParameter(
":Distance", sp.
Distance));
427 cmd.ExecuteNonQuery();
442 DataTable windlightTable = ds.Tables[
"regionwindlight"];
443 DataRow windlightRow = windlightTable.Rows.Find(regionUUID.ToString());
444 if (windlightRow == null)
447 wl.regionID = regionUUID;
448 StoreRegionWindlightSettings(wl);
451 wl = buildRegionWindlight(windlightRow);
464 DataTable windlightTable = ds.Tables[
"regionwindlight"];
465 DataRow windlightRow = windlightTable.Rows.Find(regionID.ToString());
467 if (windlightRow != null)
469 windlightRow.Delete();
483 DataTable windlightTable = ds.Tables[
"regionwindlight"];
484 DataRow windlightRow = windlightTable.Rows.Find(wl.regionID.ToString());
486 if (windlightRow == null)
488 windlightRow = windlightTable.NewRow();
489 fillRegionWindlightRow(windlightRow, wl);
490 windlightTable.Rows.Add(windlightRow);
494 fillRegionWindlightRow(windlightRow, wl);
501 #region Region Environment Settings
506 DataTable environmentTable = ds.Tables[
"regionenvironment"];
507 DataRow row = environmentTable.Rows.Find(regionUUID.ToString());
513 return (
String)row[
"llsd_settings"];
521 DataTable environmentTable = ds.Tables[
"regionenvironment"];
522 DataRow row = environmentTable.Rows.Find(regionUUID.ToString());
526 row = environmentTable.NewRow();
527 row[
"region_id"] = regionUUID.ToString();
528 row[
"llsd_settings"] = settings;
529 environmentTable.Rows.Add(row);
533 row[
"llsd_settings"] = settings;
536 regionEnvironmentDa.Update(ds,
"regionenvironment");
544 DataTable environmentTable = ds.Tables[
"regionenvironment"];
545 DataRow row = environmentTable.Rows.Find(regionUUID.ToString());
552 regionEnvironmentDa.Update(ds,
"regionenvironment");
562 DataTable regionsettings = ds.Tables[
"regionsettings"];
564 string searchExp =
"regionUUID = '" + regionUUID.ToString() +
"'";
565 DataRow[] rawsettings = regionsettings.Select(searchExp);
566 if (rawsettings.Length == 0)
569 rs.RegionUUID = regionUUID;
570 rs.OnSave += StoreRegionSettings;
572 StoreRegionSettings(rs);
576 DataRow row = rawsettings[0];
579 newSettings.OnSave += StoreRegionSettings;
581 LoadSpawnPoints(newSettings);
589 rs.ClearSpawnPoints();
591 DataTable spawnpoints = ds.Tables[
"spawn_points"];
592 string byRegion =
"RegionID = '" + rs.RegionUUID +
"'";
593 DataRow[] spForRegion = spawnpoints.Select(byRegion);
595 foreach (DataRow spRow
in spForRegion)
598 sp.Pitch = (float)spRow[
"Pitch"];
599 sp.Yaw = (float)spRow[
"Yaw"];
600 sp.Distance = (float)spRow[
"Distance"];
602 rs.AddSpawnPoint(sp);
613 uint flags = obj.RootPart.GetEffectiveObjectFlags();
617 if ((flags & (uint)
PrimFlags.Temporary) != 0)
619 if ((flags & (uint)
PrimFlags.TemporaryOnRez) != 0)
627 addPrim(prim, obj.
UUID, regionUUID);
644 DataTable prims = ds.Tables[
"prims"];
645 DataTable shapes = ds.Tables[
"primshapes"];
647 string selectExp =
"SceneGroupID = '" + obj +
"' and RegionUUID = '" + regionUUID +
"'";
650 DataRow[] primRows = prims.Select(selectExp);
651 foreach (DataRow row
in primRows)
654 UUID uuid =
new UUID((
string)row[
"UUID"]);
655 DataRow shapeRow = shapes.Rows.Find(uuid.ToString());
656 if (shapeRow != null)
676 private void RemoveItems(UUID uuid)
678 DataTable items = ds.Tables[
"primitems"];
680 String sql = String.Format(
"primID = '{0}'", uuid);
681 DataRow[] itemRows = items.Select(sql);
683 foreach (DataRow itemRow
in itemRows)
696 Dictionary<UUID, SceneObjectGroup> createdObjects =
new Dictionary<UUID, SceneObjectGroup>();
698 List<SceneObjectGroup> retvals =
new List<SceneObjectGroup>();
700 DataTable prims = ds.Tables[
"prims"];
701 DataTable shapes = ds.Tables[
"primshapes"];
703 string byRegion =
"RegionUUID = '" + regionUUID +
"'";
707 DataRow[] primsForRegion = prims.Select(byRegion);
711 foreach (DataRow primRow
in primsForRegion)
717 string uuid = (string)primRow[
"UUID"];
718 string objID = (string)primRow[
"SceneGroupID"];
722 prim = buildPrim(primRow);
723 DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString());
724 if (shapeRow != null)
726 prim.Shape = buildShape(shapeRow);
731 "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape");
732 prim.Shape = PrimitiveBaseShape.Default;
737 createdObjects.Add(group.UUID, group);
746 m_log.Error(
"[SQLITE REGION DB]: Failed create prim object in new group, exception and data follows");
747 m_log.Error(
"[SQLITE REGION DB]: ", e);
748 foreach (DataColumn col
in prims.Columns)
750 m_log.Error(
"[SQLITE REGION DB]: Col: " + col.ColumnName +
" => " + primRow[col]);
756 foreach (DataRow primRow
in primsForRegion)
762 string uuid = (string)primRow[
"UUID"];
763 string objID = (string)primRow[
"SceneGroupID"];
766 prim = buildPrim(primRow);
767 DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString());
768 if (shapeRow != null)
770 prim.Shape = buildShape(shapeRow);
775 "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape");
776 prim.Shape = PrimitiveBaseShape.Default;
779 createdObjects[
new UUID(objID)].AddPart(prim);
785 m_log.Error(
"[SQLITE REGION DB]: Failed create prim object in group, exception and data follows");
786 m_log.Error(
"[SQLITE REGION DB]: ", e);
787 foreach (DataColumn col
in prims.Columns)
789 m_log.Error(
"[SQLITE REGION DB]: Col: " + col.ColumnName +
" => " + primRow[col]);
805 DataTable dbItems = ds.Tables[
"primitems"];
806 String sql = String.Format(
"primID = '{0}'", prim.UUID.ToString());
807 DataRow[] dbItemRows = dbItems.Select(sql);
808 IList<TaskInventoryItem> inventory =
new List<TaskInventoryItem>();
812 foreach (DataRow row
in dbItemRows)
820 prim.Inventory.RestoreInventoryItems(inventory);
839 SqliteCommand cmd =
new SqliteCommand(
"delete from terrain where RegionUUID=:RegionUUID", m_conn))
841 cmd.Parameters.Add(
new SqliteParameter(
":RegionUUID", regionID.ToString()));
842 cmd.ExecuteNonQuery();
847 String sql =
"insert into terrain(RegionUUID, Revision, Heightfield)" +
848 " values(:RegionUUID, :Revision, :Heightfield)";
850 int terrainDBRevision;
852 terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob);
854 m_log.DebugFormat(
"{0} Storing terrain revision r {1}", LogHeader, terrainDBRevision);
856 using (SqliteCommand cmd =
new SqliteCommand(sql, m_conn))
858 cmd.Parameters.Add(
new SqliteParameter(
":RegionUUID", regionID.ToString()));
859 cmd.Parameters.Add(
new SqliteParameter(
":Revision", terrainDBRevision));
860 cmd.Parameters.Add(
new SqliteParameter(
":Heightfield", terrainDBblob));
861 cmd.ExecuteNonQuery();
873 double[,] ret = null;
875 if (terrData != null)
876 ret = terrData.GetDoubles();
887 String sql =
"select RegionUUID, Revision, Heightfield from terrain" +
888 " where RegionUUID=:RegionUUID order by Revision desc";
890 using (SqliteCommand cmd =
new SqliteCommand(sql, m_conn))
892 cmd.Parameters.Add(
new SqliteParameter(
":RegionUUID", regionID.ToString()));
894 using (IDataReader row = cmd.ExecuteReader())
899 rev = Convert.ToInt32(row[
"Revision"]);
900 byte[] blob = (byte[])row[
"Heightfield"];
901 terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob);
905 m_log.Warn(
"[SQLITE REGION DB]: No terrain found for region");
909 m_log.Debug(
"[SQLITE REGION DB]: Loaded terrain revision r" + rev.ToString());
935 DataTable land = ds.Tables[
"land"];
936 DataTable landaccesslist = ds.Tables[
"landaccesslist"];
937 DataRow landRow = land.Rows.Find(globalID.ToString());
942 List<DataRow> rowsToDelete =
new List<DataRow>();
943 foreach (DataRow rowToCheck
in landaccesslist.Rows)
945 if (rowToCheck[
"LandUUID"].ToString() == globalID.ToString())
946 rowsToDelete.Add(rowToCheck);
948 for (
int iter = 0; iter < rowsToDelete.Count; iter++)
950 rowsToDelete[iter].Delete();
964 DataTable land = ds.Tables[
"land"];
965 DataTable landaccesslist = ds.Tables[
"landaccesslist"];
967 DataRow landRow = land.Rows.Find(parcel.LandData.GlobalID.ToString());
970 landRow = land.NewRow();
972 land.Rows.Add(landRow);
990 List<DataRow> rowsToDelete =
new List<DataRow>();
991 foreach (DataRow rowToCheck
in landaccesslist.Rows)
993 if (rowToCheck[
"LandUUID"].ToString() == parcel.LandData.GlobalID.ToString())
994 rowsToDelete.Add(rowToCheck);
996 for (
int iter = 0; iter < rowsToDelete.Count; iter++)
998 rowsToDelete[iter].Delete();
999 landaccesslist.Rows.Remove(rowsToDelete[iter]);
1001 rowsToDelete.Clear();
1004 DataRow newAccessRow = landaccesslist.NewRow();
1006 landaccesslist.Rows.Add(newAccessRow);
1020 List<LandData> landDataForRegion =
new List<LandData>();
1023 DataTable land = ds.Tables[
"land"];
1024 DataTable landaccesslist = ds.Tables[
"landaccesslist"];
1025 string searchExp =
"RegionUUID = '" + regionUUID +
"'";
1026 DataRow[] rawDataForRegion = land.Select(searchExp);
1027 foreach (DataRow rawDataLand
in rawDataForRegion)
1029 LandData newLand = buildLandData(rawDataLand);
1030 string accessListSearchExp =
"LandUUID = '" + newLand.GlobalID +
"'";
1031 DataRow[] rawDataForLandAccessList = landaccesslist.Select(accessListSearchExp);
1032 foreach (DataRow rawDataLandAccess
in rawDataForLandAccessList)
1034 newLand.ParcelAccessList.Add(buildLandAccessData(rawDataLandAccess));
1037 landDataForRegion.Add(newLand);
1040 return landDataForRegion;
1051 primDa.Update(ds,
"prims");
1052 shapeDa.Update(ds,
"primshapes");
1054 itemsDa.Update(ds,
"primitems");
1056 terrainDa.Update(ds,
"terrain");
1057 landDa.Update(ds,
"land");
1058 landAccessListDa.Update(ds,
"landaccesslist");
1061 regionSettingsDa.Update(ds,
"regionsettings");
1062 regionWindlightDa.Update(ds,
"regionwindlight");
1064 catch (SqliteException SqlEx)
1066 throw new Exception(
1067 "There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!",
1092 ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName);
1093 foreach (DataColumn col
in ds.Tables[tableName].Columns)
1095 dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName);
1105 private static void createCol(DataTable dt,
string name, Type type)
1107 DataColumn col =
new DataColumn(name, type);
1108 dt.Columns.Add(col);
1115 private static DataTable createTerrainTable()
1117 DataTable terrain =
new DataTable(
"terrain");
1119 createCol(terrain,
"RegionUUID", typeof(String));
1120 createCol(terrain,
"Revision", typeof(Int32));
1121 createCol(terrain,
"Heightfield", typeof(Byte[]));
1130 private static DataTable createPrimTable()
1132 DataTable prims =
new DataTable(
"prims");
1134 createCol(prims,
"UUID", typeof(String));
1135 createCol(prims,
"RegionUUID", typeof(String));
1136 createCol(prims,
"CreationDate", typeof(Int32));
1137 createCol(prims,
"Name", typeof(String));
1138 createCol(prims,
"SceneGroupID", typeof(String));
1140 createCol(prims,
"Text", typeof(String));
1141 createCol(prims,
"ColorR", typeof(Int32));
1142 createCol(prims,
"ColorG", typeof(Int32));
1143 createCol(prims,
"ColorB", typeof(Int32));
1144 createCol(prims,
"ColorA", typeof(Int32));
1145 createCol(prims,
"Description", typeof(String));
1146 createCol(prims,
"SitName", typeof(String));
1147 createCol(prims,
"TouchName", typeof(String));
1149 createCol(prims,
"ObjectFlags", typeof(Int32));
1150 createCol(prims,
"CreatorID", typeof(String));
1151 createCol(prims,
"OwnerID", typeof(String));
1152 createCol(prims,
"GroupID", typeof(String));
1153 createCol(prims,
"LastOwnerID", typeof(String));
1154 createCol(prims,
"OwnerMask", typeof(Int32));
1155 createCol(prims,
"NextOwnerMask", typeof(Int32));
1156 createCol(prims,
"GroupMask", typeof(Int32));
1157 createCol(prims,
"EveryoneMask", typeof(Int32));
1158 createCol(prims,
"BaseMask", typeof(Int32));
1160 createCol(prims,
"PositionX", typeof(Double));
1161 createCol(prims,
"PositionY", typeof(Double));
1162 createCol(prims,
"PositionZ", typeof(Double));
1163 createCol(prims,
"GroupPositionX", typeof(Double));
1164 createCol(prims,
"GroupPositionY", typeof(Double));
1165 createCol(prims,
"GroupPositionZ", typeof(Double));
1166 createCol(prims,
"VelocityX", typeof(Double));
1167 createCol(prims,
"VelocityY", typeof(Double));
1168 createCol(prims,
"VelocityZ", typeof(Double));
1169 createCol(prims,
"AngularVelocityX", typeof(Double));
1170 createCol(prims,
"AngularVelocityY", typeof(Double));
1171 createCol(prims,
"AngularVelocityZ", typeof(Double));
1172 createCol(prims,
"AccelerationX", typeof(Double));
1173 createCol(prims,
"AccelerationY", typeof(Double));
1174 createCol(prims,
"AccelerationZ", typeof(Double));
1176 createCol(prims,
"RotationX", typeof(Double));
1177 createCol(prims,
"RotationY", typeof(Double));
1178 createCol(prims,
"RotationZ", typeof(Double));
1179 createCol(prims,
"RotationW", typeof(Double));
1182 createCol(prims,
"SitTargetOffsetX", typeof(Double));
1183 createCol(prims,
"SitTargetOffsetY", typeof(Double));
1184 createCol(prims,
"SitTargetOffsetZ", typeof(Double));
1186 createCol(prims,
"SitTargetOrientW", typeof(Double));
1187 createCol(prims,
"SitTargetOrientX", typeof(Double));
1188 createCol(prims,
"SitTargetOrientY", typeof(Double));
1189 createCol(prims,
"SitTargetOrientZ", typeof(Double));
1191 createCol(prims,
"PayPrice", typeof(Int32));
1192 createCol(prims,
"PayButton1", typeof(Int32));
1193 createCol(prims,
"PayButton2", typeof(Int32));
1194 createCol(prims,
"PayButton3", typeof(Int32));
1195 createCol(prims,
"PayButton4", typeof(Int32));
1197 createCol(prims,
"LoopedSound", typeof(String));
1198 createCol(prims,
"LoopedSoundGain", typeof(Double));
1199 createCol(prims,
"TextureAnimation", typeof(String));
1200 createCol(prims,
"ParticleSystem", typeof(String));
1202 createCol(prims,
"OmegaX", typeof(Double));
1203 createCol(prims,
"OmegaY", typeof(Double));
1204 createCol(prims,
"OmegaZ", typeof(Double));
1206 createCol(prims,
"CameraEyeOffsetX", typeof(Double));
1207 createCol(prims,
"CameraEyeOffsetY", typeof(Double));
1208 createCol(prims,
"CameraEyeOffsetZ", typeof(Double));
1210 createCol(prims,
"CameraAtOffsetX", typeof(Double));
1211 createCol(prims,
"CameraAtOffsetY", typeof(Double));
1212 createCol(prims,
"CameraAtOffsetZ", typeof(Double));
1214 createCol(prims,
"ForceMouselook", typeof(Int16));
1216 createCol(prims,
"ScriptAccessPin", typeof(Int32));
1218 createCol(prims,
"AllowedDrop", typeof(Int16));
1219 createCol(prims,
"DieAtEdge", typeof(Int16));
1221 createCol(prims,
"SalePrice", typeof(Int32));
1222 createCol(prims,
"SaleType", typeof(Int16));
1225 createCol(prims,
"ClickAction", typeof(Byte));
1227 createCol(prims,
"Material", typeof(Byte));
1229 createCol(prims,
"CollisionSound", typeof(String));
1230 createCol(prims,
"CollisionSoundVolume", typeof(Double));
1232 createCol(prims,
"VolumeDetect", typeof(Int16));
1234 createCol(prims,
"MediaURL", typeof(String));
1236 createCol(prims,
"AttachedPosX", typeof(Double));
1237 createCol(prims,
"AttachedPosY", typeof(Double));
1238 createCol(prims,
"AttachedPosZ", typeof(Double));
1240 createCol(prims,
"DynAttrs", typeof(String));
1242 createCol(prims,
"PhysicsShapeType", typeof(Byte));
1243 createCol(prims,
"Density", typeof(Double));
1244 createCol(prims,
"GravityModifier", typeof(Double));
1245 createCol(prims,
"Friction", typeof(Double));
1246 createCol(prims,
"Restitution", typeof(Double));
1248 createCol(prims,
"KeyframeMotion", typeof(Byte[]));
1251 prims.PrimaryKey =
new DataColumn[] { prims.Columns[
"UUID"] };
1260 private static DataTable createShapeTable()
1262 DataTable shapes =
new DataTable(
"primshapes");
1263 createCol(shapes,
"UUID", typeof(String));
1265 createCol(shapes,
"Shape", typeof(Int32));
1267 createCol(shapes,
"ScaleX", typeof(Double));
1268 createCol(shapes,
"ScaleY", typeof(Double));
1269 createCol(shapes,
"ScaleZ", typeof(Double));
1271 createCol(shapes,
"PCode", typeof(Int32));
1272 createCol(shapes,
"PathBegin", typeof(Int32));
1273 createCol(shapes,
"PathEnd", typeof(Int32));
1274 createCol(shapes,
"PathScaleX", typeof(Int32));
1275 createCol(shapes,
"PathScaleY", typeof(Int32));
1276 createCol(shapes,
"PathShearX", typeof(Int32));
1277 createCol(shapes,
"PathShearY", typeof(Int32));
1278 createCol(shapes,
"PathSkew", typeof(Int32));
1279 createCol(shapes,
"PathCurve", typeof(Int32));
1280 createCol(shapes,
"PathRadiusOffset", typeof(Int32));
1281 createCol(shapes,
"PathRevolutions", typeof(Int32));
1282 createCol(shapes,
"PathTaperX", typeof(Int32));
1283 createCol(shapes,
"PathTaperY", typeof(Int32));
1284 createCol(shapes,
"PathTwist", typeof(Int32));
1285 createCol(shapes,
"PathTwistBegin", typeof(Int32));
1287 createCol(shapes,
"ProfileBegin", typeof(Int32));
1288 createCol(shapes,
"ProfileEnd", typeof(Int32));
1289 createCol(shapes,
"ProfileCurve", typeof(Int32));
1290 createCol(shapes,
"ProfileHollow", typeof(Int32));
1291 createCol(shapes,
"State", typeof(Int32));
1294 createCol(shapes,
"Texture", typeof(Byte[]));
1295 createCol(shapes,
"ExtraParams", typeof(Byte[]));
1296 createCol(shapes,
"Media", typeof(String));
1298 shapes.PrimaryKey =
new DataColumn[] { shapes.Columns[
"UUID"] };
1307 private static DataTable createItemsTable()
1309 DataTable items =
new DataTable(
"primitems");
1311 createCol(items,
"itemID", typeof(String));
1312 createCol(items,
"primID", typeof(String));
1313 createCol(items,
"assetID", typeof(String));
1314 createCol(items,
"parentFolderID", typeof(String));
1316 createCol(items,
"invType", typeof(Int32));
1317 createCol(items,
"assetType", typeof(Int32));
1319 createCol(items,
"name", typeof(String));
1320 createCol(items,
"description", typeof(String));
1322 createCol(items,
"creationDate", typeof(Int64));
1323 createCol(items,
"creatorID", typeof(String));
1324 createCol(items,
"ownerID", typeof(String));
1325 createCol(items,
"lastOwnerID", typeof(String));
1326 createCol(items,
"groupID", typeof(String));
1328 createCol(items,
"nextPermissions", typeof(UInt32));
1329 createCol(items,
"currentPermissions", typeof(UInt32));
1330 createCol(items,
"basePermissions", typeof(UInt32));
1331 createCol(items,
"everyonePermissions", typeof(UInt32));
1332 createCol(items,
"groupPermissions", typeof(UInt32));
1333 createCol(items,
"flags", typeof(UInt32));
1335 items.PrimaryKey =
new DataColumn[] { items.Columns[
"itemID"] };
1344 private static DataTable createLandTable()
1346 DataTable
land =
new DataTable(
"land");
1347 createCol(land,
"UUID", typeof(String));
1348 createCol(land,
"RegionUUID", typeof(String));
1349 createCol(land,
"LocalLandID", typeof(UInt32));
1352 createCol(land,
"Bitmap", typeof(Byte[]));
1354 createCol(land,
"Name", typeof(String));
1355 createCol(land,
"Desc", typeof(String));
1356 createCol(land,
"OwnerUUID", typeof(String));
1357 createCol(land,
"IsGroupOwned", typeof(Boolean));
1358 createCol(land,
"Area", typeof(Int32));
1359 createCol(land,
"AuctionID", typeof(Int32));
1360 createCol(land,
"Category", typeof(Int32));
1361 createCol(land,
"ClaimDate", typeof(Int32));
1362 createCol(land,
"ClaimPrice", typeof(Int32));
1363 createCol(land,
"GroupUUID", typeof(
string));
1364 createCol(land,
"SalePrice", typeof(Int32));
1365 createCol(land,
"LandStatus", typeof(Int32));
1366 createCol(land,
"LandFlags", typeof(UInt32));
1367 createCol(land,
"LandingType", typeof(Byte));
1368 createCol(land,
"MediaAutoScale", typeof(Byte));
1369 createCol(land,
"MediaTextureUUID", typeof(String));
1370 createCol(land,
"MediaURL", typeof(String));
1371 createCol(land,
"MusicURL", typeof(String));
1372 createCol(land,
"PassHours", typeof(Double));
1373 createCol(land,
"PassPrice", typeof(UInt32));
1374 createCol(land,
"SnapshotUUID", typeof(String));
1375 createCol(land,
"UserLocationX", typeof(Double));
1376 createCol(land,
"UserLocationY", typeof(Double));
1377 createCol(land,
"UserLocationZ", typeof(Double));
1378 createCol(land,
"UserLookAtX", typeof(Double));
1379 createCol(land,
"UserLookAtY", typeof(Double));
1380 createCol(land,
"UserLookAtZ", typeof(Double));
1381 createCol(land,
"AuthbuyerID", typeof(String));
1382 createCol(land,
"OtherCleanTime", typeof(Int32));
1383 createCol(land,
"Dwell", typeof(Int32));
1384 createCol(land,
"MediaType", typeof(String));
1385 createCol(land,
"MediaDescription", typeof(String));
1386 createCol(land,
"MediaSize", typeof(String));
1387 createCol(land,
"MediaLoop", typeof(Boolean));
1388 createCol(land,
"ObscureMedia", typeof(Boolean));
1389 createCol(land,
"ObscureMusic", typeof(Boolean));
1391 land.PrimaryKey =
new DataColumn[] { land.Columns[
"UUID"] };
1400 private static DataTable createLandAccessListTable()
1402 DataTable landaccess =
new DataTable(
"landaccesslist");
1403 createCol(landaccess,
"LandUUID", typeof(String));
1404 createCol(landaccess,
"AccessUUID", typeof(String));
1405 createCol(landaccess,
"Flags", typeof(UInt32));
1410 private static DataTable createRegionSettingsTable()
1412 DataTable regionsettings =
new DataTable(
"regionsettings");
1413 createCol(regionsettings,
"regionUUID", typeof(String));
1414 createCol(regionsettings,
"block_terraform", typeof(Int32));
1415 createCol(regionsettings,
"block_fly", typeof(Int32));
1416 createCol(regionsettings,
"allow_damage", typeof(Int32));
1417 createCol(regionsettings,
"restrict_pushing", typeof(Int32));
1418 createCol(regionsettings,
"allow_land_resell", typeof(Int32));
1419 createCol(regionsettings,
"allow_land_join_divide", typeof(Int32));
1420 createCol(regionsettings,
"block_show_in_search", typeof(Int32));
1421 createCol(regionsettings,
"agent_limit", typeof(Int32));
1422 createCol(regionsettings,
"object_bonus", typeof(Double));
1423 createCol(regionsettings,
"maturity", typeof(Int32));
1424 createCol(regionsettings,
"disable_scripts", typeof(Int32));
1425 createCol(regionsettings,
"disable_collisions", typeof(Int32));
1426 createCol(regionsettings,
"disable_physics", typeof(Int32));
1427 createCol(regionsettings,
"terrain_texture_1", typeof(String));
1428 createCol(regionsettings,
"terrain_texture_2", typeof(String));
1429 createCol(regionsettings,
"terrain_texture_3", typeof(String));
1430 createCol(regionsettings,
"terrain_texture_4", typeof(String));
1431 createCol(regionsettings,
"elevation_1_nw", typeof(Double));
1432 createCol(regionsettings,
"elevation_2_nw", typeof(Double));
1433 createCol(regionsettings,
"elevation_1_ne", typeof(Double));
1434 createCol(regionsettings,
"elevation_2_ne", typeof(Double));
1435 createCol(regionsettings,
"elevation_1_se", typeof(Double));
1436 createCol(regionsettings,
"elevation_2_se", typeof(Double));
1437 createCol(regionsettings,
"elevation_1_sw", typeof(Double));
1438 createCol(regionsettings,
"elevation_2_sw", typeof(Double));
1439 createCol(regionsettings,
"water_height", typeof(Double));
1440 createCol(regionsettings,
"terrain_raise_limit", typeof(Double));
1441 createCol(regionsettings,
"terrain_lower_limit", typeof(Double));
1442 createCol(regionsettings,
"use_estate_sun", typeof(Int32));
1443 createCol(regionsettings,
"sandbox", typeof(Int32));
1444 createCol(regionsettings,
"sunvectorx", typeof(Double));
1445 createCol(regionsettings,
"sunvectory", typeof(Double));
1446 createCol(regionsettings,
"sunvectorz", typeof(Double));
1447 createCol(regionsettings,
"fixed_sun", typeof(Int32));
1448 createCol(regionsettings,
"sun_position", typeof(Double));
1449 createCol(regionsettings,
"covenant", typeof(String));
1450 createCol(regionsettings,
"covenant_datetime", typeof(Int32));
1451 createCol(regionsettings,
"map_tile_ID", typeof(String));
1452 createCol(regionsettings,
"TelehubObject", typeof(String));
1453 createCol(regionsettings,
"parcel_tile_ID", typeof(String));
1454 regionsettings.PrimaryKey =
new DataColumn[] { regionsettings.Columns[
"regionUUID"] };
1455 return regionsettings;
1462 private static DataTable createRegionWindlightTable()
1464 DataTable regionwindlight =
new DataTable(
"regionwindlight");
1465 createCol(regionwindlight,
"region_id", typeof(String));
1466 createCol(regionwindlight,
"water_color_r", typeof(Double));
1467 createCol(regionwindlight,
"water_color_g", typeof(Double));
1468 createCol(regionwindlight,
"water_color_b", typeof(Double));
1469 createCol(regionwindlight,
"water_color_i", typeof(Double));
1470 createCol(regionwindlight,
"water_fog_density_exponent", typeof(Double));
1471 createCol(regionwindlight,
"underwater_fog_modifier", typeof(Double));
1472 createCol(regionwindlight,
"reflection_wavelet_scale_1", typeof(Double));
1473 createCol(regionwindlight,
"reflection_wavelet_scale_2", typeof(Double));
1474 createCol(regionwindlight,
"reflection_wavelet_scale_3", typeof(Double));
1475 createCol(regionwindlight,
"fresnel_scale", typeof(Double));
1476 createCol(regionwindlight,
"fresnel_offset", typeof(Double));
1477 createCol(regionwindlight,
"refract_scale_above", typeof(Double));
1478 createCol(regionwindlight,
"refract_scale_below", typeof(Double));
1479 createCol(regionwindlight,
"blur_multiplier", typeof(Double));
1480 createCol(regionwindlight,
"big_wave_direction_x", typeof(Double));
1481 createCol(regionwindlight,
"big_wave_direction_y", typeof(Double));
1482 createCol(regionwindlight,
"little_wave_direction_x", typeof(Double));
1483 createCol(regionwindlight,
"little_wave_direction_y", typeof(Double));
1484 createCol(regionwindlight,
"normal_map_texture", typeof(String));
1485 createCol(regionwindlight,
"horizon_r", typeof(Double));
1486 createCol(regionwindlight,
"horizon_g", typeof(Double));
1487 createCol(regionwindlight,
"horizon_b", typeof(Double));
1488 createCol(regionwindlight,
"horizon_i", typeof(Double));
1489 createCol(regionwindlight,
"haze_horizon", typeof(Double));
1490 createCol(regionwindlight,
"blue_density_r", typeof(Double));
1491 createCol(regionwindlight,
"blue_density_g", typeof(Double));
1492 createCol(regionwindlight,
"blue_density_b", typeof(Double));
1493 createCol(regionwindlight,
"blue_density_i", typeof(Double));
1494 createCol(regionwindlight,
"haze_density", typeof(Double));
1495 createCol(regionwindlight,
"density_multiplier", typeof(Double));
1496 createCol(regionwindlight,
"distance_multiplier", typeof(Double));
1497 createCol(regionwindlight,
"max_altitude", typeof(Int32));
1498 createCol(regionwindlight,
"sun_moon_color_r", typeof(Double));
1499 createCol(regionwindlight,
"sun_moon_color_g", typeof(Double));
1500 createCol(regionwindlight,
"sun_moon_color_b", typeof(Double));
1501 createCol(regionwindlight,
"sun_moon_color_i", typeof(Double));
1502 createCol(regionwindlight,
"sun_moon_position", typeof(Double));
1503 createCol(regionwindlight,
"ambient_r", typeof(Double));
1504 createCol(regionwindlight,
"ambient_g", typeof(Double));
1505 createCol(regionwindlight,
"ambient_b", typeof(Double));
1506 createCol(regionwindlight,
"ambient_i", typeof(Double));
1507 createCol(regionwindlight,
"east_angle", typeof(Double));
1508 createCol(regionwindlight,
"sun_glow_focus", typeof(Double));
1509 createCol(regionwindlight,
"sun_glow_size", typeof(Double));
1510 createCol(regionwindlight,
"scene_gamma", typeof(Double));
1511 createCol(regionwindlight,
"star_brightness", typeof(Double));
1512 createCol(regionwindlight,
"cloud_color_r", typeof(Double));
1513 createCol(regionwindlight,
"cloud_color_g", typeof(Double));
1514 createCol(regionwindlight,
"cloud_color_b", typeof(Double));
1515 createCol(regionwindlight,
"cloud_color_i", typeof(Double));
1516 createCol(regionwindlight,
"cloud_x", typeof(Double));
1517 createCol(regionwindlight,
"cloud_y", typeof(Double));
1518 createCol(regionwindlight,
"cloud_density", typeof(Double));
1519 createCol(regionwindlight,
"cloud_coverage", typeof(Double));
1520 createCol(regionwindlight,
"cloud_scale", typeof(Double));
1521 createCol(regionwindlight,
"cloud_detail_x", typeof(Double));
1522 createCol(regionwindlight,
"cloud_detail_y", typeof(Double));
1523 createCol(regionwindlight,
"cloud_detail_density", typeof(Double));
1524 createCol(regionwindlight,
"cloud_scroll_x", typeof(Double));
1525 createCol(regionwindlight,
"cloud_scroll_x_lock", typeof(Int32));
1526 createCol(regionwindlight,
"cloud_scroll_y", typeof(Double));
1527 createCol(regionwindlight,
"cloud_scroll_y_lock", typeof(Int32));
1528 createCol(regionwindlight,
"draw_classic_clouds", typeof(Int32));
1530 regionwindlight.PrimaryKey =
new DataColumn[] { regionwindlight.Columns[
"region_id"] };
1531 return regionwindlight;
1534 private static DataTable createRegionEnvironmentTable()
1536 DataTable regionEnvironment =
new DataTable(
"regionenvironment");
1537 createCol(regionEnvironment,
"region_id", typeof(String));
1538 createCol(regionEnvironment,
"llsd_settings", typeof(String));
1540 regionEnvironment.PrimaryKey =
new DataColumn[] { regionEnvironment.Columns[
"region_id"] };
1542 return regionEnvironment;
1545 private static DataTable createRegionSpawnPointsTable()
1547 DataTable spawn_points =
new DataTable(
"spawn_points");
1548 createCol(spawn_points,
"regionID", typeof(String));
1549 createCol(spawn_points,
"Yaw", typeof(
float));
1550 createCol(spawn_points,
"Pitch", typeof(
float));
1551 createCol(spawn_points,
"Distance", typeof(
float));
1553 return spawn_points;
1594 prim.UUID =
new UUID((String)row[
"UUID"]);
1597 prim.CreationDate = Convert.ToInt32(row[
"CreationDate"]);
1598 prim.Name = row[
"Name"] == DBNull.Value ? string.Empty : (string)row[
"Name"];
1600 prim.Text = (
String)row[
"Text"];
1601 prim.Color = Color.FromArgb(Convert.ToInt32(row[
"ColorA"]),
1602 Convert.ToInt32(row[
"ColorR"]),
1603 Convert.ToInt32(row[
"ColorG"]),
1604 Convert.ToInt32(row[
"ColorB"]));
1605 prim.Description = (
String)row[
"Description"];
1606 prim.SitName = (
String)row[
"SitName"];
1607 prim.TouchName = (
String)row[
"TouchName"];
1609 prim.Flags = (
PrimFlags)Convert.ToUInt32(row[
"ObjectFlags"]);
1610 prim.CreatorIdentification = (
String)row[
"CreatorID"];
1611 prim.OwnerID =
new UUID((String)row[
"OwnerID"]);
1612 prim.GroupID =
new UUID((String)row[
"GroupID"]);
1613 prim.LastOwnerID =
new UUID((String)row[
"LastOwnerID"]);
1614 prim.OwnerMask = Convert.ToUInt32(row[
"OwnerMask"]);
1615 prim.NextOwnerMask = Convert.ToUInt32(row[
"NextOwnerMask"]);
1616 prim.GroupMask = Convert.ToUInt32(row[
"GroupMask"]);
1617 prim.EveryoneMask = Convert.ToUInt32(row[
"EveryoneMask"]);
1618 prim.BaseMask = Convert.ToUInt32(row[
"BaseMask"]);
1620 prim.OffsetPosition =
new Vector3(
1621 Convert.ToSingle(row[
"PositionX"]),
1622 Convert.ToSingle(row[
"PositionY"]),
1623 Convert.ToSingle(row[
"PositionZ"])
1625 prim.GroupPosition =
new Vector3(
1626 Convert.ToSingle(row[
"GroupPositionX"]),
1627 Convert.ToSingle(row[
"GroupPositionY"]),
1628 Convert.ToSingle(row[
"GroupPositionZ"])
1630 prim.Velocity =
new Vector3(
1631 Convert.ToSingle(row[
"VelocityX"]),
1632 Convert.ToSingle(row[
"VelocityY"]),
1633 Convert.ToSingle(row[
"VelocityZ"])
1635 prim.AngularVelocity =
new Vector3(
1636 Convert.ToSingle(row[
"AngularVelocityX"]),
1637 Convert.ToSingle(row[
"AngularVelocityY"]),
1638 Convert.ToSingle(row[
"AngularVelocityZ"])
1640 prim.Acceleration =
new Vector3(
1641 Convert.ToSingle(row[
"AccelerationX"]),
1642 Convert.ToSingle(row[
"AccelerationY"]),
1643 Convert.ToSingle(row[
"AccelerationZ"])
1646 prim.RotationOffset =
new Quaternion(
1647 Convert.ToSingle(row[
"RotationX"]),
1648 Convert.ToSingle(row[
"RotationY"]),
1649 Convert.ToSingle(row[
"RotationZ"]),
1650 Convert.ToSingle(row[
"RotationW"])
1653 prim.SitTargetPositionLL =
new Vector3(
1654 Convert.ToSingle(row[
"SitTargetOffsetX"]),
1655 Convert.ToSingle(row[
"SitTargetOffsetY"]),
1656 Convert.ToSingle(row[
"SitTargetOffsetZ"]));
1657 prim.SitTargetOrientationLL =
new Quaternion(
1659 row[
"SitTargetOrientX"]),
1661 row[
"SitTargetOrientY"]),
1663 row[
"SitTargetOrientZ"]),
1665 row[
"SitTargetOrientW"]));
1667 prim.ClickAction = Convert.ToByte(row[
"ClickAction"]);
1668 prim.PayPrice[0] = Convert.ToInt32(row[
"PayPrice"]);
1669 prim.PayPrice[1] = Convert.ToInt32(row[
"PayButton1"]);
1670 prim.PayPrice[2] = Convert.ToInt32(row[
"PayButton2"]);
1671 prim.PayPrice[3] = Convert.ToInt32(row[
"PayButton3"]);
1672 prim.PayPrice[4] = Convert.ToInt32(row[
"PayButton4"]);
1674 prim.Sound =
new UUID(row[
"LoopedSound"].ToString());
1675 prim.SoundGain = Convert.ToSingle(row[
"LoopedSoundGain"]);
1676 prim.SoundFlags = 1;
1678 if (!row.IsNull(
"TextureAnimation"))
1679 prim.
TextureAnimation = Convert.FromBase64String(row[
"TextureAnimation"].ToString());
1680 if (!row.IsNull(
"ParticleSystem"))
1681 prim.
ParticleSystem = Convert.FromBase64String(row[
"ParticleSystem"].ToString());
1683 prim.AngularVelocity =
new Vector3(
1684 Convert.ToSingle(row[
"OmegaX"]),
1685 Convert.ToSingle(row[
"OmegaY"]),
1686 Convert.ToSingle(row[
"OmegaZ"])
1689 prim.SetCameraEyeOffset(
new Vector3(
1690 Convert.ToSingle(row[
"CameraEyeOffsetX"]),
1691 Convert.ToSingle(row[
"CameraEyeOffsetY"]),
1692 Convert.ToSingle(row[
"CameraEyeOffsetZ"])
1695 prim.SetCameraAtOffset(
new Vector3(
1696 Convert.ToSingle(row[
"CameraAtOffsetX"]),
1697 Convert.ToSingle(row[
"CameraAtOffsetY"]),
1698 Convert.ToSingle(row[
"CameraAtOffsetZ"])
1701 if (Convert.ToInt16(row[
"ForceMouselook"]) != 0)
1704 prim.ScriptAccessPin = Convert.ToInt32(row[
"ScriptAccessPin"]);
1706 if (Convert.ToInt16(row[
"AllowedDrop"]) != 0)
1709 if (Convert.ToInt16(row[
"DieAtEdge"]) != 0)
1712 prim.
SalePrice = Convert.ToInt32(row[
"SalePrice"]);
1713 prim.ObjectSaleType = Convert.ToByte(row[
"SaleType"]);
1715 prim.Material = Convert.ToByte(row[
"Material"]);
1717 prim.CollisionSound =
new UUID(row[
"CollisionSound"].ToString());
1718 prim.CollisionSoundVolume = Convert.ToSingle(row[
"CollisionSoundVolume"]);
1720 if (Convert.ToInt16(row[
"VolumeDetect"]) != 0)
1723 if (!(row[
"MediaURL"] is System.DBNull))
1726 prim.MediaUrl = (string)row[
"MediaURL"];
1729 prim.AttachedPos =
new Vector3(
1730 Convert.ToSingle(row[
"AttachedPosX"]),
1731 Convert.ToSingle(row[
"AttachedPosY"]),
1732 Convert.ToSingle(row[
"AttachedPosZ"])
1735 if (!(row[
"DynAttrs"] is System.DBNull))
1738 prim.DynAttrs = DAMap.FromXml((string)row[
"DynAttrs"]);
1742 prim.DynAttrs =
new DAMap();
1745 prim.PhysicsShapeType = Convert.ToByte(row[
"PhysicsShapeType"]);
1746 prim.Density = Convert.ToSingle(row[
"Density"]);
1747 prim.GravityModifier = Convert.ToSingle(row[
"GravityModifier"]);
1748 prim.Friction = Convert.ToSingle(row[
"Friction"]);
1749 prim.Restitution = Convert.ToSingle(row[
"Restitution"]);
1752 if (!(row[
"KeyframeMotion"] is DBNull))
1754 Byte[] data = (byte[])row[
"KeyframeMotion"];
1755 if (data.Length > 0)
1756 prim.KeyframeMotion = KeyframeMotion.FromData(null, data);
1758 prim.KeyframeMotion = null;
1762 prim.KeyframeMotion = null;
1765 prim.PassCollisions = Convert.ToBoolean(row[
"PassCollisions"]);
1766 prim.PassTouches = Convert.ToBoolean(row[
"PassTouches"]);
1767 prim.RotationAxisLocks = Convert.ToByte(row[
"RotationAxisLocks"]);
1770 if (!(row[
"Vehicle"] is DBNull) && row[
"Vehicle"].ToString() !=
String.Empty)
1772 vehicle = SOPVehicle.FromXml2(row[
"Vehicle"].ToString());
1773 if (vehicle != null)
1774 prim.VehicleParams = vehicle;
1788 taskItem.ItemID =
new UUID((String)row[
"itemID"]);
1789 taskItem.ParentPartID =
new UUID((String)row[
"primID"]);
1790 taskItem.AssetID =
new UUID((String)row[
"assetID"]);
1791 taskItem.ParentID =
new UUID((String)row[
"parentFolderID"]);
1793 taskItem.InvType = Convert.ToInt32(row[
"invType"]);
1794 taskItem.Type = Convert.ToInt32(row[
"assetType"]);
1796 taskItem.Name = (
String)row[
"name"];
1797 taskItem.Description = (
String)row[
"description"];
1798 taskItem.CreationDate = Convert.ToUInt32(row[
"creationDate"]);
1799 taskItem.CreatorIdentification = (
String)row[
"creatorID"];
1800 taskItem.OwnerID =
new UUID((String)row[
"ownerID"]);
1801 taskItem.LastOwnerID =
new UUID((String)row[
"lastOwnerID"]);
1802 taskItem.GroupID =
new UUID((String)row[
"groupID"]);
1804 taskItem.NextPermissions = Convert.ToUInt32(row[
"nextPermissions"]);
1805 taskItem.CurrentPermissions = Convert.ToUInt32(row[
"currentPermissions"]);
1806 taskItem.BasePermissions = Convert.ToUInt32(row[
"basePermissions"]);
1807 taskItem.EveryonePermissions = Convert.ToUInt32(row[
"everyonePermissions"]);
1808 taskItem.GroupPermissions = Convert.ToUInt32(row[
"groupPermissions"]);
1809 taskItem.Flags = Convert.ToUInt32(row[
"flags"]);
1819 private LandData buildLandData(DataRow row)
1823 newData.GlobalID =
new UUID((String)row[
"UUID"]);
1824 newData.LocalID = Convert.ToInt32(row[
"LocalLandID"]);
1827 newData.Bitmap = (Byte[])row[
"Bitmap"];
1829 newData.Name = (
String)row[
"Name"];
1830 newData.Description = (
String)row[
"Desc"];
1831 newData.OwnerID = (
UUID)(String)row[
"OwnerUUID"];
1832 newData.IsGroupOwned = (
Boolean)row[
"IsGroupOwned"];
1833 newData.Area = Convert.ToInt32(row[
"Area"]);
1834 newData.AuctionID = Convert.ToUInt32(row[
"AuctionID"]);
1835 newData.Category = (ParcelCategory)Convert.ToInt32(row[
"Category"]);
1837 newData.ClaimDate = Convert.ToInt32(row[
"ClaimDate"]);
1838 newData.ClaimPrice = Convert.ToInt32(row[
"ClaimPrice"]);
1839 newData.GroupID =
new UUID((String)row[
"GroupUUID"]);
1840 newData.SalePrice = Convert.ToInt32(row[
"SalePrice"]);
1841 newData.Status = (ParcelStatus)Convert.ToInt32(row[
"LandStatus"]);
1843 newData.Flags = Convert.ToUInt32(row[
"LandFlags"]);
1844 newData.LandingType = (Byte)row[
"LandingType"];
1845 newData.MediaAutoScale = (Byte)row[
"MediaAutoScale"];
1846 newData.MediaID =
new UUID((String)row[
"MediaTextureUUID"]);
1847 newData.MediaURL = (
String)row[
"MediaURL"];
1848 newData.MusicURL = (
String)row[
"MusicURL"];
1849 newData.PassHours = Convert.ToSingle(row[
"PassHours"]);
1850 newData.PassPrice = Convert.ToInt32(row[
"PassPrice"]);
1851 newData.SnapshotID = (
UUID)(String)row[
"SnapshotUUID"];
1852 newData.Dwell = Convert.ToInt32(row[
"Dwell"]);
1853 newData.MediaType = (
String)row[
"MediaType"];
1854 newData.MediaDescription = (
String)row[
"MediaDescription"];
1855 newData.MediaWidth = Convert.ToInt32((((string)row[
"MediaSize"]).Split(
','))[0]);
1856 newData.MediaHeight = Convert.ToInt32((((string)row[
"MediaSize"]).Split(
','))[1]);
1857 newData.MediaLoop = Convert.ToBoolean(row[
"MediaLoop"]);
1858 newData.ObscureMedia = Convert.ToBoolean(row[
"ObscureMedia"]);
1859 newData.ObscureMusic = Convert.ToBoolean(row[
"ObscureMusic"]);
1860 newData.SeeAVs = Convert.ToBoolean(row[
"SeeAVs"]);
1861 newData.AnyAVSounds = Convert.ToBoolean(row[
"AnyAVSounds"]);
1862 newData.GroupAVSounds = Convert.ToBoolean(row[
"GroupAVSounds"]);
1866 newData.UserLocation =
1867 new Vector3(Convert.ToSingle(row[
"UserLocationX"]), Convert.ToSingle(row[
"UserLocationY"]),
1868 Convert.ToSingle(row[
"UserLocationZ"]));
1869 newData.UserLookAt =
1870 new Vector3(Convert.ToSingle(row[
"UserLookAtX"]), Convert.ToSingle(row[
"UserLookAtY"]),
1871 Convert.ToSingle(row[
"UserLookAtZ"]));
1874 catch (InvalidCastException)
1876 m_log.ErrorFormat(
"[SQLITE REGION DB]: unable to get parcel telehub settings for {1}", newData.Name);
1877 newData.UserLocation = Vector3.Zero;
1878 newData.UserLookAt = Vector3.Zero;
1880 newData.ParcelAccessList =
new List<LandAccessEntry>();
1881 UUID authBuyerID = UUID.Zero;
1883 UUID.TryParse((string)row[
"AuthbuyerID"], out authBuyerID);
1885 newData.OtherCleanTime = Convert.ToInt32(row[
"OtherCleanTime"]);
1894 newSettings.RegionUUID =
new UUID((
string)row[
"regionUUID"]);
1895 newSettings.BlockTerraform = Convert.ToBoolean(row[
"block_terraform"]);
1896 newSettings.AllowDamage = Convert.ToBoolean(row[
"allow_damage"]);
1897 newSettings.BlockFly = Convert.ToBoolean(row[
"block_fly"]);
1898 newSettings.RestrictPushing = Convert.ToBoolean(row[
"restrict_pushing"]);
1899 newSettings.AllowLandResell = Convert.ToBoolean(row[
"allow_land_resell"]);
1900 newSettings.AllowLandJoinDivide = Convert.ToBoolean(row[
"allow_land_join_divide"]);
1901 newSettings.BlockShowInSearch = Convert.ToBoolean(row[
"block_show_in_search"]);
1902 newSettings.AgentLimit = Convert.ToInt32(row[
"agent_limit"]);
1903 newSettings.ObjectBonus = Convert.ToDouble(row[
"object_bonus"]);
1904 newSettings.Maturity = Convert.ToInt32(row[
"maturity"]);
1905 newSettings.DisableScripts = Convert.ToBoolean(row[
"disable_scripts"]);
1906 newSettings.DisableCollisions = Convert.ToBoolean(row[
"disable_collisions"]);
1907 newSettings.DisablePhysics = Convert.ToBoolean(row[
"disable_physics"]);
1908 newSettings.TerrainTexture1 =
new UUID((String)row[
"terrain_texture_1"]);
1909 newSettings.TerrainTexture2 =
new UUID((String)row[
"terrain_texture_2"]);
1910 newSettings.TerrainTexture3 =
new UUID((String)row[
"terrain_texture_3"]);
1911 newSettings.TerrainTexture4 =
new UUID((String)row[
"terrain_texture_4"]);
1912 newSettings.Elevation1NW = Convert.ToDouble(row[
"elevation_1_nw"]);
1913 newSettings.Elevation2NW = Convert.ToDouble(row[
"elevation_2_nw"]);
1914 newSettings.Elevation1NE = Convert.ToDouble(row[
"elevation_1_ne"]);
1915 newSettings.Elevation2NE = Convert.ToDouble(row[
"elevation_2_ne"]);
1916 newSettings.Elevation1SE = Convert.ToDouble(row[
"elevation_1_se"]);
1917 newSettings.Elevation2SE = Convert.ToDouble(row[
"elevation_2_se"]);
1918 newSettings.Elevation1SW = Convert.ToDouble(row[
"elevation_1_sw"]);
1919 newSettings.Elevation2SW = Convert.ToDouble(row[
"elevation_2_sw"]);
1920 newSettings.WaterHeight = Convert.ToDouble(row[
"water_height"]);
1921 newSettings.TerrainRaiseLimit = Convert.ToDouble(row[
"terrain_raise_limit"]);
1922 newSettings.TerrainLowerLimit = Convert.ToDouble(row[
"terrain_lower_limit"]);
1923 newSettings.UseEstateSun = Convert.ToBoolean(row[
"use_estate_sun"]);
1924 newSettings.Sandbox = Convert.ToBoolean(row[
"sandbox"]);
1925 newSettings.SunVector =
new Vector3(
1926 Convert.ToSingle(row[
"sunvectorx"]),
1927 Convert.ToSingle(row[
"sunvectory"]),
1928 Convert.ToSingle(row[
"sunvectorz"])
1930 newSettings.FixedSun = Convert.ToBoolean(row[
"fixed_sun"]);
1931 newSettings.SunPosition = Convert.ToDouble(row[
"sun_position"]);
1932 newSettings.Covenant =
new UUID((String)row[
"covenant"]);
1933 newSettings.CovenantChangedDateTime = Convert.ToInt32(row[
"covenant_datetime"]);
1934 newSettings.TerrainImageID =
new UUID((String)row[
"map_tile_ID"]);
1935 newSettings.TelehubObject =
new UUID((String)row[
"TelehubObject"]);
1936 newSettings.ParcelImageID =
new UUID((String)row[
"parcel_tile_ID"]);
1937 newSettings.GodBlockSearch = Convert.ToBoolean(row[
"block_search"]);
1938 newSettings.Casino = Convert.ToBoolean(row[
"casino"]);
1951 windlight.regionID =
new UUID((
string)row[
"region_id"]);
1952 windlight.waterColor.X = Convert.ToSingle(row[
"water_color_r"]);
1953 windlight.waterColor.Y = Convert.ToSingle(row[
"water_color_g"]);
1954 windlight.waterColor.Z = Convert.ToSingle(row[
"water_color_b"]);
1956 windlight.waterFogDensityExponent = Convert.ToSingle(row[
"water_fog_density_exponent"]);
1957 windlight.underwaterFogModifier = Convert.ToSingle(row[
"underwater_fog_modifier"]);
1958 windlight.reflectionWaveletScale.X = Convert.ToSingle(row[
"reflection_wavelet_scale_1"]);
1959 windlight.reflectionWaveletScale.Y = Convert.ToSingle(row[
"reflection_wavelet_scale_2"]);
1960 windlight.reflectionWaveletScale.Z = Convert.ToSingle(row[
"reflection_wavelet_scale_3"]);
1961 windlight.fresnelScale = Convert.ToSingle(row[
"fresnel_scale"]);
1962 windlight.fresnelOffset = Convert.ToSingle(row[
"fresnel_offset"]);
1963 windlight.refractScaleAbove = Convert.ToSingle(row[
"refract_scale_above"]);
1964 windlight.refractScaleBelow = Convert.ToSingle(row[
"refract_scale_below"]);
1965 windlight.blurMultiplier = Convert.ToSingle(row[
"blur_multiplier"]);
1966 windlight.bigWaveDirection.X = Convert.ToSingle(row[
"big_wave_direction_x"]);
1967 windlight.bigWaveDirection.Y = Convert.ToSingle(row[
"big_wave_direction_y"]);
1968 windlight.littleWaveDirection.X = Convert.ToSingle(row[
"little_wave_direction_x"]);
1969 windlight.littleWaveDirection.Y = Convert.ToSingle(row[
"little_wave_direction_y"]);
1970 windlight.normalMapTexture =
new UUID((
string)row[
"normal_map_texture"]);
1971 windlight.horizon.X = Convert.ToSingle(row[
"horizon_r"]);
1972 windlight.horizon.Y = Convert.ToSingle(row[
"horizon_g"]);
1973 windlight.horizon.Z = Convert.ToSingle(row[
"horizon_b"]);
1974 windlight.horizon.W = Convert.ToSingle(row[
"horizon_i"]);
1975 windlight.hazeHorizon = Convert.ToSingle(row[
"haze_horizon"]);
1976 windlight.blueDensity.X = Convert.ToSingle(row[
"blue_density_r"]);
1977 windlight.blueDensity.Y = Convert.ToSingle(row[
"blue_density_g"]);
1978 windlight.blueDensity.Z = Convert.ToSingle(row[
"blue_density_b"]);
1979 windlight.blueDensity.W = Convert.ToSingle(row[
"blue_density_i"]);
1980 windlight.hazeDensity = Convert.ToSingle(row[
"haze_density"]);
1981 windlight.densityMultiplier = Convert.ToSingle(row[
"density_multiplier"]);
1982 windlight.distanceMultiplier = Convert.ToSingle(row[
"distance_multiplier"]);
1983 windlight.maxAltitude = Convert.ToUInt16(row[
"max_altitude"]);
1984 windlight.sunMoonColor.X = Convert.ToSingle(row[
"sun_moon_color_r"]);
1985 windlight.sunMoonColor.Y = Convert.ToSingle(row[
"sun_moon_color_g"]);
1986 windlight.sunMoonColor.Z = Convert.ToSingle(row[
"sun_moon_color_b"]);
1987 windlight.sunMoonColor.W = Convert.ToSingle(row[
"sun_moon_color_i"]);
1988 windlight.sunMoonPosition = Convert.ToSingle(row[
"sun_moon_position"]);
1989 windlight.ambient.X = Convert.ToSingle(row[
"ambient_r"]);
1990 windlight.ambient.Y = Convert.ToSingle(row[
"ambient_g"]);
1991 windlight.ambient.Z = Convert.ToSingle(row[
"ambient_b"]);
1992 windlight.ambient.W = Convert.ToSingle(row[
"ambient_i"]);
1993 windlight.eastAngle = Convert.ToSingle(row[
"east_angle"]);
1994 windlight.sunGlowFocus = Convert.ToSingle(row[
"sun_glow_focus"]);
1995 windlight.sunGlowSize = Convert.ToSingle(row[
"sun_glow_size"]);
1996 windlight.sceneGamma = Convert.ToSingle(row[
"scene_gamma"]);
1997 windlight.starBrightness = Convert.ToSingle(row[
"star_brightness"]);
1998 windlight.cloudColor.X = Convert.ToSingle(row[
"cloud_color_r"]);
1999 windlight.cloudColor.Y = Convert.ToSingle(row[
"cloud_color_g"]);
2000 windlight.cloudColor.Z = Convert.ToSingle(row[
"cloud_color_b"]);
2001 windlight.cloudColor.W = Convert.ToSingle(row[
"cloud_color_i"]);
2002 windlight.cloudXYDensity.X = Convert.ToSingle(row[
"cloud_x"]);
2003 windlight.cloudXYDensity.Y = Convert.ToSingle(row[
"cloud_y"]);
2004 windlight.cloudXYDensity.Z = Convert.ToSingle(row[
"cloud_density"]);
2005 windlight.cloudCoverage = Convert.ToSingle(row[
"cloud_coverage"]);
2006 windlight.cloudScale = Convert.ToSingle(row[
"cloud_scale"]);
2007 windlight.cloudDetailXYDensity.X = Convert.ToSingle(row[
"cloud_detail_x"]);
2008 windlight.cloudDetailXYDensity.Y = Convert.ToSingle(row[
"cloud_detail_y"]);
2009 windlight.cloudDetailXYDensity.Z = Convert.ToSingle(row[
"cloud_detail_density"]);
2010 windlight.cloudScrollX = Convert.ToSingle(row[
"cloud_scroll_x"]);
2011 windlight.cloudScrollXLock = Convert.ToBoolean(row[
"cloud_scroll_x_lock"]);
2012 windlight.cloudScrollY = Convert.ToSingle(row[
"cloud_scroll_y"]);
2013 windlight.cloudScrollYLock = Convert.ToBoolean(row[
"cloud_scroll_y_lock"]);
2014 windlight.drawClassicClouds = Convert.ToBoolean(row[
"draw_classic_clouds"]);
2027 entry.AgentID =
new UUID((
string)row[
"AccessUUID"]);
2028 entry.Flags = (AccessList)row[
"Flags"];
2041 private static void fillPrimRow(DataRow row,
SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID)
2043 row[
"UUID"] = prim.UUID.ToString();
2044 row[
"RegionUUID"] = regionUUID.ToString();
2045 row[
"CreationDate"] = prim.CreationDate;
2046 row[
"Name"] = prim.Name;
2047 row[
"SceneGroupID"] = sceneGroupID.ToString();
2050 row[
"Text"] = prim.Text;
2051 row[
"Description"] = prim.Description;
2052 row[
"SitName"] = prim.SitName;
2053 row[
"TouchName"] = prim.TouchName;
2055 row[
"ObjectFlags"] = (uint)prim.
Flags;
2057 row[
"OwnerID"] = prim.OwnerID.ToString();
2058 row[
"GroupID"] = prim.GroupID.ToString();
2059 row[
"LastOwnerID"] = prim.LastOwnerID.ToString();
2060 row[
"OwnerMask"] = prim.OwnerMask;
2061 row[
"NextOwnerMask"] = prim.NextOwnerMask;
2062 row[
"GroupMask"] = prim.GroupMask;
2063 row[
"EveryoneMask"] = prim.EveryoneMask;
2064 row[
"BaseMask"] = prim.BaseMask;
2066 row[
"PositionX"] = prim.OffsetPosition.X;
2067 row[
"PositionY"] = prim.OffsetPosition.Y;
2068 row[
"PositionZ"] = prim.OffsetPosition.Z;
2069 row[
"GroupPositionX"] = prim.GroupPosition.X;
2070 row[
"GroupPositionY"] = prim.GroupPosition.Y;
2071 row[
"GroupPositionZ"] = prim.GroupPosition.Z;
2072 row[
"VelocityX"] = prim.Velocity.X;
2073 row[
"VelocityY"] = prim.Velocity.Y;
2074 row[
"VelocityZ"] = prim.Velocity.Z;
2075 row[
"AngularVelocityX"] = prim.AngularVelocity.X;
2076 row[
"AngularVelocityY"] = prim.AngularVelocity.Y;
2077 row[
"AngularVelocityZ"] = prim.AngularVelocity.Z;
2078 row[
"AccelerationX"] = prim.Acceleration.X;
2079 row[
"AccelerationY"] = prim.Acceleration.Y;
2080 row[
"AccelerationZ"] = prim.Acceleration.Z;
2082 row[
"RotationX"] = prim.RotationOffset.X;
2083 row[
"RotationY"] = prim.RotationOffset.Y;
2084 row[
"RotationZ"] = prim.RotationOffset.Z;
2085 row[
"RotationW"] = prim.RotationOffset.W;
2088 Vector3 sitTargetPos = prim.SitTargetPositionLL;
2089 row[
"SitTargetOffsetX"] = sitTargetPos.X;
2090 row[
"SitTargetOffsetY"] = sitTargetPos.Y;
2091 row[
"SitTargetOffsetZ"] = sitTargetPos.Z;
2093 Quaternion sitTargetOrient = prim.SitTargetOrientationLL;
2094 row[
"SitTargetOrientW"] = sitTargetOrient.W;
2095 row[
"SitTargetOrientX"] = sitTargetOrient.X;
2096 row[
"SitTargetOrientY"] = sitTargetOrient.Y;
2097 row[
"SitTargetOrientZ"] = sitTargetOrient.Z;
2098 row[
"ColorR"] = Convert.ToInt32(prim.Color.R);
2099 row[
"ColorG"] = Convert.ToInt32(prim.Color.G);
2100 row[
"ColorB"] = Convert.ToInt32(prim.Color.B);
2101 row[
"ColorA"] = Convert.ToInt32(prim.Color.A);
2102 row[
"PayPrice"] = prim.PayPrice[0];
2103 row[
"PayButton1"] = prim.PayPrice[1];
2104 row[
"PayButton2"] = prim.PayPrice[2];
2105 row[
"PayButton3"] = prim.PayPrice[3];
2106 row[
"PayButton4"] = prim.PayPrice[4];
2108 row[
"TextureAnimation"] = Convert.ToBase64String(prim.TextureAnimation);
2109 row[
"ParticleSystem"] = Convert.ToBase64String(prim.ParticleSystem);
2111 row[
"OmegaX"] = prim.AngularVelocity.X;
2112 row[
"OmegaY"] = prim.AngularVelocity.Y;
2113 row[
"OmegaZ"] = prim.AngularVelocity.Z;
2115 row[
"CameraEyeOffsetX"] = prim.GetCameraEyeOffset().X;
2116 row[
"CameraEyeOffsetY"] = prim.GetCameraEyeOffset().Y;
2117 row[
"CameraEyeOffsetZ"] = prim.GetCameraEyeOffset().Z;
2119 row[
"CameraAtOffsetX"] = prim.GetCameraAtOffset().X;
2120 row[
"CameraAtOffsetY"] = prim.GetCameraAtOffset().Y;
2121 row[
"CameraAtOffsetZ"] = prim.GetCameraAtOffset().Z;
2126 row[
"LoopedSound"] = prim.Sound.ToString();
2127 row[
"LoopedSoundGain"] = prim.SoundGain;
2131 row[
"LoopedSound"] = UUID.Zero.ToString();
2132 row[
"LoopedSoundGain"] = 0.0f;
2136 row[
"ForceMouselook"] = 1;
2138 row[
"ForceMouselook"] = 0;
2140 row[
"ScriptAccessPin"] = prim.ScriptAccessPin;
2143 row[
"AllowedDrop"] = 1;
2145 row[
"AllowedDrop"] = 0;
2148 row[
"DieAtEdge"] = 1;
2150 row[
"DieAtEdge"] = 0;
2152 row[
"SalePrice"] = prim.SalePrice;
2153 row[
"SaleType"] = Convert.ToInt16(prim.ObjectSaleType);
2156 row[
"ClickAction"] = prim.ClickAction;
2160 row[
"CollisionSound"] = prim.CollisionSound.ToString();
2161 row[
"CollisionSoundVolume"] = prim.CollisionSoundVolume;
2163 row[
"VolumeDetect"] = 1;
2165 row[
"VolumeDetect"] = 0;
2167 row[
"MediaURL"] = prim.MediaUrl;
2169 row[
"AttachedPosX"] = prim.AttachedPos.X;
2170 row[
"AttachedPosY"] = prim.AttachedPos.Y;
2171 row[
"AttachedPosZ"] = prim.AttachedPos.Z;
2174 row[
"DynAttrs"] = prim.DynAttrs.ToXml();
2176 row[
"DynAttrs"] = null;
2178 row[
"PhysicsShapeType"] = prim.PhysicsShapeType;
2179 row[
"Density"] = (double)prim.
Density;
2180 row[
"GravityModifier"] = (
double)prim.GravityModifier;
2181 row[
"Friction"] = (double)prim.
Friction;
2182 row[
"Restitution"] = (
double)prim.Restitution;
2185 row[
"KeyframeMotion"] = prim.KeyframeMotion.Serialize();
2187 row[
"KeyframeMotion"] =
new Byte[0];
2189 row[
"PassTouches"] = prim.PassTouches;
2190 row[
"PassCollisions"] = prim.PassCollisions;
2191 row[
"RotationAxisLocks"] = prim.RotationAxisLocks;
2194 row[
"Vehicle"] = prim.VehicleParams.ToXml2();
2196 row[
"Vehicle"] = String.Empty;
2207 row[
"itemID"] = taskItem.ItemID.ToString();
2208 row[
"primID"] = taskItem.ParentPartID.ToString();
2209 row[
"assetID"] = taskItem.AssetID.ToString();
2210 row[
"parentFolderID"] = taskItem.ParentID.ToString();
2212 row[
"invType"] = taskItem.InvType;
2213 row[
"assetType"] = taskItem.Type;
2215 row[
"name"] = taskItem.Name;
2216 row[
"description"] = taskItem.Description;
2217 row[
"creationDate"] = taskItem.CreationDate;
2218 row[
"creatorID"] = taskItem.CreatorIdentification.ToString();
2219 row[
"ownerID"] = taskItem.OwnerID.ToString();
2220 row[
"lastOwnerID"] = taskItem.LastOwnerID.ToString();
2221 row[
"groupID"] = taskItem.GroupID.ToString();
2222 row[
"nextPermissions"] = taskItem.NextPermissions;
2223 row[
"currentPermissions"] = taskItem.CurrentPermissions;
2224 row[
"basePermissions"] = taskItem.BasePermissions;
2225 row[
"everyonePermissions"] = taskItem.EveryonePermissions;
2226 row[
"groupPermissions"] = taskItem.GroupPermissions;
2227 row[
"flags"] = taskItem.Flags;
2236 private static void fillLandRow(DataRow row,
LandData land, UUID regionUUID)
2238 row[
"UUID"] = land.GlobalID.ToString();
2239 row[
"RegionUUID"] = regionUUID.ToString();
2240 row[
"LocalLandID"] = land.LocalID;
2243 row[
"Bitmap"] = land.Bitmap;
2245 row[
"Name"] = land.Name;
2246 row[
"Desc"] = land.Description;
2247 row[
"OwnerUUID"] = land.OwnerID.ToString();
2248 row[
"IsGroupOwned"] = land.IsGroupOwned;
2249 row[
"Area"] = land.Area;
2250 row[
"AuctionID"] = land.AuctionID;
2251 row[
"Category"] = land.Category;
2252 row[
"ClaimDate"] = land.ClaimDate;
2253 row[
"ClaimPrice"] = land.ClaimPrice;
2254 row[
"GroupUUID"] = land.GroupID.ToString();
2255 row[
"SalePrice"] = land.SalePrice;
2256 row[
"LandStatus"] = land.Status;
2257 row[
"LandFlags"] = land.Flags;
2258 row[
"LandingType"] = land.LandingType;
2259 row[
"MediaAutoScale"] = land.MediaAutoScale;
2260 row[
"MediaTextureUUID"] = land.MediaID.ToString();
2261 row[
"MediaURL"] = land.MediaURL;
2262 row[
"MusicURL"] = land.MusicURL;
2263 row[
"PassHours"] = land.PassHours;
2264 row[
"PassPrice"] = land.PassPrice;
2265 row[
"SnapshotUUID"] = land.SnapshotID.ToString();
2266 row[
"UserLocationX"] = land.UserLocation.X;
2267 row[
"UserLocationY"] = land.UserLocation.Y;
2268 row[
"UserLocationZ"] = land.UserLocation.Z;
2269 row[
"UserLookAtX"] = land.UserLookAt.X;
2270 row[
"UserLookAtY"] = land.UserLookAt.Y;
2271 row[
"UserLookAtZ"] = land.UserLookAt.Z;
2272 row[
"AuthbuyerID"] = land.AuthBuyerID.ToString();
2273 row[
"OtherCleanTime"] = land.OtherCleanTime;
2274 row[
"Dwell"] = land.Dwell;
2275 row[
"MediaType"] = land.MediaType;
2276 row[
"MediaDescription"] = land.MediaDescription;
2277 row[
"MediaSize"] = String.Format(
"{0},{1}", land.MediaWidth, land.MediaHeight);
2278 row[
"MediaLoop"] = land.MediaLoop;
2279 row[
"ObscureMusic"] = land.ObscureMusic;
2280 row[
"ObscureMedia"] = land.ObscureMedia;
2281 row[
"SeeAVs"] = land.SeeAVs;
2282 row[
"AnyAVSounds"] = land.AnyAVSounds;
2283 row[
"GroupAVSounds"] = land.GroupAVSounds;
2293 private static void fillLandAccessRow(DataRow row,
LandAccessEntry entry, UUID parcelID)
2295 row[
"LandUUID"] = parcelID.ToString();
2296 row[
"AccessUUID"] = entry.AgentID.ToString();
2297 row[
"Flags"] = entry.Flags;
2300 private static void fillRegionSettingsRow(DataRow row,
RegionSettings settings)
2302 row[
"regionUUID"] = settings.RegionUUID.ToString();
2303 row[
"block_terraform"] = settings.BlockTerraform;
2304 row[
"block_fly"] = settings.BlockFly;
2305 row[
"allow_damage"] = settings.AllowDamage;
2306 row[
"restrict_pushing"] = settings.RestrictPushing;
2307 row[
"allow_land_resell"] = settings.AllowLandResell;
2308 row[
"allow_land_join_divide"] = settings.AllowLandJoinDivide;
2309 row[
"block_show_in_search"] = settings.BlockShowInSearch;
2310 row[
"agent_limit"] = settings.AgentLimit;
2311 row[
"object_bonus"] = settings.ObjectBonus;
2312 row[
"maturity"] = settings.Maturity;
2313 row[
"disable_scripts"] = settings.DisableScripts;
2314 row[
"disable_collisions"] = settings.DisableCollisions;
2315 row[
"disable_physics"] = settings.DisablePhysics;
2316 row[
"terrain_texture_1"] = settings.TerrainTexture1.ToString();
2317 row[
"terrain_texture_2"] = settings.TerrainTexture2.ToString();
2318 row[
"terrain_texture_3"] = settings.TerrainTexture3.ToString();
2319 row[
"terrain_texture_4"] = settings.TerrainTexture4.ToString();
2320 row[
"elevation_1_nw"] = settings.Elevation1NW;
2321 row[
"elevation_2_nw"] = settings.Elevation2NW;
2322 row[
"elevation_1_ne"] = settings.Elevation1NE;
2323 row[
"elevation_2_ne"] = settings.Elevation2NE;
2324 row[
"elevation_1_se"] = settings.Elevation1SE;
2325 row[
"elevation_2_se"] = settings.Elevation2SE;
2326 row[
"elevation_1_sw"] = settings.Elevation1SW;
2327 row[
"elevation_2_sw"] = settings.Elevation2SW;
2328 row[
"water_height"] = settings.WaterHeight;
2329 row[
"terrain_raise_limit"] = settings.TerrainRaiseLimit;
2330 row[
"terrain_lower_limit"] = settings.TerrainLowerLimit;
2331 row[
"use_estate_sun"] = settings.UseEstateSun;
2332 row[
"sandbox"] = settings.Sandbox;
2333 row[
"sunvectorx"] = settings.SunVector.X;
2334 row[
"sunvectory"] = settings.SunVector.Y;
2335 row[
"sunvectorz"] = settings.SunVector.Z;
2336 row[
"fixed_sun"] = settings.FixedSun;
2337 row[
"sun_position"] = settings.SunPosition;
2338 row[
"covenant"] = settings.Covenant.ToString();
2339 row[
"covenant_datetime"] = settings.CovenantChangedDateTime;
2340 row[
"map_tile_ID"] = settings.TerrainImageID.ToString();
2341 row[
"TelehubObject"] = settings.TelehubObject.ToString();
2342 row[
"parcel_tile_ID"] = settings.ParcelImageID.ToString();
2343 row[
"block_search"] = settings.GodBlockSearch;
2344 row[
"casino"] = settings.Casino;
2354 row[
"region_id"] = windlight.regionID.ToString();
2355 row[
"water_color_r"] = windlight.waterColor.X;
2356 row[
"water_color_g"] = windlight.waterColor.Y;
2357 row[
"water_color_b"] = windlight.waterColor.Z;
2358 row[
"water_color_i"] = 1;
2359 row[
"water_fog_density_exponent"] = windlight.waterFogDensityExponent;
2360 row[
"underwater_fog_modifier"] = windlight.underwaterFogModifier;
2361 row[
"reflection_wavelet_scale_1"] = windlight.reflectionWaveletScale.X;
2362 row[
"reflection_wavelet_scale_2"] = windlight.reflectionWaveletScale.Y;
2363 row[
"reflection_wavelet_scale_3"] = windlight.reflectionWaveletScale.Z;
2364 row[
"fresnel_scale"] = windlight.fresnelScale;
2365 row[
"fresnel_offset"] = windlight.fresnelOffset;
2366 row[
"refract_scale_above"] = windlight.refractScaleAbove;
2367 row[
"refract_scale_below"] = windlight.refractScaleBelow;
2368 row[
"blur_multiplier"] = windlight.blurMultiplier;
2369 row[
"big_wave_direction_x"] = windlight.bigWaveDirection.X;
2370 row[
"big_wave_direction_y"] = windlight.bigWaveDirection.Y;
2371 row[
"little_wave_direction_x"] = windlight.littleWaveDirection.X;
2372 row[
"little_wave_direction_y"] = windlight.littleWaveDirection.Y;
2373 row[
"normal_map_texture"] = windlight.normalMapTexture.ToString();
2374 row[
"horizon_r"] = windlight.horizon.X;
2375 row[
"horizon_g"] = windlight.horizon.Y;
2376 row[
"horizon_b"] = windlight.horizon.Z;
2377 row[
"horizon_i"] = windlight.horizon.W;
2378 row[
"haze_horizon"] = windlight.hazeHorizon;
2379 row[
"blue_density_r"] = windlight.blueDensity.X;
2380 row[
"blue_density_g"] = windlight.blueDensity.Y;
2381 row[
"blue_density_b"] = windlight.blueDensity.Z;
2382 row[
"blue_density_i"] = windlight.blueDensity.W;
2383 row[
"haze_density"] = windlight.hazeDensity;
2384 row[
"density_multiplier"] = windlight.densityMultiplier;
2385 row[
"distance_multiplier"] = windlight.distanceMultiplier;
2386 row[
"max_altitude"] = windlight.maxAltitude;
2387 row[
"sun_moon_color_r"] = windlight.sunMoonColor.X;
2388 row[
"sun_moon_color_g"] = windlight.sunMoonColor.Y;
2389 row[
"sun_moon_color_b"] = windlight.sunMoonColor.Z;
2390 row[
"sun_moon_color_i"] = windlight.sunMoonColor.W;
2391 row[
"sun_moon_position"] = windlight.sunMoonPosition;
2392 row[
"ambient_r"] = windlight.ambient.X;
2393 row[
"ambient_g"] = windlight.ambient.Y;
2394 row[
"ambient_b"] = windlight.ambient.Z;
2395 row[
"ambient_i"] = windlight.ambient.W;
2396 row[
"east_angle"] = windlight.eastAngle;
2397 row[
"sun_glow_focus"] = windlight.sunGlowFocus;
2398 row[
"sun_glow_size"] = windlight.sunGlowSize;
2399 row[
"scene_gamma"] = windlight.sceneGamma;
2400 row[
"star_brightness"] = windlight.starBrightness;
2401 row[
"cloud_color_r"] = windlight.cloudColor.X;
2402 row[
"cloud_color_g"] = windlight.cloudColor.Y;
2403 row[
"cloud_color_b"] = windlight.cloudColor.Z;
2404 row[
"cloud_color_i"] = windlight.cloudColor.W;
2405 row[
"cloud_x"] = windlight.cloudXYDensity.X;
2406 row[
"cloud_y"] = windlight.cloudXYDensity.Y;
2407 row[
"cloud_density"] = windlight.cloudXYDensity.Z;
2408 row[
"cloud_coverage"] = windlight.cloudCoverage;
2409 row[
"cloud_scale"] = windlight.cloudScale;
2410 row[
"cloud_detail_x"] = windlight.cloudDetailXYDensity.X;
2411 row[
"cloud_detail_y"] = windlight.cloudDetailXYDensity.Y;
2412 row[
"cloud_detail_density"] = windlight.cloudDetailXYDensity.Z;
2413 row[
"cloud_scroll_x"] = windlight.cloudScrollX;
2414 row[
"cloud_scroll_x_lock"] = windlight.cloudScrollXLock;
2415 row[
"cloud_scroll_y"] = windlight.cloudScrollY;
2416 row[
"cloud_scroll_y_lock"] = windlight.cloudScrollYLock;
2417 row[
"draw_classic_clouds"] = windlight.drawClassicClouds;
2428 s.Scale =
new Vector3(
2429 Convert.ToSingle(row[
"ScaleX"]),
2430 Convert.ToSingle(row[
"ScaleY"]),
2431 Convert.ToSingle(row[
"ScaleZ"])
2434 s.PCode = Convert.ToByte(row[
"PCode"]);
2435 s.PathBegin = Convert.ToUInt16(row[
"PathBegin"]);
2436 s.PathEnd = Convert.ToUInt16(row[
"PathEnd"]);
2437 s.PathScaleX = Convert.ToByte(row[
"PathScaleX"]);
2438 s.PathScaleY = Convert.ToByte(row[
"PathScaleY"]);
2439 s.PathShearX = Convert.ToByte(row[
"PathShearX"]);
2440 s.PathShearY = Convert.ToByte(row[
"PathShearY"]);
2441 s.PathSkew = Convert.ToSByte(row[
"PathSkew"]);
2442 s.PathCurve = Convert.ToByte(row[
"PathCurve"]);
2443 s.PathRadiusOffset = Convert.ToSByte(row[
"PathRadiusOffset"]);
2444 s.PathRevolutions = Convert.ToByte(row[
"PathRevolutions"]);
2445 s.PathTaperX = Convert.ToSByte(row[
"PathTaperX"]);
2446 s.PathTaperY = Convert.ToSByte(row[
"PathTaperY"]);
2447 s.PathTwist = Convert.ToSByte(row[
"PathTwist"]);
2448 s.PathTwistBegin = Convert.ToSByte(row[
"PathTwistBegin"]);
2450 s.ProfileBegin = Convert.ToUInt16(row[
"ProfileBegin"]);
2451 s.ProfileEnd = Convert.ToUInt16(row[
"ProfileEnd"]);
2452 s.ProfileCurve = Convert.ToByte(row[
"ProfileCurve"]);
2453 s.ProfileHollow = Convert.ToUInt16(row[
"ProfileHollow"]);
2454 s.State = Convert.ToByte(row[
"State"]);
2455 s.LastAttachPoint = Convert.ToByte(row[
"LastAttachPoint"]);
2457 byte[] textureEntry = (byte[])row[
"Texture"];
2458 s.TextureEntry = textureEntry;
2460 s.ExtraParams = (byte[])row[
"ExtraParams"];
2462 if (!(row[
"Media"] is System.DBNull))
2476 row[
"UUID"] = prim.UUID.ToString();
2480 row[
"ScaleX"] = s.Scale.X;
2481 row[
"ScaleY"] = s.Scale.Y;
2482 row[
"ScaleZ"] = s.Scale.Z;
2484 row[
"PCode"] = s.PCode;
2485 row[
"PathBegin"] = s.PathBegin;
2486 row[
"PathEnd"] = s.PathEnd;
2487 row[
"PathScaleX"] = s.PathScaleX;
2488 row[
"PathScaleY"] = s.PathScaleY;
2489 row[
"PathShearX"] = s.PathShearX;
2490 row[
"PathShearY"] = s.PathShearY;
2491 row[
"PathSkew"] = s.PathSkew;
2492 row[
"PathCurve"] = s.PathCurve;
2493 row[
"PathRadiusOffset"] = s.PathRadiusOffset;
2494 row[
"PathRevolutions"] = s.PathRevolutions;
2495 row[
"PathTaperX"] = s.PathTaperX;
2496 row[
"PathTaperY"] = s.PathTaperY;
2497 row[
"PathTwist"] = s.PathTwist;
2498 row[
"PathTwistBegin"] = s.PathTwistBegin;
2500 row[
"ProfileBegin"] = s.ProfileBegin;
2501 row[
"ProfileEnd"] = s.ProfileEnd;
2502 row[
"ProfileCurve"] = s.ProfileCurve;
2503 row[
"ProfileHollow"] = s.ProfileHollow;
2504 row[
"State"] = s.State;
2505 row[
"LastAttachPoint"] = s.LastAttachPoint;
2507 row[
"Texture"] = s.TextureEntry;
2508 row[
"ExtraParams"] = s.ExtraParams;
2510 if (s.
Media != null)
2511 row[
"Media"] = s.Media.ToXml();
2520 private void addPrim(
SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID)
2522 DataTable prims = ds.Tables[
"prims"];
2523 DataTable shapes = ds.Tables[
"primshapes"];
2525 DataRow primRow = prims.Rows.Find(prim.UUID.ToString());
2526 if (primRow == null)
2528 primRow = prims.NewRow();
2529 fillPrimRow(primRow, prim, sceneGroupID, regionUUID);
2530 prims.Rows.Add(primRow);
2534 fillPrimRow(primRow, prim, sceneGroupID, regionUUID);
2537 DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString());
2538 if (shapeRow == null)
2540 shapeRow = shapes.NewRow();
2541 fillShapeRow(shapeRow, prim);
2542 shapes.Rows.Add(shapeRow);
2546 fillShapeRow(shapeRow, prim);
2558 DataTable dbItems = ds.Tables[
"primitems"];
2564 RemoveItems(primID);
2574 DataRow newItemRow = dbItems.NewRow();
2575 fillItemRow(newItemRow, newItem);
2576 dbItems.Rows.Add(newItemRow);
2608 private static SqliteCommand createInsertCommand(
string table, DataTable dt)
2610 string[] cols =
new string[dt.Columns.Count];
2611 for (
int i = 0; i < dt.Columns.Count; i++)
2613 DataColumn col = dt.Columns[i];
2614 cols[i] = col.ColumnName;
2617 string sql =
"insert into " + table +
"(";
2618 sql += String.Join(
", ", cols);
2620 sql +=
") values (:";
2621 sql += String.Join(
", :", cols);
2624 SqliteCommand cmd =
new SqliteCommand(sql);
2628 foreach (DataColumn col
in dt.Columns)
2630 cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
2643 private static SqliteCommand createUpdateCommand(
string table,
string pk, DataTable dt)
2645 string sql =
"update " + table +
" set ";
2646 string subsql = String.Empty;
2647 foreach (DataColumn col
in dt.Columns)
2649 if (subsql.Length > 0)
2654 subsql += col.ColumnName +
"= :" + col.ColumnName;
2657 sql +=
" where " + pk;
2658 SqliteCommand cmd =
new SqliteCommand(sql);
2663 foreach (DataColumn col
in dt.Columns)
2665 cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
2677 private static SqliteCommand createUpdateCommand(
string table,
string pk1,
string pk2, DataTable dt)
2679 string sql =
"update " + table +
" set ";
2680 string subsql = String.Empty;
2681 foreach (DataColumn col
in dt.Columns)
2683 if (subsql.Length > 0)
2688 subsql += col.ColumnName +
"= :" + col.ColumnName;
2691 sql +=
" where " + pk1 +
" and " + pk2;
2692 SqliteCommand cmd =
new SqliteCommand(sql);
2697 foreach (DataColumn col
in dt.Columns)
2699 cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
2751 private static SqliteParameter createSqliteParameter(
string name, Type type)
2753 SqliteParameter param =
new SqliteParameter();
2754 param.ParameterName =
":" + name;
2755 param.DbType = dbtypeFromType(type);
2756 param.SourceColumn = name;
2757 param.SourceVersion = DataRowVersion.Current;
2766 private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn)
2768 da.InsertCommand = createInsertCommand(
"prims", ds.Tables[
"prims"]);
2769 da.InsertCommand.Connection = conn;
2771 da.UpdateCommand = createUpdateCommand(
"prims",
"UUID=:UUID", ds.Tables[
"prims"]);
2772 da.UpdateCommand.Connection = conn;
2774 SqliteCommand
delete =
new SqliteCommand(
"delete from prims where UUID = :UUID");
2775 delete.Parameters.Add(createSqliteParameter(
"UUID", typeof(String)));
2776 delete.Connection = conn;
2777 da.DeleteCommand =
delete;
2785 private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn)
2787 da.InsertCommand = createInsertCommand(
"primitems", ds.Tables[
"primitems"]);
2788 da.InsertCommand.Connection = conn;
2790 da.UpdateCommand = createUpdateCommand(
"primitems",
"itemID = :itemID", ds.Tables[
"primitems"]);
2791 da.UpdateCommand.Connection = conn;
2793 SqliteCommand
delete =
new SqliteCommand(
"delete from primitems where itemID = :itemID");
2794 delete.Parameters.Add(createSqliteParameter(
"itemID", typeof(String)));
2795 delete.Connection = conn;
2796 da.DeleteCommand =
delete;
2804 private void setupTerrainCommands(SqliteDataAdapter da, SqliteConnection conn)
2806 da.InsertCommand = createInsertCommand(
"terrain", ds.Tables[
"terrain"]);
2807 da.InsertCommand.Connection = conn;
2815 private void setupLandCommands(SqliteDataAdapter da, SqliteConnection conn)
2817 da.InsertCommand = createInsertCommand(
"land", ds.Tables[
"land"]);
2818 da.InsertCommand.Connection = conn;
2820 da.UpdateCommand = createUpdateCommand(
"land",
"UUID=:UUID", ds.Tables[
"land"]);
2821 da.UpdateCommand.Connection = conn;
2823 SqliteCommand
delete =
new SqliteCommand(
"delete from land where UUID=:UUID");
2824 delete.Parameters.Add(createSqliteParameter(
"UUID", typeof(String)));
2825 da.DeleteCommand =
delete;
2826 da.DeleteCommand.Connection = conn;
2834 private void setupLandAccessCommands(SqliteDataAdapter da, SqliteConnection conn)
2836 da.InsertCommand = createInsertCommand(
"landaccesslist", ds.Tables[
"landaccesslist"]);
2837 da.InsertCommand.Connection = conn;
2839 da.UpdateCommand = createUpdateCommand(
"landaccesslist",
"LandUUID=:landUUID",
"AccessUUID=:AccessUUID", ds.Tables[
"landaccesslist"]);
2840 da.UpdateCommand.Connection = conn;
2842 SqliteCommand
delete =
new SqliteCommand(
"delete from landaccesslist where LandUUID= :LandUUID and AccessUUID= :AccessUUID");
2843 delete.Parameters.Add(createSqliteParameter(
"LandUUID", typeof(String)));
2844 delete.Parameters.Add(createSqliteParameter(
"AccessUUID", typeof(String)));
2845 da.DeleteCommand =
delete;
2846 da.DeleteCommand.Connection = conn;
2849 private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn)
2851 da.InsertCommand = createInsertCommand(
"regionsettings", ds.Tables[
"regionsettings"]);
2852 da.InsertCommand.Connection = conn;
2853 da.UpdateCommand = createUpdateCommand(
"regionsettings",
"regionUUID=:regionUUID", ds.Tables[
"regionsettings"]);
2854 da.UpdateCommand.Connection = conn;
2862 private void setupRegionWindlightCommands(SqliteDataAdapter da, SqliteConnection conn)
2864 da.InsertCommand = createInsertCommand(
"regionwindlight", ds.Tables[
"regionwindlight"]);
2865 da.InsertCommand.Connection = conn;
2866 da.UpdateCommand = createUpdateCommand(
"regionwindlight",
"region_id=:region_id", ds.Tables[
"regionwindlight"]);
2867 da.UpdateCommand.Connection = conn;
2870 private void setupRegionEnvironmentCommands(SqliteDataAdapter da, SqliteConnection conn)
2872 da.InsertCommand = createInsertCommand(
"regionenvironment", ds.Tables[
"regionenvironment"]);
2873 da.InsertCommand.Connection = conn;
2874 da.UpdateCommand = createUpdateCommand(
"regionenvironment",
"region_id=:region_id", ds.Tables[
"regionenvironment"]);
2875 da.UpdateCommand.Connection = conn;
2878 private void setupRegionSpawnPointsCommands(SqliteDataAdapter da, SqliteConnection conn)
2880 da.InsertCommand = createInsertCommand(
"spawn_points", ds.Tables[
"spawn_points"]);
2881 da.InsertCommand.Connection = conn;
2882 da.UpdateCommand = createUpdateCommand(
"spawn_points",
"RegionID=:RegionID", ds.Tables[
"spawn_points"]);
2883 da.UpdateCommand.Connection = conn;
2891 private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn)
2893 da.InsertCommand = createInsertCommand(
"primshapes", ds.Tables[
"primshapes"]);
2894 da.InsertCommand.Connection = conn;
2896 da.UpdateCommand = createUpdateCommand(
"primshapes",
"UUID=:UUID", ds.Tables[
"primshapes"]);
2897 da.UpdateCommand.Connection = conn;
2899 SqliteCommand
delete =
new SqliteCommand(
"delete from primshapes where UUID = :UUID");
2900 delete.Parameters.Add(createSqliteParameter(
"UUID", typeof(String)));
2901 delete.Connection = conn;
2902 da.DeleteCommand =
delete;
2916 private static DbType dbtypeFromType(Type type)
2918 if (type == typeof(String))
2920 return DbType.String;
2922 else if (type == typeof(Int32))
2924 return DbType.Int32;
2926 else if (type == typeof(Double))
2928 return DbType.Double;
2930 else if (type == typeof(Byte))
2934 else if (type == typeof(Double))
2936 return DbType.Double;
2938 else if (type == typeof(Byte[]))
2940 return DbType.Binary;
2944 return DbType.String;
2948 static void PrintDataSet(DataSet ds)
2951 Console.WriteLine(
"DataSet is named: {0}", ds.DataSetName);
2952 foreach (System.Collections.DictionaryEntry de in ds.ExtendedProperties)
2954 Console.WriteLine(
"Key = {0}, Value = {1}", de.Key, de.Value);
2956 Console.WriteLine();
2957 foreach (DataTable dt
in ds.Tables)
2959 Console.WriteLine(
"=> {0} Table:", dt.TableName);
2961 for (
int curCol = 0; curCol < dt.Columns.Count; curCol++)
2963 Console.Write(dt.Columns[curCol].ColumnName +
"\t");
2965 Console.WriteLine(
"\n----------------------------------");
2967 for (
int curRow = 0; curRow < dt.Rows.Count; curRow++)
2969 for (
int curCol = 0; curCol < dt.Columns.Count; curCol++)
2971 Console.Write(dt.Rows[curRow][curCol].ToString() +
"\t");
2973 Console.WriteLine();
2983 public void SaveExtra(UUID regionID,
string name,
string value)
2991 public Dictionary<string, string>
GetExtra(UUID regionID)
void SaveExtra(UUID regionID, string name, string value)
SQLiteSimulationData(string connectionString)
void RemoveExtra(UUID regionID, string name)
void StoreObject(SceneObjectGroup obj, UUID regionUUID)
Adds an object into region storage
List< SceneObjectGroup > LoadObjects(UUID regionUUID)
Load persisted objects from region storage.
List< LandAccessEntry > ParcelAccessList
List of access data for the parcel. User data, some bitflags, and a time
void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
Store Environment settings into region storage
OpenSim.Framework.RegionSettings RegionSettings
void RemoveLandObject(UUID globalID)
delete from land where UUID=globalID delete from landaccesslist where LandUUID=globalID ...
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
PrimFlags Flags
Property flags. See OpenMetaverse.PrimFlags
MediaList Media
Entries to store media textures on each face
int CountNamespaces
Get the number of namespaces
Represents an item in a task inventory
void RemoveRegionWindlightSettings(UUID regionID)
Remove windlight settings from region storage
string CreatorIdentification
Used by the DB layer to retrieve / store the entire user identification. The identification can eithe...
A RegionData Interface to the SQLite database
Dictionary< string, string > GetExtra(UUID regionID)
UUID GlobalID
Global ID for the parcel. (3rd Party Integration)
void RemoveRegionEnvironmentSettings(UUID regionUUID)
Delete Environment settings from region storage
UUID[] GetObjectIDs(UUID regionID)
void StoreLandObject(ILandObject parcel)
void Dispose()
Dispose the database
void StoreTerrain(double[,] ter, UUID regionID)
double[,] LoadTerrain(UUID regionID)
Load the latest terrain revision from region storage
This class stores and retrieves dynamic attributes.
void StoreRegionWindlightSettings(RegionLightShareData wl)
Adds an windlight into region storage
void StoreTerrain(TerrainData terrData, UUID regionID)
Store a terrain revision in region storage
Details of a Parcel of land
TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
Load the latest terrain revision from region storage
void Shutdown()
See Commit
void SetForceMouselook(bool force)
void RemoveObject(UUID obj, UUID regionUUID)
Removes an object from region storage
void StoreSpawnPoints(RegionSettings rs)
void Initialise(string connectionString)
Initialises RegionData Interface Loads and initialises a new SQLite connection and maintains it...
List< LandData > LoadLandObjects(UUID regionUUID)
RegionSettings LoadRegionSettings(UUID regionUUID)
void StorePrimInventory(UUID primID, ICollection< TaskInventoryItem > items)
DAMap DynAttrs
Dynamic attributes can be created and deleted as required.
Material
Material type for a primitive
KeyframeMotion KeyframeMotion
void CreateDataSetMapping(IDataAdapter da, string tableName)
void StoreRegionSettings(RegionSettings rs)
string LoadRegionEnvironmentSettings(UUID regionUUID)
Load Environment settings from region storage
RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
Load windlight settings from region storage