diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 0608f66827..a47fc01ab0 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -756,7 +756,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController // Set the estate // Check for an existing estate - List estateIDs = m_application.StorageManager.EstateDataStore.GetEstates((string) requestData["estate_name"]); + List estateIDs = m_application.EstateDataService.GetEstates((string) requestData["estate_name"]); if (estateIDs.Count < 1) { UUID userID = UUID.Zero; @@ -784,7 +784,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } // Create a new estate with the name provided - region.EstateSettings = m_application.StorageManager.EstateDataStore.LoadEstateSettings(region.RegionID, true); + region.EstateSettings = m_application.EstateDataService.LoadEstateSettings(region.RegionID, true); region.EstateSettings.EstateName = (string) requestData["estate_name"]; region.EstateSettings.EstateOwner = userID; @@ -794,10 +794,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController else { int estateID = estateIDs[0]; - - region.EstateSettings = m_application.StorageManager.EstateDataStore.LoadEstateSettings(estateID); - - if (!m_application.StorageManager.EstateDataStore.LinkRegion(region.RegionID, estateID)) + + region.EstateSettings = m_application.EstateDataService.LoadEstateSettings(estateID); + + if (!m_application.EstateDataService.LinkRegion(region.RegionID, estateID)) throw new Exception("Failed to join estate."); } diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs index 4369216b26..8271d76b44 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs @@ -384,7 +384,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory // } // // rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method)); -// +// // } /// @@ -449,7 +449,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory // rdata.userAppearance = new AvatarAppearance(); // rdata.userAppearance.Owner = old.Owner; // adata = new AvatarData(rdata.userAppearance); -// +// // Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata); // // rdata.Complete(); diff --git a/OpenSim/Data/DBGuids.cs b/OpenSim/Data/DBGuids.cs index fb6832b8d1..ad1c19c6ee 100644 --- a/OpenSim/Data/DBGuids.cs +++ b/OpenSim/Data/DBGuids.cs @@ -1,4 +1,31 @@ -using System; +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; using System.Collections.Generic; using System.Text; using OpenMetaverse; @@ -17,7 +44,7 @@ namespace OpenSim.Data /// public static UUID FromDB(object id) { - if( (id == null) || (id == DBNull.Value)) + if ((id == null) || (id == DBNull.Value)) return UUID.Zero; if (id.GetType() == typeof(Guid)) diff --git a/OpenSim/Data/IAssetData.cs b/OpenSim/Data/IAssetData.cs index 065d3a5f3d..0c8eadd4af 100644 --- a/OpenSim/Data/IAssetData.cs +++ b/OpenSim/Data/IAssetData.cs @@ -40,15 +40,4 @@ namespace OpenSim.Data void Initialise(string connect); bool Delete(string id); } - - public class AssetDataInitialiser : PluginInitialiserBase - { - private string connect; - public AssetDataInitialiser (string s) { connect = s; } - public override void Initialise (IPlugin plugin) - { - IAssetDataPlugin p = plugin as IAssetDataPlugin; - p.Initialise (connect); - } - } } diff --git a/OpenSim/Data/IInventoryData.cs b/OpenSim/Data/IInventoryData.cs index 90f74b713b..74d5d37bf9 100644 --- a/OpenSim/Data/IInventoryData.cs +++ b/OpenSim/Data/IInventoryData.cs @@ -155,15 +155,4 @@ namespace OpenSim.Data /// List fetchActiveGestures(UUID avatarID); } - - public class InventoryDataInitialiser : PluginInitialiserBase - { - private string connect; - public InventoryDataInitialiser (string s) { connect = s; } - public override void Initialise (IPlugin plugin) - { - IInventoryDataPlugin p = plugin as IInventoryDataPlugin; - p.Initialise (connect); - } - } } diff --git a/OpenSim/Data/MSSQL/MSSQLEstateData.cs b/OpenSim/Data/MSSQL/MSSQLEstateData.cs index 80bf10638d..e9a0935048 100644 --- a/OpenSim/Data/MSSQL/MSSQLEstateData.cs +++ b/OpenSim/Data/MSSQL/MSSQLEstateData.cs @@ -50,6 +50,15 @@ namespace OpenSim.Data.MSSQL #region Public methods + public MSSQLEstateStore() + { + } + + public MSSQLEstateStore(string connectionString) + { + Initialise(connectionString); + } + /// /// Initialises the estatedata class. /// diff --git a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs similarity index 99% rename from OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs rename to OpenSim/Data/MSSQL/MSSQLSimulationData.cs index 77b8a10f07..8eae0a2a12 100644 --- a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs +++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs @@ -43,7 +43,7 @@ namespace OpenSim.Data.MSSQL /// /// A MSSQL Interface for the Region Server. /// - public class MSSQLRegionDataStore : IRegionDataStore + public class MSSQLSimulationData : ISimulationDataStore { private const string _migrationStore = "RegionStore"; @@ -55,6 +55,16 @@ namespace OpenSim.Data.MSSQL /// private MSSQLManager _Database; private string m_connectionString; + + public MSSQLSimulationData() + { + } + + public MSSQLSimulationData(string connectionString) + { + Initialise(connectionString); + } + /// /// Initialises the region datastore /// @@ -1126,7 +1136,7 @@ VALUES prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]); if (!(primRow["MediaURL"] is System.DBNull)) - prim.MediaUrl = (string)primRow["MediaURL"]; + prim.MediaUrl = (string)primRow["MediaURL"]; return prim; } @@ -1180,7 +1190,7 @@ VALUES { } - if (!(shapeRow["Media"] is System.DBNull)) + if (!(shapeRow["Media"] is System.DBNull)) baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]); return baseShape; @@ -1511,7 +1521,7 @@ VALUES parameters.Add(_Database.CreateParameter("PassTouches", 1)); else parameters.Add(_Database.CreateParameter("PassTouches", 0)); - parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); + parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); return parameters.ToArray(); diff --git a/OpenSim/Data/Migration.cs b/OpenSim/Data/Migration.cs index 86531d92df..fc9a1429ec 100644 --- a/OpenSim/Data/Migration.cs +++ b/OpenSim/Data/Migration.cs @@ -122,7 +122,7 @@ namespace OpenSim.Data int ver = FindVersion(_conn, "migrations"); if (ver <= 0) // -1 = no table, 0 = no version record { - if( ver < 0 ) + if (ver < 0) ExecuteScript("create table migrations(name varchar(100), version int)"); InsertVersion("migrations", 1); } @@ -288,7 +288,7 @@ namespace OpenSim.Data SortedList migrations = new SortedList(); string[] names = _assem.GetManifestResourceNames(); - if( names.Length == 0 ) // should never happen + if (names.Length == 0) // should never happen return migrations; Array.Sort(names); // we want all the migrations ordered @@ -297,7 +297,7 @@ namespace OpenSim.Data Match m = null; string sFile = Array.FindLast(names, nm => { m = _match_new.Match(nm); return m.Success; }); // ; nm.StartsWith(sPrefix, StringComparison.InvariantCultureIgnoreCase - if( (m != null) && !String.IsNullOrEmpty(sFile) ) + if ((m != null) && !String.IsNullOrEmpty(sFile)) { /* The filename should be '.migrations[.NNN]' where NNN * is the last version number defined in the file. If the '.NNN' part is recognized, the code can skip @@ -312,7 +312,7 @@ namespace OpenSim.Data if (m.Groups.Count > 1 && int.TryParse(m.Groups[1].Value, out nLastVerFound)) { - if( nLastVerFound <= after ) + if (nLastVerFound <= after) goto scan_old_style; } @@ -329,7 +329,7 @@ namespace OpenSim.Data sb.Length = 0; } - if ( (nVersion > 0) && (nVersion > after) && (script.Count > 0) && !migrations.ContainsKey(nVersion)) // script to the versioned script list + if ((nVersion > 0) && (nVersion > after) && (script.Count > 0) && !migrations.ContainsKey(nVersion)) // script to the versioned script list { migrations[nVersion] = script.ToArray(); } @@ -345,7 +345,7 @@ namespace OpenSim.Data string sLine = resourceReader.ReadLine(); nLineNo++; - if( String.IsNullOrEmpty(sLine) || sLine.StartsWith("#") ) // ignore a comment or empty line + if (String.IsNullOrEmpty(sLine) || sLine.StartsWith("#")) // ignore a comment or empty line continue; if (sLine.Trim().Equals(":GO", StringComparison.InvariantCultureIgnoreCase)) @@ -392,7 +392,7 @@ scan_old_style: if (m.Success) { int version = int.Parse(m.Groups[1].ToString()); - if ( (version > after) && !migrations.ContainsKey(version) ) + if ((version > after) && !migrations.ContainsKey(version)) { using (Stream resource = _assem.GetManifestResourceStream(s)) { diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index f9ce3d98ea..0b0a6385d0 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs @@ -216,9 +216,6 @@ namespace OpenSim.Data.MySQL private void UpdateAccessTime(AssetBase asset) { - // Writing to the database every time Get() is called on an asset is killing us. Seriously. -jph - return; - lock (m_dbLock) { using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs index 9158f7a427..c42c687ed9 100644 --- a/OpenSim/Data/MySQL/MySQLEstateData.cs +++ b/OpenSim/Data/MySQL/MySQLEstateData.cs @@ -54,6 +54,15 @@ namespace OpenSim.Data.MySQL private Dictionary m_FieldMap = new Dictionary(); + public MySQLEstateStore() + { + } + + public MySQLEstateStore(string connectionString) + { + Initialise(connectionString); + } + public void Initialise(string connectionString) { m_connectionString = connectionString; diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs index 0aea30ffb9..2dca3eb6a9 100644 --- a/OpenSim/Data/MySQL/MySQLInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs @@ -286,7 +286,7 @@ namespace OpenSim.Data.MySQL InventoryItemBase item = new InventoryItemBase(); // TODO: this is to handle a case where NULLs creep in there, which we are not sure is endemic to the system, or legacy. It would be nice to live fix these. - // ( DBGuid.FromDB() reads db NULLs as well, returns UUID.Zero ) + // (DBGuid.FromDB() reads db NULLs as well, returns UUID.Zero) item.CreatorId = reader["creatorID"].ToString(); // Be a bit safer in parsing these because the diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs similarity index 98% rename from OpenSim/Data/MySQL/MySQLLegacyRegionData.cs rename to OpenSim/Data/MySQL/MySQLSimulationData.cs index a39e68d3ad..87f6d07063 100644 --- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -45,13 +45,22 @@ namespace OpenSim.Data.MySQL /// /// A MySQL Interface for the Region Server /// - public class MySQLDataStore : IRegionDataStore + public class MySQLSimulationData : ISimulationDataStore { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private string m_connectionString; private object m_dbLock = new object(); + public MySQLSimulationData() + { + } + + public MySQLSimulationData(string connectionString) + { + Initialise(connectionString); + } + public void Initialise(string connectionString) { m_connectionString = connectionString; @@ -680,7 +689,7 @@ namespace OpenSim.Data.MySQL "UserLocationX, UserLocationY, UserLocationZ, " + "UserLookAtX, UserLookAtY, UserLookAtZ, " + "AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " + - "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + + "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + "?UUID, ?RegionUUID, " + "?LocalLandID, ?Bitmap, ?Name, ?Description, " + "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " + @@ -691,7 +700,7 @@ namespace OpenSim.Data.MySQL "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + "?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+ - "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; + "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); @@ -728,7 +737,7 @@ namespace OpenSim.Data.MySQL string command = "select * from `regionwindlight` where region_id = ?regionID"; - using(MySqlCommand cmd = new MySqlCommand(command)) + using (MySqlCommand cmd = new MySqlCommand(command)) { cmd.Connection = dbcon; @@ -1350,13 +1359,13 @@ namespace OpenSim.Data.MySQL m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name); } - newData.MediaDescription = (string) row["MediaDescription"]; - newData.MediaType = (string) row["MediaType"]; - newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]); - newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]); - newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]); - newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); - newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); + newData.MediaDescription = (string) row["MediaDescription"]; + newData.MediaType = (string) row["MediaType"]; + newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]); + newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]); + newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]); + newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); + newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); newData.ParcelAccessList = new List(); @@ -1724,7 +1733,7 @@ namespace OpenSim.Data.MySQL s.State = (byte)(int)row["State"]; - if (!(row["Media"] is System.DBNull)) + if (!(row["Media"] is System.DBNull)) s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); return s; diff --git a/OpenSim/Data/Null/NullInventoryData.cs b/OpenSim/Data/Null/NullInventoryData.cs index 8f196e2018..fe9ed017a1 100644 --- a/OpenSim/Data/Null/NullInventoryData.cs +++ b/OpenSim/Data/Null/NullInventoryData.cs @@ -1,4 +1,31 @@ -using System; +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; using System.Collections.Generic; using OpenMetaverse; diff --git a/OpenSim/Data/Null/NullDataStore.cs b/OpenSim/Data/Null/NullSimulationData.cs similarity index 97% rename from OpenSim/Data/Null/NullDataStore.cs rename to OpenSim/Data/Null/NullSimulationData.cs index 3ba44bb54b..34d3a4e38a 100644 --- a/OpenSim/Data/Null/NullDataStore.cs +++ b/OpenSim/Data/Null/NullSimulationData.cs @@ -36,7 +36,7 @@ namespace OpenSim.Data.Null /// /// NULL DataStore, do not store anything /// - public class NullDataStore : IRegionDataStore + public class NullSimulationData : ISimulationDataStore { public void Initialise(string dbfile) { @@ -73,7 +73,6 @@ namespace OpenSim.Data.Null { } - // see IRegionDatastore public void StorePrimInventory(UUID primID, ICollection items) { } diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs index fcf041e41f..d1d67ebdab 100644 --- a/OpenSim/Data/SQLite/SQLiteEstateData.cs +++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs @@ -49,6 +49,15 @@ namespace OpenSim.Data.SQLite private Dictionary m_FieldMap = new Dictionary(); + public SQLiteEstateStore() + { + } + + public SQLiteEstateStore(string connectionString) + { + Initialise(connectionString); + } + public void Initialise(string connectionString) { m_connectionString = connectionString; diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs index ece2495c2b..ecf8e02c34 100644 --- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs @@ -731,12 +731,12 @@ namespace OpenSim.Data.SQLite **********************************************************************/ protected void CreateDataSetMapping(IDataAdapter da, string tableName) - { + { ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName); foreach (DataColumn col in ds.Tables[tableName].Columns) - { + { dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName); - } + } } /// diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs similarity index 99% rename from OpenSim/Data/SQLite/SQLiteRegionData.cs rename to OpenSim/Data/SQLite/SQLiteSimulationData.cs index 88699a767f..3e9bc3fe3b 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -44,7 +44,7 @@ namespace OpenSim.Data.SQLite /// /// A RegionData Interface to the SQLite database /// - public class SQLiteRegionData : IRegionDataStore + public class SQLiteSimulationData : ISimulationDataStore { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -70,6 +70,15 @@ namespace OpenSim.Data.SQLite private String m_connectionString; + public SQLiteSimulationData() + { + } + + public SQLiteSimulationData(string connectionString) + { + Initialise(connectionString); + } + // Temporary attribute while this is experimental /*********************************************************************** @@ -79,7 +88,6 @@ namespace OpenSim.Data.SQLite **********************************************************************/ /// - /// See IRegionDataStore /// /// Initialises RegionData Interface /// Loads and initialises a new SQLite connection and maintains it. @@ -177,7 +185,7 @@ namespace OpenSim.Data.SQLite { m_log.Info("[SQLITE REGION DB]: Caught fill error on primitems table"); } - + try { terrainDa.Fill(ds.Tables["terrain"]); @@ -511,7 +519,7 @@ namespace OpenSim.Data.SQLite "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape"); prim.Shape = PrimitiveBaseShape.Default; } - + createdObjects[new UUID(objID)].AddPart(prim); LoadItems(prim); } @@ -535,17 +543,17 @@ namespace OpenSim.Data.SQLite /// /// the prim private void LoadItems(SceneObjectPart prim) - { -// m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID); - + { +// m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID); + DataTable dbItems = ds.Tables["primitems"]; - String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); + String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); DataRow[] dbItemRows = dbItems.Select(sql); IList inventory = new List(); -// m_log.DebugFormat( -// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID); - +// m_log.DebugFormat( +// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID); + foreach (DataRow row in dbItemRows) { TaskInventoryItem item = buildItem(row); @@ -694,8 +702,6 @@ namespace OpenSim.Data.SQLite { landaccesslist.Rows.Remove(rowsToDelete[iter]); } - - } Commit(); } @@ -805,7 +811,7 @@ namespace OpenSim.Data.SQLite try { regionSettingsDa.Update(ds, "regionsettings"); - } + } catch (SqliteException SqlEx) { throw new Exception( @@ -975,7 +981,7 @@ namespace OpenSim.Data.SQLite createCol(prims, "CollisionSoundVolume", typeof(Double)); createCol(prims, "VolumeDetect", typeof(Int16)); - + createCol(prims, "MediaURL", typeof(String)); // Add in contraints @@ -1192,10 +1198,10 @@ namespace OpenSim.Data.SQLite private SceneObjectPart buildPrim(DataRow row) { // Code commented. Uncomment to test the unit test inline. - - // The unit test mentions this commented code for the purposes + + // The unit test mentions this commented code for the purposes // of debugging a unit test failure - + // SceneObjectGroup sog = new SceneObjectGroup(); // SceneObjectPart sop = new SceneObjectPart(); // sop.LocalId = 1; @@ -1212,7 +1218,7 @@ namespace OpenSim.Data.SQLite // TODO: this doesn't work yet because something more // interesting has to be done to actually get these values // back out. Not enough time to figure it out yet. - + SceneObjectPart prim = new SceneObjectPart(); prim.UUID = new UUID((String) row["UUID"]); // explicit conversion of integers is required, which sort @@ -1342,7 +1348,7 @@ namespace OpenSim.Data.SQLite if (Convert.ToInt16(row["VolumeDetect"]) != 0) prim.VolumeDetectActive = true; - + if (!(row["MediaURL"] is System.DBNull)) { //m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType()); @@ -1681,7 +1687,7 @@ namespace OpenSim.Data.SQLite row["VolumeDetect"] = 1; else row["VolumeDetect"] = 0; - + row["MediaURL"] = prim.MediaUrl; } @@ -1759,12 +1765,12 @@ namespace OpenSim.Data.SQLite row["UserLookAtZ"] = land.UserLookAt.Z; row["AuthbuyerID"] = land.AuthBuyerID.ToString(); row["OtherCleanTime"] = land.OtherCleanTime; - row["MediaType"] = land.MediaType; - row["MediaDescription"] = land.MediaDescription; - row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString(); - row["MediaLoop"] = land.MediaLoop.ToString(); - row["ObscureMusic"] = land.ObscureMusic.ToString(); - row["ObscureMedia"] = land.ObscureMedia.ToString(); + row["MediaType"] = land.MediaType; + row["MediaDescription"] = land.MediaDescription; + row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString(); + row["MediaLoop"] = land.MediaLoop.ToString(); + row["ObscureMusic"] = land.ObscureMusic.ToString(); + row["ObscureMedia"] = land.ObscureMedia.ToString(); } /// @@ -1862,10 +1868,10 @@ namespace OpenSim.Data.SQLite s.TextureEntry = textureEntry; s.ExtraParams = (byte[]) row["ExtraParams"]; - + if (!(row["Media"] is System.DBNull)) s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); - + return s; } @@ -1909,7 +1915,7 @@ namespace OpenSim.Data.SQLite row["Texture"] = s.TextureEntry; row["ExtraParams"] = s.ExtraParams; - + if (s.Media != null) row["Media"] = s.Media.ToXml(); } @@ -1951,7 +1957,6 @@ namespace OpenSim.Data.SQLite } /// - /// see IRegionDatastore /// /// /// @@ -2248,7 +2253,6 @@ namespace OpenSim.Data.SQLite delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String))); da.DeleteCommand = delete; da.DeleteCommand.Connection = conn; - } private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn) @@ -2320,7 +2324,7 @@ namespace OpenSim.Data.SQLite return DbType.String; } } - + static void PrintDataSet(DataSet ds) { // Print out any name and extended properties. diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs index bf8ee147b5..547ea6b07d 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs @@ -49,6 +49,15 @@ namespace OpenSim.Data.SQLiteLegacy private Dictionary m_FieldMap = new Dictionary(); + public SQLiteEstateStore() + { + } + + public SQLiteEstateStore(string connectionString) + { + Initialise(connectionString); + } + public void Initialise(string connectionString) { m_connectionString = connectionString; diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs similarity index 99% rename from OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs rename to OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs index b5ce4c0080..2dde926fce 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs @@ -43,7 +43,7 @@ namespace OpenSim.Data.SQLiteLegacy /// /// A RegionData Interface to the SQLite database /// - public class SQLiteRegionData : IRegionDataStore + public class SQLiteSimulationData : ISimulationDataStore { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -69,6 +69,15 @@ namespace OpenSim.Data.SQLiteLegacy private String m_connectionString; + public SQLiteSimulationData() + { + } + + public SQLiteSimulationData(string connectionString) + { + Initialise(connectionString); + } + // Temporary attribute while this is experimental /*********************************************************************** @@ -78,7 +87,6 @@ namespace OpenSim.Data.SQLiteLegacy **********************************************************************/ /// - /// See IRegionDataStore /// /// Initialises RegionData Interface /// Loads and initialises a new SQLite connection and maintains it. @@ -1888,7 +1896,6 @@ namespace OpenSim.Data.SQLiteLegacy } /// - /// see IRegionDatastore /// /// /// diff --git a/OpenSim/Data/Tests/BasicDataServiceTest.cs b/OpenSim/Data/Tests/BasicDataServiceTest.cs index c261126722..7d85f0c8eb 100644 --- a/OpenSim/Data/Tests/BasicDataServiceTest.cs +++ b/OpenSim/Data/Tests/BasicDataServiceTest.cs @@ -1,4 +1,31 @@ -using System; +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; using System.IO; using System.Collections.Generic; using log4net.Config; @@ -41,13 +68,13 @@ namespace OpenSim.Data.Tests { m_connStr = !String.IsNullOrEmpty(conn) ? conn : DefaultTestConns.Get(typeof(TConn)); - m_log = LogManager.GetLogger(this.GetType()); + m_log = LogManager.GetLogger(this.GetType()); OpenSim.Tests.Common.TestLogging.LogToConsole(); // TODO: Is that right? } /// /// To be overridden in derived classes. Do whatever init with the m_service, like setting the conn string to it. - /// You'd probably want to to cast the 'service' to a more specific type and store it in a member var. + /// You'd probably want to to cast the 'service' to a more specific type and store it in a member var. /// This framework takes care of disposing it, if it's disposable. /// /// The service being tested @@ -118,12 +145,12 @@ namespace OpenSim.Data.Tests { if (m_service != null) { - if( m_service is IDisposable) + if (m_service is IDisposable) ((IDisposable)m_service).Dispose(); m_service = null; } - if( !String.IsNullOrEmpty(m_file) && File.Exists(m_file) ) + if (!String.IsNullOrEmpty(m_file) && File.Exists(m_file)) File.Delete(m_file); } @@ -204,7 +231,7 @@ namespace OpenSim.Data.Tests lst += ", " + s; } - string sCond = stores.Length > 1 ? ("in (" + lst + ")") : ("=" + lst); + string sCond = stores.Length > 1 ? ("in (" + lst + ")") : ("=" + lst); try { ExecuteSql("DELETE FROM migrations where name " + sCond); diff --git a/OpenSim/Data/Tests/DefaultTestConns.cs b/OpenSim/Data/Tests/DefaultTestConns.cs index 7b52af575a..7c47bddd21 100644 --- a/OpenSim/Data/Tests/DefaultTestConns.cs +++ b/OpenSim/Data/Tests/DefaultTestConns.cs @@ -1,4 +1,31 @@ -using System; +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs index 29bf5a3418..a081462b73 100644 --- a/OpenSim/Data/Tests/RegionTests.cs +++ b/OpenSim/Data/Tests/RegionTests.cs @@ -61,17 +61,17 @@ namespace OpenSim.Data.Tests #else [TestFixture(Description = "Region store tests (SQLite)")] - public class SQLiteRegionTests : RegionTests + public class SQLiteRegionTests : RegionTests { } [TestFixture(Description = "Region store tests (MySQL)")] - public class MySqlRegionTests : RegionTests + public class MySqlRegionTests : RegionTests { } [TestFixture(Description = "Region store tests (MS SQL Server)")] - public class MSSQLRegionTests : RegionTests + public class MSSQLRegionTests : RegionTests { } @@ -79,11 +79,11 @@ namespace OpenSim.Data.Tests public class RegionTests : BasicDataServiceTest where TConn : DbConnection, new() - where TRegStore : class, IRegionDataStore, new() + where TRegStore : class, ISimulationDataStore, new() { bool m_rebuildDB; - public IRegionDataStore db; + public ISimulationDataStore db; public UUID zero = UUID.Zero; public UUID region1 = UUID.Random(); public UUID region2 = UUID.Random(); @@ -122,7 +122,7 @@ namespace OpenSim.Data.Tests protected override void InitService(object service) { ClearDB(); - db = (IRegionDataStore)service; + db = (ISimulationDataStore)service; db.Initialise(m_connStr); } diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index 8a339fedc9..6f32adfc7f 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs @@ -760,7 +760,7 @@ namespace OpenSim.Framework.Capabilities string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); BakedTextureUploader uploader = - new BakedTextureUploader( capsBase + uploaderPath, + new BakedTextureUploader(capsBase + uploaderPath, m_httpListener); uploader.OnUpLoad += BakedTextureUploaded; diff --git a/OpenSim/Framework/ConfigSettings.cs b/OpenSim/Framework/ConfigSettings.cs index 8feaa372ee..be7734128f 100644 --- a/OpenSim/Framework/ConfigSettings.cs +++ b/OpenSim/Framework/ConfigSettings.cs @@ -124,22 +124,6 @@ namespace OpenSim.Framework set { m_standaloneUserSource = value; } } - protected string m_storageConnectionString; - - public string StorageConnectionString - { - get { return m_storageConnectionString; } - set { m_storageConnectionString = value; } - } - - protected string m_estateConnectionString; - - public string EstateConnectionString - { - get { return m_estateConnectionString; } - set { m_estateConnectionString = value; } - } - protected string m_librariesXMLFile; public string LibrariesXMLFile { diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs index b17dbc08de..52bcd5599b 100644 --- a/OpenSim/Framework/Console/CommandConsole.cs +++ b/OpenSim/Framework/Console/CommandConsole.cs @@ -151,7 +151,7 @@ namespace OpenSim.Framework.Console help.Add(commandInfo.descriptive_help); if (descriptiveHelp != string.Empty) - help.Add(string.Empty); + help.Add(string.Empty); } else { diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs index aab920b09a..22ce88060c 100755 --- a/OpenSim/Framework/Console/ConsoleBase.cs +++ b/OpenSim/Framework/Console/ConsoleBase.cs @@ -89,6 +89,57 @@ namespace OpenSim.Framework.Console return ret; } + + public string CmdPrompt(string p, List excludedCharacters) + { + bool itisdone = false; + string ret = String.Empty; + while (!itisdone) + { + itisdone = true; + ret = CmdPrompt(p); + + foreach (char c in excludedCharacters) + { + if (ret.Contains(c.ToString())) + { + System.Console.WriteLine("The character \"" + c.ToString() + "\" is not permitted."); + itisdone = false; + } + } + } + + return ret; + } + + public string CmdPrompt(string p, string def, List excludedCharacters) + { + bool itisdone = false; + string ret = String.Empty; + while (!itisdone) + { + itisdone = true; + ret = CmdPrompt(p, def); + + if (ret == String.Empty) + { + ret = def; + } + else + { + foreach (char c in excludedCharacters) + { + if (ret.Contains(c.ToString())) + { + System.Console.WriteLine("The character \"" + c.ToString() + "\" is not permitted."); + itisdone = false; + } + } + } + } + + return ret; + } // Displays a command prompt and returns a default value, user may only enter 1 of 2 options public string CmdPrompt(string prompt, string defaultresponse, List options) diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs index a3036d0df6..6043094440 100644 --- a/OpenSim/Framework/Console/LocalConsole.cs +++ b/OpenSim/Framework/Console/LocalConsole.cs @@ -38,7 +38,7 @@ namespace OpenSim.Framework.Console { /// /// A console that uses cursor control and color - /// + /// public class LocalConsole : CommandConsole { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -100,8 +100,8 @@ namespace OpenSim.Framework.Console private int SetCursorTop(int top) { // From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try - // to set a cursor row position with a currently invalid column, mono will throw an exception. - // Therefore, we need to make sure that the column position is valid first. + // to set a cursor row position with a currently invalid column, mono will throw an exception. + // Therefore, we need to make sure that the column position is valid first. int left = System.Console.CursorLeft; if (left < 0) @@ -121,7 +121,7 @@ namespace OpenSim.Framework.Console { top = 0; } - else + else { int bh = System.Console.BufferHeight; @@ -133,7 +133,7 @@ namespace OpenSim.Framework.Console System.Console.CursorTop = top; return top; - } + } /// /// Set the cursor column. @@ -145,12 +145,12 @@ namespace OpenSim.Framework.Console /// /// /// The new cursor column. - /// + /// private int SetCursorLeft(int left) { // From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try - // to set a cursor column position with a currently invalid row, mono will throw an exception. - // Therefore, we need to make sure that the row position is valid first. + // to set a cursor column position with a currently invalid row, mono will throw an exception. + // Therefore, we need to make sure that the row position is valid first. int top = System.Console.CursorTop; if (top < 0) @@ -214,7 +214,7 @@ namespace OpenSim.Framework.Console System.Console.Write("{0}", prompt); SetCursorTop(new_y); - SetCursorLeft(new_x); + SetCursorLeft(new_x); } } @@ -461,7 +461,8 @@ namespace OpenSim.Framework.Console SetCursorLeft(0); y = SetCursorTop(y); - System.Console.WriteLine("{0}{1}", prompt, cmdline); + System.Console.WriteLine(); + //Show(); lock (cmdline) { @@ -486,7 +487,7 @@ namespace OpenSim.Framework.Console } } - AddToHistory(cmdline.ToString()); + //AddToHistory(cmdline.ToString()); return cmdline.ToString(); default: break; diff --git a/OpenSim/Framework/Console/MockConsole.cs b/OpenSim/Framework/Console/MockConsole.cs index 9eb197750d..a29b370857 100644 --- a/OpenSim/Framework/Console/MockConsole.cs +++ b/OpenSim/Framework/Console/MockConsole.cs @@ -1,4 +1,31 @@ -using System; +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; using System.Threading; using System.Collections.Generic; using System.Text; diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index 5bb0413929..3fb2fd6535 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs @@ -89,13 +89,13 @@ namespace OpenSim.Framework private Vector3 _userLocation = new Vector3(); private Vector3 _userLookAt = new Vector3(); private int _otherCleanTime = 0; - private string _mediaType = "none/none"; - private string _mediaDescription = ""; - private int _mediaHeight = 0; - private int _mediaWidth = 0; - private bool _mediaLoop = false; - private bool _obscureMusic = false; - private bool _obscureMedia = false; + private string _mediaType = "none/none"; + private string _mediaDescription = ""; + private int _mediaHeight = 0; + private int _mediaWidth = 0; + private bool _mediaLoop = false; + private bool _obscureMusic = false; + private bool _obscureMedia = false; /// /// Whether to obscure parcel media URL @@ -690,13 +690,13 @@ namespace OpenSim.Framework landData._userLocation = _userLocation; landData._userLookAt = _userLookAt; landData._otherCleanTime = _otherCleanTime; - landData._mediaType = _mediaType; - landData._mediaDescription = _mediaDescription; - landData._mediaWidth = _mediaWidth; - landData._mediaHeight = _mediaHeight; - landData._mediaLoop = _mediaLoop; - landData._obscureMusic = _obscureMusic; - landData._obscureMedia = _obscureMedia; + landData._mediaType = _mediaType; + landData._mediaDescription = _mediaDescription; + landData._mediaWidth = _mediaWidth; + landData._mediaHeight = _mediaHeight; + landData._mediaLoop = _mediaLoop; + landData._obscureMusic = _obscureMusic; + landData._obscureMedia = _obscureMedia; landData._parcelAccessList.Clear(); foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList) diff --git a/OpenSim/Framework/LandUpdateArgs.cs b/OpenSim/Framework/LandUpdateArgs.cs index ed496a1455..7d6c4f2dab 100644 --- a/OpenSim/Framework/LandUpdateArgs.cs +++ b/OpenSim/Framework/LandUpdateArgs.cs @@ -49,12 +49,12 @@ namespace OpenSim.Framework public UUID SnapshotID; public Vector3 UserLocation; public Vector3 UserLookAt; - public string MediaType; - public string MediaDescription; - public int MediaHeight; - public int MediaWidth; - public bool MediaLoop; - public bool ObscureMusic; - public bool ObscureMedia; + public string MediaType; + public string MediaDescription; + public int MediaHeight; + public int MediaWidth; + public bool MediaLoop; + public bool ObscureMusic; + public bool ObscureMedia; } } diff --git a/OpenSim/Framework/Lazy.cs b/OpenSim/Framework/Lazy.cs index 8a417ac64b..91de4bdd1d 100644 --- a/OpenSim/Framework/Lazy.cs +++ b/OpenSim/Framework/Lazy.cs @@ -1,4 +1,4 @@ -// +// // Lazy.cs // // Authors: diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index a4587d8046..f07ab7c8a8 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -175,7 +175,7 @@ namespace OpenSim.Framework } } } - + /// /// Entries to store media textures on each face /// @@ -1216,28 +1216,28 @@ namespace OpenSim.Framework prim.Properties.Permissions = new Permissions(); prim.Properties.SalePrice = 10; prim.Properties.SaleType = new SaleType(); - + return prim; } - + /// /// Encapsulates a list of media entries. /// - /// This class is necessary because we want to replace auto-serialization of MediaEntry with something more + /// This class is necessary because we want to replace auto-serialization of MediaEntry with something more /// OSD like and less vulnerable to change. public class MediaList : List, IXmlSerializable - { + { public const string MEDIA_TEXTURE_TYPE = "sl"; - + public MediaList() : base() {} public MediaList(IEnumerable collection) : base(collection) {} public MediaList(int capacity) : base(capacity) {} - + public XmlSchema GetSchema() { return null; } - + public string ToXml() { lock (this) @@ -1245,78 +1245,78 @@ namespace OpenSim.Framework using (StringWriter sw = new StringWriter()) { using (XmlTextWriter xtw = new XmlTextWriter(sw)) - { + { xtw.WriteStartElement("OSMedia"); xtw.WriteAttributeString("type", MEDIA_TEXTURE_TYPE); xtw.WriteAttributeString("version", "0.1"); - + OSDArray meArray = new OSDArray(); foreach (MediaEntry me in this) { OSD osd = (null == me ? new OSD() : me.GetOSD()); meArray.Add(osd); - } - + } + xtw.WriteStartElement("OSData"); xtw.WriteRaw(OSDParser.SerializeLLSDXmlString(meArray)); xtw.WriteEndElement(); - + xtw.WriteEndElement(); - - xtw.Flush(); + + xtw.Flush(); return sw.ToString(); } - } - } + } + } } - + public void WriteXml(XmlWriter writer) - { + { writer.WriteRaw(ToXml()); } - + public static MediaList FromXml(string rawXml) { MediaList ml = new MediaList(); ml.ReadXml(rawXml); return ml; } - + public void ReadXml(string rawXml) - { + { using (StringReader sr = new StringReader(rawXml)) { using (XmlTextReader xtr = new XmlTextReader(sr)) - { + { xtr.MoveToContent(); - + string type = xtr.GetAttribute("type"); //m_log.DebugFormat("[MOAP]: Loaded media texture entry with type {0}", type); - + if (type != MEDIA_TEXTURE_TYPE) - return; - - xtr.ReadStartElement("OSMedia"); - + return; + + xtr.ReadStartElement("OSMedia"); + OSDArray osdMeArray = (OSDArray)OSDParser.DeserializeLLSDXml(xtr.ReadInnerXml()); foreach (OSD osdMe in osdMeArray) { MediaEntry me = (osdMe is OSDMap ? MediaEntry.FromOSD(osdMe) : new MediaEntry()); Add(me); } - - xtr.ReadEndElement(); + + xtr.ReadEndElement(); } } - } - + } + public void ReadXml(XmlReader reader) { if (reader.IsEmptyElement) return; - + ReadXml(reader.ReadInnerXml()); - } + } } - } -} \ No newline at end of file + } +} diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index e36a72bf5b..a006f3e031 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -98,9 +98,9 @@ namespace OpenSim.Framework [Serializable] public class SimpleRegionInfo - { + { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + /// /// The port by which http communication occurs with the region (most noticeably, CAPS communication) /// @@ -345,7 +345,7 @@ namespace OpenSim.Framework public string proxyUrl = ""; public int ProxyOffset = 0; public string regionSecret = UUID.Random().ToString(); - + public string osSecret; public UUID lastMapUUID = UUID.Zero; @@ -700,7 +700,7 @@ namespace OpenSim.Framework RegionID = new UUID(regionUUID); originRegionID = RegionID; // What IS this?! - + RegionName = name; string location = config.GetString("Location", String.Empty); @@ -721,7 +721,7 @@ namespace OpenSim.Framework // Internal IP IPAddress address; - + if (config.Contains("InternalAddress")) { address = IPAddress.Parse(config.GetString("InternalAddress", String.Empty)); @@ -775,7 +775,7 @@ namespace OpenSim.Framework { m_externalHostName = Util.GetLocalHost().ToString(); m_log.InfoFormat( - "[REGIONINFO]: Resolving SYSTEMIP to {0} for external hostname of region {1}", + "[REGIONINFO]: Resolving SYSTEMIP to {0} for external hostname of region {1}", m_externalHostName, name); } else @@ -910,16 +910,16 @@ namespace OpenSim.Framework configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Maximum size for nonphysical prims", m_nonphysPrimMax.ToString(), true); - + configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Maximum size for physical prims", m_physPrimMax.ToString(), true); - + configMember.addConfigurationOption("clamp_prim_size", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, "Clamp prims to max size", m_clampPrimSize.ToString(), true); - + configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Max objects this sim will hold", m_objectCapacity.ToString(), true); - + configMember.addConfigurationOption("scope_id", ConfigurationOption.ConfigurationTypes.TYPE_UUID, "Scope ID for this region", ScopeID.ToString(), true); @@ -957,16 +957,16 @@ namespace OpenSim.Framework configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true); - + configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Maximum size for nonphysical prims", "0", true); - + configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Maximum size for physical prims", "0", true); - + configMember.addConfigurationOption("clamp_prim_size", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, "Clamp prims to max size", "false", true); - + configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Max objects this sim will hold", "0", true); diff --git a/OpenSim/Framework/SLUtil.cs b/OpenSim/Framework/SLUtil.cs index a4898061da..9941a7f147 100644 --- a/OpenSim/Framework/SLUtil.cs +++ b/OpenSim/Framework/SLUtil.cs @@ -46,7 +46,7 @@ namespace OpenSim.Framework case AssetType.Texture: return "image/x-j2c"; case AssetType.Sound: - return "application/ogg"; + return "audio/ogg"; case AssetType.CallingCard: return "application/vnd.ll.callingcard"; case AssetType.Landmark: @@ -98,8 +98,6 @@ namespace OpenSim.Framework return "application/vnd.ll.outfitfolder"; case AssetType.MyOutfitsFolder: return "application/vnd.ll.myoutfitsfolder"; - case AssetType.InboxFolder: - return "application/vnd.ll.inboxfolder"; case AssetType.Unknown: default: return "application/octet-stream"; @@ -128,7 +126,7 @@ namespace OpenSim.Framework case InventoryType.Object: return "application/vnd.ll.primitive"; case InventoryType.Sound: - return "application/ogg"; + return "audio/ogg"; case InventoryType.Snapshot: case InventoryType.Texture: return "image/x-j2c"; @@ -147,6 +145,7 @@ namespace OpenSim.Framework case "image/jp2": return (sbyte)AssetType.Texture; case "application/ogg": + case "audio/ogg": return (sbyte)AssetType.Sound; case "application/vnd.ll.callingcard": case "application/x-metaverse-callingcard": @@ -209,8 +208,6 @@ namespace OpenSim.Framework return (sbyte)AssetType.OutfitFolder; case "application/vnd.ll.myoutfitsfolder": return (sbyte)AssetType.MyOutfitsFolder; - case "application/vnd.ll.inboxfolder": - return (sbyte)AssetType.InboxFolder; case "application/octet-stream": default: return (sbyte)AssetType.Unknown; @@ -227,6 +224,7 @@ namespace OpenSim.Framework case "image/jpeg": return (sbyte)InventoryType.Texture; case "application/ogg": + case "audio/ogg": case "audio/x-wav": return (sbyte)InventoryType.Sound; case "application/vnd.ll.callingcard": diff --git a/OpenSim/Framework/Serialization/ArchiveConstants.cs b/OpenSim/Framework/Serialization/ArchiveConstants.cs index 3143e3bec7..7a9b33dc8c 100644 --- a/OpenSim/Framework/Serialization/ArchiveConstants.cs +++ b/OpenSim/Framework/Serialization/ArchiveConstants.cs @@ -157,9 +157,9 @@ namespace OpenSim.Framework.Serialization public static string CreateOarObjectFilename(string objectName, UUID uuid, Vector3 pos) { return string.Format( - OAR_OBJECT_FILENAME_TEMPLATE, objectName, + OAR_OBJECT_FILENAME_TEMPLATE, objectName, Math.Round(pos.X), Math.Round(pos.Y), Math.Round(pos.Z), - uuid); + uuid); } /// @@ -171,9 +171,9 @@ namespace OpenSim.Framework.Serialization /// public static string CreateOarObjectPath(string objectName, UUID uuid, Vector3 pos) { - return OBJECTS_PATH + CreateOarObjectFilename(objectName, uuid, pos); - } - + return OBJECTS_PATH + CreateOarObjectFilename(objectName, uuid, pos); + } + /// /// Extract a plain path from an IAR path /// @@ -184,18 +184,18 @@ namespace OpenSim.Framework.Serialization List plainDirs = new List(); string[] iarDirs = iarPath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); - + foreach (string iarDir in iarDirs) { if (!iarDir.Contains(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR)) plainDirs.Add(iarDir); - + int i = iarDir.LastIndexOf(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR); plainDirs.Add(iarDir.Remove(i)); } - - return string.Join("/", plainDirs.ToArray()); + + return string.Join("/", plainDirs.ToArray()); } } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index d20f8c9b25..452df38d31 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -51,7 +51,7 @@ namespace OpenSim.Framework.Servers.HttpServer { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private HttpServerLogWriter httpserverlog = new HttpServerLogWriter(); - + private volatile int NotSocketErrors = 0; public volatile bool HTTPDRunning = false; @@ -160,7 +160,7 @@ namespace OpenSim.Framework.Servers.HttpServer m_rpcHandlers[method] = handler; m_rpcHandlersKeepAlive[method] = keepAlive; // default } - + return true; } @@ -182,7 +182,7 @@ namespace OpenSim.Framework.Servers.HttpServer public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler) { //m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName); - + lock (m_HTTPHandlers) { if (!m_HTTPHandlers.ContainsKey(methodName)) @@ -204,14 +204,14 @@ namespace OpenSim.Framework.Servers.HttpServer if (!m_pollHandlers.ContainsKey(methodName)) { m_pollHandlers.Add(methodName,args); - pollHandlerResult = true; + pollHandlerResult = true; } } - + if (pollHandlerResult) return AddHTTPHandler(methodName, handler); - return false; + return false; } // Note that the agent string is provided simply to differentiate @@ -257,51 +257,51 @@ namespace OpenSim.Framework.Servers.HttpServer { IHttpClientContext context = (IHttpClientContext)source; IHttpRequest request = args.Request; - + PollServiceEventArgs psEvArgs; - + if (TryGetPollServiceHTTPHandler(request.UriPath.ToString(), out psEvArgs)) { PollServiceHttpRequest psreq = new PollServiceHttpRequest(psEvArgs, context, request); - + if (psEvArgs.Request != null) { OSHttpRequest req = new OSHttpRequest(context, request); - + Stream requestStream = req.InputStream; - + Encoding encoding = Encoding.UTF8; StreamReader reader = new StreamReader(requestStream, encoding); - + string requestBody = reader.ReadToEnd(); - + Hashtable keysvals = new Hashtable(); Hashtable headervals = new Hashtable(); - + string[] querystringkeys = req.QueryString.AllKeys; string[] rHeaders = req.Headers.AllKeys; - + keysvals.Add("body", requestBody); keysvals.Add("uri", req.RawUrl); keysvals.Add("content-type", req.ContentType); keysvals.Add("http-method", req.HttpMethod); - + foreach (string queryname in querystringkeys) { keysvals.Add(queryname, req.QueryString[queryname]); } - + foreach (string headername in rHeaders) { headervals[headername] = req.Headers[headername]; } - + keysvals.Add("headers", headervals); keysvals.Add("querystringkeys", querystringkeys); - + psEvArgs.Request(psreq.RequestID, keysvals); } - + m_PollServiceManager.Enqueue(psreq); } else @@ -348,10 +348,10 @@ namespace OpenSim.Framework.Servers.HttpServer { try { -// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); - +// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); + Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); - + // This is the REST agent interface. We require an agent to properly identify // itself. If the REST handler recognizes the prefix it will attempt to // satisfy the request. If it is not recognizable, and no damage has occurred @@ -456,7 +456,7 @@ namespace OpenSim.Framework.Servers.HttpServer } request.InputStream.Close(); - + // HTTP IN support. The script engine taes it from here // Nothing to worry about for us. // @@ -540,7 +540,7 @@ namespace OpenSim.Framework.Servers.HttpServer HandleLLSDRequests(request, response); return; } - + // m_log.DebugFormat("[BASE HTTP SERVER]: Checking for HTTP Handler for request {0}", request.RawUrl); if (DoWeHaveAHTTPHandler(request.RawUrl)) { @@ -594,7 +594,7 @@ namespace OpenSim.Framework.Servers.HttpServer } } } - + if (String.IsNullOrEmpty(bestMatch)) { streamHandler = null; @@ -641,7 +641,7 @@ namespace OpenSim.Framework.Servers.HttpServer private bool TryGetHTTPHandler(string handlerKey, out GenericHTTPMethod HTTPHandler) { // m_log.DebugFormat("[BASE HTTP HANDLER]: Looking for HTTP handler for {0}", handlerKey); - + string bestMatch = null; lock (m_HTTPHandlers) @@ -727,14 +727,14 @@ namespace OpenSim.Framework.Servers.HttpServer { xmlRprcRequest.Params.Add(request.RemoteIPEndPoint); // Param[1] XmlRpcResponse xmlRpcResponse; - + XmlRpcMethod method; bool methodWasFound; lock (m_rpcHandlers) { methodWasFound = m_rpcHandlers.TryGetValue(methodName, out method); } - + if (methodWasFound) { xmlRprcRequest.Params.Add(request.Url); // Param[2] @@ -766,10 +766,10 @@ namespace OpenSim.Framework.Servers.HttpServer else { xmlRpcResponse = new XmlRpcResponse(); - + // Code set in accordance with http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php xmlRpcResponse.SetFault( - XmlRpcErrorCodes.SERVER_ERROR_METHOD, + XmlRpcErrorCodes.SERVER_ERROR_METHOD, String.Format("Requested method [{0}] not found", methodName)); } @@ -786,11 +786,11 @@ namespace OpenSim.Framework.Servers.HttpServer response.KeepAlive = false; m_log.ErrorFormat("[BASE HTTP SERVER]: Handler not found for http request {0}", request.RawUrl); - + response.SendChunked = false; response.ContentLength64 = buf.Length; response.ContentEncoding = Encoding.UTF8; - + try { response.OutputStream.Write(buf, 0, buf.Length); @@ -872,13 +872,13 @@ namespace OpenSim.Framework.Servers.HttpServer OSD llsdRequest = null; OSD llsdResponse = null; - + bool LegacyLLSDLoginLibOMV = (requestBody.Contains("passwd") && requestBody.Contains("mac") && requestBody.Contains("viewer_digest")); - + if (requestBody.Length == 0) // Get Request { - requestBody = "requestget"; + requestBody = "requestget"; } try { @@ -1090,7 +1090,7 @@ namespace OpenSim.Framework.Servers.HttpServer string bestMatch = null; //m_log.DebugFormat("[BASE HTTP HANDLER]: Checking if we have an HTTP handler for {0}", searchquery); - + lock (m_HTTPHandlers) { foreach (string pattern in m_HTTPHandlers.Keys) @@ -1156,7 +1156,7 @@ namespace OpenSim.Framework.Servers.HttpServer // You have to specifically register for '/' and to get it, you must specificaly request it // if (pattern == "/" && searchquery == "/" || pattern != "/") - bestMatch = pattern; + bestMatch = pattern; } } } @@ -1236,11 +1236,11 @@ namespace OpenSim.Framework.Servers.HttpServer } public void HandleHTTPRequest(OSHttpRequest request, OSHttpResponse response) - { + { // m_log.DebugFormat( -// "[BASE HTTP SERVER]: HandleHTTPRequest for request to {0}, method {1}", +// "[BASE HTTP SERVER]: HandleHTTPRequest for request to {0}, method {1}", // request.RawUrl, request.HttpMethod); - + switch (request.HttpMethod) { case "OPTIONS": @@ -1256,7 +1256,7 @@ namespace OpenSim.Framework.Servers.HttpServer private void HandleContentVerbs(OSHttpRequest request, OSHttpResponse response) { // m_log.DebugFormat("[BASE HTTP SERVER]: HandleContentVerbs for request to {0}", request.RawUrl); - + // This is a test. There's a workable alternative.. as this way sucks. // We'd like to put this into a text file parhaps that's easily editable. // @@ -1391,7 +1391,7 @@ namespace OpenSim.Framework.Servers.HttpServer // m_log.DebugFormat( // "[BASE HTTP HANDLER]: TryGetHTTPHandlerPathBased() looking for HTTP handler to match {0}", searchquery); - + lock (m_HTTPHandlers) { foreach (string pattern in m_HTTPHandlers.Keys) @@ -1452,7 +1452,7 @@ namespace OpenSim.Framework.Servers.HttpServer //Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this //and should check for NullReferenceExceptions - + if (string.IsNullOrEmpty(contentType)) { contentType = "text/html"; @@ -1472,8 +1472,8 @@ namespace OpenSim.Framework.Servers.HttpServer byte[] buffer; - if (!(contentType.Contains("image") - || contentType.Contains("x-shockwave-flash") + if (!(contentType.Contains("image") + || contentType.Contains("x-shockwave-flash") || contentType.Contains("application/x-oar"))) { // Text @@ -1504,7 +1504,7 @@ namespace OpenSim.Framework.Servers.HttpServer { response.OutputStream.Flush(); response.Send(); - + //if (!response.KeepAlive && response.ReuseContext) // response.FreeContext(); } @@ -1611,11 +1611,11 @@ namespace OpenSim.Framework.Servers.HttpServer m_httpListener2 = CoolHTTPListener.Create(m_listenIPAddress, (int)m_port); m_httpListener2.ExceptionThrown += httpServerException; m_httpListener2.LogWriter = httpserverlog; - - // Uncomment this line in addition to those in HttpServerLogWriter + + // Uncomment this line in addition to those in HttpServerLogWriter // if you want more detailed trace information from the HttpServer //m_httpListener2.UseTraceLogs = true; - + //m_httpListener2.DisconnectHandler = httpServerDisconnectMonitor; } else @@ -1643,8 +1643,8 @@ namespace OpenSim.Framework.Servers.HttpServer { m_log.Error("[BASE HTTP SERVER]: Error - " + e.Message); m_log.Error("[BASE HTTP SERVER]: Tip: Do you have permission to listen on port " + m_port + ", " + m_sslport + "?"); - - // We want this exception to halt the entire server since in current configurations we aren't too + + // We want this exception to halt the entire server since in current configurations we aren't too // useful without inbound HTTP. throw e; } @@ -1656,7 +1656,7 @@ namespace OpenSim.Framework.Servers.HttpServer { case SocketError.NotSocket: NotSocketErrors++; - + break; } } @@ -1686,12 +1686,11 @@ namespace OpenSim.Framework.Servers.HttpServer m_httpListener2.LogWriter = null; m_httpListener2.RequestReceived -= OnRequest; m_httpListener2.Stop(); - } + } catch (NullReferenceException) { m_log.Warn("[BASE HTTP SERVER]: Null Reference when stopping HttpServer."); } - } public void RemoveStreamHandler(string httpMethod, string path) @@ -1712,7 +1711,7 @@ namespace OpenSim.Framework.Servers.HttpServer m_HTTPHandlers.Remove(path); return; } - + m_HTTPHandlers.Remove(GetHandlerKey(httpMethod, path)); } } @@ -1728,7 +1727,6 @@ namespace OpenSim.Framework.Servers.HttpServer } RemoveHTTPHandler(httpMethod, path); - } public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler) @@ -1759,7 +1757,6 @@ namespace OpenSim.Framework.Servers.HttpServer } } - public bool RemoveLLSDHandler(string path, LLSDMethod handler) { try @@ -1833,7 +1830,7 @@ namespace OpenSim.Framework.Servers.HttpServer oresp = osresp; } } - + /// /// Relays HttpServer log messages to our own logging mechanism. /// @@ -1852,7 +1849,7 @@ namespace OpenSim.Framework.Servers.HttpServer { case LogPrio.Trace: m_log.DebugFormat("[{0}]: {1}", source, message); - break; + break; case LogPrio.Debug: m_log.DebugFormat("[{0}]: {1}", source, message); break; @@ -1872,8 +1869,8 @@ namespace OpenSim.Framework.Servers.HttpServer break; } */ - + return; } } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index f3ac1914a0..4ae370b1ef 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -49,7 +49,7 @@ namespace OpenSim public static string GetVersionString(string versionNumber, Flavour flavour) { - string versionString = "OpenSim " + versionNumber + " (" + flavour + ")"; + string versionString = "OpenSim " + versionNumber + " " + flavour; return versionString.PadRight(VERSIONINFO_VERSION_LENGTH); } diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index 2cb78957f5..df5b936126 100644 --- a/OpenSim/Framework/TaskInventoryItem.cs +++ b/OpenSim/Framework/TaskInventoryItem.cs @@ -348,15 +348,15 @@ namespace OpenSim.Framework /// The new part ID to which this item belongs public void ResetIDs(UUID partID) { - _oldID = _itemID; - _itemID = UUID.Random(); - _parentPartID = partID; - _parentID = partID; + OldItemID = ItemID; + ItemID = UUID.Random(); + ParentPartID = partID; + ParentID = partID; } public TaskInventoryItem() { - _creationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; + CreationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; } } } diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index b860cf6bc0..d120f03dc9 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs @@ -225,7 +225,7 @@ namespace OpenSim } } MainConsole.Instance = null; - } + } */ configSource.Alias.AddAlias("On", true); configSource.Alias.AddAlias("Off", false); diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs index e69e3fc9d9..e2e06409c1 100644 --- a/OpenSim/Region/Application/ConfigurationLoader.cs +++ b/OpenSim/Region/Application/ConfigurationLoader.cs @@ -345,10 +345,6 @@ namespace OpenSim m_configSettings.StorageDll = startupConfig.GetString("storage_plugin"); - m_configSettings.StorageConnectionString - = startupConfig.GetString("storage_connection_string"); - m_configSettings.EstateConnectionString - = startupConfig.GetString("estate_connection_string", m_configSettings.StorageConnectionString); m_configSettings.ClientstackDll = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll"); } diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 945da7de05..6094bade19 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -152,7 +152,7 @@ namespace OpenSim RegisterConsoleCommands(); base.StartupSpecific(); - + MainServer.Instance.AddStreamHandler(new OpenSim.SimStatusHandler()); MainServer.Instance.AddStreamHandler(new OpenSim.XSimStatusHandler(this)); if (userStatsURI != String.Empty) @@ -192,7 +192,7 @@ namespace OpenSim // Hook up to the watchdog timer Watchdog.OnWatchdogTimeout += WatchdogTimeoutHandler; - PrintFileToConsole("startuplogo.txt"); + PrintFileToConsole("startuplogo.txt"); // For now, start at the 'root' level by default if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it @@ -218,8 +218,8 @@ namespace OpenSim m_console.Commands.AddCommand("region", false, "debug packet", "debug packet ", - "Turn on packet debugging", - "If level > 255 then all incoming and outgoing packets are logged.\n" + "Turn on packet debugging", + "If level > 255 then all incoming and outgoing packets are logged.\n" + "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n" + "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n" + "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n" @@ -316,7 +316,7 @@ namespace OpenSim m_console.Commands.AddCommand("region", false, "create region", "create region [\"region name\"] ", "Create a new region.", - "The settings for \"region name\" are read from ." + "The settings for \"region name\" are read from in your Regions directory." + " If \"region name\" does not exist in , it will be added." + Environment.NewLine + "Without \"region name\", the first region found in will be created." + Environment.NewLine + "If does not exist, it will be created.", @@ -552,19 +552,20 @@ namespace OpenSim regionFile = Path.Combine(regionsDir, regionFile); } - RegionInfo regInfo; + RegionInfo regInfo; if (isXml) { - regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source); + regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source); } else { - regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName); + regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName); } + IScene scene; - PopulateRegionEstateInfo(regInfo); - CreateRegion(regInfo, true, out scene); - regInfo.EstateSettings.Save(); + PopulateRegionEstateInfo(regInfo); + CreateRegion(regInfo, true, out scene); + regInfo.EstateSettings.Save(); } /// @@ -942,7 +943,7 @@ namespace OpenSim delegate(Scene scene) { MainConsole.Instance.Output(String.Format( - "Region Name: {0}, Region XLoc: {1}, Region YLoc: {2}, Region Port: {3}", + "Region Name: {0}, Region XLoc: {1}, Region YLoc: {2}, Region Port: {3}", scene.RegionInfo.RegionName, scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY, diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index ec3193cb7c..c5ee385af5 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -45,6 +45,7 @@ using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Physics.Manager; +using OpenSim.Server.Base; namespace OpenSim { @@ -195,6 +196,24 @@ namespace OpenSim m_permsModules = new List(permissionModules.Split(',')); } + // Load the simulation data service + IConfig simDataConfig = m_config.Source.Configs["SimulationDataStore"]; + if (simDataConfig == null) + throw new Exception("Configuration file is missing the [SimulationDataStore] section"); + string module = simDataConfig.GetString("LocalServiceModule", String.Empty); + if (String.IsNullOrEmpty(module)) + throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [SimulationDataStore] section"); + m_simulationDataService = ServerUtils.LoadPlugin(module, new object[] { m_config.Source }); + + // Load the estate data service + IConfig estateDataConfig = m_config.Source.Configs["EstateDataStore"]; + if (estateDataConfig == null) + throw new Exception("Configuration file is missing the [EstateDataStore] section"); + module = estateDataConfig.GetString("LocalServiceModule", String.Empty); + if (String.IsNullOrEmpty(module)) + throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] section"); + m_estateDataService = ServerUtils.LoadPlugin(module, new object[] { m_config.Source }); + base.StartupSpecific(); m_stats = StatsManager.StartCollectingSimExtraStats(); @@ -612,7 +631,7 @@ namespace OpenSim regionInfo.InternalEndPoint.Port = (int) port; - Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager); + Scene scene = CreateScene(regionInfo, m_simulationDataService, m_estateDataService, circuitManager); if (m_autoCreateClientStack) { @@ -628,30 +647,19 @@ namespace OpenSim return scene; } - protected override StorageManager CreateStorageManager() - { - return - CreateStorageManager(m_configSettings.StorageConnectionString, m_configSettings.EstateConnectionString); - } - - protected StorageManager CreateStorageManager(string connectionstring, string estateconnectionstring) - { - return new StorageManager(m_configSettings.StorageDll, connectionstring, estateconnectionstring); - } - protected override ClientStackManager CreateClientStackManager() { return new ClientStackManager(m_configSettings.ClientstackDll); } - protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, - AgentCircuitManager circuitManager) + protected override Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, + IEstateDataService estateDataService, AgentCircuitManager circuitManager) { SceneCommunicationService sceneGridService = new SceneCommunicationService(); return new Scene( regionInfo, circuitManager, sceneGridService, - storageManager, m_moduleLoader, false, m_configSettings.PhysicalPrim, + simDataService, estateDataService, m_moduleLoader, false, m_configSettings.PhysicalPrim, m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version); } @@ -868,21 +876,23 @@ namespace OpenSim /// public void PopulateRegionEstateInfo(RegionInfo regInfo) { - if (m_storageManager.EstateDataStore != null) + IEstateDataService estateDataService = EstateDataService; + + if (estateDataService != null) { - regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(regInfo.RegionID, false); + regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, false); } - + if (regInfo.EstateSettings.EstateID == 0) // No record at all { MainConsole.Instance.Output("Your region is not part of an estate."); while (true) { - string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List() {"yes", "no"}); + string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List() { "yes", "no" }); if (response == "no") { // Create a new estate - regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(regInfo.RegionID, true); + regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, true); regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); //regInfo.EstateSettings.Save(); @@ -894,7 +904,7 @@ namespace OpenSim if (response == "None") continue; - List estateIDs = m_storageManager.EstateDataStore.GetEstates(response); + List estateIDs = estateDataService.GetEstates(response); if (estateIDs.Count < 1) { MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again"); @@ -903,9 +913,9 @@ namespace OpenSim int estateID = estateIDs[0]; - regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(estateID); + regInfo.EstateSettings = estateDataService.LoadEstateSettings(estateID); - if (m_storageManager.EstateDataStore.LinkRegion(regInfo.RegionID, estateID)) + if (estateDataService.LinkRegion(regInfo.RegionID, estateID)) break; MainConsole.Instance.Output("Joining the estate failed. Please try again."); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 8a96389de5..0e17496992 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -63,7 +63,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Debug packet level. See OpenSim.RegisterConsoleCommands() for more details. /// protected int m_debugPacketLevel = 0; - + #region Events public event GenericMessage OnGenericMessage; @@ -288,7 +288,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event MuteListEntryRemove OnRemoveMuteListEntry; public event GodlikeMessage onGodlikeMessage; public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; - #endregion Events @@ -330,12 +329,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// ownerless phantom. /// /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock - /// + /// /// protected HashSet m_killRecord; - -// protected HashSet m_attachmentsSent; - + +// protected HashSet m_attachmentsSent; + private int m_moneyBalance; private bool m_deliverPackets = true; private int m_animationSequenceNumber = 1; @@ -395,22 +394,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP public string ActiveGroupName { get { return m_activeGroupName; } } public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } } public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); } - + /// /// First name of the agent/avatar represented by the client /// public string FirstName { get { return m_firstName; } } - + /// /// Last name of the agent/avatar represented by the client /// public string LastName { get { return m_lastName; } } - + /// /// Full name of the client (first name and last name) /// public string Name { get { return FirstName + " " + LastName; } } - + public uint CircuitCode { get { return m_circuitCode; } } public int MoneyBalance { get { return m_moneyBalance; } } public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } } @@ -453,7 +452,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); m_fullUpdateDataBlocksBuilder = new List(); m_killRecord = new HashSet(); -// m_attachmentsSent = new HashSet(); +// m_attachmentsSent = new HashSet(); m_assetService = m_scene.RequestModuleInterface(); m_GroupsModule = scene.RequestModuleInterface(); @@ -679,7 +678,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Make sure that we see any exception caused by the asynchronous operation. m_log.Error( string.Format("[LLCLIENTVIEW]: Caught exception while processing {0}", packetObject.Pack), e); - } + } } #endregion Packet Handling @@ -890,7 +889,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP foreach (GroupActiveProposals Proposal in Proposals) { GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket(); - + GAPIRP.AgentData.AgentID = AgentId; GAPIRP.AgentData.GroupID = groupID; GAPIRP.TransactionData.TransactionID = transactionID; @@ -914,7 +913,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (Proposals.Length == 0) { GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket(); - + GAPIRP.AgentData.AgentID = AgentId; GAPIRP.AgentData.GroupID = groupID; GAPIRP.TransactionData.TransactionID = transactionID; @@ -969,7 +968,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (Votes.Length == 0) { GroupVoteHistoryItemReplyPacket GVHIRP = new GroupVoteHistoryItemReplyPacket(); - + GVHIRP.AgentData.AgentID = AgentId; GVHIRP.AgentData.GroupID = groupID; GVHIRP.TransactionData.TransactionID = transactionID; @@ -993,7 +992,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(GVHIRP, ThrottleOutPacketType.Task); } } - + public void SendGroupAccountingDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt) { GroupAccountDetailsReplyPacket GADRP = new GroupAccountDetailsReplyPacket(); @@ -1012,13 +1011,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP GADRP.HistoryData[0] = History; OutPacket(GADRP, ThrottleOutPacketType.Task); } - + public void SendGroupAccountingSummary(IClientAPI sender,UUID groupID, uint moneyAmt, int totalTier, int usedTier) { GroupAccountSummaryReplyPacket GASRP = (GroupAccountSummaryReplyPacket)PacketPool.Instance.GetPacket( PacketType.GroupAccountSummaryReply); - + GASRP.AgentData = new GroupAccountSummaryReplyPacket.AgentDataBlock(); GASRP.AgentData.AgentID = sender.AgentId; GASRP.AgentData.GroupID = groupID; @@ -1045,13 +1044,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP GASRP.MoneyData.LightTaxEstimate = 0; OutPacket(GASRP, ThrottleOutPacketType.Task); } - + public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt) { GroupAccountTransactionsReplyPacket GATRP = (GroupAccountTransactionsReplyPacket)PacketPool.Instance.GetPacket( PacketType.GroupAccountTransactionsReply); - + GATRP.AgentData = new GroupAccountTransactionsReplyPacket.AgentDataBlock(); GATRP.AgentData.AgentID = sender.AgentId; GATRP.AgentData.GroupID = groupID; @@ -1520,7 +1519,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendKillObject(ulong regionHandle, uint localID) { // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle); - + KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); // TODO: don't create new blocks if recycling an old packet kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; @@ -3488,9 +3487,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence); OutPacket(objupdate, ThrottleOutPacketType.Task); - + // We need to record the avatar local id since the root prim of an attachment points to this. -// m_attachmentsSent.Add(avatar.LocalId); +// m_attachmentsSent.Add(avatar.LocalId); } public void SendCoarseLocationUpdate(List users, List CoarseLocations) @@ -3538,7 +3537,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Primitive Packet/Data Sending Methods /// - /// Generate one of the object update packets based on PrimUpdateFlags + /// Generate one of the object update packets based on PrimUpdateFlags /// and broadcast the packet to clients /// public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) @@ -3555,14 +3554,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP double priority = m_prioritizer.GetUpdatePriority(this, entity); lock (m_entityUpdates.SyncRoot) - m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags), entity.LocalId); + m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags), entity.LocalId); } private void ProcessEntityUpdates(int maxUpdates) { - Lazy> objectUpdateBlocks = new Lazy>(); - Lazy> compressedUpdateBlocks = new Lazy>(); - Lazy> terseUpdateBlocks = new Lazy>(); + OpenSim.Framework.Lazy> objectUpdateBlocks = new OpenSim.Framework.Lazy>(); + OpenSim.Framework.Lazy> compressedUpdateBlocks = new OpenSim.Framework.Lazy>(); + OpenSim.Framework.Lazy> terseUpdateBlocks = new OpenSim.Framework.Lazy>(); if (maxUpdates <= 0) maxUpdates = Int32.MaxValue; int updatesThisCall = 0; @@ -3660,28 +3659,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP // string text = sop.Text; // if (text.IndexOf("\n") >= 0) // text = text.Remove(text.IndexOf("\n")); -// +// // if (m_attachmentsSent.Contains(sop.ParentID)) // { //// m_log.DebugFormat( //// "[CLIENT]: Sending full info about attached prim {0} text {1}", //// sop.LocalId, text); -// +// // objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock(sop, this.m_agentId)); -// +// // m_attachmentsSent.Add(sop.LocalId); // } // else // { // m_log.DebugFormat( -// "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet", +// "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet", // sop.LocalId, text, sop.ParentID); -// -// m_entityUpdates.Enqueue(double.MaxValue, update, sop.LocalId); +// +// m_entityUpdates.Enqueue(double.MaxValue, update, sop.LocalId); // } // } // else -// { +// { objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); // } } @@ -3995,7 +3994,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_propertiesPacketTimer.Stop(); return; } - + m_propertiesPacketTimer.Stop(); m_propertiesPacketTimer.Start(); } @@ -4229,7 +4228,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { - ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage(); + ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage(); updateMessage.AABBMax = landData.AABBMax; updateMessage.AABBMin = landData.AABBMin; @@ -4273,7 +4272,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP updateMessage.PassHours = landData.PassHours; updateMessage.PassPrice = landData.PassPrice; updateMessage.PublicCount = 0; //TODO: Unimplemented - + updateMessage.RegionPushOverride = (regionFlags & (uint)RegionFlags.RestrictPushObject) > 0; updateMessage.RegionDenyAnonymous = (regionFlags & (uint)RegionFlags.DenyAnonymous) > 0; @@ -4303,13 +4302,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP updateMessage.UserLocation = landData.UserLocation; updateMessage.UserLookAt = landData.UserLookAt; - updateMessage.MediaType = landData.MediaType; - updateMessage.MediaDesc = landData.MediaDescription; - updateMessage.MediaWidth = landData.MediaWidth; - updateMessage.MediaHeight = landData.MediaHeight; - updateMessage.MediaLoop = landData.MediaLoop; - updateMessage.ObscureMusic = landData.ObscureMusic; - updateMessage.ObscureMedia = landData.ObscureMedia; + updateMessage.MediaType = landData.MediaType; + updateMessage.MediaDesc = landData.MediaDescription; + updateMessage.MediaWidth = landData.MediaWidth; + updateMessage.MediaHeight = landData.MediaHeight; + updateMessage.MediaLoop = landData.MediaLoop; + updateMessage.ObscureMusic = landData.ObscureMusic; + updateMessage.ObscureMedia = landData.ObscureMedia; try { @@ -4318,8 +4317,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { eq.ParcelProperties(updateMessage, this.AgentId); } else { - m_log.Warn("No EQ Interface when sending parcel data."); - } + m_log.Warn("No EQ Interface when sending parcel data."); + } } catch (Exception ex) { @@ -4692,9 +4691,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP } // m_log.DebugFormat( -// "[LLCLIENTVIEW]: Constructing client update for part {0} {1} with flags {2}, localId {3}", +// "[LLCLIENTVIEW]: Constructing client update for part {0} {1} with flags {2}, localId {3}", // data.Name, update.FullID, flags, update.ID); - + update.UpdateFlags = (uint)flags; #endregion PrimFlags @@ -4827,11 +4826,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.ObjectScale, HandleObjectScale); AddLocalPacketHandler(PacketType.ObjectRotation, HandleObjectRotation); AddLocalPacketHandler(PacketType.ObjectFlagUpdate, HandleObjectFlagUpdate); - + // Handle ObjectImage (TextureEntry) updates synchronously, since when updating multiple prim faces at once, // some clients will send out a separate ObjectImage packet for each face AddLocalPacketHandler(PacketType.ObjectImage, HandleObjectImage, false); - + AddLocalPacketHandler(PacketType.ObjectGrab, HandleObjectGrab, false); AddLocalPacketHandler(PacketType.ObjectGrabUpdate, HandleObjectGrabUpdate, false); AddLocalPacketHandler(PacketType.ObjectDeGrab, HandleObjectDeGrab); @@ -5088,12 +5087,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP return false; } - + private bool HandleParcelGodMarkAsContent(IClientAPI client, Packet Packet) { ParcelGodMarkAsContentPacket ParcelGodMarkAsContent = (ParcelGodMarkAsContentPacket)Packet; - + ParcelGodMark ParcelGodMarkAsContentHandler = OnParcelGodMark; if (ParcelGodMarkAsContentHandler != null) { @@ -5104,11 +5103,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleFreezeUser(IClientAPI client, Packet Packet) { FreezeUserPacket FreezeUser = (FreezeUserPacket)Packet; - + FreezeUserUpdate FreezeUserHandler = OnParcelFreezeUser; if (FreezeUserHandler != null) { @@ -5120,12 +5119,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleEjectUser(IClientAPI client, Packet Packet) { EjectUserPacket EjectUser = (EjectUserPacket)Packet; - + EjectUserUpdate EjectUserHandler = OnParcelEjectUser; if (EjectUserHandler != null) { @@ -5137,12 +5136,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleParcelBuyPass(IClientAPI client, Packet Packet) { ParcelBuyPassPacket ParcelBuyPass = (ParcelBuyPassPacket)Packet; - + ParcelBuyPass ParcelBuyPassHandler = OnParcelBuyPass; if (ParcelBuyPassHandler != null) { @@ -5153,7 +5152,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleParcelBuyRequest(IClientAPI sender, Packet Pack) { ParcelBuyPacket parcel = (ParcelBuyPacket)Pack; @@ -5375,7 +5374,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack; //m_log.DebugFormat("[CLIENT]: Received ScriptDialogReply from {0}", rdialog.Data.ObjectID); - + #region Packet Session and User Check if (m_checkPackets) { @@ -5521,12 +5520,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return true; } - + private bool HandleFindAgent(IClientAPI client, Packet Packet) { FindAgentPacket FindAgent = (FindAgentPacket)Packet; - + FindAgentUpdate FindAgentHandler = OnFindAgent; if (FindAgentHandler != null) { @@ -5535,12 +5534,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleTrackAgent(IClientAPI client, Packet Packet) { TrackAgentPacket TrackAgent = (TrackAgentPacket)Packet; - + TrackAgentUpdate TrackAgentHandler = OnTrackAgent; if (TrackAgentHandler != null) { @@ -5551,7 +5550,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandlerRezObject(IClientAPI sender, Packet Pack) { RezObjectPacket rezPacket = (RezObjectPacket)Pack; @@ -7207,19 +7206,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP UUID requestID = new UUID(transfer.TransferInfo.Params, 80); // m_log.DebugFormat( -// "[CLIENT]: Got request for asset {0} from item {1} in prim {2} by {3}", +// "[CLIENT]: Got request for asset {0} from item {1} in prim {2} by {3}", // requestID, itemID, taskID, Name); - + if (!(((Scene)m_scene).Permissions.BypassPermissions())) { if (taskID != UUID.Zero) // Prim { SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID); - + if (part == null) { m_log.WarnFormat( - "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but prim does not exist", + "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but prim does not exist", Name, requestID, itemID, taskID); return true; } @@ -7228,11 +7227,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (tii == null) { m_log.WarnFormat( - "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item does not exist", - Name, requestID, itemID, taskID); + "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item does not exist", + Name, requestID, itemID, taskID); return true; - } - + } + if (tii.Type == (int)AssetType.LSLText) { if (!((Scene)m_scene).Permissions.CanEditScript(itemID, taskID, AgentId)) @@ -7251,41 +7250,41 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_log.WarnFormat( "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the prim is owned by {4}", - Name, requestID, itemID, taskID, part.OwnerID); + Name, requestID, itemID, taskID, part.OwnerID); return true; } - + if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) { m_log.WarnFormat( - "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but modify permissions are not set", - Name, requestID, itemID, taskID); + "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but modify permissions are not set", + Name, requestID, itemID, taskID); return true; } - + if (tii.OwnerID != AgentId) { m_log.WarnFormat( - "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the item is owned by {4}", - Name, requestID, itemID, taskID, tii.OwnerID); + "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the item is owned by {4}", + Name, requestID, itemID, taskID, tii.OwnerID); return true; } - + if (( - tii.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) + tii.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) != ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) { m_log.WarnFormat( - "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item permissions are not modify/copy/transfer", - Name, requestID, itemID, taskID); + "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item permissions are not modify/copy/transfer", + Name, requestID, itemID, taskID); return true; } - + if (tii.AssetID != requestID) { m_log.WarnFormat( - "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but this does not match item's asset {4}", - Name, requestID, itemID, taskID, tii.AssetID); + "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but this does not match item's asset {4}", + Name, requestID, itemID, taskID, tii.AssetID); return true; } } @@ -7889,7 +7888,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP newTaskItem, updatetask.UpdateData.LocalID); } } - } + } return true; } @@ -8884,7 +8883,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // return true; } - + private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack) { RequestRegionInfoPacket.AgentDataBlock mPacket = ((RequestRegionInfoPacket)Pack).AgentData; @@ -8905,7 +8904,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return true; } - + private bool HandleEstateCovenantRequest(IClientAPI sender, Packet Pack) { @@ -8942,7 +8941,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; } - + private bool HandleGodUpdateRegionInfoUpdate(IClientAPI client, Packet Packet) { GodUpdateRegionInfoPacket GodUpdateRegionInfo = @@ -8962,7 +8961,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleSimWideDeletes(IClientAPI client, Packet Packet) { SimWideDeletesPacket SimWideDeletesRequest = @@ -8975,7 +8974,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleGodlikeMessage(IClientAPI client, Packet Packet) { GodlikeMessagePacket GodlikeMessage = @@ -8992,7 +8991,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleSaveStatePacket(IClientAPI client, Packet Packet) { StateSavePacket SaveStateMessage = @@ -9005,7 +9004,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleGodKickUser(IClientAPI sender, Packet Pack) { GodKickUserPacket gkupack = (GodKickUserPacket)Pack; @@ -9143,7 +9142,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return true; } - + #endregion Economy/Transaction Packets #region Script Packets @@ -9356,7 +9355,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return true; } - + private bool HandleUpdateMuteListEntry(IClientAPI client, Packet Packet) { UpdateMuteListEntryPacket UpdateMuteListEntry = @@ -9372,7 +9371,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleRemoveMuteListEntry(IClientAPI client, Packet Packet) { RemoveMuteListEntryPacket RemoveMuteListEntry = @@ -9388,7 +9387,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleUserReport(IClientAPI client, Packet Packet) { UserReportPacket UserReport = @@ -9413,7 +9412,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleSendPostcard(IClientAPI client, Packet packet) { // SendPostcardPacket SendPostcard = @@ -9726,7 +9725,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; } - + private bool HandleGroupVoteHistoryRequest(IClientAPI client, Packet Packet) { GroupVoteHistoryRequestPacket GroupVoteHistoryRequest = @@ -9739,7 +9738,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleGroupActiveProposalsRequest(IClientAPI client, Packet Packet) { GroupActiveProposalsRequestPacket GroupActiveProposalsRequest = @@ -9752,7 +9751,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleGroupAccountDetailsRequest(IClientAPI client, Packet Packet) { GroupAccountDetailsRequestPacket GroupAccountDetailsRequest = @@ -9765,7 +9764,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleGroupAccountSummaryRequest(IClientAPI client, Packet Packet) { GroupAccountSummaryRequestPacket GroupAccountSummaryRequest = @@ -9778,7 +9777,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleGroupTransactionsDetailsRequest(IClientAPI client, Packet Packet) { GroupAccountTransactionsRequestPacket GroupAccountTransactionsRequest = @@ -9791,7 +9790,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleGroupTitlesRequest(IClientAPI sender, Packet Pack) { GroupTitlesRequestPacket groupTitlesRequest = @@ -11239,26 +11238,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (m_debugPacketLevel > 0) { bool outputPacket = true; - - if (m_debugPacketLevel <= 255 + + if (m_debugPacketLevel <= 255 && (packet.Type == PacketType.SimStats || packet.Type == PacketType.SimulatorViewerTimeMessage)) outputPacket = false; - - if (m_debugPacketLevel <= 200 - && - (packet.Type == PacketType.ImagePacket + + if (m_debugPacketLevel <= 200 + && (packet.Type == PacketType.ImagePacket || packet.Type == PacketType.ImageData || packet.Type == PacketType.LayerData - || packet.Type == PacketType.CoarseLocationUpdate)) + || packet.Type == PacketType.CoarseLocationUpdate)) outputPacket = false; - + if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.AvatarAnimation || packet.Type == PacketType.ViewerEffect)) - outputPacket = false; - + outputPacket = false; + if (outputPacket) m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type); } - + m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting); } @@ -11348,16 +11346,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (m_debugPacketLevel > 0) { bool outputPacket = true; - + if (m_debugPacketLevel <= 255 && packet.Type == PacketType.AgentUpdate) outputPacket = false; - + if (m_debugPacketLevel <= 200 && packet.Type == PacketType.RequestImage) outputPacket = false; - + if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.ViewerEffect || packet.Type == PacketType.AgentAnimation)) outputPacket = false; - + if (outputPacket) m_log.DebugFormat("[CLIENT]: Packet IN {0}", packet.Type); } @@ -11623,12 +11621,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP UUID requestID = UUID.Zero; byte source = (byte)SourceType.Asset; - - if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) + + if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) { requestID = new UUID(transferRequest.TransferInfo.Params, 0); } - else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) + else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) { requestID = new UUID(transferRequest.TransferInfo.Params, 80); source = (byte)SourceType.SimInventoryItem; @@ -11874,7 +11872,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public PacketMethod method; public bool Async; } - + public class AsyncPacketProcess { public bool result = false; @@ -11943,8 +11941,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP dialog.Data.FirstName = Util.StringToBytes256(ownerFirstName); dialog.Data.LastName = Util.StringToBytes256(ownerLastName); dialog.Data.Message = Util.StringToBytes256(message); - - + ScriptDialogPacket.ButtonsBlock[] buttons = new ScriptDialogPacket.ButtonsBlock[1]; buttons[0] = new ScriptDialogPacket.ButtonsBlock(); buttons[0].ButtonLabel = Util.StringToBytes256("!!llTextBox!!"); @@ -11958,7 +11955,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { ScenePresence presence = p as ScenePresence; // It turns out to get the agent to stop flying, you have to feed it stop flying velocities - // There's no explicit message to send the client to tell it to stop flying.. it relies on the + // There's no explicit message to send the client to tell it to stop flying.. it relies on the // velocity, collision plane and avatar height // Add 1/6 the avatar's height to it's position so it doesn't shoot into the air @@ -11975,7 +11972,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // attach a suitable collision plane regardless of the actual situation to force the LLClient to land. // Collision plane below the avatar's position a 6th of the avatar's height is suitable. - // Mind you, that this method doesn't get called if the avatar's velocity magnitude is greater then a + // Mind you, that this method doesn't get called if the avatar's velocity magnitude is greater then a // certain amount.. because the LLClient wouldn't land in that situation anyway. // why are we still testing for this really old height value default??? diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 46b68ec04b..ea1317a19c 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -36,6 +36,7 @@ using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework; +using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Physics.Manager; @@ -48,28 +49,16 @@ namespace OpenSim.Region.ClientStack protected Dictionary m_clientCircuits = new Dictionary(); protected NetworkServersInfo m_networkServersInfo; - - public NetworkServersInfo NetServersInfo - { - get { return m_networkServersInfo; } - } - protected uint m_httpServerPort; - - protected StorageManager m_storageManager; - - public StorageManager StorageManager - { - get { return m_storageManager; } - } - + protected ISimulationDataService m_simulationDataService; + protected IEstateDataService m_estateDataService; protected ClientStackManager m_clientStackManager; - - public SceneManager SceneManager - { - get { return m_sceneManager; } - } protected SceneManager m_sceneManager = new SceneManager(); + + public SceneManager SceneManager { get { return m_sceneManager; } } + public NetworkServersInfo NetServersInfo { get { return m_networkServersInfo; } } + public ISimulationDataService SimulationDataService { get { return m_simulationDataService; } } + public IEstateDataService EstateDataService { get { return m_estateDataService; } } protected abstract void Initialize(); @@ -83,15 +72,11 @@ namespace OpenSim.Region.ClientStack /// protected abstract PhysicsScene GetPhysicsScene(string osSceneIdentifier); - protected abstract StorageManager CreateStorageManager(); protected abstract ClientStackManager CreateClientStackManager(); - protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, - AgentCircuitManager circuitManager); + protected abstract Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager); protected override void StartupSpecific() { - m_storageManager = CreateStorageManager(); - m_clientStackManager = CreateClientStackManager(); Initialize(); diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 100b55cf6d..e1c094971d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -49,8 +49,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments protected Scene m_scene = null; - public string Name { get { return "Attachments Module"; } } - public Type ReplaceableInterface { get { return null; } } + public string Name { get { return "Attachments Module"; } } + public Type ReplaceableInterface { get { return null; } } public void Initialise(IConfigSource source) {} @@ -81,7 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachmentsFromInventory; client.OnObjectAttach += AttachObject; client.OnObjectDetach += DetachObject; - client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory; + client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory; } public void UnsubscribeFromClientEvents(IClientAPI client) @@ -90,7 +90,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachmentsFromInventory; client.OnObjectAttach -= AttachObject; client.OnObjectDetach -= DetachObject; - client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory; + client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory; } /// @@ -174,12 +174,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments UUID itemID = UUID.Zero; if (sp != null) { - foreach(SceneObjectGroup grp in sp.GetAttachments(AttachmentPt)) + foreach (SceneObjectGroup grp in sp.GetAttachments(AttachmentPt)) { itemID = grp.GetFromItemID(); if (itemID != UUID.Zero) DetachSingleAttachmentToInv(itemID, remoteClient); - } + } } if (group.GetFromItemID() == UUID.Zero) @@ -232,7 +232,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments public UUID RezSingleAttachmentFromInventory( IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc) - { + { SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc); if (updateInventoryStatus) @@ -248,8 +248,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (null == att) return UUID.Zero; else - return att.UUID; - } + return att.UUID; + } protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( IClientAPI remoteClient, UUID itemID, uint AttachmentPt, XmlDocument doc) @@ -311,7 +311,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } return null; - } + } public UUID SetAttachmentInventoryStatus( SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) @@ -456,7 +456,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // We can NOT use the dictionries here, as we are looking // for an entity by the fromAssetID, which is NOT the prim UUID - List detachEntities = m_scene.GetEntities(); + EntityBase[] detachEntities = m_scene.GetEntities(); SceneObjectGroup group; foreach (EntityBase entity in detachEntities) @@ -495,7 +495,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments sog.RootPart.IsAttachment = false; sog.AbsolutePosition = sog.RootPart.AttachedPos; UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID); - sog.SetAttachmentPoint(attachmentPoint); + sog.SetAttachmentPoint(attachmentPoint); } /// @@ -622,7 +622,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // In case it is later dropped again, don't let // it get cleaned up so.RootPart.RemFlag(PrimFlags.TemporaryOnRez); - so.HasGroupChanged = false; + so.HasGroupChanged = false; } } } diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index 032e55a369..25322a17c0 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs @@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule try { deadAvatar.ControllingClient.SendAgentAlertMessage(deadAvatarMessage, true); - if(killingAvatar != null) + if (killingAvatar != null) killingAvatar.ControllingClient.SendAlertMessage("You fragged " + deadAvatar.Firstname + " " + deadAvatar.Lastname); } catch (InvalidOperationException) @@ -143,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule } private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID) - { + { try { ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index ca0b7adc08..a49e71e4c8 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -54,7 +54,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends public UUID PrincipalID; public FriendInfo[] Friends; public int Refcount; - public UUID RegionID; public bool IsFriend(string friend) { @@ -68,6 +67,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends } } + private static readonly FriendInfo[] EMPTY_FRIENDS = new FriendInfo[0]; private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected List m_Scenes = new List(); @@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends protected Dictionary m_Friends = new Dictionary(); - protected List m_NeedsListOfFriends = new List(); + protected HashSet m_NeedsListOfFriends = new HashSet(); protected IPresenceService PresenceService { @@ -146,7 +146,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends // Instantiate the request handler IHttpServer server = MainServer.GetHttpServer((uint)mPort); server.AddStreamHandler(new FriendsRequestHandler(this)); - } if (m_FriendsService == null) @@ -173,7 +172,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnClientClosed += OnClientClosed; scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; - scene.EventManager.OnMakeChildAgent += OnMakeChildAgent; scene.EventManager.OnClientLogin += OnClientLogin; } @@ -198,17 +196,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends public uint GetFriendPerms(UUID principalID, UUID friendID) { - if (!m_Friends.ContainsKey(principalID)) - return 0; - - UserFriendData data = m_Friends[principalID]; - - string searchFor = friendID.ToString(); - foreach (FriendInfo fi in data.Friends) + FriendInfo[] friends = GetFriends(principalID); + foreach (FriendInfo fi in friends) { - if (fi.Friend == searchFor) + if (fi.Friend == friendID.ToString()) return (uint)fi.TheirFlags; } + return 0; } @@ -218,73 +212,59 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends client.OnApproveFriendRequest += OnApproveFriendRequest; client.OnDenyFriendRequest += OnDenyFriendRequest; client.OnTerminateFriendship += OnTerminateFriendship; - client.OnGrantUserRights += OnGrantUserRights; - lock (m_Friends) - { - if (m_Friends.ContainsKey(client.AgentId)) + // Asynchronously fetch the friends list or increment the refcount for the existing + // friends list + Util.FireAndForget( + delegate(object o) { - m_Friends[client.AgentId].Refcount++; - return; + lock (m_Friends) + { + UserFriendData friendsData; + if (m_Friends.TryGetValue(client.AgentId, out friendsData)) + { + friendsData.Refcount++; + } + else + { + friendsData = new UserFriendData(); + friendsData.PrincipalID = client.AgentId; + friendsData.Friends = FriendsService.GetFriends(client.AgentId); + friendsData.Refcount = 1; + + m_Friends[client.AgentId] = friendsData; + } + } } - - UserFriendData newFriends = new UserFriendData(); - - newFriends.PrincipalID = client.AgentId; - newFriends.Friends = m_FriendsService.GetFriends(client.AgentId); - newFriends.Refcount = 1; - newFriends.RegionID = UUID.Zero; - - m_Friends.Add(client.AgentId, newFriends); - } - + ); } private void OnClientClosed(UUID agentID, Scene scene) { ScenePresence sp = scene.GetScenePresence(agentID); if (sp != null && !sp.IsChildAgent) + { // do this for root agents closing out StatusChange(agentID, false); + } lock (m_Friends) - if (m_Friends.ContainsKey(agentID)) + { + UserFriendData friendsData; + if (m_Friends.TryGetValue(agentID, out friendsData)) { - if (m_Friends[agentID].Refcount == 1) + friendsData.Refcount--; + if (friendsData.Refcount <= 0) m_Friends.Remove(agentID); - else - m_Friends[agentID].Refcount--; } + } } private void OnMakeRootAgent(ScenePresence sp) { UUID agentID = sp.ControllingClient.AgentId; - - if (m_Friends.ContainsKey(agentID)) - { - // This is probably an overkill, but just - // to make sure we have the latest and greatest - // friends list -- always pull OnMakeRoot - m_Friends[agentID].Friends = - m_FriendsService.GetFriends(agentID); - - m_Friends[agentID].RegionID = - sp.ControllingClient.Scene.RegionInfo.RegionID; - } - } - - - private void OnMakeChildAgent(ScenePresence sp) - { - UUID agentID = sp.ControllingClient.AgentId; - - if (m_Friends.ContainsKey(agentID)) - { - if (m_Friends[agentID].RegionID == sp.ControllingClient.Scene.RegionInfo.RegionID) - m_Friends[agentID].RegionID = UUID.Zero; - } + UpdateFriendsCache(agentID); } private void OnClientLogin(IClientAPI client) @@ -296,75 +276,56 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends // Register that we need to send the list of online friends to this user lock (m_NeedsListOfFriends) - if (!m_NeedsListOfFriends.Contains(agentID)) - { - m_NeedsListOfFriends.Add(agentID); - } + m_NeedsListOfFriends.Add(agentID); } public void SendFriendsOnlineIfNeeded(IClientAPI client) { UUID agentID = client.AgentId; - if (m_NeedsListOfFriends.Contains(agentID)) + + // Check if the online friends list is needed + lock (m_NeedsListOfFriends) { - if (!m_Friends.ContainsKey(agentID)) - { - m_log.DebugFormat("[FRIENDS MODULE]: agent {0} not found in local cache", agentID); + if (!m_NeedsListOfFriends.Remove(agentID)) return; - } + } - // - // Send the friends online - // - List online = GetOnlineFriends(agentID); - if (online.Count > 0) - { - m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count); - client.SendAgentOnline(online.ToArray()); - } + // Send the friends online + List online = GetOnlineFriends(agentID); + if (online.Count > 0) + { + m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count); + client.SendAgentOnline(online.ToArray()); + } - // - // Send outstanding friendship offers - // - if (m_Friends.ContainsKey(agentID)) - { - List outstanding = new List(); + // Send outstanding friendship offers + List outstanding = new List(); + FriendInfo[] friends = GetFriends(agentID); + foreach (FriendInfo fi in friends) + { + if (fi.TheirFlags == -1) + outstanding.Add(fi.Friend); + } - foreach (FriendInfo fi in m_Friends[agentID].Friends) - if (fi.TheirFlags == -1) - outstanding.Add(fi.Friend); + GridInstantMessage im = new GridInstantMessage(client.Scene, UUID.Zero, String.Empty, agentID, (byte)InstantMessageDialog.FriendshipOffered, + "Will you be my friend?", true, Vector3.Zero); - GridInstantMessage im = new GridInstantMessage(client.Scene, UUID.Zero, "", agentID, (byte)InstantMessageDialog.FriendshipOffered, "Will you be my friend?", true, Vector3.Zero); - foreach (string fid in outstanding) - { - try - { - im.fromAgentID = new Guid(fid); - } - catch - { - continue; - } + foreach (string fid in outstanding) + { + UUID fromAgentID; + if (!UUID.TryParse(fid, out fromAgentID)) + continue; - UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, new UUID(im.fromAgentID)); - im.fromAgentName = account.FirstName + " " + account.LastName; + UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID); + PresenceInfo presence = PresenceService.GetAgent(fromAgentID); - PresenceInfo presence = null; - PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid }); - if (presences != null && presences.Length > 0) - presence = presences[0]; - if (presence != null) - im.offline = 0; + im.fromAgentID = fromAgentID.Guid; + im.fromAgentName = account.FirstName + " " + account.LastName; + im.offline = (byte)((presence == null) ? 1 : 0); + im.imSessionID = im.fromAgentID; - im.imSessionID = im.fromAgentID; - - // Finally - LocalFriendshipOffered(agentID, im); - } - } - - lock (m_NeedsListOfFriends) - m_NeedsListOfFriends.Remove(agentID); + // Finally + LocalFriendshipOffered(agentID, im); } } @@ -373,44 +334,46 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends List friendList = new List(); List online = new List(); - foreach (FriendInfo fi in m_Friends[userID].Friends) + FriendInfo[] friends = GetFriends(userID); + foreach (FriendInfo fi in friends) { if (((fi.TheirFlags & 1) != 0) && (fi.TheirFlags != -1)) friendList.Add(fi.Friend); } - if (friendList.Count == 0) - // no friends whatsoever - return online; - - PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray()); - - foreach (PresenceInfo pi in presence) - online.Add(new UUID(pi.UserID)); - //m_log.DebugFormat("[XXX] {0} friend online {1}", userID, pi.UserID); + if (friendList.Count > 0) + { + PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray()); + foreach (PresenceInfo pi in presence) + { + UUID presenceID; + if (UUID.TryParse(pi.UserID, out presenceID)) + online.Add(presenceID); + } + } return online; } - // - // Find the client for a ID - // + /// + /// Find the client for a ID + /// public IClientAPI LocateClientObject(UUID agentID) { Scene scene = GetClientScene(agentID); - if (scene == null) - return null; + if (scene != null) + { + ScenePresence presence = scene.GetScenePresence(agentID); + if (presence != null) + return presence.ControllingClient; + } - ScenePresence presence = scene.GetScenePresence(agentID); - if (presence == null) - return null; - - return presence.ControllingClient; + return null; } - // - // Find the scene for an agent - // + /// + /// Find the scene for an agent + /// private Scene GetClientScene(UUID agentId) { lock (m_Scenes) @@ -418,13 +381,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends foreach (Scene scene in m_Scenes) { ScenePresence presence = scene.GetScenePresence(agentId); - if (presence != null) - { - if (!presence.IsChildAgent) - return scene; - } + if (presence != null && !presence.IsChildAgent) + return scene; } } + return null; } @@ -435,35 +396,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends /// private void StatusChange(UUID agentID, bool online) { - //m_log.DebugFormat("[FRIENDS]: StatusChange {0}", online); - if (m_Friends.ContainsKey(agentID)) + FriendInfo[] friends = GetFriends(agentID); + if (friends.Length > 0) { - //m_log.DebugFormat("[FRIENDS]: # of friends: {0}", m_Friends[agentID].Friends.Length); List friendList = new List(); - foreach (FriendInfo fi in m_Friends[agentID].Friends) + foreach (FriendInfo fi in friends) { if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1)) friendList.Add(fi); } - Util.FireAndForget(delegate - { - foreach (FriendInfo fi in friendList) + Util.FireAndForget( + delegate { - //m_log.DebugFormat("[FRIENDS]: Notifying {0}", fi.PrincipalID); - // Notify about this user status - StatusNotify(fi, agentID, online); + foreach (FriendInfo fi in friendList) + { + //m_log.DebugFormat("[FRIENDS]: Notifying {0}", fi.PrincipalID); + // Notify about this user status + StatusNotify(fi, agentID, online); + } } - }); + ); } - else - m_log.WarnFormat("[FRIENDS]: {0} not found in cache", agentID); } private void StatusNotify(FriendInfo friend, UUID userID, bool online) { - UUID friendID = UUID.Zero; - + UUID friendID; if (UUID.TryParse(friend.Friend, out friendID)) { // Try local @@ -471,35 +430,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends return; // The friend is not here [as root]. Let's forward. - PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); - if (friendSessions != null && friendSessions.Length > 0) + PresenceInfo friendSession = PresenceService.GetAgent(friendID); + if (friendSession != null && friendSession.RegionID != UUID.Zero) // let's guard against sessions-gone-bad with the RegionID check { - PresenceInfo friendSession = null; - foreach (PresenceInfo pinfo in friendSessions) - if (pinfo.RegionID != UUID.Zero) // let's guard against sessions-gone-bad - { - friendSession = pinfo; - break; - } - - if (friendSession != null) - { - GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName); - m_FriendsSimConnector.StatusNotify(region, userID, friendID, online); - } + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName); + m_FriendsSimConnector.StatusNotify(region, userID, friendID, online); } - - // Friend is not online. Ignore. } else + { m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend); + } } private void OnInstantMessage(IClientAPI client, GridInstantMessage im) { - if (im.dialog == (byte)OpenMetaverse.InstantMessageDialog.FriendshipOffered) - { + if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered) + { // we got a friendship offer UUID principalID = new UUID(im.fromAgentID); UUID friendID = new UUID(im.toAgentID); @@ -529,15 +477,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends return; // The prospective friend is not here [as root]. Let's forward. - PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); - if (friendSessions != null && friendSessions.Length > 0) + PresenceInfo friendSession = PresenceService.GetAgent(friendID); + if (friendSession != null) { - PresenceInfo friendSession = friendSessions[0]; - if (friendSession != null) - { - GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); - } + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); } // If the prospective friend is not online, he'll get the message upon login. } @@ -548,9 +492,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends FriendsService.StoreFriend(agentID, friendID.ToString(), 1); FriendsService.StoreFriend(friendID, agentID.ToString(), 1); - // update the local cache - m_Friends[agentID].Friends = FriendsService.GetFriends(agentID); + // Update the local cache + UpdateFriendsCache(agentID); // // Notify the friend @@ -564,16 +508,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends } // The friend is not here - PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); - if (friendSessions != null && friendSessions.Length > 0) + PresenceInfo friendSession = PresenceService.GetAgent(friendID); + if (friendSession != null) { - PresenceInfo friendSession = friendSessions[0]; - if (friendSession != null) - { - GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID); - client.SendAgentOnline(new UUID[] { friendID }); - } + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID); + client.SendAgentOnline(new UUID[] { friendID }); } } @@ -592,18 +532,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (LocalFriendshipDenied(agentID, client.Name, friendID)) return; - PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); - if (friendSessions != null && friendSessions.Length > 0) + PresenceInfo friendSession = PresenceService.GetAgent(friendID); + if (friendSession != null) { - PresenceInfo friendSession = friendSessions[0]; - if (friendSession != null) - { - GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - if (region != null) - m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); - else - m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID); - } + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + if (region != null) + m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); + else + m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID); } } @@ -613,7 +549,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends FriendsService.Delete(exfriendID, agentID.ToString()); // Update local cache - m_Friends[agentID].Friends = FriendsService.GetFriends(agentID); + UpdateFriendsCache(agentID); client.SendTerminateFriend(exfriendID); @@ -625,30 +561,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (LocalFriendshipTerminated(exfriendID)) return; - PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() }); - if (friendSessions != null && friendSessions.Length > 0) + PresenceInfo friendSession = PresenceService.GetAgent(exfriendID); + if (friendSession != null) { - PresenceInfo friendSession = friendSessions[0]; - if (friendSession != null) - { - GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID); - } + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID); } } private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights) { - if (!m_Friends.ContainsKey(remoteClient.AgentId)) + FriendInfo[] friends = GetFriends(remoteClient.AgentId); + if (friends.Length == 0) return; m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target); // Let's find the friend in this user's friend list - UserFriendData fd = m_Friends[remoteClient.AgentId]; FriendInfo friend = null; - foreach (FriendInfo fi in fd.Friends) + foreach (FriendInfo fi in friends) + { if (fi.Friend == target.ToString()) friend = fi; + } if (friend != null) // Found it { @@ -670,17 +604,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (LocalGrantRights(requester, target, myFlags, rights)) return; - PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() }); - if (friendSessions != null && friendSessions.Length > 0) + PresenceInfo friendSession = PresenceService.GetAgent(target); + if (friendSession != null) { - PresenceInfo friendSession = friendSessions[0]; - if (friendSession != null) - { - GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - // TODO: You might want to send the delta to save the lookup - // on the other end!! - m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights); - } + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + // TODO: You might want to send the delta to save the lookup + // on the other end!! + m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights); } } } @@ -709,8 +639,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID, (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); friendClient.SendInstantMessage(im); - // update the local cache - m_Friends[friendID].Friends = FriendsService.GetFriends(friendID); + + // Update the local cache + UpdateFriendsCache(friendID); + // we're done return true; } @@ -724,7 +656,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (friendClient != null) { // the prospective friend in this sim as root agent - GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID, (byte)OpenMetaverse.InstantMessageDialog.FriendshipDeclined, userID.ToString(), false, Vector3.Zero); friendClient.SendInstantMessage(im); @@ -743,7 +674,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends // the friend in this sim as root agent friendClient.SendTerminateFriend(exfriendID); // update local cache - m_Friends[exfriendID].Friends = FriendsService.GetFriends(exfriendID); + UpdateFriendsCache(exfriendID); // we're done return true; } @@ -772,11 +703,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends } - // update local cache - //m_Friends[friendID].Friends = m_FriendsService.GetFriends(friendID); - foreach (FriendInfo finfo in m_Friends[friendID].Friends) - if (finfo.Friend == userID.ToString()) - finfo.TheirFlags = rights; + // Update local cache + lock (m_Friends) + { + FriendInfo[] friends = GetFriends(friendID); + foreach (FriendInfo finfo in friends) + { + if (finfo.Friend == userID.ToString()) + finfo.TheirFlags = rights; + } + } return true; } @@ -802,7 +738,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends return false; } + #endregion + private FriendInfo[] GetFriends(UUID agentID) + { + UserFriendData friendsData; + + lock (m_Friends) + { + if (m_Friends.TryGetValue(agentID, out friendsData)) + return friendsData.Friends; + } + + return EMPTY_FRIENDS; + } + + private void UpdateFriendsCache(UUID agentID) + { + lock (m_Friends) + { + UserFriendData friendsData; + if (m_Friends.TryGetValue(agentID, out friendsData)) + friendsData.Friends = FriendsService.GetFriends(agentID); + } + } } } diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs index 4b30b0d9ee..5ec64d5141 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs @@ -58,13 +58,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods public void SubscribeToClientEvents(IClientAPI client) { client.OnGodKickUser += KickUser; - client.OnRequestGodlikePowers += RequestGodlikePowers; - } + client.OnRequestGodlikePowers += RequestGodlikePowers; + } public void UnsubscribeFromClientEvents(IClientAPI client) { client.OnGodKickUser -= KickUser; - client.OnRequestGodlikePowers -= RequestGodlikePowers; + client.OnRequestGodlikePowers -= RequestGodlikePowers; } public void RequestGodlikePowers( diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index a49faec3de..a6894ff0b0 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -138,8 +138,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage if (scene.Entities.ContainsKey(toAgentID) && scene.Entities[toAgentID] is ScenePresence) { - // m_log.DebugFormat("[INSTANT MESSAGE]: Looking for {0} in {1}", toAgentID.ToString(), scene.RegionInfo.RegionName); - // Local message +// m_log.DebugFormat( +// "[INSTANT MESSAGE]: Looking for root agent {0} in {1}", +// toAgentID.ToString(), scene.RegionInfo.RegionName); + ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; if (!user.IsChildAgent) { @@ -495,9 +497,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage if (lookupAgent) { // Non-cached user agent lookup. - PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() }); - if (presences != null && presences.Length > 0) - upd = presences[0]; + upd = PresenceService.GetAgent(toAgentID); if (upd != null) { diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 52342ec357..c1df827069 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -179,14 +179,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver m_log.DebugFormat( "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures", successfulAssetRestores, failedAssetRestores); - m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores); + m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores); return loadedNodes; } finally { m_loadStream.Close(); - } + } } public void Close() @@ -201,7 +201,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// The item archive path to replicate /// The root folder for the inventory load /// - /// The folders that we have resolved so far for a given archive path. + /// The folders that we have resolved so far for a given archive path. /// This method will add more folders if necessary /// /// @@ -246,17 +246,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// The root folder for the inventory load /// /// - /// The folders that we have resolved so far for a given archive path. + /// The folders that we have resolved so far for a given archive path. /// /// /// The folder in the user's inventory that matches best the archive path given. If no such folder was found /// then the passed in root destination folder is returned. - /// + /// protected InventoryFolderBase ResolveDestinationFolder( - InventoryFolderBase rootDestFolder, - ref string archivePath, + InventoryFolderBase rootDestFolder, + ref string archivePath, Dictionary resolvedFolders) - { + { // string originalArchivePath = archivePath; while (archivePath.Length > 0) @@ -370,7 +370,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (0 == i) loadedNodes.Add(destFolder); - } + } } /// diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 9908018d25..bae5a7a289 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs @@ -119,7 +119,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver protected void ReceivedAllAssets(ICollection assetsFoundUuids, ICollection assetsNotFoundUuids) { Exception reportedException = null; - bool succeeded = true; + bool succeeded = true; try { @@ -136,7 +136,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver finally { m_saveStream.Close(); - } + } m_module.TriggerInventoryArchiveSaved( m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException); @@ -270,7 +270,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver { // We couldn't find the path indicated string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); - Exception e = new InventoryArchiverException(errorMessage); + Exception e = new InventoryArchiverException(errorMessage); m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e); throw e; } @@ -283,7 +283,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}", inventoryFolder.Name, inventoryFolder.ID, - m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath ); + m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath); //recurse through all dirs getting dirs and files SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly); @@ -301,7 +301,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver //SaveUsers(); new AssetsRequest( - new AssetsArchiver(m_archiveWriter), m_assetUuids, m_scene.AssetService, ReceivedAllAssets).Execute(); + new AssetsArchiver(m_archiveWriter), m_assetUuids, m_scene.AssetService, ReceivedAllAssets).Execute(); } catch (Exception) { diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs index e07e2ca689..5fd1a7ee82 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs @@ -33,7 +33,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// Signals an inventory archiving problem /// public class InventoryArchiverException : Exception - { + { public InventoryArchiverException(string message) : base(message) {} public InventoryArchiverException(string message, Exception e) : base(message, e) {} } diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index f03f2a1514..2eaca499b0 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -91,12 +91,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver scene.AddCommand( this, "load iar", - "load iar []", + "load iar []", //"load iar [--merge] []", "Load user inventory archive (IAR).", //"--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones" //+ " is user's first name." + Environment.NewLine - " is user's first name." + Environment.NewLine + " is user's first name." + Environment.NewLine + " is user's last name." + Environment.NewLine + " is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine + " is the user's password." + Environment.NewLine @@ -241,7 +241,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (CheckPresence(userInfo.PrincipalID)) { InventoryArchiveReadRequest request; - bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); + bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); try { @@ -286,10 +286,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (CheckPresence(userInfo.PrincipalID)) { InventoryArchiveReadRequest request; - bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); + bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); try - { + { request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath, merge); } catch (EntryPointNotFoundException e) @@ -325,20 +325,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams) { try - { - m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); - - Dictionary options = new Dictionary(); + { + m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); + + Dictionary options = new Dictionary(); OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); List mainParams = optionSet.Parse(cmdparams); - + if (mainParams.Count < 6) { m_log.Error( "[INVENTORY ARCHIVER]: usage is load iar [--merge] []"); return; - } + } string firstName = mainParams[2]; string lastName = mainParams[3]; @@ -353,7 +353,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options)) m_log.InfoFormat( "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", - loadPath, firstName, lastName); + loadPath, firstName, lastName); } catch (InventoryArchiverException e) { @@ -390,7 +390,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", savePath, invPath, firstName, lastName); - ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary()); + ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary()); } catch (InventoryArchiverException e) { @@ -398,7 +398,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } lock (m_pendingConsoleSaves) - m_pendingConsoleSaves.Add(id); + m_pendingConsoleSaves.Add(id); } private void SaveInvConsoleCommandCompleted( diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index d66a1d0640..938886b2d3 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -58,18 +58,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests /// /// Stream of data representing a common IAR that can be reused in load tests. /// - protected MemoryStream m_iarStream; + protected MemoryStream m_iarStream; protected UserAccount m_ua1 = new UserAccount { PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"), FirstName = "Mr", - LastName = "Tiddles" }; + LastName = "Tiddles" }; protected UserAccount m_ua2 = new UserAccount { PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"), FirstName = "Lord", - LastName = "Lucan" }; + LastName = "Lucan" }; string m_item1Name = "b.lsl"; private void SaveCompleted( @@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests } protected void ConstructDefaultIarForTestLoad() - { + { string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random()); MemoryStream archiveWriteStream = new MemoryStream(); @@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests string item1FileName = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); - tar.Close(); + tar.Close(); m_iarStream = new MemoryStream(archiveWriteStream.ToArray()); } @@ -341,7 +341,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests // Assert.That(gotObject2File, Is.True, "No object2 file in archive"); // TODO: Test presence of more files and contents of files. - } + } /// /// Test that things work when the load path specified starts with a slash @@ -349,22 +349,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestLoadIarPathStartsWithSlash() { - TestHelper.InMethod(); + TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); SerialiserModule serialiserModule = new SerialiserModule(); - InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); - Scene scene = SceneSetupHelpers.SetupScene("inventory"); + InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + Scene scene = SceneSetupHelpers.SetupScene("inventory"); SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); - UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password"); + UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password"); archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/Objects", "password", m_iarStream); InventoryItemBase foundItem1 = InventoryArchiveUtils.FindItemByPath( scene.InventoryService, m_ua1.PrincipalID, "/Objects/" + m_item1Name); - Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()"); + Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()"); } /// @@ -376,7 +376,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestLoadIarV0_1ExistingUsers() { - TestHelper.InMethod(); + TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); SerialiserModule serialiserModule = new SerialiserModule(); @@ -386,9 +386,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests Scene scene = SceneSetupHelpers.SetupScene("inventory"); SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); - - UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood"); - UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire"); + + UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood"); + UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire"); archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream); @@ -450,7 +450,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests string userFirstName = "Jock"; string userLastName = "Stirrup"; UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); - UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood"); + UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood"); // Create asset SceneObjectGroup object1; @@ -524,7 +524,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestLoadIarV0_1AbsentUsers() { - TestHelper.InMethod(); + TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); string userFirstName = "Charlie"; @@ -562,7 +562,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests Scene scene = SceneSetupHelpers.SetupScene("inventory"); SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); - UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood"); + UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood"); archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream); @@ -680,8 +680,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests string folder2aArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2aName, UUID.Random()); string folder2bArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2bName, UUID.Random()); - string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName }); - string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName }); + string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName }); + string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName }); { // Test replication of path1 @@ -694,7 +694,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name); Assert.That(folder1Candidates.Count, Is.EqualTo(1)); - InventoryFolderBase folder1 = folder1Candidates[0]; + InventoryFolderBase folder1 = folder1Candidates[0]; List folder2aCandidates = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName); Assert.That(folder2aCandidates.Count, Is.EqualTo(1)); @@ -715,11 +715,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests List folder2aCandidates = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName); - Assert.That(folder2aCandidates.Count, Is.EqualTo(1)); + Assert.That(folder2aCandidates.Count, Is.EqualTo(1)); List folder2bCandidates = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2bName); - Assert.That(folder2bCandidates.Count, Is.EqualTo(1)); + Assert.That(folder2bCandidates.Count, Is.EqualTo(1)); } } @@ -741,7 +741,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryFolderBase folder1 = UserInventoryTestUtils.CreateInventoryFolder( - scene.InventoryService, ua1.PrincipalID, folder1ExistingName); + scene.InventoryService, ua1.PrincipalID, folder1ExistingName); string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); @@ -772,7 +772,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests List folder2PostCandidates = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b"); Assert.That(folder2PostCandidates.Count, Is.EqualTo(1)); - } + } /// /// Test replication of a partly existing archive path to the user's inventory. This should create @@ -792,7 +792,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryFolderBase folder1 = UserInventoryTestUtils.CreateInventoryFolder( - scene.InventoryService, ua1.PrincipalID, folder1ExistingName); + scene.InventoryService, ua1.PrincipalID, folder1ExistingName); string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); @@ -812,6 +812,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests List folder2PostCandidates = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1PostCandidates[0], "b"); Assert.That(folder2PostCandidates.Count, Is.EqualTo(1)); - } + } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs index 35b70de8ab..05fe3eee04 100644 --- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs @@ -138,7 +138,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue { if (!queues.ContainsKey(agentId)) { - /* + /* m_log.DebugFormat( "[EVENTQUEUE]: Adding new queue for agent {0} in region {1}", agentId, m_scene.RegionInfo.RegionName); @@ -701,7 +701,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue public void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID) { - OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage); + OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage); Enqueue(item, avatarID); } diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs index b62df18c10..0d7d16a2ba 100644 --- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue } // private static byte[] uintToByteArray(uint uIntValue) -// { +// { // byte[] result = new byte[4]; // Utils.UIntToBytesBig(uIntValue, result, 0); // return result; @@ -386,14 +386,14 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue return placesReply; } - public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage) - { - OSDMap message = new OSDMap(); - message.Add("message", OSD.FromString("ParcelProperties")); - OSD message_body = parcelPropertiesMessage.Serialize(); - message.Add("body", message_body); - return message; - } + public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage) + { + OSDMap message = new OSDMap(); + message.Add("message", OSD.FromString("ParcelProperties")); + OSD message_body = parcelPropertiesMessage.Serialize(); + message.Add("body", message_body); + return message; + } } } diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 37f6ea0ba8..a2ba49842b 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -629,7 +629,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess rootPart.Name = item.Name; rootPart.Description = item.Description; - List partList = null; + List partList = null; lock (group.Children) partList = new List(group.Children.Values); diff --git a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs b/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs index b75a7001b8..a75ff6234e 100644 --- a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs @@ -49,8 +49,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments protected bool m_collectStats; protected Scene m_scene = null; - public string Name { get { return "Binary Statistics Logging Module"; } } - public Type ReplaceableInterface { get { return null; } } + public string Name { get { return "Binary Statistics Logging Module"; } } + public Type ReplaceableInterface { get { return null; } } public void Initialise(IConfigSource source) { @@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments catch { // if it doesn't work, we don't collect anything - } + } } public void AddRegion(Scene scene) @@ -94,12 +94,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments public void RegionLoaded(Scene scene) { if (m_collectStats) - m_scene.StatsReporter.OnSendStatsResult += LogSimStats; + m_scene.StatsReporter.OnSendStatsResult += LogSimStats; } public void Close() { - } + } public class StatLogger { @@ -164,6 +164,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } } return; - } + } } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs index 235914a0b0..2f96bcb1ab 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs @@ -115,6 +115,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); new UserAgentServerConnector(m_Config, MainServer.Instance); + new HeloServiceInConnector(m_Config, MainServer.Instance, "HeloService"); } scene.RegisterModuleInterface(m_HypergridHandler.GateKeeper); } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 5b4fecb802..39410b561b 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -37,6 +37,7 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; using OpenSim.Services.Connectors; +using OpenSim.Services.Connectors.SimianGrid; using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory @@ -538,12 +539,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } else { - // We're instantiating this class explicitly, but this won't - // work in general, because the remote grid may be running - // an inventory server that has a different protocol. - // Eventually we will want a piece of protocol asking - // the remote server about its kind. Definitely cool thing to do! - connector = new RemoteXInventoryServicesConnector(url); + // Still not as flexible as I would like this to be, + // but good enough for now + string connectorType = new HeloServicesConnector(url).Helo(); + m_log.DebugFormat("[HG INVENTORY SERVICE]: HELO returned {0}", connectorType); + if (connectorType == "opensim-simian") + connector = new SimianInventoryServiceConnector(url); + else + connector = new RemoteXInventoryServicesConnector(url); m_connectors.Add(url, connector); } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs index 4e2f6024cc..2322d7cb45 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs @@ -185,7 +185,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return folders[type]; } - m_log.WarnFormat("[INVENTORY CACHE]: Could not find folder for system type {0} for {1}", type, userID); + m_log.WarnFormat("[INVENTORY CACHE]: Could not find folder for system type {0} for {1}", type, userID); return null; } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index cbd9e05de7..ab6be50ec6 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -220,7 +220,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory { // m_log.DebugFormat( // "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}", -// item.Name, item.Owner, item.Folder); +// item.Name, item.Owner, item.Folder); return m_InventoryService.AddItem(item); } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs index 4ab69474a1..34205e3df8 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs @@ -227,7 +227,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory public bool AddItem(InventoryItemBase item) { if (item == null) - return false; + return false; return m_RemoteConnector.AddItem(item); } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs index fb2edb91a9..64788dbc4d 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs @@ -36,6 +36,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts { public class UserAccountCache { + private const double CACHE_EXPIRATION_SECONDS = 120.0; + private static readonly ILog m_log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); @@ -51,9 +53,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts public void Cache(UUID userID, UserAccount account) { // Cache even null accounts - m_UUIDCache.AddOrUpdate(userID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d)); + m_UUIDCache.AddOrUpdate(userID, account, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS)); if (account != null) - m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromMinutes(2.0d)); + m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS)); // m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); } diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs index ddc3dd7644..c72acc332b 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs @@ -33,7 +33,7 @@ using OpenSim.Framework.Serialization; using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.World.Archiver -{ +{ /// /// Helper methods for archive manipulation /// @@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver public static string CreateObjectFilename(SceneObjectGroup sog) { return ArchiveConstants.CreateOarObjectFilename(sog.Name, sog.UUID, sog.AbsolutePosition); - } + } /// /// Create the path used to store an object in an OpenSim Archive. @@ -62,7 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver public static string CreateObjectPath(SceneObjectGroup sog) { return ArchiveConstants.CreateOarObjectPath(sog.Name, sog.UUID, sog.AbsolutePosition); - } + } /// /// Resolve path to a working FileStream @@ -123,6 +123,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver // return new BufferedStream(file, (int) response.ContentLength); return new BufferedStream(file, 1000000); - } + } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index b25636ffcb..283b33be04 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs @@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver { Dictionary assetUuids = new Dictionary(); - List entities = m_scene.GetEntities(); + EntityBase[] entities = m_scene.GetEntities(); List sceneObjects = new List(); /* diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 58698ee189..3342164b35 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -48,6 +48,7 @@ using OpenSim.Tests.Common.Setup; using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants; using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader; using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter; +using RegionSettings = OpenSim.Framework.RegionSettings; namespace OpenSim.Region.CoreModules.World.Archiver.Tests { @@ -135,7 +136,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests SceneObjectPart part2 = CreateSceneObjectPart2(); - AssetNotecard nc = new AssetNotecard("Hello World!"); + AssetNotecard nc = new AssetNotecard(); + nc.BodyText = "Hello World!"; + nc.Encode(); UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); AssetBase ncAsset @@ -215,7 +218,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests public void TestLoadOarV0_2() { TestHelper.InMethod(); - //log4net.Config.XmlConfigurator.Configure(); +// log4net.Config.XmlConfigurator.Configure(); MemoryStream archiveWriteStream = new MemoryStream(); TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index f62ec1b275..5bd72ee247 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -72,12 +72,12 @@ namespace OpenSim.Region.CoreModules.World.Land #pragma warning restore 0429 /// - /// Local land ids at specified region co-ordinates (region size / 4) + /// Local land ids at specified region co-ordinates (region size / 4) /// private readonly int[,] m_landIDList = new int[landArrayMax, landArrayMax]; /// - /// Land objects keyed by local id + /// Land objects keyed by local id /// private readonly Dictionary m_landList = new Dictionary(); @@ -94,8 +94,8 @@ namespace OpenSim.Region.CoreModules.World.Land #region INonSharedRegionModule Members - public Type ReplaceableInterface - { + public Type ReplaceableInterface + { get { return null; } } @@ -200,7 +200,7 @@ namespace OpenSim.Region.CoreModules.World.Land Debug.WriteLine(string.Format("Stopping force position because {0} is close enough to position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition)); forcedPosition = null; } - //if we are far away, teleport + //if we are far away, teleport else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition.Value) > 3) { Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition)); @@ -329,8 +329,6 @@ namespace OpenSim.Region.CoreModules.World.Land } } - - private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) { if (m_scene.Permissions.IsGod(avatar.UUID)) return; @@ -344,7 +342,6 @@ namespace OpenSim.Region.CoreModules.World.Land { avatar.ControllingClient.SendAlertMessage( "You are not allowed on this parcel because the land owner has restricted access."); - } public void EventManagerOnAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID) @@ -456,7 +453,7 @@ namespace OpenSim.Region.CoreModules.World.Land if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && clientAvatar.sentMessageAboutRestrictedParcelFlyingDown) { - EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID, + EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID, m_scene.RegionInfo.RegionID); //They are going under the safety line! if (!parcel.IsBannedFromLand(clientAvatar.UUID)) @@ -660,7 +657,7 @@ namespace OpenSim.Region.CoreModules.World.Land if (x_float > Constants.RegionSize || x_float < 0 || y_float > Constants.RegionSize || y_float < 0) return null; - + try { x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / 4.0)); @@ -675,7 +672,7 @@ namespace OpenSim.Region.CoreModules.World.Land { return null; } - + lock (m_landList) { // Corner case. If an autoreturn happens during sim startup @@ -695,7 +692,7 @@ namespace OpenSim.Region.CoreModules.World.Land // they happen every time at border crossings throw new Exception("Error: Parcel not found at point " + x + ", " + y); } - + lock (m_landIDList) { try @@ -749,7 +746,6 @@ namespace OpenSim.Region.CoreModules.World.Land public void EventManagerOnObjectBeingRemovedFromScene(SceneObjectGroup obj) { - lock (m_landList) { foreach (LandObject p in m_landList.Values) @@ -802,7 +798,8 @@ namespace OpenSim.Region.CoreModules.World.Land public void EventManagerOnParcelPrimCountUpdate() { ResetAllLandPrimCounts(); - foreach (EntityBase obj in m_scene.Entities) + EntityBase[] entities = m_scene.Entities.GetEntities(); + foreach (EntityBase obj in entities) { if (obj != null) { @@ -943,7 +940,7 @@ namespace OpenSim.Region.CoreModules.World.Land return; } } - + lock (m_landList) { foreach (ILandObject slaveLandObject in selectedLandObjects) @@ -1089,7 +1086,6 @@ namespace OpenSim.Region.CoreModules.World.Land temp.Add(currentParcel); } } - } } @@ -1132,7 +1128,7 @@ namespace OpenSim.Region.CoreModules.World.Land join(west, south, east, north, remote_client.AgentId); } - public void ClientOnParcelSelectObjects(int local_id, int request_type, + public void ClientOnParcelSelectObjects(int local_id, int request_type, List returnIDs, IClientAPI remote_client) { m_landList[local_id].SendForceObjectSelect(local_id, request_type, returnIDs, remote_client); @@ -1382,31 +1378,31 @@ namespace OpenSim.Region.CoreModules.World.Land { return RemoteParcelRequest(request, path, param, agentID, caps); })); - UUID parcelCapID = UUID.Random(); - caps.RegisterHandler("ParcelPropertiesUpdate", - new RestStreamHandler("POST", "/CAPS/" + parcelCapID, - delegate(string request, string path, string param, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - return ProcessPropertiesUpdate(request, path, param, agentID, caps); - })); + UUID parcelCapID = UUID.Random(); + caps.RegisterHandler("ParcelPropertiesUpdate", + new RestStreamHandler("POST", "/CAPS/" + parcelCapID, + delegate(string request, string path, string param, + OSHttpRequest httpRequest, OSHttpResponse httpResponse) + { + return ProcessPropertiesUpdate(request, path, param, agentID, caps); + })); } - private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps) - { - IClientAPI client; - if ( ! m_scene.TryGetClient(agentID, out client) ) { - m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString() ); - return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); - } - - ParcelPropertiesUpdateMessage properties = new ParcelPropertiesUpdateMessage(); - OpenMetaverse.StructuredData.OSDMap args = (OpenMetaverse.StructuredData.OSDMap) OSDParser.DeserializeLLSDXml(request); + private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps) + { + IClientAPI client; + if (! m_scene.TryGetClient(agentID, out client)) { + m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString()); + return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); + } - properties.Deserialize(args); - - LandUpdateArgs land_update = new LandUpdateArgs(); - int parcelID = properties.LocalID; - land_update.AuthBuyerID = properties.AuthBuyerID; + ParcelPropertiesUpdateMessage properties = new ParcelPropertiesUpdateMessage(); + OpenMetaverse.StructuredData.OSDMap args = (OpenMetaverse.StructuredData.OSDMap) OSDParser.DeserializeLLSDXml(request); + + properties.Deserialize(args); + + LandUpdateArgs land_update = new LandUpdateArgs(); + int parcelID = properties.LocalID; + land_update.AuthBuyerID = properties.AuthBuyerID; land_update.Category = properties.Category; land_update.Desc = properties.Desc; land_update.GroupID = properties.GroupID; @@ -1423,15 +1419,15 @@ namespace OpenSim.Region.CoreModules.World.Land land_update.SnapshotID = properties.SnapshotID; land_update.UserLocation = properties.UserLocation; land_update.UserLookAt = properties.UserLookAt; - land_update.MediaDescription = properties.MediaDesc; - land_update.MediaType = properties.MediaType; - land_update.MediaWidth = properties.MediaWidth; - land_update.MediaHeight = properties.MediaHeight; - land_update.MediaLoop = properties.MediaLoop; - land_update.ObscureMusic = properties.ObscureMusic; - land_update.ObscureMedia = properties.ObscureMedia; - - ILandObject land; + land_update.MediaDescription = properties.MediaDesc; + land_update.MediaType = properties.MediaType; + land_update.MediaWidth = properties.MediaWidth; + land_update.MediaHeight = properties.MediaHeight; + land_update.MediaLoop = properties.MediaLoop; + land_update.ObscureMusic = properties.ObscureMusic; + land_update.ObscureMedia = properties.ObscureMedia; + + ILandObject land; lock (m_landList) { m_landList.TryGetValue(parcelID, out land); @@ -1439,15 +1435,15 @@ namespace OpenSim.Region.CoreModules.World.Land if (land != null) { - land.UpdateLandProperties(land_update, client); + land.UpdateLandProperties(land_update, client); m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client); - } + } else { - m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID); - } + m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID); + } return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); - } + } // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the // "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to. // So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x @@ -1524,19 +1520,19 @@ namespace OpenSim.Region.CoreModules.World.Land if (parcelID == UUID.Zero) return; - ExtendedLandData data = - (ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(), - delegate(string id) + ExtendedLandData data = + (ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(), + delegate(string id) { UUID parcel = UUID.Zero; UUID.TryParse(id, out parcel); // assume we've got the parcelID we just computed in RemoteParcelRequest ExtendedLandData extLandData = new ExtendedLandData(); - Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle, + Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle, out extLandData.X, out extLandData.Y); m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}", extLandData.RegionHandle, extLandData.X, extLandData.Y); - + // for this region or for somewhere else? if (extLandData.RegionHandle == m_scene.RegionInfo.RegionHandle) { diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 1b2cabbbee..bd1dd66d4a 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -229,13 +229,13 @@ namespace OpenSim.Region.CoreModules.World.Land newData.SnapshotID = args.SnapshotID; newData.UserLocation = args.UserLocation; newData.UserLookAt = args.UserLookAt; - newData.MediaType = args.MediaType; - newData.MediaDescription = args.MediaDescription; - newData.MediaWidth = args.MediaWidth; - newData.MediaHeight = args.MediaHeight; - newData.MediaLoop = args.MediaLoop; - newData.ObscureMusic = args.ObscureMusic; - newData.ObscureMedia = args.ObscureMedia; + newData.MediaType = args.MediaType; + newData.MediaDescription = args.MediaDescription; + newData.MediaWidth = args.MediaWidth; + newData.MediaHeight = args.MediaHeight; + newData.MediaLoop = args.MediaLoop; + newData.ObscureMusic = args.ObscureMusic; + newData.ObscureMedia = args.ObscureMedia; m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index 82ad109a49..7c5d044347 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs @@ -54,11 +54,11 @@ namespace OpenSim.Region.CoreModules.Media.Moap { [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MoapModule")] public class MoapModule : INonSharedRegionModule, IMoapModule - { + { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public string Name { get { return "MoapModule"; } } - public Type ReplaceableInterface { get { return null; } } + public string Name { get { return "MoapModule"; } } + public Type ReplaceableInterface { get { return null; } } /// /// Is this module enabled? @@ -78,17 +78,17 @@ namespace OpenSim.Region.CoreModules.Media.Moap /// /// Track the ObjectMedia capabilities given to users keyed by agent. Lock m_omCapUsers to manipulate. /// - protected Dictionary m_omCapUrls = new Dictionary(); + protected Dictionary m_omCapUrls = new Dictionary(); /// /// Track the ObjectMediaUpdate capabilities given to users keyed by path - /// + /// protected Dictionary m_omuCapUsers = new Dictionary(); /// /// Track the ObjectMediaUpdate capabilities given to users keyed by agent. Lock m_omuCapUsers to manipulate - /// - protected Dictionary m_omuCapUrls = new Dictionary(); + /// + protected Dictionary m_omuCapUrls = new Dictionary(); public void Initialise(IConfigSource configSource) { @@ -129,7 +129,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps; m_scene.EventManager.OnDeregisterCaps -= OnDeregisterCaps; m_scene.EventManager.OnSceneObjectPartCopy -= OnSceneObjectPartCopy; - } + } public void OnRegisterCaps(UUID agentID, Caps caps) { @@ -159,7 +159,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap caps.RegisterHandler( "ObjectMediaNavigate", new RestStreamHandler("POST", omuCapUrl, HandleObjectMediaNavigateMessage)); } - } + } public void OnDeregisterCaps(UUID agentID, Caps caps) { @@ -179,7 +179,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap } protected void OnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed) - { + { if (original.Shape.Media != null) { PrimitiveBaseShape.MediaList dupeMedia = new PrimitiveBaseShape.MediaList(); @@ -195,7 +195,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap } copy.Shape.Media = dupeMedia; - } + } } public MediaEntry GetMediaEntry(SceneObjectPart part, int face) @@ -211,9 +211,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap me = null; } else - { + { lock (media) - me = media[face]; + me = media[face]; // TODO: Really need a proper copy constructor down in libopenmetaverse if (me != null) @@ -227,17 +227,17 @@ namespace OpenSim.Region.CoreModules.Media.Moap public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me) { - CheckFaceParam(part, face); + CheckFaceParam(part, face); if (null == part.Shape.Media) part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]); - lock (part.Shape.Media) + lock (part.Shape.Media) part.Shape.Media[face] = me; - UpdateMediaUrl(part, UUID.Zero); + UpdateMediaUrl(part, UUID.Zero); part.ScheduleFullUpdate(); - part.TriggerScriptChangedEvent(Changed.MEDIA); + part.TriggerScriptChangedEvent(Changed.MEDIA); } public void ClearMediaEntry(SceneObjectPart part, int face) @@ -256,7 +256,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap /// protected string HandleObjectMediaMessage( string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { + { // m_log.DebugFormat("[MOAP]: Got ObjectMedia path [{0}], raw request [{1}]", path, request); OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request); @@ -266,12 +266,12 @@ namespace OpenSim.Region.CoreModules.Media.Moap if (omm.Request is ObjectMediaRequest) return HandleObjectMediaRequest(omm.Request as ObjectMediaRequest); else if (omm.Request is ObjectMediaUpdate) - return HandleObjectMediaUpdate(path, omm.Request as ObjectMediaUpdate); + return HandleObjectMediaUpdate(path, omm.Request as ObjectMediaUpdate); throw new Exception( string.Format( "[MOAP]: ObjectMediaMessage has unrecognized ObjectMediaBlock of {0}", - omm.Request.GetType())); + omm.Request.GetType())); } /// @@ -279,7 +279,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap /// /// /// - protected string HandleObjectMediaRequest(ObjectMediaRequest omr) + protected string HandleObjectMediaRequest(ObjectMediaRequest omr) { UUID primId = omr.PrimID; @@ -318,7 +318,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap /// Path on which this request was made /// /param> /// - protected string HandleObjectMediaUpdate(string path, ObjectMediaUpdate omu) + protected string HandleObjectMediaUpdate(string path, ObjectMediaUpdate omu) { UUID primId = omu.PrimID; @@ -330,9 +330,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap "[MOAP]: Received an UPDATE ObjectMediaRequest for prim {0} but this doesn't exist in region {1}", primId, m_scene.RegionInfo.RegionName); return string.Empty; - } + } -// m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId); +// m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId); // for (int i = 0; i < omu.FaceMedia.Length; i++) // { @@ -374,14 +374,14 @@ namespace OpenSim.Region.CoreModules.Media.Moap part.Shape.Textures = te; // m_log.DebugFormat( // "[MOAP]: Media flags for face {0} is {1}", -// i, part.Shape.Textures.FaceTextures[i].MediaFlags); +// i, part.Shape.Textures.FaceTextures[i].MediaFlags); } } } else - { + { // We need to go through the media textures one at a time to make sure that we have permission - // to change them + // to change them // FIXME: Race condition here since some other texture entry manipulator may overwrite/get // overwritten. Unfortunately, PrimitiveBaseShape does not allow us to change texture entry @@ -391,18 +391,18 @@ namespace OpenSim.Region.CoreModules.Media.Moap lock (media) { for (int i = 0; i < media.Count; i++) - { + { if (m_scene.Permissions.CanControlPrimMedia(agentId, part.UUID, i)) - { + { media[i] = omu.FaceMedia[i]; // When a face is cleared this is done by setting the MediaFlags in the TextureEntry via a normal // texture update, so we don't need to worry about clearing MediaFlags here. if (null == media[i]) - continue; + continue; Primitive.TextureEntryFace face = te.CreateFace((uint)i); - face.MediaFlags = true; + face.MediaFlags = true; // m_log.DebugFormat( // "[MOAP]: Media flags for face {0} is {1}", @@ -414,11 +414,11 @@ namespace OpenSim.Region.CoreModules.Media.Moap part.Shape.Textures = te; -// for (int i2 = 0; i2 < part.Shape.Textures.FaceTextures.Length; i2++) -// m_log.DebugFormat("[MOAP]: FaceTexture[{0}] is {1}", i2, part.Shape.Textures.FaceTextures[i2]); +// for (int i2 = 0; i2 < part.Shape.Textures.FaceTextures.Length; i2++) +// m_log.DebugFormat("[MOAP]: FaceTexture[{0}] is {1}", i2, part.Shape.Textures.FaceTextures[i2]); } - UpdateMediaUrl(part, agentId); + UpdateMediaUrl(part, agentId); // Arguably, we could avoid sending a full update to the avatar that just changed the texture. part.ScheduleFullUpdate(); @@ -439,16 +439,16 @@ namespace OpenSim.Region.CoreModules.Media.Moap /// protected string HandleObjectMediaNavigateMessage( string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { + { // m_log.DebugFormat("[MOAP]: Got ObjectMediaNavigate request [{0}]", request); OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request); ObjectMediaNavigateMessage omn = new ObjectMediaNavigateMessage(); - omn.Deserialize(osd); + omn.Deserialize(osd); UUID primId = omn.PrimID; - SceneObjectPart part = m_scene.GetSceneObjectPart(primId); + SceneObjectPart part = m_scene.GetSceneObjectPart(primId); if (null == part) { @@ -456,12 +456,12 @@ namespace OpenSim.Region.CoreModules.Media.Moap "[MOAP]: Received an ObjectMediaNavigateMessage for prim {0} but this doesn't exist in region {1}", primId, m_scene.RegionInfo.RegionName); return string.Empty; - } + } UUID agentId = default(UUID); lock (m_omuCapUsers) - agentId = m_omuCapUsers[path]; + agentId = m_omuCapUsers[path]; if (!m_scene.Permissions.CanInteractWithPrimMedia(agentId, part.UUID, omn.Face)) return string.Empty; @@ -484,7 +484,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap return string.Empty; if (me.EnableWhiteList) - { + { if (!CheckUrlAgainstWhitelist(omn.URL, me.WhiteList)) { // m_log.DebugFormat( @@ -493,18 +493,18 @@ namespace OpenSim.Region.CoreModules.Media.Moap return string.Empty; } - } + } me.CurrentURL = omn.URL; UpdateMediaUrl(part, agentId); - part.ScheduleFullUpdate(); + part.ScheduleFullUpdate(); part.TriggerScriptChangedEvent(Changed.MEDIA); return OSDParser.SerializeLLSDXmlString(new OSD()); - } + } /// /// Check that the face number is valid for the given prim. @@ -519,7 +519,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap int maxFaces = part.GetNumberOfSides() - 1; if (face > maxFaces) throw new ArgumentException( - string.Format("Face argument was {0} but max is {1}", face, maxFaces)); + string.Format("Face argument was {0} but max is {1}", face, maxFaces)); } /// @@ -542,9 +542,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap string rawVersion = part.MediaUrl.Substring(5, 10); int version = int.Parse(rawVersion); part.MediaUrl = string.Format("x-mv:{0:D10}/{1}", ++version, updateId); - } + } -// m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID); +// m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID); } /// @@ -554,7 +554,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap /// /// true if the url matches an entry on the whitelist, false otherwise protected bool CheckUrlAgainstWhitelist(string rawUrl, string[] whitelist) - { + { Uri url = new Uri(rawUrl); foreach (string origWlUrl in whitelist) @@ -575,7 +575,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap if (url.Host.Contains(wlUrl)) { // m_log.DebugFormat("[MOAP]: Whitelist URL {0} matches {1}", origWlUrl, rawUrl); - return true; + return true; } } else @@ -588,7 +588,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap return true; } } - } + } return false; } diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index 12750c5e2c..db50339fec 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs @@ -49,8 +49,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell protected Scene m_scene = null; protected IDialogModule m_dialogModule; - public string Name { get { return "Object BuySell Module"; } } - public Type ReplaceableInterface { get { return null; } } + public string Name { get { return "Object BuySell Module"; } } + public Type ReplaceableInterface { get { return null; } } public void Initialise(IConfigSource source) {} @@ -78,8 +78,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell public void SubscribeToClientEvents(IClientAPI client) { - client.OnObjectSaleInfo += ObjectSaleInfo; - } + client.OnObjectSaleInfo += ObjectSaleInfo; + } protected void ObjectSaleInfo( IClientAPI client, UUID agentID, UUID sessionID, uint localID, byte saleType, int salePrice) @@ -99,7 +99,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell part.ParentGroup.HasGroupChanged = true; part.GetProperties(client); - } + } public bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType) { @@ -225,7 +225,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell } else { - if (m_dialogModule != null) + if (m_dialogModule != null) m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable"); return false; } @@ -261,6 +261,6 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell } return true; - } + } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index b1747efab6..ecfd211e02 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -397,13 +397,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions m_groupsModule = m_scene.RequestModuleInterface(); if (m_groupsModule == null) - m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work"); + m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work"); m_moapModule = m_scene.RequestModuleInterface(); // This log line will be commented out when no longer required for debugging // if (m_moapModule == null) -// m_log.Warn("[PERMISSIONS]: Media on a prim module not found, media on a prim permissions will not work"); +// m_log.Warn("[PERMISSIONS]: Media on a prim module not found, media on a prim permissions will not work"); } public void Close() @@ -1906,7 +1906,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions } private bool CanControlPrimMedia(UUID agentID, UUID primID, int face) - { + { // m_log.DebugFormat( // "[PERMISSONS]: Performing CanControlPrimMedia check with agentID {0}, primID {1}, face {2}", // agentID, primID, face); @@ -1918,7 +1918,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions if (null == part) return false; - MediaEntry me = m_moapModule.GetMediaEntry(part, face); + MediaEntry me = m_moapModule.GetMediaEntry(part, face); // If there is no existing media entry then it can be controlled (in this context, created). if (null == me) @@ -1929,7 +1929,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions // agentID, primID, face, me.ControlPermissions); return GenericPrimMediaPermission(part, agentID, me.ControlPermissions); - } + } private bool CanInteractWithPrimMedia(UUID agentID, UUID primID, int face) { @@ -1952,15 +1952,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions // m_log.DebugFormat( // "[PERMISSIONS]: Checking CanInteractWithPrimMedia for {0} on {1} face {2} with interact permissions {3}", -// agentID, primID, face, me.InteractPermissions); +// agentID, primID, face, me.InteractPermissions); return GenericPrimMediaPermission(part, agentID, me.InteractPermissions); - } + } private bool GenericPrimMediaPermission(SceneObjectPart part, UUID agentID, MediaPermission perms) { // if (IsAdministrator(agentID)) -// return true; +// return true; if ((perms & MediaPermission.Anyone) == MediaPermission.Anyone) return true; @@ -1969,15 +1969,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions { if (agentID == part.OwnerID) return true; - } + } if ((perms & MediaPermission.Group) == MediaPermission.Group) { if (IsGroupMember(part.GroupID, agentID, 0)) return true; - } + } - return false; + return false; } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs index bef7fe4627..5067ebd12b 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs @@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser { string xmlstream = ""; - List EntityList = scene.GetEntities(); + EntityBase[] EntityList = scene.GetEntities(); List EntityXml = new List(); foreach (EntityBase ent in EntityList) diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs index 58e42619c7..98fe4935bc 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs @@ -165,12 +165,12 @@ namespace OpenSim.Region.CoreModules.World.Serialiser return SceneXmlLoader.SaveGroupToXml2(grp); } - public void SavePrimListToXml2(List entityList, string fileName) + public void SavePrimListToXml2(EntityBase[] entityList, string fileName) { SceneXmlLoader.SavePrimListToXml2(entityList, fileName); } - public void SavePrimListToXml2(List entityList, TextWriter stream, Vector3 min, Vector3 max) + public void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max) { SceneXmlLoader.SavePrimListToXml2(entityList, stream, min, max); } diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index d4166d09fc..4611352b76 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -816,7 +816,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain { //m_log.Debug("Terrain packet unacked, resending patch: " + patchX + " , " + patchY); client.SendLayerData(patchX, patchY, m_scene.Heightmap.GetFloatsSerialised()); - } + } private void StoreUndoState() { diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs index 9736b73adf..6bac5559e9 100644 --- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs +++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs @@ -425,7 +425,7 @@ namespace OpenSim.Region.CoreModules { if (m_ready) { - if(m_scene.GetRootAgentCount() > 0) + if (m_scene.GetRootAgentCount() > 0) { // Ask wind plugin to generate a LL wind array to be cached locally // Try not to update this too often, as it may involve array copies diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs index 57eff8a0b3..1bd1371c53 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs @@ -212,7 +212,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap double[,] hm = whichScene.Heightmap.GetDoubles(); tc = Environment.TickCount; m_log.Info("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile"); - List objs = whichScene.GetEntities(); + EntityBase[] objs = whichScene.GetEntities(); Dictionary z_sort = new Dictionary(); //SortedList z_sort = new SortedList(); List z_sortheights = new List(); @@ -228,7 +228,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap SceneObjectGroup mapdot = (SceneObjectGroup)obj; Color mapdotspot = Color.Gray; // Default color when prim color is white - // Loop over prim in group + // Loop over prim in group List partList = null; lock (mapdot.Children) partList = new List(mapdot.Children.Values); diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index f036d85910..fbc8a50350 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -307,7 +307,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap lock (m_rootAgents) { m_rootAgents.Remove(AgentId); - if(m_rootAgents.Count == 0) + if (m_rootAgents.Count == 0) StopThread(); } } diff --git a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs index 3c39f9e9cf..5e75cae838 100644 --- a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs +++ b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs @@ -101,7 +101,8 @@ namespace OpenSim.Region.DataSnapshot.Providers XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "objectdata", ""); XmlNode node; - foreach (EntityBase entity in m_scene.Entities) + EntityBase[] entities = m_scene.Entities.GetEntities(); + foreach (EntityBase entity in entities) { // only objects, not avatars if (entity is SceneObjectGroup) diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index 59c035ffd7..6a0fb6311c 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs @@ -56,7 +56,7 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// - /// true if the object was successfully attached, false otherwise + /// true if the object was successfully attached, false otherwise bool AttachObject( IClientAPI remoteClient, SceneObjectGroup grp, uint AttachmentPt, bool silent); diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index f5cd528d32..6289f7aecb 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs @@ -202,7 +202,7 @@ namespace OpenSim.Region.Framework.Interfaces /// Backup the inventory to the given data store /// /// - void ProcessInventoryBackup(IRegionDataStore datastore); + void ProcessInventoryBackup(ISimulationDataService datastore); uint MaskEffectivePermissions(); diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs new file mode 100644 index 0000000000..95c9659bc1 --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using OpenSim.Framework; +using OpenMetaverse; + +namespace OpenSim.Region.Framework.Interfaces +{ + public interface IEstateDataService + { + EstateSettings LoadEstateSettings(UUID regionID, bool create); + EstateSettings LoadEstateSettings(int estateID); + void StoreEstateSettings(EstateSettings es); + List GetEstates(string search); + bool LinkRegion(UUID regionID, int estateID); + List GetRegions(int estateID); + bool DeleteEstate(int estateID); + } +} diff --git a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs index 2c091e753f..4c501f669b 100644 --- a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs @@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Interfaces /// Get a group /// /// ID of the group - /// The group's data. Null if there is no such group. + /// The group's data. Null if there is no such group. GroupRecord GetGroupRecord(UUID GroupID); void ActivateGroup(IClientAPI remoteClient, UUID groupID); @@ -74,14 +74,14 @@ namespace OpenSim.Region.Framework.Interfaces List GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID); List GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID); GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID); - GroupMembershipData[] GetMembershipData(UUID UserID); + GroupMembershipData[] GetMembershipData(UUID UserID); GroupMembershipData GetMembershipData(UUID GroupID, UUID UserID); void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish); void SetGroupAcceptNotices(IClientAPI remoteClient, UUID groupID, bool acceptNotices, bool listInProfile); - void GroupTitleUpdate(IClientAPI remoteClient, UUID GroupID, UUID TitleRoleID); + void GroupTitleUpdate(IClientAPI remoteClient, UUID GroupID, UUID TitleRoleID); GroupNoticeData[] GroupNoticesListRequest(IClientAPI remoteClient, UUID GroupID); string GetGroupTitle(UUID avatarID); diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs index 01066e6ab1..ddf7565945 100644 --- a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs @@ -43,14 +43,14 @@ namespace OpenSim.Region.Framework.Interfaces /// Contains the exception generated if the save did not succeed public delegate void InventoryArchiveSaved( Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException); - + public interface IInventoryArchiverModule { /// /// Fired when an archive inventory save has been completed. /// event InventoryArchiveSaved OnInventoryArchiveSaved; - + /// /// Dearchive a user's inventory folder from the given stream /// @@ -60,7 +60,7 @@ namespace OpenSim.Region.Framework.Interfaces /// The stream from which the inventory archive will be loaded /// true if the first stage of the operation succeeded, false otherwise bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream); - + /// /// Dearchive a user's inventory folder from the given stream /// @@ -72,8 +72,8 @@ namespace OpenSim.Region.Framework.Interfaces /// the loaded IAR with existing folders where possible. /// true if the first stage of the operation succeeded, false otherwise bool DearchiveInventory( - string firstName, string lastName, string invPath, string pass, Stream loadStream, - Dictionary options); + string firstName, string lastName, string invPath, string pass, Stream loadStream, + Dictionary options); /// /// Archive a user's inventory folder to the given stream @@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Interfaces /// The stream to which the inventory archive will be saved /// true if the first stage of the operation succeeded, false otherwise bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream); - + /// /// Archive a user's inventory folder to the given stream /// @@ -97,7 +97,7 @@ namespace OpenSim.Region.Framework.Interfaces /// Archiving options. Currently, there are none. /// true if the first stage of the operation succeeded, false otherwise bool ArchiveInventory( - Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream, - Dictionary options); + Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream, + Dictionary options); } } diff --git a/OpenSim/Region/Framework/Interfaces/IMoapModule.cs b/OpenSim/Region/Framework/Interfaces/IMoapModule.cs index 24b6860742..1d3d240b04 100644 --- a/OpenSim/Region/Framework/Interfaces/IMoapModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IMoapModule.cs @@ -63,5 +63,5 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /param> void ClearMediaEntry(SceneObjectPart part, int face); - } + } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs index e7562a55c9..18758c8832 100644 --- a/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs @@ -90,7 +90,7 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// - void SavePrimListToXml2(List entityList, string fileName); + void SavePrimListToXml2(EntityBase[] entityList, string fileName); /// /// Save a set of prims in the xml2 format, optionally specifying a bounding box for which @@ -101,7 +101,7 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// - void SavePrimListToXml2(List entityList, TextWriter stream, Vector3 min, Vector3 max); + void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max); void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName); diff --git a/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs b/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs new file mode 100644 index 0000000000..edaa07c80f --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs @@ -0,0 +1,98 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Region.Framework.Interfaces +{ + public interface ISimulationDataService + { + /// + /// Stores all object's details apart from inventory + /// + /// + /// + void StoreObject(SceneObjectGroup obj, UUID regionUUID); + + /// + /// Entirely removes the object, including inventory + /// + /// + /// + /// + void RemoveObject(UUID uuid, UUID regionUUID); + + /// + /// Store a prim's inventory + /// + /// + void StorePrimInventory(UUID primID, ICollection items); + + /// + /// Load persisted objects from region storage. + /// + /// the Region UUID + /// List of loaded groups + List LoadObjects(UUID regionUUID); + + /// + /// Store a terrain revision in region storage + /// + /// HeightField data + /// region UUID + void StoreTerrain(double[,] terrain, UUID regionID); + + /// + /// Load the latest terrain revision from region storage + /// + /// the region UUID + /// Heightfield data + double[,] LoadTerrain(UUID regionID); + + void StoreLandObject(ILandObject Parcel); + + /// + /// + /// delete from land where UUID=globalID + /// delete from landaccesslist where LandUUID=globalID + /// + /// + /// + void RemoveLandObject(UUID globalID); + + List LoadLandObjects(UUID regionUUID); + + void StoreRegionSettings(RegionSettings rs); + RegionSettings LoadRegionSettings(UUID regionUUID); + RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID); + void StoreRegionWindlightSettings(RegionLightShareData wl); + } +} diff --git a/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs b/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs similarity index 99% rename from OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs rename to OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs index 3e8e19670c..0a4d531b91 100644 --- a/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs +++ b/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs @@ -32,7 +32,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.Framework.Interfaces { - public interface IRegionDataStore + public interface ISimulationDataStore { /// /// Initialises the data storage engine diff --git a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs index d6e31f4503..65c57a6eb8 100644 --- a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs @@ -31,7 +31,7 @@ namespace OpenSim.Region.Framework.Interfaces { /// /// Generate a map tile for the scene. a terrain texture for this scene - /// + /// void GenerateMaptile(); } } diff --git a/OpenSim/Region/Framework/Scenes/EntityManager.cs b/OpenSim/Region/Framework/Scenes/EntityManager.cs index c246e32be9..0defa93c6a 100644 --- a/OpenSim/Region/Framework/Scenes/EntityManager.cs +++ b/OpenSim/Region/Framework/Scenes/EntityManager.cs @@ -34,227 +34,89 @@ using OpenMetaverse; namespace OpenSim.Region.Framework.Scenes { - public class EntityManager : IEnumerable + public class EntityManager { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private readonly Dictionary m_eb_uuid = new Dictionary(); - private readonly Dictionary m_eb_localID = new Dictionary(); - //private readonly Dictionary m_pres_uuid = new Dictionary(); - private System.Threading.ReaderWriterLockSlim m_lock = new System.Threading.ReaderWriterLockSlim(); + private readonly DoubleDictionary m_entities = new DoubleDictionary(); - [Obsolete("Use Add() instead.")] - public void Add(UUID id, EntityBase eb) + public int Count { - Add(eb); + get { return m_entities.Count; } } public void Add(EntityBase entity) { - m_lock.EnterWriteLock(); - try - { - try - { - m_eb_uuid.Add(entity.UUID, entity); - m_eb_localID.Add(entity.LocalId, entity); - } - catch(Exception e) - { - m_log.ErrorFormat("Add Entity failed: {0}", e.Message); - } - } - finally - { - m_lock.ExitWriteLock(); - } - } - - public void InsertOrReplace(EntityBase entity) - { - m_lock.EnterWriteLock(); - try - { - try - { - m_eb_uuid[entity.UUID] = entity; - m_eb_localID[entity.LocalId] = entity; - } - catch(Exception e) - { - m_log.ErrorFormat("Insert or Replace Entity failed: {0}", e.Message); - } - } - finally - { - m_lock.ExitWriteLock(); - } + m_entities.Add(entity.UUID, entity.LocalId, entity); } public void Clear() { - m_lock.EnterWriteLock(); - try - { - m_eb_uuid.Clear(); - m_eb_localID.Clear(); - } - finally - { - m_lock.ExitWriteLock(); - } - } - - public int Count - { - get - { - return m_eb_uuid.Count; - } + m_entities.Clear(); } public bool ContainsKey(UUID id) { - try - { - return m_eb_uuid.ContainsKey(id); - } - catch - { - return false; - } + return m_entities.ContainsKey(id); } public bool ContainsKey(uint localID) { - try - { - return m_eb_localID.ContainsKey(localID); - } - catch - { - return false; - } + return m_entities.ContainsKey(localID); } public bool Remove(uint localID) { - m_lock.EnterWriteLock(); - try - { - try - { - bool a = false; - EntityBase entity; - if (m_eb_localID.TryGetValue(localID, out entity)) - a = m_eb_uuid.Remove(entity.UUID); - - bool b = m_eb_localID.Remove(localID); - return a && b; - } - catch (Exception e) - { - m_log.ErrorFormat("Remove Entity failed for {0}", localID, e); - return false; - } - } - finally - { - m_lock.ExitWriteLock(); - } + return m_entities.Remove(localID); } public bool Remove(UUID id) { - m_lock.EnterWriteLock(); - try - { - try - { - bool a = false; - EntityBase entity; - if (m_eb_uuid.TryGetValue(id, out entity)) - a = m_eb_localID.Remove(entity.LocalId); - - bool b = m_eb_uuid.Remove(id); - return a && b; - } - catch (Exception e) - { - m_log.ErrorFormat("Remove Entity failed for {0}", id, e); - return false; - } - } - finally - { - m_lock.ExitWriteLock(); - } + return m_entities.Remove(id); } - public List GetAllByType() + public EntityBase[] GetAllByType() { List tmp = new List(); - m_lock.EnterReadLock(); - try - { - try + m_entities.ForEach( + delegate(EntityBase entity) { - foreach (KeyValuePair pair in m_eb_uuid) - { - if (pair.Value is T) - { - tmp.Add(pair.Value); - } - } + if (entity is T) + tmp.Add(entity); } - catch (Exception e) - { - m_log.ErrorFormat("GetAllByType failed for {0}", e); - tmp = null; - } - } - finally - { - m_lock.ExitReadLock(); - } + ); - return tmp; + return tmp.ToArray(); } - public List GetEntities() + public EntityBase[] GetEntities() { - m_lock.EnterReadLock(); - try - { - return new List(m_eb_uuid.Values); - } - finally - { - m_lock.ExitReadLock(); - } + List tmp = new List(m_entities.Count); + m_entities.ForEach(delegate(EntityBase entity) { tmp.Add(entity); }); + return tmp.ToArray(); + } + + public void ForEach(Action action) + { + m_entities.ForEach(action); + } + + public EntityBase Find(Predicate predicate) + { + return m_entities.FindValue(predicate); } public EntityBase this[UUID id] { get { - m_lock.EnterReadLock(); - try - { - EntityBase entity; - if (m_eb_uuid.TryGetValue(id, out entity)) - return entity; - else - return null; - } - finally - { - m_lock.ExitReadLock(); - } + EntityBase entity; + m_entities.TryGetValue(id, out entity); + return entity; } set { - InsertOrReplace(value); + Add(value); } } @@ -262,65 +124,24 @@ namespace OpenSim.Region.Framework.Scenes { get { - m_lock.EnterReadLock(); - try - { - EntityBase entity; - if (m_eb_localID.TryGetValue(localID, out entity)) - return entity; - else - return null; - } - finally - { - m_lock.ExitReadLock(); - } + EntityBase entity; + m_entities.TryGetValue(localID, out entity); + return entity; } set { - InsertOrReplace(value); + Add(value); } } public bool TryGetValue(UUID key, out EntityBase obj) { - m_lock.EnterReadLock(); - try - { - return m_eb_uuid.TryGetValue(key, out obj); - } - finally - { - m_lock.ExitReadLock(); - } + return m_entities.TryGetValue(key, out obj); } public bool TryGetValue(uint key, out EntityBase obj) { - m_lock.EnterReadLock(); - try - { - return m_eb_localID.TryGetValue(key, out obj); - } - finally - { - m_lock.ExitReadLock(); - } + return m_entities.TryGetValue(key, out obj); } - - /// - /// This could be optimised to work on the list 'live' rather than making a safe copy and iterating that. - /// - /// - public IEnumerator GetEnumerator() - { - return GetEntities().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - } } diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 3fae5e63c5..e923932690 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -61,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes public event OnTerrainUpdateDelegate OnTerrainUpdate; - public delegate void OnBackupDelegate(IRegionDataStore datastore, bool forceBackup); + public delegate void OnBackupDelegate(ISimulationDataService datastore, bool forceBackup); public event OnBackupDelegate OnBackup; @@ -336,7 +336,7 @@ namespace OpenSim.Region.Framework.Scenes /// If the object is being attached, then the avatarID will be present. If the object is being detached then /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical). public delegate void Attach(uint localID, UUID itemID, UUID avatarID); - public event Attach OnAttach; + public event Attach OnAttach; /// /// Called immediately after an object is loaded from storage. @@ -348,7 +348,7 @@ namespace OpenSim.Region.Framework.Scenes /// Called immediately before an object is saved to storage. /// /// - /// The scene object being persisted. + /// The scene object being persisted. /// This is actually a copy of the original scene object so changes made here will be saved to storage but will not be kept in memory. /// /// @@ -367,7 +367,7 @@ namespace OpenSim.Region.Framework.Scenes public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed); public delegate void RegionUp(GridRegion region); - public event RegionUp OnRegionUp; + public event RegionUp OnRegionUp; public class MoneyTransferArgs : EventArgs { @@ -688,7 +688,7 @@ namespace OpenSim.Region.Framework.Scenes } } - public void TriggerOnBackup(IRegionDataStore dstore, bool forced) + public void TriggerOnBackup(ISimulationDataService dstore, bool forced) { OnBackupDelegate handlerOnAttach = OnBackup; if (handlerOnAttach != null) @@ -2087,7 +2087,7 @@ namespace OpenSim.Region.Framework.Scenes } } } - } + } public void TriggerOnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObjectGroup originalSo) { @@ -2129,7 +2129,7 @@ namespace OpenSim.Region.Framework.Scenes } } } - } + } public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int local_id, IClientAPI remote_client) @@ -2151,6 +2151,6 @@ namespace OpenSim.Region.Framework.Scenes } } } - } + } } } diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index 3a3ec2b1dc..c75f8baf13 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs @@ -1,3 +1,30 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + using System; using System.Collections.Generic; using log4net; @@ -35,7 +62,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// This is added to the priority of all child prims, to make sure that the root prim update is sent to the - /// viewer before child prim updates. + /// viewer before child prim updates. /// The adjustment is added to child prims and subtracted from root prims, so the gap ends up /// being double. We do it both ways so that there is a still a priority delta even if the priority is already /// double.MinValue or double.MaxValue. @@ -123,9 +150,9 @@ namespace OpenSim.Region.Framework.Scenes if (entity is SceneObjectPart) { // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene - // before its scheduled update was triggered + // before its scheduled update was triggered //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; - entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; + entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; } else { @@ -152,15 +179,10 @@ namespace OpenSim.Region.Framework.Scenes Vector3 entityPos = entity.AbsolutePosition; if (entity is SceneObjectPart) { - SceneObjectGroup group = m_scene.GetGroupByPrim(entity.LocalId); - if (group == null) - { - entityPos = entity.AbsolutePosition; - } - else - { - entityPos = group.AbsolutePosition; - } + // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene + // before its scheduled update was triggered + //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; + entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; } else { diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index ccbd880b2c..867fb10b93 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -58,7 +58,8 @@ namespace OpenSim.Region.Framework.Scenes { m_log.Info("[PRIM INVENTORY]: Starting scripts in scene"); - foreach (EntityBase group in Entities) + EntityBase[] entities = Entities.GetEntities(); + foreach (EntityBase group in entities) { if (group is SceneObjectGroup) { @@ -132,7 +133,7 @@ namespace OpenSim.Region.Framework.Scenes item.Owner, item.Name, item.ID); return false; - } + } } /// @@ -1987,7 +1988,7 @@ namespace OpenSim.Region.Framework.Scenes return null; if (!Permissions.CanRezObject(group.PrimCount, item.OwnerID, pos)) - return null; + return null; if (!Permissions.BypassPermissions()) { @@ -2065,7 +2066,7 @@ namespace OpenSim.Region.Framework.Scenes List partList = null; lock (sog.Children) - partList = new List(sog.Children.Values); + partList = new List(sog.Children.Values); foreach (SceneObjectPart child in partList) child.Inventory.ChangeInventoryOwner(ownerID); @@ -2080,7 +2081,7 @@ namespace OpenSim.Region.Framework.Scenes List partList = null; lock (sog.Children) - partList = new List(sog.Children.Values); + partList = new List(sog.Children.Values); foreach (SceneObjectPart child in partList) { @@ -2090,7 +2091,7 @@ namespace OpenSim.Region.Framework.Scenes sog.SetOwnerId(groupID); sog.ApplyNextOwnerPermissions(); - } + } } foreach (uint localID in localIDs) diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index c511774d69..7788e43c18 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -116,9 +116,8 @@ namespace OpenSim.Region.Framework.Scenes /// public void RequestPrim(uint primLocalID, IClientAPI remoteClient) { - List EntityList = GetEntities(); - - foreach (EntityBase ent in EntityList) + EntityBase[] entityList = GetEntities(); + foreach (EntityBase ent in entityList) { if (ent is SceneObjectGroup) { @@ -138,9 +137,8 @@ namespace OpenSim.Region.Framework.Scenes /// public void SelectPrim(uint primLocalID, IClientAPI remoteClient) { - List EntityList = GetEntities(); - - foreach (EntityBase ent in EntityList) + EntityBase[] entityList = GetEntities(); + foreach (EntityBase ent in entityList) { if (ent is SceneObjectGroup) { @@ -166,7 +164,7 @@ namespace OpenSim.Region.Framework.Scenes List partList = null; lock (sog.Children) - partList = new List(sog.Children.Values); + partList = new List(sog.Children.Values); foreach (SceneObjectPart part in partList) { @@ -259,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List surfaceArgs) { - List EntityList = GetEntities(); + EntityBase[] EntityList = GetEntities(); SurfaceTouchEventArgs surfaceArg = null; if (surfaceArgs != null && surfaceArgs.Count > 0) @@ -303,7 +301,7 @@ namespace OpenSim.Region.Framework.Scenes public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List surfaceArgs) { - List EntityList = GetEntities(); + EntityBase[] EntityList = GetEntities(); SurfaceTouchEventArgs surfaceArg = null; if (surfaceArgs != null && surfaceArgs.Count > 0) @@ -343,7 +341,7 @@ namespace OpenSim.Region.Framework.Scenes public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List surfaceArgs) { - List EntityList = GetEntities(); + EntityBase[] EntityList = GetEntities(); SurfaceTouchEventArgs surfaceArg = null; if (surfaceArgs != null && surfaceArgs.Count > 0) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index 4e80bf2e32..06890a02e1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs @@ -997,6 +997,6 @@ namespace OpenSim.Region.Framework.Scenes } } return true; - } + } } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index be342abd19..0e1b4b18e2 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -57,55 +57,21 @@ namespace OpenSim.Region.Framework.Scenes public partial class Scene : SceneBase { - public delegate void SynchronizeSceneHandler(Scene scene); - public SynchronizeSceneHandler SynchronizeScene = null; - - /* Used by the loadbalancer plugin on GForge */ - protected int m_splitRegionID = 0; - public int SplitRegionID - { - get { return m_splitRegionID; } - set { m_splitRegionID = value; } - } - private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L; private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L; + public delegate void SynchronizeSceneHandler(Scene scene); + #region Fields - protected Timer m_restartWaitTimer = new Timer(); - + public SynchronizeSceneHandler SynchronizeScene; public SimStatsReporter StatsReporter; - - protected List m_regionRestartNotifyList = new List(); - protected List m_neighbours = new List(); - - private volatile int m_bordersLocked = 0; - public bool BordersLocked - { - get { return m_bordersLocked == 1; } - set - { - if (value == true) - m_bordersLocked = 1; - else - m_bordersLocked = 0; - } - } public List NorthBorders = new List(); public List EastBorders = new List(); public List SouthBorders = new List(); public List WestBorders = new List(); - /// - /// The scene graph for this scene - /// - /// TODO: Possibly stop other classes being able to manipulate this directly. - private SceneGraph m_sceneGraph; - - /// - /// Are we applying physics to any of the prims in this scene? - /// + /// Are we applying physics to any of the prims in this scene? public bool m_physicalPrim; public float m_maxNonphys = 256; public float m_maxPhys = 10; @@ -119,25 +85,131 @@ namespace OpenSim.Region.Framework.Scenes // root agents when ACL denies access to root agent public bool m_strictAccessControl = true; public int MaxUndoCount = 5; + public bool LoginsDisabled = true; + public bool LoadingPrims; + public IXfer XferManager; + + // the minimum time that must elapse before a changed object will be considered for persisted + public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L; + // the maximum time that must elapse before a changed object will be considered for persisted + public long m_persistAfter = DEFAULT_MAX_TIME_FOR_PERSISTENCE * 10000000L; + + protected int m_splitRegionID; + protected Timer m_restartWaitTimer = new Timer(); + protected List m_regionRestartNotifyList = new List(); + protected List m_neighbours = new List(); + protected string m_simulatorVersion = "OpenSimulator Server"; + protected ModuleLoader m_moduleLoader; + protected AgentCircuitManager m_authenticateHandler; + protected SceneCommunicationService m_sceneGridService; + protected ISnmpModule m_snmpService = null; + + protected ISimulationDataService m_SimulationDataService; + protected IEstateDataService m_EstateDataService; + protected IAssetService m_AssetService; + protected IAuthorizationService m_AuthorizationService; + protected IInventoryService m_InventoryService; + protected IGridService m_GridService; + protected ILibraryService m_LibraryService; + protected ISimulationService m_simulationService; + protected IAuthenticationService m_AuthenticationService; + protected IPresenceService m_PresenceService; + protected IUserAccountService m_UserAccountService; + protected IAvatarService m_AvatarService; + protected IGridUserService m_GridUserService; + + protected IXMLRPC m_xmlrpcModule; + protected IWorldComm m_worldCommModule; + protected IAvatarFactory m_AvatarFactory; + protected IConfigSource m_config; + protected IRegionSerialiserModule m_serialiser; + protected IDialogModule m_dialogModule; + protected IEntityTransferModule m_teleportModule; + protected ICapabilitiesModule m_capsModule; + // Central Update Loop + protected int m_fps = 10; + protected uint m_frame; + protected float m_timespan = 0.089f; + protected DateTime m_lastupdate = DateTime.UtcNow; + + // TODO: Possibly stop other classes being able to manipulate this directly. + private SceneGraph m_sceneGraph; + private volatile int m_bordersLocked; private int m_RestartTimerCounter; private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing private int m_incrementsof15seconds; private volatile bool m_backingup; - private Dictionary m_returns = new Dictionary(); private Dictionary m_groupsWithTargets = new Dictionary(); + private Object m_heartbeatLock = new Object(); - protected string m_simulatorVersion = "OpenSimulator Server"; + private int m_update_physics = 1; + private int m_update_entitymovement = 1; + private int m_update_objects = 1; // Update objects which have scheduled themselves for updates + private int m_update_presences = 1; // Update scene presence movements + private int m_update_events = 1; + private int m_update_backup = 200; + private int m_update_terrain = 50; + private int m_update_land = 1; + private int m_update_coarse_locations = 50; - protected ModuleLoader m_moduleLoader; - protected StorageManager m_storageManager; - protected AgentCircuitManager m_authenticateHandler; + private int frameMS; + private int physicsMS2; + private int physicsMS; + private int otherMS; + private int tempOnRezMS; + private int eventMS; + private int backupMS; + private int terrainMS; + private int landMS; + private int lastCompletedFrame; - protected SceneCommunicationService m_sceneGridService; - public bool LoginsDisabled = true; - public bool LoadingPrims = false; public bool CombineRegions = false; + private bool m_physics_enabled = true; + private bool m_scripts_enabled = true; + private string m_defaultScriptEngine; + private int m_LastLogin; + private Thread HeartbeatThread; + private volatile bool shuttingdown; + private int m_lastUpdate; + private bool m_firstHeartbeat = true; + + private object m_deleting_scene_object = new object(); + private object m_cleaningAttachments = new object(); + + private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; + private bool m_reprioritizationEnabled = true; + private double m_reprioritizationInterval = 5000.0; + private double m_rootReprioritizationDistance = 10.0; + private double m_childReprioritizationDistance = 20.0; + + private Timer m_mapGenerationTimer = new Timer(); + private bool m_generateMaptiles; + + #endregion Fields + + #region Properties + + /* Used by the loadbalancer plugin on GForge */ + public int SplitRegionID + { + get { return m_splitRegionID; } + set { m_splitRegionID = value; } + } + + public bool BordersLocked + { + get { return m_bordersLocked == 1; } + set + { + if (value == true) + m_bordersLocked = 1; + else + m_bordersLocked = 0; + } + } + public new float TimeDilation { get { return m_sceneGraph.PhysicsScene.TimeDilation; } @@ -148,9 +220,6 @@ namespace OpenSim.Region.Framework.Scenes get { return m_sceneGridService; } } - public IXfer XferManager; - - protected ISnmpModule m_snmpService = null; public ISnmpModule SnmpService { get @@ -164,10 +233,41 @@ namespace OpenSim.Region.Framework.Scenes } } - protected IAssetService m_AssetService; - protected IAuthorizationService m_AuthorizationService; + public ISimulationDataService SimulationDataService + { + get + { + if (m_SimulationDataService == null) + { + m_SimulationDataService = RequestModuleInterface(); - private Object m_heartbeatLock = new Object(); + if (m_SimulationDataService == null) + { + throw new Exception("No ISimulationDataService available."); + } + } + + return m_SimulationDataService; + } + } + + public IEstateDataService EstateDataService + { + get + { + if (m_EstateDataService == null) + { + m_EstateDataService = RequestModuleInterface(); + + if (m_EstateDataService == null) + { + throw new Exception("No IEstateDataService available."); + } + } + + return m_EstateDataService; + } + } public IAssetService AssetService { @@ -206,8 +306,6 @@ namespace OpenSim.Region.Framework.Scenes } } - protected IInventoryService m_InventoryService; - public IInventoryService InventoryService { get @@ -226,8 +324,6 @@ namespace OpenSim.Region.Framework.Scenes } } - protected IGridService m_GridService; - public IGridService GridService { get @@ -246,8 +342,6 @@ namespace OpenSim.Region.Framework.Scenes } } - protected ILibraryService m_LibraryService; - public ILibraryService LibraryService { get @@ -259,7 +353,6 @@ namespace OpenSim.Region.Framework.Scenes } } - protected ISimulationService m_simulationService; public ISimulationService SimulationService { get @@ -270,7 +363,6 @@ namespace OpenSim.Region.Framework.Scenes } } - protected IAuthenticationService m_AuthenticationService; public IAuthenticationService AuthenticationService { get @@ -281,7 +373,6 @@ namespace OpenSim.Region.Framework.Scenes } } - protected IPresenceService m_PresenceService; public IPresenceService PresenceService { get @@ -291,7 +382,7 @@ namespace OpenSim.Region.Framework.Scenes return m_PresenceService; } } - protected IUserAccountService m_UserAccountService; + public IUserAccountService UserAccountService { get @@ -302,8 +393,7 @@ namespace OpenSim.Region.Framework.Scenes } } - protected OpenSim.Services.Interfaces.IAvatarService m_AvatarService; - public OpenSim.Services.Interfaces.IAvatarService AvatarService + public IAvatarService AvatarService { get { @@ -313,7 +403,6 @@ namespace OpenSim.Region.Framework.Scenes } } - protected IGridUserService m_GridUserService; public IGridUserService GridUserService { get @@ -324,58 +413,18 @@ namespace OpenSim.Region.Framework.Scenes } } - protected IXMLRPC m_xmlrpcModule; - protected IWorldComm m_worldCommModule; public IAttachmentsModule AttachmentsModule { get; set; } - protected IAvatarFactory m_AvatarFactory; + public IAvatarFactory AvatarFactory { get { return m_AvatarFactory; } } - protected IConfigSource m_config; - protected IRegionSerialiserModule m_serialiser; - protected IDialogModule m_dialogModule; - protected IEntityTransferModule m_teleportModule; - protected ICapabilitiesModule m_capsModule; public ICapabilitiesModule CapsModule { get { return m_capsModule; } } - protected override IConfigSource GetConfig() - { - return m_config; - } - - // Central Update Loop - - protected int m_fps = 10; - protected uint m_frame; - protected float m_timespan = 0.089f; - protected DateTime m_lastupdate = DateTime.UtcNow; - - private int m_update_physics = 1; - private int m_update_entitymovement = 1; - private int m_update_objects = 1; // Update objects which have scheduled themselves for updates - private int m_update_presences = 1; // Update scene presence movements - private int m_update_events = 1; - private int m_update_backup = 200; - private int m_update_terrain = 50; - private int m_update_land = 1; - private int m_update_coarse_locations = 50; - - private int frameMS; - private int physicsMS2; - private int physicsMS; - private int otherMS; - private int tempOnRezMS; - private int eventMS; - private int backupMS; - private int terrainMS; - private int landMS; - private int lastCompletedFrame; - public int MonitorFrameTime { get { return frameMS; } } public int MonitorPhysicsUpdateTime { get { return physicsMS; } } public int MonitorPhysicsSyncTime { get { return physicsMS2; } } @@ -387,37 +436,6 @@ namespace OpenSim.Region.Framework.Scenes public int MonitorLandTime { get { return landMS; } } public int MonitorLastFrameTick { get { return lastCompletedFrame; } } - private bool m_physics_enabled = true; - private bool m_scripts_enabled = true; - private string m_defaultScriptEngine; - private int m_LastLogin; - private Thread HeartbeatThread; - private volatile bool shuttingdown; - - private int m_lastUpdate; - private bool m_firstHeartbeat = true; - - private object m_deleting_scene_object = new object(); - private object m_cleaningAttachments = new object(); - - // the minimum time that must elapse before a changed object will be considered for persisted - public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L; - // the maximum time that must elapse before a changed object will be considered for persisted - public long m_persistAfter = DEFAULT_MAX_TIME_FOR_PERSISTENCE * 10000000L; - - private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; - private bool m_reprioritizationEnabled = true; - private double m_reprioritizationInterval = 5000.0; - private double m_rootReprioritizationDistance = 10.0; - private double m_childReprioritizationDistance = 20.0; - - private Timer m_mapGenerationTimer = new Timer(); - bool m_generateMaptiles = false; - - #endregion - - #region Properties - public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return m_priorityScheme; } } public bool IsReprioritizationEnabled { get { return m_reprioritizationEnabled; } } public double ReprioritizationInterval { get { return m_reprioritizationInterval; } } @@ -497,13 +515,13 @@ namespace OpenSim.Region.Framework.Scenes set { m_sceneGraph.RestorePresences = value; } } - #endregion + #endregion Properties #region Constructors public Scene(RegionInfo regInfo, AgentCircuitManager authen, SceneCommunicationService sceneGridService, - StorageManager storeManager, + ISimulationDataService simDataService, IEstateDataService estateDataService, ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) { @@ -539,7 +557,8 @@ namespace OpenSim.Region.Framework.Scenes m_moduleLoader = moduleLoader; m_authenticateHandler = authen; m_sceneGridService = sceneGridService; - m_storageManager = storeManager; + m_SimulationDataService = simDataService; + m_EstateDataService = estateDataService; m_regInfo = regInfo; m_regionHandle = m_regInfo.RegionHandle; m_regionName = m_regInfo.RegionName; @@ -558,13 +577,11 @@ namespace OpenSim.Region.Framework.Scenes #region Region Settings // Load region settings - m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID); - m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(m_regInfo.RegionID); + m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(m_regInfo.RegionID); - if (m_storageManager.EstateDataStore != null) - { - m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); - } + m_regInfo.RegionSettings = simDataService.LoadRegionSettings(m_regInfo.RegionID); + if (estateDataService != null) + m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false); #endregion Region Settings @@ -574,9 +591,9 @@ namespace OpenSim.Region.Framework.Scenes //Bind Storage Manager functions to some land manager functions for this scene EventManager.OnLandObjectAdded += - new EventManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject); + new EventManager.LandObjectAdded(simDataService.StoreLandObject); EventManager.OnLandObjectRemoved += - new EventManager.LandObjectRemoved(m_storageManager.DataStore.RemoveLandObject); + new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); m_sceneGraph = new SceneGraph(this, m_regInfo); @@ -1062,29 +1079,30 @@ namespace OpenSim.Region.Framework.Scenes if (ScriptEngine) { m_log.Info("Stopping all Scripts in Scene"); - foreach (EntityBase ent in Entities) + + EntityBase[] entities = Entities.GetEntities(); + foreach (EntityBase ent in entities) { if (ent is SceneObjectGroup) - { - ((SceneObjectGroup) ent).RemoveScriptInstances(false); - } + ((SceneObjectGroup)ent).RemoveScriptInstances(false); } } else { m_log.Info("Starting all Scripts in Scene"); - lock (Entities) + + EntityBase[] entities = Entities.GetEntities(); + foreach (EntityBase ent in entities) { - foreach (EntityBase ent in Entities) + if (ent is SceneObjectGroup) { - if (ent is SceneObjectGroup) - { - ((SceneObjectGroup)ent).CreateScriptInstances(0, false, DefaultScriptEngine, 0); - ((SceneObjectGroup)ent).ResumeScripts(); - } + SceneObjectGroup sog = (SceneObjectGroup)ent; + sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0); + sog.ResumeScripts(); } } } + m_scripts_enabled = !ScriptEngine; m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); } @@ -1131,12 +1149,12 @@ namespace OpenSim.Region.Framework.Scenes shuttingdown = true; m_log.Debug("[SCENE]: Persisting changed objects"); - List entities = GetEntities(); + EntityBase[] entities = GetEntities(); foreach (EntityBase entity in entities) { if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged) { - ((SceneObjectGroup)entity).ProcessBackup(m_storageManager.DataStore, false); + ((SceneObjectGroup)entity).ProcessBackup(SimulationDataService, false); } } @@ -1192,8 +1210,9 @@ namespace OpenSim.Region.Framework.Scenes while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) { MainConsole.Instance.Output("The current estate has no owner set."); - string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test"); - string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User"); + List excluded = new List(new char[1]{' '}); + string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded); + string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded); UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last); @@ -1577,7 +1596,7 @@ namespace OpenSim.Region.Framework.Scenes { lock (m_returns) { - EventManager.TriggerOnBackup(m_storageManager.DataStore, forced); + EventManager.TriggerOnBackup(SimulationDataService, forced); m_backingup = false; foreach (KeyValuePair ret in m_returns) @@ -1618,7 +1637,7 @@ namespace OpenSim.Region.Framework.Scenes { if (group != null) { - group.ProcessBackup(m_storageManager.DataStore, true); + group.ProcessBackup(SimulationDataService, true); } } @@ -1660,20 +1679,19 @@ namespace OpenSim.Region.Framework.Scenes /// public void SaveTerrain() { - m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); + SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); } public void StoreWindlightProfile(RegionLightShareData wl) { m_regInfo.WindlightSettings = wl; - wl.Save(); - m_storageManager.DataStore.StoreRegionWindlightSettings(wl); + SimulationDataService.StoreRegionWindlightSettings(wl); m_eventManager.TriggerOnSaveNewWindlightProfile(); } public void LoadWindlightProfile() { - m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(RegionInfo.RegionID); + m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(RegionInfo.RegionID); m_eventManager.TriggerOnSaveNewWindlightProfile(); } @@ -1684,13 +1702,13 @@ namespace OpenSim.Region.Framework.Scenes { try { - double[,] map = m_storageManager.DataStore.LoadTerrain(RegionInfo.RegionID); + double[,] map = SimulationDataService.LoadTerrain(RegionInfo.RegionID); if (map == null) { m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain."); Heightmap = new TerrainChannel(); - m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); + SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); } else { @@ -1707,7 +1725,7 @@ namespace OpenSim.Region.Framework.Scenes { Heightmap = new TerrainChannel(); - m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); + SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); } } catch (Exception e) @@ -1754,7 +1772,7 @@ namespace OpenSim.Region.Framework.Scenes public void loadAllLandObjectsFromStorage(UUID regionID) { m_log.Info("[SCENE]: Loading land objects from storage"); - List landData = m_storageManager.DataStore.LoadLandObjects(regionID); + List landData = SimulationDataService.LoadLandObjects(regionID); if (LandChannel != null) { @@ -1785,7 +1803,7 @@ namespace OpenSim.Region.Framework.Scenes LoadingPrims = true; m_log.Info("[SCENE]: Loading objects from datastore"); - List PrimsFromDB = m_storageManager.DataStore.LoadObjects(regionID); + List PrimsFromDB = SimulationDataService.LoadObjects(regionID); m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count + " objects from the datastore"); @@ -1978,7 +1996,7 @@ namespace OpenSim.Region.Framework.Scenes sceneObject.ScheduleGroupForFullUpdate(); return sceneObject; - } + } /// /// Add an object into the scene that has come from storage @@ -2074,7 +2092,7 @@ namespace OpenSim.Region.Framework.Scenes /// public bool AddNewSceneObject( SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) - { + { return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel); } @@ -2094,8 +2112,7 @@ namespace OpenSim.Region.Framework.Scenes List toReturn = new List(); lock (Entities) { - ICollection entities = new List(Entities); - + EntityBase[] entities = Entities.GetEntities(); foreach (EntityBase e in entities) { if (e is SceneObjectGroup) @@ -2190,12 +2207,12 @@ namespace OpenSim.Region.Framework.Scenes // group has recently been delinked from another group but that this change has not been persisted // to the DB. ForceSceneObjectBackup(so); - so.DetachFromBackup(); - m_storageManager.DataStore.RemoveObject(so.UUID, m_regInfo.RegionID); + so.DetachFromBackup(); + SimulationDataService.RemoveObject(so.UUID, m_regInfo.RegionID); } // We need to keep track of this state in case this group is still queued for further backup. - so.IsDeleted = true; + so.IsDeleted = true; return true; } @@ -2482,7 +2499,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence sp = GetScenePresence(userID); if (sp != null && AttachmentsModule != null) { - uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID); + uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID); AttachmentsModule.RezSingleAttachmentFromInventory(sp.ControllingClient, itemID, attPt); } @@ -2531,7 +2548,7 @@ namespace OpenSim.Region.Framework.Scenes sceneObject.RootPart.AddFlag(PrimFlags.Phantom); // Don't sent a full update here because this will cause full updates to be sent twice for - // attachments on region crossings, resulting in viewer glitches. + // attachments on region crossings, resulting in viewer glitches. AddRestoredSceneObject(sceneObject, false, false, false); // Handle attachment special case @@ -2788,7 +2805,7 @@ namespace OpenSim.Region.Framework.Scenes } public virtual void SubscribeToClientPrimEvents(IClientAPI client) - { + { client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition; client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation; @@ -2824,7 +2841,7 @@ namespace OpenSim.Region.Framework.Scenes client.OnUndo += m_sceneGraph.HandleUndo; client.OnRedo += m_sceneGraph.HandleRedo; client.OnObjectDescription += m_sceneGraph.PrimDescription; - client.OnObjectDrop += m_sceneGraph.DropObject; + client.OnObjectDrop += m_sceneGraph.DropObject; client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable; client.OnObjectOwner += ObjectOwner; } @@ -3804,7 +3821,7 @@ namespace OpenSim.Region.Framework.Scenes public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) { ScenePresence presence = GetScenePresence(agentID); - if(presence != null) + if (presence != null) { try { @@ -4083,6 +4100,11 @@ namespace OpenSim.Region.Framework.Scenes #region Other Methods + protected override IConfigSource GetConfig() + { + return m_config; + } + #endregion public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) @@ -4107,9 +4129,8 @@ namespace OpenSim.Region.Framework.Scenes /// public void ForceClientUpdate() { - List EntityList = GetEntities(); - - foreach (EntityBase ent in EntityList) + EntityBase[] entityList = GetEntities(); + foreach (EntityBase ent in entityList) { if (ent is SceneObjectGroup) { @@ -4127,9 +4148,8 @@ namespace OpenSim.Region.Framework.Scenes { m_log.Debug("Searching for Primitive: '" + cmdparams[2] + "'"); - List EntityList = GetEntities(); - - foreach (EntityBase ent in EntityList) + EntityBase[] entityList = GetEntities(); + foreach (EntityBase ent in entityList) { if (ent is SceneObjectGroup) { @@ -4498,7 +4518,7 @@ namespace OpenSim.Region.Framework.Scenes /// will not affect the original list of objects in the scene. /// /// - public List GetEntities() + public EntityBase[] GetEntities() { return m_sceneGraph.GetEntities(); } @@ -4532,9 +4552,8 @@ namespace OpenSim.Region.Framework.Scenes public void CleanTempObjects() { - List objs = GetEntities(); - - foreach (EntityBase obj in objs) + EntityBase[] entities = GetEntities(); + foreach (EntityBase obj in entities) { if (obj is SceneObjectGroup) { @@ -4554,7 +4573,7 @@ namespace OpenSim.Region.Framework.Scenes public void DeleteFromStorage(UUID uuid) { - m_storageManager.DataStore.RemoveObject(uuid, m_regInfo.RegionID); + SimulationDataService.RemoveObject(uuid, m_regInfo.RegionID); } public int GetHealth() @@ -4963,17 +4982,21 @@ namespace OpenSim.Region.Framework.Scenes public List GetEstateRegions(int estateID) { - if (m_storageManager.EstateDataStore == null) - return new List(); + IEstateDataService estateDataService = EstateDataService; + if (estateDataService == null) + return new List(0); - return m_storageManager.EstateDataStore.GetRegions(estateID); + return estateDataService.GetRegions(estateID); } public void ReloadEstateData() { - m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); - - TriggerEstateSunUpdate(); + IEstateDataService estateDataService = EstateDataService; + if (estateDataService != null) + { + m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false); + TriggerEstateSunUpdate(); + } } public void TriggerEstateSunUpdate() diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index f8591ba8ad..c71aefadee 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -521,7 +521,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - /// + /// public void AddCommand( object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) { diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index a39f27ac1c..624640057d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -81,10 +81,7 @@ namespace OpenSim.Region.Framework.Scenes protected Dictionary m_scenePresenceMap = new Dictionary(); protected List m_scenePresenceArray = new List(); - // SceneObjects is not currently populated or used. - //public Dictionary SceneObjects; protected internal EntityManager Entities = new EntityManager(); -// protected internal Dictionary Entities = new Dictionary(); protected internal Dictionary RestorePresences = new Dictionary(); protected RegionInfo m_regInfo; @@ -323,7 +320,7 @@ namespace OpenSim.Region.Framework.Scenes /// Position of the object /// Rotation of the object /// Velocity of the object. This parameter only has an effect if the object is physical - /// + /// public bool AddNewSceneObject( SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) { @@ -347,7 +344,7 @@ namespace OpenSim.Region.Framework.Scenes } return true; - } + } /// /// Add an object to the scene. This will both update the scene, and send information about the @@ -370,69 +367,58 @@ namespace OpenSim.Region.Framework.Scenes if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero) return false; - lock (sceneObject) - { - if (Entities.ContainsKey(sceneObject.UUID)) - { -// m_log.WarnFormat( -// "[SCENE GRAPH]: Scene object {0} {1} was already in region {2} on add request", -// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName); - return false; - } - -// m_log.DebugFormat( -// "[SCENE GRAPH]: Adding object {0} {1} to region {2}", -// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName); - - lock (sceneObject.Children) - { - if (m_parentScene.m_clampPrimSize) - { - foreach (SceneObjectPart part in sceneObject.Children.Values) - { - Vector3 scale = part.Shape.Scale; - - if (scale.X > m_parentScene.m_maxNonphys) - scale.X = m_parentScene.m_maxNonphys; - if (scale.Y > m_parentScene.m_maxNonphys) - scale.Y = m_parentScene.m_maxNonphys; - if (scale.Z > m_parentScene.m_maxNonphys) - scale.Z = m_parentScene.m_maxNonphys; - - part.Shape.Scale = scale; - } - } - - m_numPrim += sceneObject.Children.Count; - } - - sceneObject.AttachToScene(m_parentScene); + if (Entities.ContainsKey(sceneObject.UUID)) + return false; - if (sendClientUpdates) - sceneObject.ScheduleGroupForFullUpdate(); - - Entities.Add(sceneObject); + List children; + lock (sceneObject.Children) + children = new List(sceneObject.Children.Values); - if (attachToBackup) - sceneObject.AttachToBackup(); + // Clamp child prim sizes and add child prims to the m_numPrim count + if (m_parentScene.m_clampPrimSize) + { + foreach (SceneObjectPart part in children) + { + Vector3 scale = part.Shape.Scale; - if (OnObjectCreate != null) - OnObjectCreate(sceneObject); - - lock (SceneObjectGroupsByFullID) - { - SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; - foreach (SceneObjectPart part in sceneObject.Children.Values) - SceneObjectGroupsByFullID[part.UUID] = sceneObject; - } - - lock (SceneObjectGroupsByLocalID) - { - SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; - foreach (SceneObjectPart part in sceneObject.Children.Values) - SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; + if (scale.X > m_parentScene.m_maxNonphys) + scale.X = m_parentScene.m_maxNonphys; + if (scale.Y > m_parentScene.m_maxNonphys) + scale.Y = m_parentScene.m_maxNonphys; + if (scale.Z > m_parentScene.m_maxNonphys) + scale.Z = m_parentScene.m_maxNonphys; + + part.Shape.Scale = scale; } } + m_numPrim += children.Count; + + sceneObject.AttachToScene(m_parentScene); + + if (sendClientUpdates) + sceneObject.ScheduleGroupForFullUpdate(); + + Entities.Add(sceneObject); + + if (attachToBackup) + sceneObject.AttachToBackup(); + + if (OnObjectCreate != null) + OnObjectCreate(sceneObject); + + lock (SceneObjectGroupsByFullID) + { + SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; + foreach (SceneObjectPart part in children) + SceneObjectGroupsByFullID[part.UUID] = sceneObject; + } + + lock (SceneObjectGroupsByLocalID) + { + SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; + foreach (SceneObjectPart part in children) + SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; + } return true; } @@ -443,42 +429,38 @@ namespace OpenSim.Region.Framework.Scenes /// true if the object was deleted, false if there was no object to delete public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked) { - if (Entities.ContainsKey(uuid)) + EntityBase entity; + if (!Entities.TryGetValue(uuid, out entity) && entity is SceneObjectGroup) + return false; + + SceneObjectGroup grp = (SceneObjectGroup)entity; + + if (!resultOfObjectLinked) { - SceneObjectGroup grp = (SceneObjectGroup)Entities[uuid]; + m_numPrim -= grp.PrimCount; - if (!resultOfObjectLinked) - { - m_numPrim -= grp.PrimCount; - - if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) - RemovePhysicalPrim(grp.PrimCount); - } - - if (OnObjectRemove != null) - OnObjectRemove(Entities[uuid]); - - lock (SceneObjectGroupsByFullID) - { - foreach (SceneObjectPart part in grp.Children.Values) - SceneObjectGroupsByFullID.Remove(part.UUID); - SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID); - } - lock (SceneObjectGroupsByLocalID) - { - foreach (SceneObjectPart part in grp.Children.Values) - SceneObjectGroupsByLocalID.Remove(part.LocalId); - SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId); - } - - Entities.Remove(uuid); - //SceneObjectGroup part; - //((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) - - return true; + if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) + RemovePhysicalPrim(grp.PrimCount); } - return false; + if (OnObjectRemove != null) + OnObjectRemove(Entities[uuid]); + + lock (SceneObjectGroupsByFullID) + { + foreach (SceneObjectPart part in grp.Children.Values) + SceneObjectGroupsByFullID.Remove(part.UUID); + SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID); + } + + lock (SceneObjectGroupsByLocalID) + { + foreach (SceneObjectPart part in grp.Children.Values) + SceneObjectGroupsByLocalID.Remove(part.LocalId); + SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId); + } + + return Entities.Remove(uuid); } /// @@ -490,9 +472,7 @@ namespace OpenSim.Region.Framework.Scenes protected internal void AddToUpdateList(SceneObjectGroup obj) { lock (m_updateList) - { m_updateList[obj.UUID] = obj; - } } public void FireAttachToBackup(SceneObjectGroup obj) @@ -526,34 +506,39 @@ namespace OpenSim.Region.Framework.Scenes { if (!Monitor.TryEnter(m_updateLock)) return; - - List updates; - - // Some updates add more updates to the updateList. - // Get the current list of updates and clear the list before iterating - lock (m_updateList) + try { - updates = new List(m_updateList.Values); - m_updateList.Clear(); - } + List updates; - // Go through all updates - for (int i = 0; i < updates.Count; i++) - { - SceneObjectGroup sog = updates[i]; - - // Don't abort the whole update if one entity happens to give us an exception. - try + // Some updates add more updates to the updateList. + // Get the current list of updates and clear the list before iterating + lock (m_updateList) { - sog.Update(); + updates = new List(m_updateList.Values); + m_updateList.Clear(); } - catch (Exception e) + + // Go through all updates + for (int i = 0; i < updates.Count; i++) { - m_log.ErrorFormat( - "[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e); + SceneObjectGroup sog = updates[i]; + + // Don't abort the whole update if one entity happens to give us an exception. + try + { + sog.Update(); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e); + } } } - Monitor.Exit(m_updateLock); + finally + { + Monitor.Exit(m_updateLock); + } } protected internal void AddPhysicalPrim(int number) @@ -920,38 +905,38 @@ namespace OpenSim.Region.Framework.Scenes /// null if no scene object group containing that prim is found public SceneObjectGroup GetGroupByPrim(uint localID) { - if (Entities.ContainsKey(localID)) - return Entities[localID] as SceneObjectGroup; + EntityBase entity; + if (Entities.TryGetValue(localID, out entity)) + return entity as SceneObjectGroup; //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); SceneObjectGroup sog; lock (SceneObjectGroupsByLocalID) + SceneObjectGroupsByLocalID.TryGetValue(localID, out sog); + + if (sog != null) { - if (SceneObjectGroupsByLocalID.TryGetValue(localID, out sog)) - { - if (sog.HasChildPrim(localID)) - return sog; - SceneObjectGroupsByLocalID.Remove(localID); - } + if (sog.HasChildPrim(localID)) + return sog; + SceneObjectGroupsByLocalID.Remove(localID); } - List EntityList = GetEntities(); - foreach (EntityBase ent in EntityList) + EntityBase[] entityList = GetEntities(); + foreach (EntityBase ent in entityList) { //m_log.DebugFormat("Looking at entity {0}", ent.UUID); if (ent is SceneObjectGroup) { - if (((SceneObjectGroup)ent).HasChildPrim(localID)) + sog = (SceneObjectGroup)ent; + if (sog.HasChildPrim(localID)) { - sog = (SceneObjectGroup)ent; lock (SceneObjectGroupsByLocalID) - { SceneObjectGroupsByLocalID[localID] = sog; - } return sog; } } } + return null; } @@ -964,36 +949,35 @@ namespace OpenSim.Region.Framework.Scenes { SceneObjectGroup sog; lock (SceneObjectGroupsByFullID) + SceneObjectGroupsByFullID.TryGetValue(fullID, out sog); + + if (sog != null) { - if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog)) + lock (sog.Children) { - lock (sog.Children) - { - if (sog.Children.ContainsKey(fullID)) - return sog; - } - - SceneObjectGroupsByFullID.Remove(fullID); + if (sog.Children.ContainsKey(fullID)) + return sog; } + + lock (SceneObjectGroupsByFullID) + SceneObjectGroupsByFullID.Remove(fullID); } - List EntityList = GetEntities(); - - foreach (EntityBase ent in EntityList) + EntityBase[] entityList = GetEntities(); + foreach (EntityBase ent in entityList) { if (ent is SceneObjectGroup) { - if (((SceneObjectGroup)ent).HasChildPrim(fullID)) + sog = (SceneObjectGroup)ent; + if (sog.HasChildPrim(fullID)) { - sog = (SceneObjectGroup)ent; lock (SceneObjectGroupsByFullID) - { SceneObjectGroupsByFullID[fullID] = sog; - } return sog; } } } + return null; } @@ -1002,7 +986,7 @@ namespace OpenSim.Region.Framework.Scenes // Primitive Ray Tracing float closestDistance = 280f; EntityIntersection result = new EntityIntersection(); - List EntityList = GetEntities(); + EntityBase[] EntityList = GetEntities(); foreach (EntityBase ent in EntityList) { if (ent is SceneObjectGroup) @@ -1040,23 +1024,28 @@ namespace OpenSim.Region.Framework.Scenes /// null if the part was not found protected internal SceneObjectPart GetSceneObjectPart(string name) { - List EntityList = GetEntities(); + SceneObjectPart sop = null; - // FIXME: use a dictionary here - foreach (EntityBase ent in EntityList) - { - if (ent is SceneObjectGroup) + Entities.Find( + delegate(EntityBase entity) { - foreach (SceneObjectPart p in ((SceneObjectGroup) ent).GetParts()) + if (entity is SceneObjectGroup) { - if (p.Name == name) + foreach (SceneObjectPart p in ((SceneObjectGroup)entity).GetParts()) { - return p; + if (p.Name == name) + { + sop = p; + return true; + } } } + + return false; } - } - return null; + ); + + return sop; } /// @@ -1077,7 +1066,7 @@ namespace OpenSim.Region.Framework.Scenes /// it /// /// - protected internal List GetEntities() + protected internal EntityBase[] GetEntities() { return Entities.GetEntities(); } @@ -1086,7 +1075,7 @@ namespace OpenSim.Region.Framework.Scenes { Dictionary topScripts = new Dictionary(); - List EntityList = GetEntities(); + EntityBase[] EntityList = GetEntities(); int limit = 0; foreach (EntityBase ent in EntityList) { @@ -1140,7 +1129,7 @@ namespace OpenSim.Region.Framework.Scenes /// protected internal void ForEachSOG(Action action) { - List objlist = Entities.GetAllByType(); + EntityBase[] objlist = Entities.GetAllByType(); foreach (EntityBase ent in objlist) { SceneObjectGroup obj = (SceneObjectGroup)ent; @@ -1353,7 +1342,7 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectGroup group = GetGroupByPrim(localID); if (group != null) - { + { if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) { if (m_parentScene.AttachmentsModule != null) @@ -1798,8 +1787,8 @@ namespace OpenSim.Region.Framework.Scenes UUID objid = UUID.Zero; SceneObjectPart obj = null; - List EntityList = GetEntities(); - foreach (EntityBase ent in EntityList) + EntityBase[] entityList = GetEntities(); + foreach (EntityBase ent in entityList) { if (ent is SceneObjectGroup) { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 470fdd796d..a952508e3f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1326,7 +1326,7 @@ namespace OpenSim.Region.Framework.Scenes AbsolutePosition = detachedpos; m_rootPart.AttachedAvatar = UUID.Zero; - //Anakin Lohner bug #3839 + //Anakin Lohner bug #3839 lock (m_parts) { foreach (SceneObjectPart p in m_parts.Values) @@ -1556,7 +1556,7 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Delete this group from its scene. + /// Delete this group from its scene. /// /// /// This only handles the in-world consequences of deletion (e.g. any avatars sitting on it are forcibly stood @@ -1731,12 +1731,12 @@ namespace OpenSim.Region.Framework.Scenes /// Processes backup. /// /// - public virtual void ProcessBackup(IRegionDataStore datastore, bool forcedBackup) + public virtual void ProcessBackup(ISimulationDataService datastore, bool forcedBackup) { if (!m_isBackedUp) { // m_log.DebugFormat( -// "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID); +// "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID); return; } @@ -1748,7 +1748,7 @@ namespace OpenSim.Region.Framework.Scenes } // Since this is the top of the section of call stack for backing up a particular scene object, don't let - // any exception propogate upwards. + // any exception propogate upwards. try { if (!m_scene.ShuttingDown || // if shutting down then there will be nothing to handle the return so leave till next restart @@ -1944,7 +1944,6 @@ namespace OpenSim.Region.Framework.Scenes part.PhysActor.LocalID = part.LocalId; part.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); } - } if (userExposed) { @@ -1954,7 +1953,6 @@ namespace OpenSim.Region.Framework.Scenes ScheduleGroupForFullUpdate(); } - } finally { @@ -2515,16 +2513,9 @@ namespace OpenSim.Region.Framework.Scenes /// null if a child part with the primID was not found public SceneObjectPart GetChildPart(UUID primID) { - SceneObjectPart childPart = null; - + SceneObjectPart childPart; lock (m_parts) - { - if (m_parts.ContainsKey(primID)) - { - childPart = m_parts[primID]; - } - } - + m_parts.TryGetValue(primID, out childPart); return childPart; } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index eefe8bb5f1..5c4a2a3b47 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -508,7 +508,14 @@ namespace OpenSim.Region.Framework.Scenes public UUID UUID { get { return m_uuid; } - set { m_uuid = value; } + set + { + m_uuid = value; + + // This is necessary so that TaskInventoryItem parent ids correctly reference the new uuid of this part + if (Inventory != null) + Inventory.ResetInventoryIDs(); + } } public uint LocalId @@ -1027,12 +1034,12 @@ namespace OpenSim.Region.Framework.Scenes return m_mediaUrl; } - set - { + set + { m_mediaUrl = value; if (ParentGroup != null) - ParentGroup.HasGroupChanged = true; + ParentGroup.HasGroupChanged = true; } } @@ -1045,7 +1052,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat("[SOP]: Setting CreateSelected to {0} for {1} {2}", value, Name, UUID); m_createSelected = value; } - } + } #endregion @@ -1207,7 +1214,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Property flags. See OpenMetaverse.PrimFlags - /// + /// /// Example properties are PrimFlags.Phantom and PrimFlags.DieAtEdge public PrimFlags Flags { @@ -1372,7 +1379,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Tell the scene presence that it should send updates for this part to its client - /// + /// public void AddFullUpdateToAvatar(ScenePresence presence) { presence.SceneViewer.QueuePartForUpdate(this); @@ -1431,7 +1438,7 @@ namespace OpenSim.Region.Framework.Scenes m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) { - if(!sp.IsChildAgent) + if (!sp.IsChildAgent) sp.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume); }); } @@ -1683,7 +1690,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat("[SCENE OBJECT PART]: Clone of {0} {1} finished", Name, UUID); - return dupe; + return dupe; } protected void AssetReceived(string id, Object sender, AssetBase asset) @@ -1993,10 +2000,10 @@ namespace OpenSim.Region.Framework.Scenes } public uint GetEffectiveObjectFlags() - { + { // Commenting this section of code out since it doesn't actually do anything, as enums are handled by // value rather than reference -// PrimFlags f = _flags; +// PrimFlags f = _flags; // if (m_parentGroup == null || m_parentGroup.RootPart == this) // f &= ~(PrimFlags.Touch | PrimFlags.Money); @@ -2793,7 +2800,6 @@ namespace OpenSim.Region.Framework.Scenes UUID = UUID.Random(); LinkNum = linkNum; LocalId = 0; - Inventory.ResetInventoryIDs(); } /// @@ -4756,7 +4762,7 @@ namespace OpenSim.Region.Framework.Scenes if (ParentGroup == null || ParentGroup.IsDeleted) return; - if (IsAttachment && ParentGroup.RootPart != this) + if (IsAttachment && ParentGroup.RootPart != this) return; // Causes this thread to dig into the Client Thread Data. diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 1959427cf3..2de439b605 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -125,7 +125,7 @@ namespace OpenSim.Region.Framework.Scenes { m_items.LockItemsForWrite(true); - if (0 == Items.Count) + if (Items.Count == 0) { m_items.LockItemsForWrite(false); return; @@ -1010,7 +1010,7 @@ namespace OpenSim.Region.Framework.Scenes /// Process inventory backup /// /// - public void ProcessInventoryBackup(IRegionDataStore datastore) + public void ProcessInventoryBackup(ISimulationDataService datastore) { if (HasInventoryChanged) { @@ -1257,7 +1257,7 @@ namespace OpenSim.Region.Framework.Scenes engine.ResumeScript(item.ItemID); } } - } + } } Items.LockItemsForRead(false); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index d88f2ccd29..6d0ecf05b9 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1427,7 +1427,7 @@ namespace OpenSim.Region.Framework.Scenes // Setting parent ID would fix this, if we knew what value // to use. Or we could add a m_isSitting variable. //Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); - SitGround = true; + SitGround = true; } // In the future, these values might need to go global. diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs index f478a4a770..b45291fcba 100644 --- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs +++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs @@ -73,9 +73,10 @@ namespace OpenSim.Region.Framework.Scenes { m_pendingObjects = new Queue(); - lock(m_pendingObjects) + lock (m_pendingObjects) { - foreach (EntityBase e in m_presence.Scene.Entities) + EntityBase[] entities = m_presence.Scene.Entities.GetEntities(); + foreach (EntityBase e in entities) { if (e != null && e is SceneObjectGroup) m_pendingObjects.Enqueue((SceneObjectGroup)e); @@ -84,7 +85,7 @@ namespace OpenSim.Region.Framework.Scenes } } - lock(m_pendingObjects) + lock (m_pendingObjects) { while (m_pendingObjects != null && m_pendingObjects.Count > 0) { diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs index b6677f092e..5494549a3e 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs @@ -84,9 +84,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization int primCount = 0; stream.WriteLine("\n"); - List EntityList = scene.GetEntities(); - - foreach (EntityBase ent in EntityList) + EntityBase[] entityList = scene.GetEntities(); + foreach (EntityBase ent in entityList) { if (ent is SceneObjectGroup) { @@ -204,16 +203,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization public static void SavePrimsToXml2(Scene scene, string fileName) { - List EntityList = scene.GetEntities(); - - SavePrimListToXml2(EntityList, fileName); + EntityBase[] entityList = scene.GetEntities(); + SavePrimListToXml2(entityList, fileName); } public static void SavePrimsToXml2(Scene scene, TextWriter stream, Vector3 min, Vector3 max) { - List EntityList = scene.GetEntities(); - - SavePrimListToXml2(EntityList, stream, min, max); + EntityBase[] entityList = scene.GetEntities(); + SavePrimListToXml2(entityList, stream, min, max); } public static void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName) @@ -222,7 +219,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization "[SERIALISER]: Saving prims with name {0} in xml2 format for region {1} to {2}", primName, scene.RegionInfo.RegionName, fileName); - List entityList = scene.GetEntities(); + EntityBase[] entityList = scene.GetEntities(); List primList = new List(); foreach (EntityBase ent in entityList) @@ -236,10 +233,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } } - SavePrimListToXml2(primList, fileName); + SavePrimListToXml2(primList.ToArray(), fileName); } - public static void SavePrimListToXml2(List entityList, string fileName) + public static void SavePrimListToXml2(EntityBase[] entityList, string fileName) { FileStream file = new FileStream(fileName, FileMode.Create); try @@ -260,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } } - public static void SavePrimListToXml2(List entityList, TextWriter stream, Vector3 min, Vector3 max) + public static void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max) { int primCount = 0; stream.WriteLine("\n"); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index c9662ef9eb..7d9a6a9e99 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs @@ -71,7 +71,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(dupeSo.Children.Count, Is.EqualTo(2)); SceneObjectPart dupePart1 = dupeSo.GetLinkNumPart(1); - SceneObjectPart dupePart2 = dupeSo.GetLinkNumPart(2); + SceneObjectPart dupePart2 = dupeSo.GetLinkNumPart(2); Assert.That(dupePart1.LocalId, Is.Not.EqualTo(part1.LocalId)); Assert.That(dupePart2.LocalId, Is.Not.EqualTo(part2.LocalId)); @@ -84,6 +84,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(dupePart1.PhysActor, Is.Not.Null); Assert.That(dupePart2.PhysActor, Is.Not.Null); */ - } + } } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index e3ef263b11..60824be683 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs @@ -270,7 +270,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - TestScene scene = SceneSetupHelpers.SetupScene(); + TestScene scene = SceneSetupHelpers.SetupScene(); string rootPartName = "rootpart"; UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); @@ -282,17 +282,17 @@ namespace OpenSim.Region.Framework.Scenes.Tests { Name = rootPartName, UUID = rootPartUuid }; SceneObjectPart linkPart = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) - { Name = linkPartName, UUID = linkPartUuid }; + { Name = linkPartName, UUID = linkPartUuid }; SceneObjectGroup sog = new SceneObjectGroup(rootPart); - sog.AddPart(linkPart); - scene.AddNewSceneObject(sog, true); + sog.AddPart(linkPart); + scene.AddNewSceneObject(sog, true); // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked // scene backup thread. scene.Backup(true); - List storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID); + List storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID); Assert.That(storedObjects.Count, Is.EqualTo(1)); Assert.That(storedObjects[0].Children.Count, Is.EqualTo(2)); @@ -309,7 +309,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - TestScene scene = SceneSetupHelpers.SetupScene(); + TestScene scene = SceneSetupHelpers.SetupScene(); string rootPartName = "rootpart"; UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); @@ -321,11 +321,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests { Name = rootPartName, UUID = rootPartUuid }; SceneObjectPart linkPart = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) - { Name = linkPartName, UUID = linkPartUuid }; + { Name = linkPartName, UUID = linkPartUuid }; SceneObjectGroup sog = new SceneObjectGroup(rootPart); - sog.AddPart(linkPart); - scene.AddNewSceneObject(sog, true); + sog.AddPart(linkPart); + scene.AddNewSceneObject(sog, true); // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked // scene backup thread. @@ -333,9 +333,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests // These changes should occur immediately without waiting for a backup pass SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false); - scene.DeleteSceneObject(groupToDelete, false); + scene.DeleteSceneObject(groupToDelete, false); - List storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID); + List storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID); Assert.That(storedObjects.Count, Is.EqualTo(1)); Assert.That(storedObjects[0].Children.Count, Is.EqualTo(1)); diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index da8199ddf4..fe59d4f031 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs @@ -59,8 +59,8 @@ namespace OpenSim.Region.Framework.Tests string userFirstName = "Jock"; string userLastName = "Stirrup"; string userPassword = "troll"; - UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); - return UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword); + UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); + return UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword); } protected SceneObjectGroup CreateSO1(Scene scene, UUID ownerId) @@ -70,14 +70,16 @@ namespace OpenSim.Region.Framework.Tests SceneObjectPart part1 = new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) { Name = part1Name, UUID = part1Id }; - return new SceneObjectGroup(part1); + return new SceneObjectGroup(part1); } protected TaskInventoryItem CreateSOItem1(Scene scene, SceneObjectPart part) { - AssetNotecard nc = new AssetNotecard("Hello World!"); + AssetNotecard nc = new AssetNotecard(); + nc.BodyText = "Hello World!"; + nc.Encode(); UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); - UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); + UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); AssetBase ncAsset = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero); scene.AssetService.Store(ncAsset); @@ -112,9 +114,9 @@ namespace OpenSim.Region.Framework.Tests scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID); InventoryItemBase ncUserItem - = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem"); + = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem"); Assert.That(ncUserItem, Is.Not.Null, "Objects/ncItem was not found"); - } + } /// /// Test MoveTaskInventoryItem where the item has no parent folder assigned. @@ -136,7 +138,7 @@ namespace OpenSim.Region.Framework.Tests scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); InventoryItemBase ncUserItem - = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem"); + = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem"); Assert.That(ncUserItem, Is.Not.Null, "Notecards/ncItem was not found"); } } diff --git a/OpenSim/Region/Framework/StorageManager.cs b/OpenSim/Region/Framework/StorageManager.cs deleted file mode 100644 index 9375b4add2..0000000000 --- a/OpenSim/Region/Framework/StorageManager.cs +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Reflection; -using log4net; -using OpenSim.Region.Framework.Interfaces; - -namespace OpenSim.Region.Framework -{ - public class StorageManager - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - protected IRegionDataStore m_dataStore; - - public IRegionDataStore DataStore - { - get { return m_dataStore; } - } - - private IEstateDataStore m_estateDataStore; - - public IEstateDataStore EstateDataStore - { - get { return m_estateDataStore; } - } - - public StorageManager(IRegionDataStore storage) - { - m_dataStore = storage; - } - - public StorageManager(string dllName, string connectionstring, string estateconnectionstring) - { - m_log.Info("[DATASTORE]: Attempting to load " + dllName); - Assembly pluginAssembly = Assembly.LoadFrom(dllName); - - foreach (Type pluginType in pluginAssembly.GetTypes()) - { - if (pluginType.IsPublic) - { - Type typeInterface = pluginType.GetInterface("IRegionDataStore", true); - - if (typeInterface != null) - { - IRegionDataStore plug = - (IRegionDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); - plug.Initialise(connectionstring); - - m_dataStore = plug; - - m_log.Info("[DATASTORE]: Added IRegionDataStore Interface"); - } - - typeInterface = pluginType.GetInterface("IEstateDataStore", true); - - if (typeInterface != null) - { - IEstateDataStore estPlug = - (IEstateDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); - estPlug.Initialise(estateconnectionstring); - - m_estateDataStore = estPlug; - } - } - } - - //TODO: Add checking and warning to make sure it initialised. - } - } -} diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index b98aabeed0..4ab67aa883 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -375,8 +375,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server private void IRC_SendNamesReply() { - List users = m_scene.Entities.GetAllByType(); - + EntityBase[] users = m_scene.Entities.GetAllByType(); foreach (EntityBase user in users) { SendServerCommand("353 " + m_nick + " = " + IrcRegionName + " :" + user.Name.Replace(" ", "")); @@ -386,8 +385,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server private void IRC_SendWhoReply() { - List users = m_scene.Entities.GetAllByType(); - + EntityBase[] users = m_scene.Entities.GetAllByType(); foreach (EntityBase user in users) { /*SendServerCommand(String.Format("352 {0} {1} {2} {3} {4} {5} :0 {6}", IrcRegionName, @@ -415,11 +413,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server private void IRC_SendReplyUsers() { - List users = m_scene.Entities.GetAllByType(); + EntityBase[] users = m_scene.Entities.GetAllByType(); SendServerCommand("392 :UserID Terminal Host"); - if (users.Count == 0) + if (users.Length == 0) { SendServerCommand("395 :Nobody logged in"); return; diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 29695034ae..6f044e0086 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -962,7 +962,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if ((groupInfo == null) || (account == null)) { return; - } + } // Send Message to Ejectee GridInstantMessage msg = new GridInstantMessage(); diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs index 9363205263..0d265f2501 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs @@ -91,11 +91,11 @@ using OpenSim.Services.Interfaces; * + RoleID * * GroupID -> GroupNotice -> NoticeID - * + TimeStamp [uint] - * + FromName [string] - * + Subject [string] - * + Message [string] - * + BinaryBucket [byte[]] + * + TimeStamp [uint] + * + FromName [string] + * + Subject [string] + * + Message [string] + * + BinaryBucket [byte[]] * * */ @@ -309,7 +309,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups GroupInfoMap["OwnerRoleID"] = OSD.FromUUID(OwnerRoleID); GroupInfoMap["OwnersPowers"] = OSD.FromULong((ulong)m_DefaultOwnerPowers); - if(SimianAddGeneric(GroupID, "Group", name, GroupInfoMap)) + if (SimianAddGeneric(GroupID, "Group", name, GroupInfoMap)) { AddGroupRole(requestingAgentID, GroupID, UUID.Zero, "Everyone", "Members of " + name, "Member of " + name, (ulong)m_DefaultEveryonePowers); AddGroupRole(requestingAgentID, GroupID, OwnerRoleID, "Owners", "Owners of " + name, "Owner of " + name, (ulong)m_DefaultOwnerPowers); @@ -334,7 +334,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups string GroupName; OSDMap GroupInfoMap; - if( SimianGetFirstGenericEntry(groupID, "GroupInfo", out GroupName, out GroupInfoMap) ) + if (SimianGetFirstGenericEntry(groupID, "GroupInfo", out GroupName, out GroupInfoMap)) { GroupInfoMap["Charter"] = OSD.FromString(charter); GroupInfoMap["ShowInList"] = OSD.FromBoolean(showInList); @@ -379,7 +379,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups string GroupRoleMemberType = "GroupRole" + groupID.ToString(); if (SimianGetGenericEntries(GroupRoleMemberType, roleID.ToString(), out GroupRoleMembers)) { - foreach(UUID UserID in GroupRoleMembers.Keys) + foreach (UUID UserID in GroupRoleMembers.Keys) { EnsureRoleNotSelectedByMember(groupID, roleID, UserID); @@ -724,7 +724,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } OSDMap UserGroupMemberInfo; - if( SimianGetGenericEntry(agentID, "GroupMember", groupID.ToString(), out UserGroupMemberInfo) ) + if (SimianGetGenericEntry(agentID, "GroupMember", groupID.ToString(), out UserGroupMemberInfo)) { data.AcceptNotices = UserGroupMemberInfo["AcceptNotices"].AsBoolean(); data.Contribution = UserGroupMemberInfo["Contribution"].AsInteger(); @@ -736,7 +736,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // OSDMap GroupRoleInfo; - if( SimianGetGenericEntry(groupID, "GroupRole", data.ActiveRole.ToString(), out GroupRoleInfo) ) + if (SimianGetGenericEntry(groupID, "GroupRole", data.ActiveRole.ToString(), out GroupRoleInfo)) { data.GroupTitle = GroupRoleInfo["Title"].AsString(); data.GroupPowers = GroupRoleInfo["Powers"].AsULong(); @@ -748,7 +748,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // OSDMap GroupInfo; string GroupName; - if( SimianGetFirstGenericEntry(groupID, "Group", out GroupName, out GroupInfo) ) + if (SimianGetFirstGenericEntry(groupID, "Group", out GroupName, out GroupInfo)) { data.GroupID = groupID; data.AllowPublish = GroupInfo["AllowPublish"].AsBoolean(); @@ -928,12 +928,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups Dictionary GroupRoles; if (SimianGetGenericEntries(groupID, "GroupRole", out GroupRoles)) { - foreach( KeyValuePair Role in GroupRoles ) + foreach (KeyValuePair Role in GroupRoles) { Dictionary GroupRoleMembers; - if( SimianGetGenericEntries("GroupRole"+groupID.ToString(), Role.Key, out GroupRoleMembers) ) + if (SimianGetGenericEntries("GroupRole"+groupID.ToString(), Role.Key, out GroupRoleMembers)) { - foreach( KeyValuePair GroupRoleMember in GroupRoleMembers ) + foreach (KeyValuePair GroupRoleMember in GroupRoleMembers) { GroupRoleMembersData data = new GroupRoleMembersData(); @@ -1264,7 +1264,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString()); maps.Add(entryMap["Key"].AsString(), (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString())); } - if(maps.Count == 0) + if (maps.Count == 0) { if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results"); } @@ -1352,17 +1352,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } // Check if this is an update or a request - if ( requestArgs["RequestMethod"] == "RemoveGeneric" - || requestArgs["RequestMethod"] == "AddGeneric" - ) - + if (requestArgs["RequestMethod"] == "RemoveGeneric" + || requestArgs["RequestMethod"] == "AddGeneric") { // Any and all updates cause the cache to clear m_memoryCache.Clear(); // Send update to server, return the response without caching it return WebUtil.PostToService(m_groupsServerURI, requestArgs); - } // If we're not doing an update, we must be requesting data @@ -1372,7 +1369,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups OSDMap response = null; if (!m_memoryCache.TryGetValue(CacheKey, out response)) { - // if it wasn't in the cache, pass the request to the Simian Grid Services + // if it wasn't in the cache, pass the request to the Simian Grid Services response = WebUtil.PostToService(m_groupsServerURI, requestArgs); // and cache the response diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 79b9a167d0..a88c5e2d60 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -960,7 +960,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } - if( resp == null ) + if (resp == null) { string UserService; UUID SessionID; @@ -1065,7 +1065,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups /// /// Group Request Tokens are an attempt to allow the groups service to authenticate - /// requests. + /// requests. /// TODO: This broke after the big grid refactor, either find a better way, or discard this /// /// diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs index de1e01c89d..d21b6527f6 100644 --- a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs +++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs @@ -111,7 +111,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement } // Check if there are SceneObjectGroups in the list that do not have corresponding ContentManagementGroups in the CMEntityHash - public System.Collections.ArrayList CheckForMissingEntities(System.Collections.Generic.List currList) + public System.Collections.ArrayList CheckForMissingEntities(EntityBase[] currList) { System.Collections.ArrayList missingList = new System.Collections.ArrayList(); SceneObjectGroup temp = null; diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs index 2730eee2e5..49d20e10f8 100644 --- a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs +++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs @@ -127,7 +127,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement /// public void FindDifferences() { - System.Collections.Generic.List sceneEntityList = m_Entity.Scene.GetEntities(); + List sceneEntityList = new List(m_Entity.Scene.GetEntities()); DiffersFromSceneGroup = false; // if group is not contained in scene's list if (!ContainsKey(sceneEntityList, m_UnchangedEntity.UUID)) diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs index 796f437974..d7838c56f0 100644 --- a/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs +++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs @@ -161,7 +161,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement //finalize m_Entity.RootPart.PhysActor = null; - m_Entity.Children = parts; + m_Entity.Children = parts; } } diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs index 6ba5ccfdc9..140264b5e7 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs @@ -41,12 +41,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule private readonly Scene m_scene; private readonly IEnumerator m_sogEnum; private readonly ISecurityCredential m_security; + private readonly List m_entities; public IObjEnum(Scene scene, ISecurityCredential security) { m_scene = scene; m_security = security; - m_sogEnum = m_scene.Entities.GetAllByType().GetEnumerator(); + m_entities = new List(m_scene.Entities.GetEntities()); + m_sogEnum = m_entities.GetEnumerator(); } public void Dispose() diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs index c439e3ec20..59ad9d87a8 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs @@ -432,7 +432,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule return; } - foreach(string button in buttons) + foreach (string button in buttons) { if (button == String.Empty) { @@ -448,7 +448,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule dm.SendDialogToUser( avatar, GetSOP().Name, GetSOP().UUID, GetSOP().OwnerID, - message, new UUID("00000000-0000-2222-3333-100000001000"), chat_channel, buttons); + message, new UUID("00000000-0000-2222-3333-100000001000"), chat_channel, buttons); } diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs index 45bb005903..f2324d29a8 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs @@ -205,10 +205,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { get { - List ents = m_internalScene.Entities.GetAllByType(); - IAvatar[] rets = new IAvatar[ents.Count]; + EntityBase[] ents = m_internalScene.Entities.GetAllByType(); + IAvatar[] rets = new IAvatar[ents.Length]; - for (int i = 0; i < ents.Count; i++) + for (int i = 0; i < ents.Length; i++) { EntityBase ent = ents[i]; rets[i] = new SPAvatar(m_internalScene, ent.UUID, m_security); diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs index 61cbb907d9..cc51c3b020 100644 --- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs +++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs @@ -824,5 +824,5 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule RegionMoneyRequest = 1, Gift = 2, Purchase = 3 - } + } } \ No newline at end of file diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs index 3ed338baea..421da3664a 100644 --- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs +++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs @@ -568,8 +568,7 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator { m_copse = new List(); - List objs = m_scene.GetEntities(); - + EntityBase[] objs = m_scene.GetEntities(); foreach (EntityBase obj in objs) { if (obj is SceneObjectGroup) diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs index a0d6197004..f424e7f42c 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs @@ -49,7 +49,7 @@ namespace OpenSim.Region.RegionCombinerModule public void ClientConnect(IClientAPI client) { m_virtScene.UnSubscribeToClientPrimEvents(client); - m_virtScene.UnSubscribeToClientPrimRezEvents(client); + m_virtScene.UnSubscribeToClientPrimRezEvents(client); m_virtScene.UnSubscribeToClientInventoryEvents(client); ((AttachmentsModule)m_virtScene.AttachmentsModule).UnsubscribeFromClientEvents(client); //m_virtScene.UnSubscribeToClientTeleportEvents(client); @@ -66,7 +66,7 @@ namespace OpenSim.Region.RegionCombinerModule client.OnRezObject += LocalRezObject; m_rootScene.SubscribeToClientInventoryEvents(client); - ((AttachmentsModule)m_rootScene.AttachmentsModule).SubscribeToClientEvents(client); + ((AttachmentsModule)m_rootScene.AttachmentsModule).SubscribeToClientEvents(client); //m_rootScene.SubscribeToClientTeleportEvents(client); m_rootScene.SubscribeToClientScriptEvents(client); diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs index 33ff707e9f..be5411a34b 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs @@ -118,7 +118,7 @@ public class RegionCombinerLargeLandChannel : ILandChannel return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY); } } - + ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene); obj.LandData.Name = "NO LAND"; return obj; @@ -142,14 +142,14 @@ public class RegionCombinerLargeLandChannel : ILandChannel public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) { - RootRegionLandChannel.Join(start_x, start_y, end_x, end_y, attempting_user_id); + RootRegionLandChannel.Join(start_x, start_y, end_x, end_y, attempting_user_id); } public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) { RootRegionLandChannel.Subdivide(start_x, start_y, end_x, end_y, attempting_user_id); } - + public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) { RootRegionLandChannel.ReturnObjectsInParcel(localID, returnType, agentIDs, taskIDs, remoteClient); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 512957de8c..a5b3cd0e6b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4298,9 +4298,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } - PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); - if (pinfos != null && pinfos.Length > 0) - pinfo = pinfos[0]; + pinfo = World.PresenceService.GetAgent(uuid); ce = new UserInfoCacheEntry(); ce.time = Util.EnvironmentTickCount(); @@ -4319,11 +4317,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000) { - PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); - if (pinfos != null && pinfos.Length > 0) - pinfo = pinfos[0]; - else - pinfo = null; + pinfo = World.PresenceService.GetAgent(uuid); ce.time = Util.EnvironmentTickCount(); ce.pinfo = pinfo; @@ -8482,7 +8476,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api res.Add(new LSL_Integer((int)me.ControlPermissions)); break; } - } + } return res; } @@ -8498,7 +8492,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (face < 0 || face > m_host.GetNumberOfSides() - 1) return ScriptBaseClass.LSL_STATUS_OK; - return SetPrimMediaParams(face, rules); + return SetPrimMediaParams(face, rules); } private LSL_Integer SetPrimMediaParams(int face, LSL_List rules) @@ -8587,7 +8581,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++); break; } - } + } module.SetMediaEntry(m_host, face, me); @@ -8607,7 +8601,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api IMoapModule module = m_ScriptEngine.World.RequestModuleInterface(); if (null == module) - throw new Exception("Media on a prim functions not available"); + throw new Exception("Media on a prim functions not available"); module.ClearMediaEntry(m_host, face); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index a08b135b26..6827ede047 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1197,7 +1197,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api World.LandChannel.Join(startx,starty,endx,endy,m_host.OwnerID); } - + public void osParcelSubdivide(LSL_Vector pos1, LSL_Vector pos2) { CheckThreatLevel(ThreatLevel.High, "osParcelSubdivide"); @@ -1220,7 +1220,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // can modify it ILandObject startLandObject = World.LandChannel.GetLandObject((int)pos.x, (int)pos.y); - if (startLandObject == null) + if (startLandObject == null) { OSSLShoutError("There is no land at that location"); return; @@ -1237,7 +1237,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID uuid; // Process the rules, not sure what the impact would be of changing owner or group - for (int idx = 0; idx < rules.Length; ) + for (int idx = 0; idx < rules.Length;) { int code = rules.GetLSLIntegerItem(idx++); string arg = rules.GetLSLStringItem(idx++); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index a5b1124911..3b7de5331d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -286,7 +286,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins } else { - Entities = m_CmdManager.m_ScriptEngine.World.GetEntities(); + Entities = new List(m_CmdManager.m_ScriptEngine.World.GetEntities()); } SceneObjectPart SensePoint = ts.host; @@ -417,7 +417,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins List sensedEntities = new List(); // If nobody about quit fast - if(m_CmdManager.m_ScriptEngine.World.GetRootAgentCount() == 0) + if (m_CmdManager.m_ScriptEngine.World.GetRootAgentCount() == 0) return sensedEntities; SceneObjectPart SensePoint = ts.host; @@ -496,7 +496,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins { ScenePresence sp; // Try direct lookup by UUID - if(!m_CmdManager.m_ScriptEngine.World.TryGetScenePresence(ts.keyID, out sp)) + if (!m_CmdManager.m_ScriptEngine.World.TryGetScenePresence(ts.keyID, out sp)) return sensedEntities; senseEntity(sp); } diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index e5e8a56127..e82d297ab5 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -632,7 +632,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine bool postOnRez = (bool)p[4]; StateSource stateSource = (StateSource)p[5]; - lock(m_CompileDict) + lock (m_CompileDict) { if (!m_CompileDict.ContainsKey(itemID)) return false; diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index e7a8294fef..f4472c7dc0 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -62,7 +62,7 @@ namespace OpenSim.Server.Base /// /// /// The arguments which control which constructor is invoked on the plugin - /// + /// public static T LoadPlugin(string dllName, Object[] args) where T:class { string[] parts = dllName.Split(new char[] {':'}); diff --git a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs new file mode 100644 index 0000000000..39baa324cb --- /dev/null +++ b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs @@ -0,0 +1,79 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Net; +using System.Reflection; +using Nini.Config; +using log4net; +using OpenSim.Server.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Server.Handlers.Base; + +namespace OpenSim.Server.Handlers.Hypergrid +{ + public class HeloServiceInConnector : ServiceConnector + { + public HeloServiceInConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) + { + server.AddStreamHandler(new HeloServerGetHandler("opensim-robust")); + } + } + + public class HeloServerGetHandler : BaseStreamHandler + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private string m_HandlersType; + + public HeloServerGetHandler(string handlersType) : + base("GET", "/helo") + { + m_HandlersType = handlersType; + } + + public override byte[] Handle(string path, Stream requestData, + OSHttpRequest httpRequest, OSHttpResponse httpResponse) + { + return OKResponse(httpResponse); + } + + private byte[] OKResponse(OSHttpResponse httpResponse) + { + m_log.Debug("[HELO]: hi, I was called"); + httpResponse.AddHeader("X-Handlers-Provided", m_HandlersType); + httpResponse.StatusCode = (int)HttpStatusCode.OK; + httpResponse.StatusDescription = "OK"; + return new byte[0]; + } + + } +} diff --git a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs index 34df54a90b..5c31639ac2 100644 --- a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs @@ -32,6 +32,8 @@ using System.Collections.Generic; using System.Reflection; using OpenSim.Framework; using OpenSim.Services.Interfaces; +using OpenSim.Services.Connectors.Hypergrid; +using OpenSim.Services.Connectors.SimianGrid; namespace OpenSim.Services.Connectors { @@ -41,7 +43,7 @@ namespace OpenSim.Services.Connectors LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); - private Dictionary m_connectors = new Dictionary(); + private Dictionary m_connectors = new Dictionary(); public HGAssetServiceConnector(IConfigSource source) { @@ -81,7 +83,7 @@ namespace OpenSim.Services.Connectors private IAssetService GetConnector(string url) { - AssetServicesConnector connector = null; + IAssetService connector = null; lock (m_connectors) { if (m_connectors.ContainsKey(url)) @@ -90,12 +92,17 @@ namespace OpenSim.Services.Connectors } else { - // We're instantiating this class explicitly, but this won't - // work in general, because the remote grid may be running - // an asset server that has a different protocol. - // Eventually we will want a piece of protocol asking - // the remote server about its kind. Definitely cool thing to do! - connector = new AssetServicesConnector(url); + // Still not as flexible as I would like this to be, + // but good enough for now + string connectorType = new HeloServicesConnector(url).Helo(); + m_log.DebugFormat("[HG ASSET SERVICE]: HELO returned {0}", connectorType); + if (connectorType == "opensim-simian") + { + connector = new SimianAssetServiceConnector(url); + } + else + connector = new AssetServicesConnector(url); + m_connectors.Add(url, connector); } } diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index f5b59823e6..479a80e297 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -86,7 +86,7 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); - string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/" ); + string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"); m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri); XmlRpcResponse response = null; try diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs new file mode 100644 index 0000000000..7b166c14e3 --- /dev/null +++ b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs @@ -0,0 +1,75 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using log4net; +using System; +using System.Net; +using System.Reflection; +using Nini.Config; + +namespace OpenSim.Services.Connectors +{ + public class HeloServicesConnector + { + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + private string m_ServerURI = String.Empty; + + public HeloServicesConnector() + { + } + + public HeloServicesConnector(string serverURI) + { + m_ServerURI = serverURI.TrimEnd('/'); + } + + + public virtual string Helo() + { + HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI + "/helo"); + + try + { + WebResponse response = req.GetResponse(); + if (response.Headers.Get("X-Handlers-Provided") == null) // just in case this ever returns a null + return string.Empty; + return response.Headers.Get("X-Handlers-Provided"); + } + catch (Exception e) + { + m_log.DebugFormat("[HELO SERVICE]: Unable to perform HELO request to {0}: {1}", m_ServerURI, e.Message); + } + + // fail + return string.Empty; + } + + } +} diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs index e25e7ebd3c..403ee15b38 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs @@ -526,7 +526,7 @@ namespace OpenSim.Services.Connectors InventoryFolderBase folder = new InventoryFolderBase(); try - { + { folder.ParentID = new UUID(data["ParentID"].ToString()); folder.Type = short.Parse(data["Type"].ToString()); folder.Version = ushort.Parse(data["Version"].ToString()); diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs index a871d07f16..67a06f3f83 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs @@ -26,11 +26,9 @@ */ using System; -using System.Collections.Generic; using System.Reflection; using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; -using OpenSim.Services.Interfaces; using OpenMetaverse; using log4net; @@ -71,7 +69,10 @@ namespace OpenSim.Services.Connectors.SimianGrid public void OnMakeRootAgent(ScenePresence sp) { m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName); - m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); + Util.FireAndForget(delegate(object o) + { + m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); + }); } public void OnNewClient(IClientAPI client) @@ -107,7 +108,11 @@ namespace OpenSim.Services.Connectors.SimianGrid void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID) { - m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); + // Asynchronously update the position stored in the session table for this agent + Util.FireAndForget(delegate(object o) + { + m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); + }); } } } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 6d5b30e6d2..30d3147aa4 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs @@ -84,6 +84,11 @@ namespace OpenSim.Services.Connectors.SimianGrid CommonInit(source); } + public SimianAssetServiceConnector(string url) + { + m_serverUrl = url; + } + public void Initialise(IConfigSource source) { IConfig moduleConfig = source.Configs["Modules"]; @@ -119,6 +124,12 @@ namespace OpenSim.Services.Connectors.SimianGrid public AssetBase Get(string id) { + if (String.IsNullOrEmpty(m_serverUrl)) + { + m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured"); + throw new InvalidOperationException(); + } + // Cache fetch if (m_cache != null) { @@ -145,6 +156,12 @@ namespace OpenSim.Services.Connectors.SimianGrid /// public AssetMetadata GetMetadata(string id) { + if (String.IsNullOrEmpty(m_serverUrl)) + { + m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured"); + throw new InvalidOperationException(); + } + AssetMetadata metadata = null; // Cache fetch @@ -216,6 +233,12 @@ namespace OpenSim.Services.Connectors.SimianGrid /// True if the id was parseable, false otherwise public bool Get(string id, Object sender, AssetRetrieved handler) { + if (String.IsNullOrEmpty(m_serverUrl)) + { + m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured"); + throw new InvalidOperationException(); + } + // Cache fetch if (m_cache != null) { @@ -246,6 +269,12 @@ namespace OpenSim.Services.Connectors.SimianGrid /// public string Store(AssetBase asset) { + if (String.IsNullOrEmpty(m_serverUrl)) + { + m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured"); + throw new InvalidOperationException(); + } + bool storedInCache = false; string errorMessage = null; @@ -378,6 +407,12 @@ namespace OpenSim.Services.Connectors.SimianGrid /// public bool Delete(string id) { + if (String.IsNullOrEmpty(m_serverUrl)) + { + m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured"); + throw new InvalidOperationException(); + } + //string errorMessage = String.Empty; string url = m_serverUrl + id; diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs index 3505c640a0..4d0d53ec0b 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs @@ -28,8 +28,6 @@ using System; using System.Collections.Generic; using System.Collections.Specialized; -using System.IO; -using System.Net; using System.Reflection; using log4net; using Mono.Addins; @@ -37,7 +35,6 @@ using Nini.Config; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenMetaverse; using OpenMetaverse.StructuredData; diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs index 5b18aeff3c..6f2d73559b 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs @@ -30,13 +30,10 @@ using System.Collections.Generic; using System.Collections.Specialized; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Framework; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs index 470eccd716..21ad4abd9a 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs @@ -37,7 +37,6 @@ using OpenMetaverse.StructuredData; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Server.Base; using OpenSim.Services.Interfaces; namespace OpenSim.Services.Connectors.SimianGrid @@ -91,6 +90,11 @@ namespace OpenSim.Services.Connectors.SimianGrid CommonInit(source); } + public SimianInventoryServiceConnector(string url) + { + m_serverUrl = url; + } + public void Initialise(IConfigSource source) { IConfig moduleConfig = source.Configs["Modules"]; diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs index 077be3c31a..a344594a1d 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs @@ -28,17 +28,14 @@ using System; using System.Collections.Generic; using System.Collections.Specialized; -using System.Net; using System.Reflection; using log4net; using Mono.Addins; using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; -using OpenSim.Server.Base; using OpenMetaverse; using OpenMetaverse.StructuredData; @@ -358,25 +355,6 @@ namespace OpenSim.Services.Connectors.SimianGrid return null; } -// private OSDMap GetSessionData(UUID sessionID) -// { -// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for session " + sessionID); -// -// NameValueCollection requestArgs = new NameValueCollection -// { -// { "RequestMethod", "GetSession" }, -// { "SessionID", sessionID.ToString() } -// }; -// -// OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); -// if (response["Success"].AsBoolean()) -// return response; -// else -// m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session data for session " + sessionID); -// -// return null; -// } - private List GetSessions(UUID userID) { List presences = new List(1); @@ -429,39 +407,6 @@ namespace OpenSim.Services.Connectors.SimianGrid return success; } - ///// - ///// Fetch the last known avatar location with GetSession and persist it - ///// as user data with AddUserData - ///// - //private bool SetLastLocation(UUID sessionID) - //{ - // NameValueCollection requestArgs = new NameValueCollection - // { - // { "RequestMethod", "GetSession" }, - // { "SessionID", sessionID.ToString() } - // }; - - // OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); - // bool success = response["Success"].AsBoolean(); - - // if (success) - // { - // UUID userID = response["UserID"].AsUUID(); - // UUID sceneID = response["SceneID"].AsUUID(); - // Vector3 position = response["ScenePosition"].AsVector3(); - // Vector3 lookAt = response["SceneLookAt"].AsVector3(); - - // return SetLastLocation(userID, sceneID, position, lookAt); - // } - // else - // { - // m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve presence information for session " + sessionID + - // " while saving last location: " + response["Message"].AsString()); - // } - - // return success; - //} - private PresenceInfo ResponseToPresenceInfo(OSDMap sessionResponse, OSDMap userResponse) { if (sessionResponse == null) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs index 0ef4974f79..b7e8538824 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs @@ -291,8 +291,8 @@ namespace OpenSim.Services.Connectors.SimianGrid // Check if the user is online if (client.Scene is Scene) { - OpenSim.Services.Interfaces.PresenceInfo[] presences = ((Scene)client.Scene).PresenceService.GetAgents(new string[] { avatarID.ToString() }); - if (presences != null && presences.Length > 0) + OpenSim.Services.Interfaces.PresenceInfo presence = ((Scene)client.Scene).PresenceService.GetAgent(avatarID); + if (presence != null) flags |= ProfileFlags.Online; } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 694aa72d2e..ddd232286f 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs @@ -28,7 +28,6 @@ using System; using System.Collections.Generic; using System.Collections.Specialized; -using System.IO; using System.Reflection; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; @@ -49,13 +48,15 @@ namespace OpenSim.Services.Connectors.SimianGrid [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule { + private const double CACHE_EXPIRATION_SECONDS = 120.0; + private static readonly ILog m_log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); private string m_serverUrl = String.Empty; - private ExpiringCache m_accountCache; - private bool m_Enabled = false; + private ExpiringCache m_accountCache = new ExpiringCache(); + private bool m_Enabled; #region ISharedRegionModule @@ -141,7 +142,15 @@ namespace OpenSim.Services.Connectors.SimianGrid { "UserID", userID.ToString() } }; - return GetUser(requestArgs); + account = GetUser(requestArgs); + + if (account == null) + { + // Store null responses too, to avoid repeated lookups for missing accounts + m_accountCache.AddOrUpdate(userID, null, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS)); + } + + return account; } public List GetUserAccounts(UUID scopeID, string query) @@ -216,7 +225,7 @@ namespace OpenSim.Services.Connectors.SimianGrid if (success) { // Cache the user account info - m_accountCache.AddOrUpdate(data.PrincipalID, data, DateTime.Now + TimeSpan.FromMinutes(2.0d)); + m_accountCache.AddOrUpdate(data.PrincipalID, data, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS)); } else { @@ -281,7 +290,7 @@ namespace OpenSim.Services.Connectors.SimianGrid GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName); // Cache the user account info - m_accountCache.AddOrUpdate(account.PrincipalID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d)); + m_accountCache.AddOrUpdate(account.PrincipalID, account, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS)); return account; } diff --git a/OpenSim/Services/Connectors/Simulation/EstateDataService.cs b/OpenSim/Services/Connectors/Simulation/EstateDataService.cs new file mode 100644 index 0000000000..87c49d34a8 --- /dev/null +++ b/OpenSim/Services/Connectors/Simulation/EstateDataService.cs @@ -0,0 +1,112 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using OpenMetaverse; +using log4net; +using Mono.Addins; +using Nini.Config; +using System.Reflection; +using OpenSim.Services.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Data; +using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Services.Connectors +{ + public class EstateDataService : ServiceBase, IEstateDataService + { + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + protected IEstateDataStore m_database; + + public EstateDataService(IConfigSource config) + : base(config) + { + string dllName = String.Empty; + string connString = String.Empty; + + // Try reading the [DatabaseService] section, if it exists + IConfig dbConfig = config.Configs["DatabaseService"]; + if (dbConfig != null) + { + dllName = dbConfig.GetString("StorageProvider", String.Empty); + connString = dbConfig.GetString("EstateConnectionString", String.Empty); + if (String.IsNullOrEmpty(connString)) + connString = dbConfig.GetString("ConnectionString", String.Empty); + } + + // We tried, but this doesn't exist. We can't proceed + if (dllName == String.Empty) + throw new Exception("No StorageProvider configured"); + + m_database = LoadPlugin(dllName, new Object[] { connString }); + if (m_database == null) + throw new Exception("Could not find a storage interface in the given module"); + } + + public EstateSettings LoadEstateSettings(UUID regionID, bool create) + { + return m_database.LoadEstateSettings(regionID, create); + } + + public EstateSettings LoadEstateSettings(int estateID) + { + return m_database.LoadEstateSettings(estateID); + } + + public void StoreEstateSettings(EstateSettings es) + { + m_database.StoreEstateSettings(es); + } + + public List GetEstates(string search) + { + return m_database.GetEstates(search); + } + + public bool LinkRegion(UUID regionID, int estateID) + { + return m_database.LinkRegion(regionID, estateID); + } + + public List GetRegions(int estateID) + { + return m_database.GetRegions(estateID); + } + + public bool DeleteEstate(int estateID) + { + return m_database.DeleteEstate(estateID); + } + } +} diff --git a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs new file mode 100644 index 0000000000..946f7e48e1 --- /dev/null +++ b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs @@ -0,0 +1,140 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using OpenMetaverse; +using log4net; +using Mono.Addins; +using Nini.Config; +using System.Reflection; +using OpenSim.Services.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Data; +using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Services.Connectors +{ + public class SimulationDataService : ServiceBase, ISimulationDataService + { + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + protected ISimulationDataStore m_database; + + public SimulationDataService(IConfigSource config) + : base(config) + { + string dllName = String.Empty; + string connString = String.Empty; + + // Try reading the [DatabaseService] section, if it exists + IConfig dbConfig = config.Configs["DatabaseService"]; + if (dbConfig != null) + { + dllName = dbConfig.GetString("StorageProvider", String.Empty); + connString = dbConfig.GetString("ConnectionString", String.Empty); + } + + // We tried, but this doesn't exist. We can't proceed + if (dllName == String.Empty) + throw new Exception("No StorageProvider configured"); + + m_database = LoadPlugin(dllName, new Object[] { connString }); + if (m_database == null) + throw new Exception("Could not find a storage interface in the given module"); + } + + public void StoreObject(SceneObjectGroup obj, UUID regionUUID) + { + m_database.StoreObject(obj, regionUUID); + } + + public void RemoveObject(UUID uuid, UUID regionUUID) + { + m_database.RemoveObject(uuid, regionUUID); + } + + public void StorePrimInventory(UUID primID, ICollection items) + { + m_database.StorePrimInventory(primID, items); + } + + public List LoadObjects(UUID regionUUID) + { + return m_database.LoadObjects(regionUUID); + } + + public void StoreTerrain(double[,] terrain, UUID regionID) + { + m_database.StoreTerrain(terrain, regionID); + } + + public double[,] LoadTerrain(UUID regionID) + { + return m_database.LoadTerrain(regionID); + } + + public void StoreLandObject(ILandObject Parcel) + { + m_database.StoreLandObject(Parcel); + } + + public void RemoveLandObject(UUID globalID) + { + m_database.RemoveLandObject(globalID); + } + + public List LoadLandObjects(UUID regionUUID) + { + return m_database.LoadLandObjects(regionUUID); + } + + public void StoreRegionSettings(RegionSettings rs) + { + m_database.StoreRegionSettings(rs); + } + + public RegionSettings LoadRegionSettings(UUID regionUUID) + { + return m_database.LoadRegionSettings(regionUUID); + } + + public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) + { + return m_database.LoadRegionWindlightSettings(regionUUID); + } + + public void StoreRegionWindlightSettings(RegionLightShareData wl) + { + m_database.StoreRegionWindlightSettings(wl); + } + } +} diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs index 86bca79d6b..e543337c71 100644 --- a/OpenSim/Services/InventoryService/InventoryService.cs +++ b/OpenSim/Services/InventoryService/InventoryService.cs @@ -276,11 +276,11 @@ namespace OpenSim.Services.InventoryService List folders = RequestSubFolders(root.ID); foreach (InventoryFolderBase folder in folders) - { + { if (folder.Type == (short)type) { // m_log.DebugFormat( -// "[INVENTORY SERVICE]: Found folder {0} type {1}", folder.Name, (AssetType)folder.Type); +// "[INVENTORY SERVICE]: Found folder {0} type {1}", folder.Name, (AssetType)folder.Type); return folder; } diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 5ccb912185..1e4b6c2520 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -314,7 +314,7 @@ namespace OpenSim.Services.LLLoginService { // something went wrong, make something up, so that we don't have to test this anywhere else guinfo = new GridUserInfo(); - guinfo.LastPosition = guinfo.HomePosition = new Vector3(128, 128, 30); + guinfo.LastPosition = guinfo.HomePosition = new Vector3(128, 128, 30); } // diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index 326e502017..f376cf825b 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs @@ -97,10 +97,10 @@ namespace OpenSim.Services.UserAccountService public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) { -// m_log.DebugFormat( -// "[USER ACCOUNT SERVICE]: Retrieving account by username for {0} {1}, scope {2}", -// firstName, lastName, scopeID); - +// m_log.DebugFormat( +// "[USER ACCOUNT SERVICE]: Retrieving account by username for {0} {1}, scope {2}", +// firstName, lastName, scopeID); + UserAccountData[] d; if (scopeID != UUID.Zero) @@ -235,10 +235,10 @@ namespace OpenSim.Services.UserAccountService public bool StoreUserAccount(UserAccount data) { -// m_log.DebugFormat( -// "[USER ACCOUNT SERVICE]: Storing user account for {0} {1} {2}, scope {3}", -// data.FirstName, data.LastName, data.PrincipalID, data.ScopeID); - +// m_log.DebugFormat( +// "[USER ACCOUNT SERVICE]: Storing user account for {0} {1} {2}, scope {3}", +// data.FirstName, data.LastName, data.PrincipalID, data.ScopeID); + UserAccountData d = new UserAccountData(); d.FirstName = data.FirstName; @@ -285,7 +285,7 @@ namespace OpenSim.Services.UserAccountService #endregion #region Console commands - + /// /// Handle the create user command from the console. /// @@ -297,12 +297,14 @@ namespace OpenSim.Services.UserAccountService string password; string email; + List excluded = new List(new char[]{' '}); + if (cmdparams.Length < 3) - firstName = MainConsole.Instance.CmdPrompt("First name", "Default"); + firstName = MainConsole.Instance.CmdPrompt("First name", "Default", excluded); else firstName = cmdparams[2]; if (cmdparams.Length < 4) - lastName = MainConsole.Instance.CmdPrompt("Last name", "User"); + lastName = MainConsole.Instance.CmdPrompt("Last name", "User", excluded); else lastName = cmdparams[3]; if (cmdparams.Length < 5) diff --git a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs index 2a055cc3c1..de6e815a9b 100644 --- a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs @@ -35,11 +35,86 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Data.Null { + public class NullDataService : ISimulationDataService + { + private NullDataStore m_store; + + public NullDataService() + { + m_store = new NullDataStore(); + } + + public void StoreObject(SceneObjectGroup obj, UUID regionUUID) + { + m_store.StoreObject(obj, regionUUID); + } + + public void RemoveObject(UUID uuid, UUID regionUUID) + { + m_store.RemoveObject(uuid, regionUUID); + } + + public void StorePrimInventory(UUID primID, ICollection items) + { + m_store.StorePrimInventory(primID, items); + } + + public List LoadObjects(UUID regionUUID) + { + return m_store.LoadObjects(regionUUID); + } + + public void StoreTerrain(double[,] terrain, UUID regionID) + { + m_store.StoreTerrain(terrain, regionID); + } + + public double[,] LoadTerrain(UUID regionID) + { + return m_store.LoadTerrain(regionID); + } + + public void StoreLandObject(ILandObject Parcel) + { + m_store.StoreLandObject(Parcel); + } + + public void RemoveLandObject(UUID globalID) + { + m_store.RemoveLandObject(globalID); + } + + public List LoadLandObjects(UUID regionUUID) + { + return m_store.LoadLandObjects(regionUUID); + } + + public void StoreRegionSettings(RegionSettings rs) + { + m_store.StoreRegionSettings(rs); + } + + public RegionSettings LoadRegionSettings(UUID regionUUID) + { + return m_store.LoadRegionSettings(regionUUID); + } + + public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) + { + return m_store.LoadRegionWindlightSettings(regionUUID); + } + + public void StoreRegionWindlightSettings(RegionLightShareData wl) + { + m_store.StoreRegionWindlightSettings(wl); + } + } + /// /// Mock region data plugin. This obeys the api contract for persistence but stores everything in memory, so that /// tests can check correct persistence. /// - public class NullDataStore : IRegionDataStore + public class NullDataStore : ISimulationDataStore { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -99,7 +174,7 @@ namespace OpenSim.Data.Null } public void RemoveObject(UUID obj, UUID regionUUID) - { + { // All parts belonging to the object with the uuid are removed. List parts = new List(m_sceneObjectParts.Values); foreach (SceneObjectPart part in parts) @@ -108,13 +183,12 @@ namespace OpenSim.Data.Null { m_log.DebugFormat( "[MOCK REGION DATA PLUGIN]: Removing part {0} {1} as part of object {2} from {3}", - part.Name, part.UUID, obj, regionUUID); + part.Name, part.UUID, obj, regionUUID); m_sceneObjectParts.Remove(part.UUID); } } } - // see IRegionDatastore public void StorePrimInventory(UUID primID, ICollection items) { m_primItems[primID] = items; @@ -130,7 +204,7 @@ namespace OpenSim.Data.Null if (prim.IsRoot) { m_log.DebugFormat( - "[MOCK REGION DATA PLUGIN]: Loading root part {0} {1} in {2}", prim.Name, prim.UUID, regionUUID); + "[MOCK REGION DATA PLUGIN]: Loading root part {0} {1} in {2}", prim.Name, prim.UUID, regionUUID); objects[prim.UUID] = new SceneObjectGroup(prim); } } diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs index 615e519b2d..0e1433a62b 100644 --- a/OpenSim/Tests/Common/Mock/TestScene.cs +++ b/OpenSim/Tests/Common/Mock/TestScene.cs @@ -31,6 +31,7 @@ using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Region.Framework; +using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; namespace OpenSim.Tests.Common.Mock @@ -39,19 +40,14 @@ namespace OpenSim.Tests.Common.Mock { public TestScene( RegionInfo regInfo, AgentCircuitManager authen, - SceneCommunicationService sceneGridService, StorageManager storeManager, + SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService, ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) - : base(regInfo, authen, sceneGridService, storeManager, moduleLoader, + : base(regInfo, authen, sceneGridService, simDataService, estateDataService, moduleLoader, dumpAssetsToFile, physicalPrim, SeeIntoRegionFromNeighbor, config, simulatorVersion) { } - /// - /// Allow retrieval for test check purposes - /// - public StorageManager StorageManager { get { return m_storageManager; } } - /// /// Temporarily override session authentication for tests (namely teleport). /// @@ -69,6 +65,6 @@ namespace OpenSim.Tests.Common.Mock public AsyncSceneObjectGroupDeleter SceneObjectGroupDeleter { get { return m_asyncSceneObjectDeleter; } - } + } } } \ No newline at end of file diff --git a/OpenSim/Tests/Common/Setup/AssetHelpers.cs b/OpenSim/Tests/Common/Setup/AssetHelpers.cs index f9a80b05b2..8647cfed51 100644 --- a/OpenSim/Tests/Common/Setup/AssetHelpers.cs +++ b/OpenSim/Tests/Common/Setup/AssetHelpers.cs @@ -54,8 +54,8 @@ namespace OpenSim.Tests.Common { AssetBase asset = CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId); scene.AssetService.Store(asset); - return asset; - } + return asset; + } /// /// Create an asset from the given scene object. diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 9318a27d05..fc9db03932 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -58,7 +58,7 @@ namespace OpenSim.Tests.Common.Setup public class SceneSetupHelpers { // These static variables in order to allow regions to be linked by shared modules and same - // CommunicationsManager. + // CommunicationsManager. private static ISharedRegionModule m_assetService = null; // private static ISharedRegionModule m_authenticationService = null; private static ISharedRegionModule m_inventoryService = null; @@ -69,19 +69,19 @@ namespace OpenSim.Tests.Common.Setup /// /// Set up a test scene /// - /// + /// /// Automatically starts service threads, as would the normal runtime. - /// + /// /// public static TestScene SetupScene() { return SetupScene(""); } - + /// /// Set up a test scene /// - /// + /// /// Starts real inventory and asset services, as opposed to mock ones, if true /// public static TestScene SetupScene(String realServices) @@ -94,7 +94,7 @@ namespace OpenSim.Tests.Common.Setup ///// ///// Set up a test scene ///// - ///// + ///// ///// Starts real inventory and asset services, as opposed to mock ones, if true ///// This should be the same if simulating two scenes within a standalone ///// @@ -157,23 +157,24 @@ namespace OpenSim.Tests.Common.Setup AgentCircuitManager acm = new AgentCircuitManager(); SceneCommunicationService scs = new SceneCommunicationService(); - StorageManager sm = new StorageManager("OpenSim.Tests.Common.dll", "", ""); + ISimulationDataService simDataService = OpenSim.Server.Base.ServerUtils.LoadPlugin("OpenSim.Tests.Common.dll", null); + IEstateDataService estateDataService = null; IConfigSource configSource = new IniConfigSource(); TestScene testScene = new TestScene( - regInfo, acm, scs, sm, null, false, false, false, configSource, null); + regInfo, acm, scs, simDataService, estateDataService, null, false, false, false, configSource, null); INonSharedRegionModule capsModule = new CapabilitiesModule(); capsModule.Initialise(new IniConfigSource()); testScene.AddRegionModule(capsModule.Name, capsModule); capsModule.AddRegion(testScene); - + IRegionModule godsModule = new GodsModule(); godsModule.Initialise(testScene, new IniConfigSource()); testScene.AddModule(godsModule.Name, godsModule); realServices = realServices.ToLower(); // IConfigSource config = new IniConfigSource(); - + // If we have a brand new scene, need to initialize shared region modules if ((m_assetService == null && m_inventoryService == null) || newScene) { @@ -184,13 +185,13 @@ namespace OpenSim.Tests.Common.Setup // For now, always started a 'real' authentication service StartAuthenticationService(testScene, true); - + if (realServices.Contains("inventory")) StartInventoryService(testScene, true); else StartInventoryService(testScene, false); - - StartGridService(testScene, true); + + StartGridService(testScene, true); StartUserAccountService(testScene); StartPresenceService(testScene); } @@ -207,7 +208,7 @@ namespace OpenSim.Tests.Common.Setup m_presenceService.RegionLoaded(testScene); } - + m_inventoryService.PostInitialise(); m_assetService.PostInitialise(); m_userAccountService.PostInitialise(); @@ -250,7 +251,7 @@ namespace OpenSim.Tests.Common.Setup else config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockAssetService"); config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); - assetService.Initialise(config); + assetService.Initialise(config); assetService.AddRegion(testScene); assetService.RegionLoaded(testScene); testScene.AddRegionModule(assetService.Name, assetService); @@ -277,7 +278,7 @@ namespace OpenSim.Tests.Common.Setup testScene.AddRegionModule(service.Name, service); //m_authenticationService = service; } - + private static void StartInventoryService(Scene testScene, bool real) { ISharedRegionModule inventoryService = new LocalInventoryServicesConnector(); @@ -285,7 +286,7 @@ namespace OpenSim.Tests.Common.Setup config.AddConfig("Modules"); config.AddConfig("InventoryService"); config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); - + if (real) { config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService"); @@ -294,7 +295,7 @@ namespace OpenSim.Tests.Common.Setup { config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockInventoryService"); } - + config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); inventoryService.Initialise(config); inventoryService.AddRegion(testScene); @@ -338,14 +339,14 @@ namespace OpenSim.Tests.Common.Setup config.Configs["UserAccountService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); config.Configs["UserAccountService"].Set( "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService"); - + if (m_userAccountService == null) { ISharedRegionModule userAccountService = new LocalUserAccountServicesConnector(); userAccountService.Initialise(config); m_userAccountService = userAccountService; } - + m_userAccountService.AddRegion(testScene); m_userAccountService.RegionLoaded(testScene); testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService); @@ -559,5 +560,4 @@ namespace OpenSim.Tests.Common.Setup sogd.InventoryDeQueueAndDelete(); } } - } diff --git a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs index 915af7e58d..135c50eb74 100644 --- a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs +++ b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs @@ -42,7 +42,7 @@ namespace OpenSim.Tests.Common public static InventoryItemBase CreateInventoryItem( Scene scene, string itemName, UUID itemId, string folderPath, UUID userId) - { + { InventoryItemBase item = new InventoryItemBase(); item.Name = itemName; item.AssetID = AssetHelpers.CreateAsset(scene, userId).FullID; @@ -52,7 +52,7 @@ namespace OpenSim.Tests.Common InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object); item.Folder = objsFolder.ID; - scene.AddInventoryItem(item); + scene.AddInventoryItem(item); return item; } diff --git a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs index 26156f396f..d01521dbdb 100644 --- a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs +++ b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs @@ -53,7 +53,7 @@ namespace OpenSim.Tests.Common.Setup // UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099"); // return CreateUserWithInventory(commsManager, userId, callback); // } -// +// // /// // /// Create a test user with a standard inventory // /// @@ -108,11 +108,11 @@ namespace OpenSim.Tests.Common.Setup // { // LocalUserServices lus = (LocalUserServices)commsManager.UserService; // lus.AddUser(firstName, lastName, password, "bill@bailey.com", 1000, 1000, userId); -// +// // CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); // userInfo.OnInventoryReceived += callback; // userInfo.FetchInventory(); -// +// // return userInfo; // } @@ -140,6 +140,6 @@ namespace OpenSim.Tests.Common.Setup scene.UserAccountService.StoreUserAccount(ua); scene.InventoryService.CreateUserInventory(ua.PrincipalID); scene.AuthenticationService.SetPassword(ua.PrincipalID, pw); - } + } } } \ No newline at end of file diff --git a/Prebuild/AUTHORS b/Prebuild/AUTHORS new file mode 100644 index 0000000000..9e86ac018f --- /dev/null +++ b/Prebuild/AUTHORS @@ -0,0 +1,10 @@ +Dave Hudson (jendave@yahoo.com), +Matthew Holmes (matthew@wildfiregames.com) +Dan Moorehead (dan05a@gmail.com) +Rob Loach (http://www.robloach.net) +C.J. Adams-Collier (cjac@colliertech.org) + +Patch Contributers +lbsa71 +chi11ken +sdague diff --git a/Prebuild/COPYING b/Prebuild/COPYING new file mode 100644 index 0000000000..c57c080b15 --- /dev/null +++ b/Prebuild/COPYING @@ -0,0 +1,65 @@ +BSD License +Copyright (c)2004-2008 + +See AUTHORS file for list of copyright holders + +Dave Hudson (jendave@yahoo.com), +Matthew Holmes (matthew@wildfiregames.com) +Dan Moorehead (dan05a@gmail.com) +Rob Loach (http://www.robloach.net) +C.J. Adams-Collier (cjac@colliertech.org) + +http://dnpb.sourceforge.net +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +--- + +Portions of src/Core/Targets/AutotoolsTarget.cs +// Copyright (C) 2006 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Prebuild/ChangeLog b/Prebuild/ChangeLog new file mode 100644 index 0000000000..bb8e7b09d8 --- /dev/null +++ b/Prebuild/ChangeLog @@ -0,0 +1,461 @@ +2008-12-09T02:15 D. Moonfire + * src/Core/Kernel.cs + - Added a /ppi target to get the results of processing but before + processing the actual results. + * src/Core/Preprocessor.cs + - Applied the patch from kanato with formatting changes. + - Uses the format. + * tests/ + - Added some lightweight tests to test the functionality of the + include patch. + +2008-06-19T09:37 John Anderson + * src/Core/Kernel.cs + - Only Loop through targets that are not abstract. + * src/Core/Targets/VSGenericTarget.cs + - Marked abstract and removed the Target attribute. + +2008-06-16T17:37 John Anderson + * src/Core/Nodes/ProjectNode.cs,data/prebuild-1.7.xsd + - Added the ability to hardcode guid's in the projects + +2008-05-21T0737 C.J. Adams-Collier + * src/Core/Targets/AutotoolsTarget.cs + - catch exception when unable to compile AssemblyInfo.cs + +2008-05-07T17:29 John Anderson + * src/Core/Targets/VSGenericTarget.cs + - Generate asp.net output in bin\ folder (asp.net requires it there) + +2008-04-30T17:29 John Anderson + * src/Core/Nodes/DatabaseReferenceNode.cs, + src/Core/Nodes/Datanode.cs, + src/Core/Nodes/FileNode.cs, + src/Core/Nodes/FileNodes.cs, + src/Core/Nodes/MatchNode.cs, + src/Core/Targets/VS2008Target.cs, + src/data/prebuild-1.7.xsd + - Refactored the project generation code to handle web projects and more + logically handle embedded resources and designer files. + +2008-04-30T17:29 Joseph Lombrozo + * src/Core/Nodes/SolutionNode.cs + - Had solutions inherit Configurations in the same way that Projects do. + +2008-04-29T06:35 Joseph Lombrozo + * src/Core/Targets/VS2008Target.cs, + src/Core/Nodes/DatabaseProjectNode.cs, + src/Core/Nodes/DatabaseReferenceNode.cs, + src/data/prebuild-1.7.xsd + - Added database references to database projects. + - Prevented nested solutions from being written to disk. + +2008-04-29T05:43 Joseph Lombrozo + * src/Core/Targets/VS2008Target.cs + - Enabled embedded solutions to contain Files. + +2008-04-29T04:13 Joseph Lombrozo + * src/Core/VSVersion.cs + - Fixed spelling mistake in enum comment. + * src/Core/Attributes/DataNodeAttribute.cs + - Allowed the DataNodeAttribute to be attached to a single class + more than once, allowing one class to be used to parse more than + one node at a time. + * src/Core/Kernel.cs + - Changed CacheNodeTypes() to allow for multiple DataNodeAttribute + instances in one class. Refactored ProcessFile(...) to return Solutions, + rather than adding them to the Kernel. + * src/Core/Nodes/SolutionNode.cs + - Added Guid (for embedded folders) + - Added DatabaseProjects, Solutions and Processes to the SolutionNode + when parsing. + * src/Core/Nodes/ProjectNode.cs + - Added FrameworkVersion property to allow for 2.0/3.0/3.5 differentiation. + * src/Core/Targets/VS2008Target.cs, src/data/prebuild-1.7.xsd + - Added ability to have embedded solutions, and externally referenced + prebuild scripts. + +2008-04-24T04:33 John M. Anderson + * src/Core/Targets/VS2003Target.cs, src/Core/Targets/VSVersion.cs + - Moved the VSVersion enum into its own file. + * src/Core/Targets/VS2008Target.cs + - added support for VS2008 + * src/Core/Nodes/ProjectNode.cs + - Added initial support for ASP.NET projects + * src/Core/Nodes/DatabaseProjectNode.cs + - Added support for Visual Studio database projects + +2008-02-19T07:08 C.J. Adams-Collier + * TODO + - added some tasks from Sam Hocevar + * src/Core/Targets/AutotoolsTarget.cs + - added a missing end paren + * COPYING + - Removed Randy Ridge's name from the copyright. Looks to me like + his name was present only because the file was nabbed from Tao + +2008-02-09T20:29 C.J. Adams-Collier + * COPYING + - added MIT/X11 license due to inclusion of code from Monodevelop + * THANKS + - added Lluis Sanchez Gual and Todd Berman - I yoinked code from + their pkg-config .pc file parser to build AutotoolsTarget.cs. + Sorry it took me so long to remember to add mention of you guys! + * src/Core/Targets/AutotoolsTarget.cs + - added MIT/X11 license. see above. + +2008-02-07T08:27 C.J. Adams-Collier + * AUTHORS + - consolidated names and contact info found laying around the + source + * src/Core/Kernel.cs + - updated copyright date + - re-formatted license for 80-column editor + - updated log banner to indicate new date, new authors + * src/Core/Targets/AutotoolsTarget.cs + - clarified reasoning behind use of constants in + AutotoolsTarget.ParsePCFile + - reduced length of some long lines using newline/indent + - added log messages for parsing .pc files, emitting solutions, + projects + - robustified the inter-package dependency resolution target + - log warning when we can't find assembly for + - clarified code for case of inability to find embedded + autotools.xml + * src/data/autotools.xml + - adding system lookup of resgen2 to configure.ac + - fixed .resource -> .resources typo + - added a rule to create .response file containing all sources + - using @.response on $(CSC) command line instead of listing + all source files + * src/Properties/AssemblyInfo.cs + - re-formatted license for an 80-column editor + - added more authors to the AssemblyCopyright attribute + - bumped version to 2.0.3 + * prebuild.xml + - bumped version to 2.0.3 + * scripts/autotools.sh + - if 'mono' is in the path, run Prebuild.exe with it + - using dirname to capture correct path to prebuild.xml &c + +2008-02-06T17:18 C.J. Adams-Collier + * src/Core/Targets/NAntTarget.cs + - re-formatted the license for an 80-column editor + - added myself to the copyright + - added a fix submitted by Gryc Ueusp + * src/Core/Targets/AutotoolsTarget.cs + - updated copyright to include 2008 + * THANKS + - created file, added Gryc Ueusp + +2008-01-01T14:50 C.J. Adams-Collier + * src/data/autotools.xml + - fixed .resx -> .resource compilation + - fixed failing edge case where Project is an unsigned Library + - added $(RESOURCE_SRC) to list of extra dist files + * src/Core/Targets/AutotoolsTarget.cs + - removed embeddedResources from extraDistFiles list + +2007-04-18T07:49 C.J. Adams-Collier + * src/data/prebuild-1.7.xsd + - removed default version from references + +2007-04-06T12:42 C.J. Adams-Collier + * src/data/autotools.xml + - added support for /doc: output when XmlDocFile is not empty + - not printing \t \\n on lines that have no content + - gacutil now installs the root assembly instead of the one under + bin/Debug or whatever + +2007-04-04T22:12 C.J. Adams-Collier + * src/Core/Targets/AutotoolsTarget.cs + - removed debugging Console.WriteLine() + * src/data/autotools.xml + - ensuring that install-sh and missing get distributed + - explicitly stating that the sources, snk, resources and binary + references live under $(srcdir) + - corrected uninstall target + - verified distcheck completes successfully + +2007-04-03T21:56 C.J. Adams-Collier + * src/Core/Targets/AutotoolsTarget.cs + - added a using for System.Diagnostics + - added enum ClrVersion for use with the pkg-config parser + - added class SystemPackage for use with the pkg-config parser + - removed explicit "private" property of members since it is implied + - flushing the stream-writer before it's closed + - removed excess braces around an if statement + ! NormalizeAsmName(), AddAssembly(), GetAssembliesWithLibInfo(), + GetAssembliesWithoutLibInfo(), ProcessPiece(), + GetVariableFromPkgConfig(), ParsePCFile(), + RegisterSystemAssemblies(), RunInitialization() + - pulled the above from MonoDevelop to parse the system pkgconfig + files and determine /pkg: arguments. Original sources are here: + http://svn.myrealbox.com/source/trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core/SystemAssemblyService.cs + http://svn.myrealbox.com/source/trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core/ClrVersion.cs + ! WriteProject() + - now gathering project version from AssemblyInfo.cs if it is part + of the project + - changed the declaration of the ArrayList's in the method + - now copying assembly .config files to the project, distributing, + installing + - making sure all needed files live under the Project directory + - copying strongname keys to project directory + - parsing AssemblyInfo.cs to determine assembly version + - removing all references to ".." + - removed superfluous if(project.References.Count > 0) around + for(int refNum = 0; refNum < project.References.Count; refNum++) + - removed use of runtimeLibs + - adding hook to copy sibling project's generated assemblies to + this project during Make time + - added extra dist target to ensure all files required to build + get distributed during "make dist" + - added new xslt processing args: + -- assemblyName + -- extraDistFiles + -- pkgLibs (/pkg:foo) + -- localCopyTargets (to copy sibling assemblies at Make time) + -- projectVersion (if determined from AssemblyInfo.cs) + -- hasAssemblyConfig (if there's a assembly.exe.config present) + ! Write() + - calling RunInitialization() to gather pkg-config data + * src/data/autotools.xml + - accepting new args passed from AutotoolsTarget.cs + - modernized configure.ac a bit + - using a version of tar that allows >99-char filenames + - added ASSEMBLY_NAME variable + - using assembly name rather than project name for gac installation + - generated assembly is now assembly name and not project name + - accepting /pkg: flags gathered from AutotoolsTarget.cs + - adding Makefile targets to copy sibling project assemblies to . + - fixed Debug, Release targets + - adding support for strongname key signing + - adding /unsafe support + - adding a clean make target + - only running gacutil /u if the assembly being uninstalled is in gac + - added some templates to determine each Configuration's .snk + - added explanation as to why .exe assemblies live in $prefix/lib + * src/Properties/AssemblyInfo.cs + - bumped assembly version + * prebuild.xml + - bumped assembly version + +2007-03-29T18:03 C.J. Adams-Collier + * src/Core/Targets/AutotoolsTarget.cs + ! WriteProject() + - re-named incorrectly-named variable gacLibs to systemLibs + - added another reference list, runtimeLibs which contains the + libs we will need at runtime. we use this to build a MONO_PATH + - added monoPath to the xslt args list + * src/data/autotools.xml + ! + - renamed gacLibs to systemLibs + - added the sources to the dist list + - added logic to install libs that aren't strongnamed + ! + - accepting a param to update the MONO_PATH + +2007-03-28T19:46 C.J. Adams-Collier + * src/Core/Targets/MonoDevelopTarget.cs + ! CleanProject() + - using Assembly.LoadWithPartialName to locate the assembly + * src/Core/Targets/AutotoolsTarget.cs + ! WriteCombine() + - no longer using $PWD to determine a project's source dir; this + doesn't work with elements + - passing the solution name to all templates - fixes + multi-solution prebuild systems + ! WriteProject() + - no longer using $PWD to determine a project's source dir; this + doesn't work with elements + - passing the solution name to all templates - fixes + multi-solution prebuild systems + - copying strongname key to the autotools directory + - using Assembly.LoadWithPartialName to locate assemblies + * src/data/autotools.xml + ! + - fixed the .pc AC_CONFIG_FILES macro + ! + - added solution name param + - wrapping if type=exe check around script install macro + - added type=lib check and .pc file install macro + - added support for Configuration-specific builds (Debug, Release, etc) + - added strongname keyfile code + - TODO: support non-strongnamed library installation + ! + - added space preservation attribute to stylesheet element + - added a lower-case project name variable + - added solution name param + - made for-each template more specific + ! + - added solution name param + ! + - added solution name param + ! + - added solution name param + ! + - added solution name param + +2007-03-27T09:33 C.J. Adams-Collier + * src/Core/Targets/AutotoolsTarget.cs + - now processing the wrapper script if type is "Exe" or "WinExe" + * src/data/autotools.xml + ! + - being more exact about where text escaping is used + - using the correct variable name for the GACUTIL_FLAGS template + - using correct test="" for the AC_CONFIG_FILES macros + ! + - uncommented the bin_SCRIPTS section now that the script is being + generated correctly + ! + - fixed whitespace at beginning of file, before #! + - using lower-case packageName to indicate installation location + +2007-03-27T09:33 C.J. Adams-Collier + * src/data/autotools.xml + ! + * added a lcProjectName which is $projectName lower-cased + * moved autoconf template specifier near AC_OUTPUT + * AC_OUTPUT with args is deprecated. now using AC_CONFIG_FILES + * placed AC_CONFIG_FILES() calls for wrapper script or pkg-config + file in xslt project type checks + ! + * commented out bin_SCRIPTS + * added a lcProjectName which is $projectName lower-cased + * using $lcProjectName instead of the longer version + +2007-03-27T08:39 C.J. Adams-Collier + * src/data/autotools.xml + ! + - added whitespace-preservation + - added the missing projectName param + - replaced bin_SCRIPTS with something that worked + +2007-03-27T07:56 C.J. Adams-Collier + * src/data/autotools.xml + ! + - cleaned up duplicate checks + - placed initialization macros above system check macros + - added some more messages about what's going on + - added GACUTIL_FLAGS variable including /package option + ! + - added an incomplete bin_SCRIPTS + - RCS check says "building" instead of "compiling" + ! + - removed macros that are useful only for projects + ! + - created this element on this revision + - this is a wrapper shell script that lives in the $PATH and runs + the CIL assembly + +2007-03-26T20:18 C.J. Adams-Collier + * src/Core/Targets/AutotoolsTarget.cs + - creating new template arguments to contain the list of libs to + reference: source, binary & GAC + - source libs are included as part of this solution (untested) + - binary libs are distributed with the source (untested) + - GAC libs are assumed to be in the GAC or other lib path (tested) + * src/data/autotools.xml + - created new params through which to accept reference info + - created a working $(CSC) line + - added a TODO item for ordering project dependency for + AC_CONFIG_SUBDIRS code + +2007-03-26T08:41 C.J. Adams-Collier + * src/Core/Targets/AutotoolsTarget.cs + - now creating list of source files in managed code and passing + them to the template via s + * src/data/prebuild-1.7.xsd + - updated the header comment to 2007 + * src/data/autotools.xml + ! + - copied checks from Solution-level configure.ac + - copied solution-level config status + ! + - added elements for file list to be passed through + - made a temporary target for the assembly we're building + - added this target to the deps of "all:" + ! + - changed status header/footer from "- - -" to "===" + +2007-03-23T08:33 C.J. Adams-Collier + Added version attribute handling code for Property element + Added description element handling code + * prebuild.xml + - added /Prebuild/Solution/Property/@version attribute + - added /Prebuild/Solution/Property/Description element + * src/Core/Nodes/ProjectNode.cs + - added some docs where they were missing and obvious + - added code to handle @version + * src/Core/Nodes/DescriptionNode.cs + - new file. Used to handle /Prebuild/Solution/Property/Description + * src/Core/Targets/AutotoolsTarget.cs + - added mkdirDashP(), a recursive directory creation method + - WriteProject() now copies the files to autotools/ + * src/data/prebuild-1.7.xsd + - added /Prebuild/Solution/Property/Description element + - added /Prebuild/Solution/Property/@version attribute + * src/data/autotools.xml + - removed excess + - explicitly using dnpb: prefix + +2007-03-23T04:31 C.J. Adams-Collier + Merged code from my stripped-down test + Adding support for the /Prebuild/Solution/Project/Author element + * prebuild.xml + - added Author elements + - cleaned up the really long Project element + * src/Core/Nodes/ProjectNode.cs + - added Author tag processing code + * src/Core/Nodes/AuthorNode.cs + - Created to process Author elements + - based off of ReferencePathNode.cs + * src/Core/Targets/AutotoolsTarget.cs + - merged code from https://svn.colliertech.org/mono/dnpbAutotools/dnpbAutotools/test.cs + - renamed old WriteCombine to WriteCombineOld + - renamed old WriteProject to WriteProjectOld + * src/data/prebuild-1.7.xsd + - added Author element to Project + * src/data/autotools.xml + - lower-cased utf + + +2007-03-22T13:58 C.J. Adams-Collier + Exposing an XmlDocument that represents the prebuild.xml file + passed to the program + + * src/Core/Kernel.cs + - created an object member called XmlDocument m_CurrentDoc + - created a property to access its value + - using m_CurrentDoc to load up the prebuild.xml file rather than + a local variable called "doc" + +2007-03-22 C.J. Adams-Collier + * prebuild.xml + - added autotools.xml created at https://svn.colliertech.org/mono/dnpbAutotools/dnpbAutotools/autotools.xml + * src/data/autotools.xml + - the same + * src/Core/Targets/MonoDevelopTarget.cs + - fixed bug introduced in r206 + +2007-03-07 C.J. Adams-Collier + * src/data/prebuild-1.7.xsd + - added version attribute to Solution and Project elements + +2006-11-04T00:38 C.J. Adams-Collier + * placing AssemblyInfo.cs into Properties/ + * Fixed double-mention of the package name + +2006-11-03T15:23 C.J. Adams-Collier + * corrected a problem in the Include.am generation code + * created the new .exe + * copied it to the root of the build + +2006-11-03T14:57 C.J. Adams-Collier + * Updated the .exe file + +2006-11-03 C.J. Adams-Collier + * Added a TODO file + * Added a ChangeLog file + * applied some fixes for autotools gac and pkg-config installation + problems diff --git a/Prebuild/INSTALL b/Prebuild/INSTALL new file mode 100644 index 0000000000..23e5f25d0e --- /dev/null +++ b/Prebuild/INSTALL @@ -0,0 +1,236 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free +Software Foundation, Inc. + +This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + +These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. (Caching is +disabled by default to prevent problems with accidental use of stale +cache files.) + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You only need +`configure.ac' if you want to change it or regenerate `configure' using +a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + +Some systems require unusual options for compilation or linking that the +`configure' script does not know about. Run `./configure --help' for +details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + +You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not support the `VPATH' +variable, you have to compile the package for one architecture at a +time in the source code directory. After you have installed the +package for one architecture, use `make distclean' before reconfiguring +for another architecture. + +Installation Names +================== + +By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + +Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + +There may be some features `configure' cannot figure out automatically, +but needs to determine by the type of machine the package will run on. +Usually, assuming the package is built to be run on the _same_ +architectures, `configure' can figure that out, but if it prints a +message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + +If you want to set default values for `configure' scripts to share, you +can create a site shell script called `config.site' that gives default +values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + +Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). Here is a another example: + + /bin/bash ./configure CONFIG_SHELL=/bin/bash + +Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent +configuration-related scripts to be executed by `/bin/bash'. + +`configure' Invocation +====================== + +`configure' recognizes the following options to control how it operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/Prebuild/NEWS b/Prebuild/NEWS new file mode 100644 index 0000000000..3ab3108b4c --- /dev/null +++ b/Prebuild/NEWS @@ -0,0 +1,200 @@ +Prebuild is an XML-driven pre-build tool allowing developers to easily generate project or make files for major IDE's and .NET development tools including: Visual Studio 2005, Visual Studio 2003, Visual Studio 2002, SharpDevelop, MonoDevelop, and NAnt. + +Documentation and downloads are available at http://dnpb.sourceforge.net. + +Prebuild is licensed under the BSD license. + +[ XXXXXXX XX, XXX - 1.3.2 ] + + Added Keyfile signing to NAnt target and VS2005 target + + Updated XSD file to 1.7 + + Boo and VisualBasic Language support in VS2005 target + + Added basic Autotools target. It creates a non-recursive Autotools system. + ! Multiple files can be excluded from the Match node + ! VS2005 now handles .resx files correctly. + ! NAnt and Autotools now handle defines + ! NAnt and Autotools now handle resources + + Conditional XML variables can be passed through the command line. + + Added /install and /remove command line flags to install and remove assemblies from the GAC + + Many fixes to VS2005 target + +[ July 21, 2006 - 1.3.1 ] + ! VS2005 fixes from Rob Loach + ! NAnt fixes from Rob Loach and David Hudson + ! XML doc fixes from Rob Loach + + Added SharpDevelop2 target (really just uses VS2005 target) + ! Fixed bug with BuildEvents in Monodevelop target + + Passing /yes will default to answering yes to any warnings + +[ February 28, 2006 - 1.3 ] + + Added MonoDevelop target. + + Added NAnt target. + + Lots of fixes to all targets. + * Cleaned up the code using FXCop. + * Updated schema to 1.6 to fix a typo and add a new parameter. + * jendave is now the maintainer of the project. RobLoach has been added as a developer. + * Removed references to 'dnpb'. + + Added rudimentary support for pre- and post- build scripts + * Updated examples. + +[ August 5, 2004 - 1.2 ] + + Added Visual Studio Express (vs2005express) target contributed by Borrillis and modified for use with different languages + + Added the allowedgroups command line option followed by a pipe-delimited list of project group filter flags (eg. Group1|Group2) allow optional filtering of all projects that dont have at least one of these flags + + Added the filterGroups XML attribute to the project node and updated the scheme to v1.5 for this addition, it is used to specified the delimited list of filter groups to which a project belongs + * Modified the removedir command line option to allow for a pipe-delimited list of directory names + ! Modified the resource loading code to search for resourced without the prepended namespace (as Visual Studio .NET does it) to allow for it to be compiled with SharpDevelop as well + + Added the GenerateXmlDocFile boolean option to the Options XML element + * Changed the behavior of the XmlDocFile option so that if not specified it uses the assemblyName (without file extension) + .xml for the file name instead of just not generating the file since the new GenerateXmlDocFile takes care of this + +[ January 3, 2004 - 1.1 ] + ! Replaced regex use for more efficient manual parsing to allow use on non-windows platforms with Mono which has Regex problems + + Added the checkOsVars attribute to the root element for enabling interpolation for Enviroment variables in the form ${var}, otherwise no checking is performed for efficiency-sake + * Make the version attribute on the root element optional as it isn't used and not needed since the schema url contains the version + +[ December 30, 2004 - 1.1 ] + ! Applied Leed's fix for SharpDevelop references + + Rewrote much of the processing for better validation and without the use of a temp file + + Added support for configurations at the project level which are named All. They now apply changes to all Solution level defined configs + * Changed all spaces into tabs + + Added support for the None build action + * Replaced all sequence's in the XML schema for all's because the order doesn't matter since the xml file is loaded into an XmlDocument + +[ December 25, 2004 - 1.0 ] + + Added the /removedir option for cleaning directories like obj before file releases + + Changed WriteTempXml() and the new DeleteTempXml() methods to be compiled only in DEBUG builds + * Made path optional for Match elements (defaults to current directory) and updates schema for it + ! Fixed XML example in the readme.txt + + Added example xml files to docs directory + * Updated license.txt to add Dan Moorehead and update copyright years + + Updated prebuild.xml to take advantage of the default path attribute for match elements + + Updated Clean to delete the obj directories + +[ December 25, 2004 - 0.13 ] + + Added dnpb.exe so that it can be used to generate the project files + + Added dnpb.ico + * Added parameterless Write statement to Log for writing a single line + * Changed scehema to version 1.3 for support of icon attribute + * Added support for All configuration name under a Project node signifying common settings for all configurations + ! Fixed the SupressWarnings by adding the corresponding field to OptionsNode + * Wrote documentation in docs/readme.txt + * Added Dan Moorehead to copyrights and extended date from 2004 to 2004-2005 + * Updated prebuild.xml + * Optimized Log class + * Updated OutputUsage() + * /clean targets all by default + * No log file is used by default, /log without value specified uses default file name + + Added support for the /pause which pauses the utility after execution to observe output + + +[ September 27, 2004 - 0.12.2a ] + ! Fixed a nasty bug when trying to delete our temp file for pre-processing. + +[ September 15, 2004 - 0.12.2 ] + + Expanded platform identification, thanks to the NAnt guys for shedding some + light on how to properly check for UNIX platforms! Thanks guys! + * POSIX OS identifier changed to UNIX. Valid OS names are now "Win32", "UNIX", + and "Unknown". + ! Fixed SharpDevelop target to properly use the 'rootNamespace' attribute of + the Project tag. + + New command-line switch, /ppo, forces DNPB to pre-process the file and write + the pre-processed file. This allows you to test/debug your pre-processor + macros. No other processing will be done. You can specify a target file as + a paramter for the /ppo switch, or DNPB will write the file 'preprocessed.xml' + if you do not specify a file. + + The Match tag now has a 'buildAction' attribute which functions exactly like + the attribute of the same name for the File tag. + +[ August 5, 2004 - 0.12.1 ] + + Added environment variable expansion for all values. Environment variables + should be listed in the form ${VAR}. + +[ July 30, 2004 - 0.12.0 ] + + Added preprocessing via XML processing information tags. Available tags + are: ?>, ?>, and . The + current expression parser is very basic, but will be replaced with a more + capable parser over time. Current operators available are: =, !=, <, >, + <=, >=. Current test variables available: OS, RuntimeVersion, RuntimeMajor, + RuntimeMinor, RuntimeRevision. + +[ July 27, 2004 - 0.11.4 ] + + Added 'useRegex' attribute to the Match tag. Matches can now use regular + expressions to match filenames. + + Added the 'assemblyName' attribute to the Project tag. Projects can now + set their output assembly name. + ! Fixed several bugs in the way that Project tags inheirt their parent + Solutions configuration options. This operation should now work fully as + intended. + ! Due to some wierdness, Project Guid's are now stored as part of the Project + node and created at parse time. + +[ May 11, 2004 - 0.11.3 ] + ! Fixed a bug where I was writing the wrong property name for a projects root + namespace. + ! Removed a DEBUG statement I had left in the code in 0.11.2. + ! Fixed a bug in the VS2002 writer which caused the version variables to not + be overriden correctly. + + Added the rootNamespace property to the element, allowing you to + specify the root namespace. + * /target and /clean are now mutually exclusive command line switches, and + they both now take the all option. In the case of /target all, all build + file for all targets will be created. In the case of /clean all, the user + will be prompted to make sure they want to do it, and if so, will clean + all build files for all targets. + +[ April 22, 2004 - 0.11.2 ] + ! Fixed a bug with the /file command-line operator. Was using the unresolved + file path rather then the resolved one, was making the attempt to open the + dnpb file fail. + ! Fixed a bug in the schema that required at least 1 solution and 1 reference + path. We can do just fine with 0 of either of these. Some files may be all + statements and not have any tags. + ! Fixed a bug that caused the project references not to be written with the + SharpDevelop target. + * Changed the schema to version 1.2, allowing for Configuration nodes to exist + under project nodes. The inheritance of values is hierarchical. Meaning, if + you define a configuration named Debug at the Soltion level, and one by the + same name at the Project level, the one at the Project level will first + inherit the options of the Solution level configuration, then set it's own + options. If you define a configuration at the Project level and it does not + exist at the Solution level, it will be created at the Solution level. + * Project references should now work correctly across the board. Note that due + to a restriction in Visual Studio, you can only reference projects in the same + solution. + +[ April 21, 2004 - 0.11.1 ] + ! Fixed a problem with resolving paths in various targets. Was not properly + setting the CWD. + * Schema updated to 1.1, moving the ReferencePath element from the Options + element to the Project element. This makes more logical sense, given that + reference paths are resolved relative to the project path. Any prebuild.xml + file referecning verison 1.0 will fail! Please update to the 1.1 schema. + +[ April 19, 2004 - 0.11.0 ] + * Added several attributes across the code to make FxCop happy + ! Fixed bugs in reference paths being written in the VS targets. + ! Fixed a bug in ProjectNode which was doing two CWDStack.Push() calls instead of + a Push/Pop pair. Was wreaking havoc with tags. + ! Fixed some bugs in the path tracking, both the Project and Solution nodes now + have a FullPath property, which is the full path to the file resolved at load + time. This should fix all path relativity problems. + + Added new /clean switch, allowing the target to clean up any files it generated. + in accordance, the ITarget interface has been updated to support a new Clean() + method. + + Completed addition of the tag, to allow the referencing of external + prebuild.xml files. + + Added the runtime attribute to the Project element. This allows the developer + to specify which runtime a project should target (Mono or Microsoft). This is + of course ignored in certain targets like the Visual Studio targets. + + Added the SharpDevelop target. + +[ April 13, 2004 - 0.10.1a ] + + Added the buildAction attribute to the File node. This is needed for dnpb + to even be able to bootstrap itself (dnpb-1.0.xsd must be an embedded resource) + +[ April 13, 2004 - 0.10.1 ] + * First Release + +[ Key ] +* = Change or information ++ = Addition +! = Bug Fix + diff --git a/Prebuild/README b/Prebuild/README new file mode 100644 index 0000000000..e8a2d69530 --- /dev/null +++ b/Prebuild/README @@ -0,0 +1,274 @@ +Prebuild Instructions + +Prebuild is an XML-driven pre-build tool allowing developers to easily generate project or make files for major IDE's and .NET development tools including: Visual Studio 2005, Visual Studio 2003, Visual Studio 2002, SharpDevelop, SharpDevelop2, MonoDevelop, and NAnt. + +_______________________________________________________________________________ +Overview + +Prebuild can be either be run from the command line to generate the +project and make files or you can execute the included batch (*.bat) +and Unix Shell script (*.sh) files. + +_______________________________________________________________________________ +The currently supported developement tools and their associated batch +and shell script files. + +Visual Studio .NET 2005 (VS2005.bat) +Visual Studio .NET 2003 (VS2003.bat) +Visual Studio .NET 2002 (VS2002.bat) +SharpDevelop (SharpDevelop.bat) - http://www.icsharpcode.net/OpenSource/SD/ +SharpDevelop2 (SharpDevelop.bat) - http://www.icsharpcode.net/OpenSource/SD/ +MonoDevelop (MonoDevelop.sh) - http://www.monodevelop.com/ +NAnt (nant.sh and nant.bat) - http://nant.sourceforge.net/ +Autotools (autotools.bat and autotools.sh) - http://en.wikipedia.org/wiki/GNU_build_system + +Notes: + +A Unix Shell script is provided for MonoDevelop, as it does not run on +Windows at this time. + +Visual Studio .NET 2005 and the Visual Express IDE's can import +solutions from older versions of Visual Studio .NET. + +Makefiles are not currently supported. + +_______________________________________________________________________________ +Command Line Syntax: + +Example: +> Prebuild /target vs2003 + +This will generate the project files for Visual Studio.NET 2003 and +place the redirect the log to a file named PrebuildLog.txt in the +parent directory + + +The syntax structure is as below, where commandParameter is optional +depending on the command and you can provide several option-value +pairs. + +Note: The '> ' signifies the command prompt, do not enter this literally + +> Prebuild / /// The targets. - public Hashtable Targets + public Dictionary Targets { get { @@ -259,7 +255,7 @@ namespace Prebuild.Core private void LoadSchema() { - Assembly assembly = this.GetType().Assembly; + Assembly assembly = GetType().Assembly; Stream stream = assembly.GetManifestResourceStream("Prebuild.data." + m_Schema); if(stream == null) { @@ -319,23 +315,24 @@ namespace Prebuild.Core private void LogBanner() { - m_Log.Write("Prebuild v" + this.Version); - m_Log.Write("Copyright (c) 2004-2008"); - m_Log.Write("Matthew Holmes (matthew@wildfiregames.com),"); - m_Log.Write("Dan Moorehead (dan05a@gmail.com),"); - m_Log.Write("David Hudson (jendave@yahoo.com),"); - m_Log.Write("Rob Loach (http://www.robloach.net),"); - m_Log.Write("C.J. Adams-Collier (cjac@colliertech.org),"); + m_Log.Write("Prebuild v" + Version); + m_Log.Write("Copyright (c) 2004-2010"); + m_Log.Write("Matthew Holmes (matthew@wildfiregames.com),"); + m_Log.Write("Dan Moorehead (dan05a@gmail.com),"); + m_Log.Write("David Hudson (jendave@yahoo.com),"); + m_Log.Write("Rob Loach (http://www.robloach.net),"); + m_Log.Write("C.J. Adams-Collier (cjac@colliertech.org),"); + m_Log.Write("John Hurliman (john.hurliman@intel.com),"); - m_Log.Write("See 'prebuild /usage' for help"); - m_Log.Write(); + m_Log.Write("See 'prebuild /usage' for help"); + m_Log.Write(); } private void ProcessFile(string file) { - ProcessFile(file, this.m_Solutions); + ProcessFile(file, m_Solutions); } public void ProcessFile(ProcessNode node, SolutionNode parent) @@ -381,12 +378,12 @@ namespace Prebuild.Core Core.Parse.Preprocessor pre = new Core.Parse.Preprocessor(); //register command line arguments as XML variables - IDictionaryEnumerator dict = m_CommandLine.GetEnumerator(); + IEnumerator> dict = m_CommandLine.GetEnumerator(); while (dict.MoveNext()) { - string name = dict.Key.ToString().Trim(); + string name = dict.Current.Key.Trim(); if (name.Length > 0) - pre.RegisterVariable(name, dict.Value.ToString()); + pre.RegisterVariable(name, dict.Current.Value); } string xml = pre.Process(reader);//remove script and evaulate pre-proccessing to get schema-conforming XML @@ -422,6 +419,10 @@ namespace Prebuild.Core m_CurrentDoc = new XmlDocument(); try { +#if NO_VALIDATE + XmlReader validator = XmlReader.Create(new StringReader(xml)); + m_CurrentDoc.Load(validator); +#else XmlValidatingReader validator = new XmlValidatingReader(new XmlTextReader(new StringReader(xml))); //validate while reading from string into XmlDocument DOM structure in memory @@ -430,6 +431,7 @@ namespace Prebuild.Core validator.Schemas.Add(schema); } m_CurrentDoc.Load(validator); +#endif } catch(XmlException e) { @@ -541,7 +543,7 @@ namespace Prebuild.Core return null; } - NodeEntry ne = (NodeEntry)m_Nodes[node.Name]; + NodeEntry ne = m_Nodes[node.Name]; return ne.Type; } @@ -578,11 +580,11 @@ namespace Prebuild.Core { if(!m_Nodes.ContainsKey(node.Name)) { - //throw new XmlException("Unknown XML node: " + node.Name); + Console.WriteLine("WARNING: Unknown XML node: " + node.Name); return null; } - NodeEntry ne = (NodeEntry)m_Nodes[node.Name]; + NodeEntry ne = m_Nodes[node.Name]; Type type = ne.Type; //DataNodeAttribute dna = ne.Attribute; @@ -624,10 +626,8 @@ namespace Prebuild.Core /// The args. public void Initialize(LogTargets target, string[] args) { - m_Targets = new Hashtable(); - CacheTargets(this.GetType().Assembly); - m_Nodes = new Hashtable(); - CacheNodeTypes(this.GetType().Assembly); + CacheTargets(GetType().Assembly); + CacheNodeTypes(GetType().Assembly); CacheVersion(); m_CommandLine = new CommandLineCollection(args); @@ -750,11 +750,11 @@ namespace Prebuild.Core } else { - if (!m_Targets.Contains(target)) { + if (!m_Targets.ContainsKey(target)) { m_Log.Write(LogType.Error, "Unknown Target \"{0}\"", target); return; } - ITarget targ = (ITarget)m_Targets[target]; + ITarget targ = m_Targets[target]; if(clean) { @@ -793,18 +793,19 @@ namespace Prebuild.Core /// protected virtual void Dispose(bool disposing) { - if (!this.disposed) + if (!disposed) { if (disposing) { - if (this.m_Log != null) + GC.SuppressFinalize(this); + if (m_Log != null) { - this.m_Log.Close(); - this.m_Log = null; + m_Log.Close(); + m_Log = null; } } } - this.disposed = true; + disposed = true; } /// @@ -812,7 +813,7 @@ namespace Prebuild.Core /// ~Kernel() { - this.Dispose(false); + Dispose(false); } /// diff --git a/Prebuild/src/Core/Nodes/AuthorNode.cs b/Prebuild/src/Core/Nodes/AuthorNode.cs index 20e72c01f1..4c415bb6b1 100644 --- a/Prebuild/src/Core/Nodes/AuthorNode.cs +++ b/Prebuild/src/Core/Nodes/AuthorNode.cs @@ -24,8 +24,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O #endregion using System; -using System.Collections; -using System.Collections.Specialized; using System.Xml; using Prebuild.Core.Attributes; diff --git a/Prebuild/src/Core/Nodes/CleanFilesNode.cs b/Prebuild/src/Core/Nodes/CleanFilesNode.cs new file mode 100644 index 0000000000..71405f9aaa --- /dev/null +++ b/Prebuild/src/Core/Nodes/CleanFilesNode.cs @@ -0,0 +1,80 @@ +#region BSD License +/* +Copyright (c) 2007 C.J. Adams-Collier (cjac@colliertech.org) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +using System; +using System.Collections.Generic; +using System.Xml; + +using Prebuild.Core.Attributes; +using Prebuild.Core.Interfaces; +using Prebuild.Core.Utilities; + +namespace Prebuild.Core.Nodes +{ + [DataNode("CleanFiles")] + public class CleanFilesNode : DataNode + { + #region Fields + + private string m_Pattern; + + #endregion + + #region Properties + + /// + /// Gets the signature. + /// + /// The signature. + public string Pattern + { + get + { + return m_Pattern; + } + } + + #endregion + + #region Public Methods + + /// + /// Parses the specified node. + /// + /// The node. + public override void Parse(XmlNode node) + { + if (node == null) + { + throw new ArgumentNullException("node"); + } + + m_Pattern = Helper.AttributeValue(node, "pattern", String.Empty); ; + m_Pattern = m_Pattern.Trim(); + } + + #endregion + } +} \ No newline at end of file diff --git a/Prebuild/src/Core/Nodes/CleanupNode.cs b/Prebuild/src/Core/Nodes/CleanupNode.cs new file mode 100644 index 0000000000..b8131b0ebb --- /dev/null +++ b/Prebuild/src/Core/Nodes/CleanupNode.cs @@ -0,0 +1,85 @@ +#region BSD License +/* +Copyright (c) 2007 C.J. Adams-Collier (cjac@colliertech.org) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +using System; +using System.Collections.Generic; +using System.Xml; + +using Prebuild.Core.Attributes; +using Prebuild.Core.Interfaces; + +namespace Prebuild.Core.Nodes +{ + [DataNode("Cleanup")] + public class CleanupNode : DataNode + { + #region Fields + + private List m_CleanFiles = new List(); + + #endregion + + #region Properties + + /// + /// Gets the signature. + /// + /// The signature. + public List CleanFiles + { + get + { + return m_CleanFiles; + } + } + + #endregion + + #region Public Methods + + /// + /// Parses the specified node. + /// + /// The node. + public override void Parse(XmlNode node) + { + if( node == null ) + { + throw new ArgumentNullException("node"); + } + + foreach (XmlNode child in node.ChildNodes) + { + IDataNode dataNode = Kernel.Instance.ParseNode(child, this); + if (dataNode is CleanFilesNode) + { + m_CleanFiles.Add((CleanFilesNode)dataNode); + } + } + } + + #endregion + } +} \ No newline at end of file diff --git a/Prebuild/src/Core/Nodes/ConfigurationNode.cs b/Prebuild/src/Core/Nodes/ConfigurationNode.cs index 67d78d55fd..cd2f740ae7 100644 --- a/Prebuild/src/Core/Nodes/ConfigurationNode.cs +++ b/Prebuild/src/Core/Nodes/ConfigurationNode.cs @@ -41,6 +41,7 @@ namespace Prebuild.Core.Nodes #region Fields private string m_Name = "unknown"; + private string m_Platform = "AnyCPU"; private OptionsNode m_Options; #endregion @@ -83,6 +84,33 @@ namespace Prebuild.Core.Nodes } } + /// + /// Identifies the platform for this specific configuration. + /// + public string Platform + { + get + { + return m_Platform; + } + set + { + switch ((value + "").ToLower()) + { + case "x86": + case "x64": + m_Platform = value; + break; + case "itanium": + m_Platform = "Itanium"; + break; + default: + m_Platform = "AnyCPU"; + break; + } + } + } + /// /// Gets the name. /// @@ -95,6 +123,22 @@ namespace Prebuild.Core.Nodes } } + /// + /// Gets the name and platform for the configuration. + /// + /// The name and platform. + public string NameAndPlatform + { + get + { + string platform = m_Platform; + if (platform == "AnyCPU") + platform = "Any CPU"; + + return String.Format("{0}|{1}", m_Name, platform); + } + } + /// /// Gets or sets the options. /// @@ -122,7 +166,9 @@ namespace Prebuild.Core.Nodes public override void Parse(XmlNode node) { m_Name = Helper.AttributeValue(node, "name", m_Name); - if( node == null ) + Platform = Helper.AttributeValue(node, "platform", m_Platform); + + if (node == null) { throw new ArgumentNullException("node"); } @@ -159,6 +205,7 @@ namespace Prebuild.Core.Nodes { ConfigurationNode ret = new ConfigurationNode(); ret.m_Name = m_Name; + ret.m_Platform = m_Platform; m_Options.CopyTo(ret.m_Options); return ret; } diff --git a/Prebuild/src/Core/Nodes/ConfigurationNodeCollection.cs b/Prebuild/src/Core/Nodes/ConfigurationNodeCollection.cs new file mode 100644 index 0000000000..1c38d9e443 --- /dev/null +++ b/Prebuild/src/Core/Nodes/ConfigurationNodeCollection.cs @@ -0,0 +1,71 @@ +#region BSD License +/* +Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +using System.Collections.Generic; + +namespace Prebuild.Core.Nodes +{ + /// + /// Implements a specialized list of configuration nodes which allows for lookup via + /// configuration name and platform. + /// + public class ConfigurationNodeCollection : List + { + #region Properties + + public ConfigurationNode this[string nameAndPlatform] + { + get + { + foreach (ConfigurationNode configurationNode in this) + { + if (configurationNode.NameAndPlatform == nameAndPlatform) + { + return configurationNode; + } + } + + return null; + } + + set + { + // See if the node + ConfigurationNode configurationNode = this[nameAndPlatform]; + + if (configurationNode != null) + { + this[IndexOf(configurationNode)] = value; + } + else + { + Add(value); + } + } + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Nodes/DataNode.cs b/Prebuild/src/Core/Nodes/DataNode.cs index 763e6c3831..318b13ccb9 100644 --- a/Prebuild/src/Core/Nodes/DataNode.cs +++ b/Prebuild/src/Core/Nodes/DataNode.cs @@ -104,7 +104,7 @@ namespace Prebuild.Core.Nodes foreach (string type in WebTypes) { - if (path.EndsWith(string.Format("{0}{1}", type, extension))) + if (path.EndsWith(type)) { return SubType.CodeBehind; } diff --git a/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs b/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs index 27c205162a..278ecd81ce 100644 --- a/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs +++ b/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs @@ -1,5 +1,4 @@ using System; -using System.Collections; using System.Collections.Generic; using System.Text; using System.Xml; diff --git a/Prebuild/src/Core/Nodes/DescriptionNode.cs b/Prebuild/src/Core/Nodes/DescriptionNode.cs index 353a5aec07..d1293a0c80 100644 --- a/Prebuild/src/Core/Nodes/DescriptionNode.cs +++ b/Prebuild/src/Core/Nodes/DescriptionNode.cs @@ -24,8 +24,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O #endregion using System; -using System.Collections; -using System.Collections.Specialized; using System.Xml; using Prebuild.Core.Attributes; diff --git a/Prebuild/src/Core/Nodes/FileNode.cs b/Prebuild/src/Core/Nodes/FileNode.cs index 1520fcb789..01cea1ebdb 100644 --- a/Prebuild/src/Core/Nodes/FileNode.cs +++ b/Prebuild/src/Core/Nodes/FileNode.cs @@ -54,7 +54,15 @@ namespace Prebuild.Core.Nodes /// /// /// - EmbeddedResource + EmbeddedResource, + /// + /// + /// + ApplicationDefinition, + /// + /// + /// + Page } /// @@ -264,6 +272,12 @@ namespace Prebuild.Core.Nodes m_Valid = false; Kernel.Instance.Log.Write(LogType.Warning, "File does not exist: {0}", m_Path); } + + if (System.IO.Path.GetExtension(m_Path) == ".settings") + { + m_SubType = SubType.Settings; + m_BuildAction = BuildAction.None; + } } #endregion diff --git a/Prebuild/src/Core/Nodes/FilesNode.cs b/Prebuild/src/Core/Nodes/FilesNode.cs index dc306c2252..23a716cfde 100644 --- a/Prebuild/src/Core/Nodes/FilesNode.cs +++ b/Prebuild/src/Core/Nodes/FilesNode.cs @@ -24,8 +24,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O #endregion using System; -using System.Collections; -using System.Collections.Specialized; +using System.Collections.Generic; using System.Xml; using Prebuild.Core.Attributes; @@ -42,41 +41,19 @@ namespace Prebuild.Core.Nodes { #region Fields - private StringCollection m_Files; - private Hashtable m_BuildActions; - private Hashtable m_SubTypes; - private Hashtable m_ResourceNames; - private Hashtable m_CopyToOutputs; - private Hashtable m_Links; - private Hashtable m_LinkPaths; - private Hashtable m_PreservePaths; - - #endregion - - #region Constructors - - /// - /// - /// - public FilesNode() - { - m_Files = new StringCollection(); - m_BuildActions = new Hashtable(); - m_SubTypes = new Hashtable(); - m_ResourceNames = new Hashtable(); - m_CopyToOutputs = new Hashtable(); - m_Links = new Hashtable(); - m_LinkPaths = new Hashtable(); - m_PreservePaths = new Hashtable(); - } + private readonly List m_Files = new List(); + private readonly Dictionary m_BuildActions = new Dictionary(); + private readonly Dictionary m_SubTypes = new Dictionary(); + private readonly Dictionary m_ResourceNames = new Dictionary(); + private readonly Dictionary m_CopyToOutputs = new Dictionary(); + private readonly Dictionary m_Links = new Dictionary(); + private readonly Dictionary m_LinkPaths = new Dictionary(); + private readonly Dictionary m_PreservePaths = new Dictionary(); #endregion #region Properties - /// - /// - /// public int Count { get @@ -89,11 +66,6 @@ namespace Prebuild.Core.Nodes #region Public Methods - /// - /// - /// - /// - /// public BuildAction GetBuildAction(string file) { if(!m_BuildActions.ContainsKey(file)) @@ -101,41 +73,41 @@ namespace Prebuild.Core.Nodes return BuildAction.Compile; } - return (BuildAction)m_BuildActions[file]; + return m_BuildActions[file]; } public CopyToOutput GetCopyToOutput(string file) { - if (!this.m_CopyToOutputs.ContainsKey(file)) + if (!m_CopyToOutputs.ContainsKey(file)) { return CopyToOutput.Never; } - return (CopyToOutput) this.m_CopyToOutputs[file]; + return m_CopyToOutputs[file]; } public bool GetIsLink(string file) { - if (!this.m_Links.ContainsKey(file)) + if (!m_Links.ContainsKey(file)) { return false; } - return (bool) this.m_Links[file]; + return m_Links[file]; } + public bool Contains(string file) + { + return m_Files.Contains(file); + } + public string GetLinkPath( string file ) { - if ( !this.m_LinkPaths.ContainsKey( file ) ) + if ( !m_LinkPaths.ContainsKey( file ) ) { return string.Empty; } - return (string)this.m_LinkPaths[ file ]; + return m_LinkPaths[ file ]; } - /// - /// - /// - /// - /// public SubType GetSubType(string file) { if(!m_SubTypes.ContainsKey(file)) @@ -143,29 +115,19 @@ namespace Prebuild.Core.Nodes return SubType.Code; } - return (SubType)m_SubTypes[file]; + return m_SubTypes[file]; } - /// - /// - /// - /// - /// public string GetResourceName(string file) { if(!m_ResourceNames.ContainsKey(file)) { - return ""; + return string.Empty; } - return (string)m_ResourceNames[file]; + return m_ResourceNames[file]; } - /// - /// - /// - /// - /// public bool GetPreservePath( string file ) { if ( !m_PreservePaths.ContainsKey( file ) ) @@ -173,13 +135,9 @@ namespace Prebuild.Core.Nodes return false; } - return (bool)m_PreservePaths[ file ]; + return m_PreservePaths[ file ]; } - /// - /// - /// - /// public override void Parse(XmlNode node) { if( node == null ) @@ -200,10 +158,10 @@ namespace Prebuild.Core.Nodes m_BuildActions[fileNode.Path] = fileNode.BuildAction; m_SubTypes[fileNode.Path] = fileNode.SubType; m_ResourceNames[fileNode.Path] = fileNode.ResourceName; - this.m_PreservePaths[ fileNode.Path ] = fileNode.PreservePath; - this.m_Links[ fileNode.Path ] = fileNode.IsLink; - this.m_LinkPaths[ fileNode.Path ] = fileNode.LinkPath; - this.m_CopyToOutputs[ fileNode.Path ] = fileNode.CopyToOutput; + m_PreservePaths[ fileNode.Path ] = fileNode.PreservePath; + m_Links[ fileNode.Path ] = fileNode.IsLink; + m_LinkPaths[ fileNode.Path ] = fileNode.LinkPath; + m_CopyToOutputs[ fileNode.Path ] = fileNode.CopyToOutput; } } @@ -216,13 +174,16 @@ namespace Prebuild.Core.Nodes if (!m_Files.Contains(file)) { m_Files.Add(file); - m_BuildActions[ file ] = matchNode.BuildAction == null ? GetBuildActionByFileName(file) : matchNode.BuildAction; - m_SubTypes[file] = matchNode.SubType == null ? GetSubTypeByFileName(file) : matchNode.SubType.Value; + if (matchNode.BuildAction == null) + m_BuildActions[file] = GetBuildActionByFileName(file); + else + m_BuildActions[file] = matchNode.BuildAction.Value; + m_SubTypes[file] = matchNode.SubType == null ? GetSubTypeByFileName(file) : matchNode.SubType.Value; m_ResourceNames[ file ] = matchNode.ResourceName; - this.m_PreservePaths[ file ] = matchNode.PreservePath; - this.m_Links[ file ] = matchNode.IsLink; - this.m_LinkPaths[ file ] = matchNode.LinkPath; - this.m_CopyToOutputs[ file ] = matchNode.CopyToOutput; + m_PreservePaths[ file ] = matchNode.PreservePath; + m_Links[ file ] = matchNode.IsLink; + m_LinkPaths[ file ] = matchNode.LinkPath; + m_CopyToOutputs[ file ] = matchNode.CopyToOutput; } } @@ -232,11 +193,7 @@ namespace Prebuild.Core.Nodes // TODO: Check in to why StringCollection's enumerator doesn't implement // IEnumerator? - /// - /// - /// - /// - public StringEnumerator GetEnumerator() + public IEnumerator GetEnumerator() { return m_Files.GetEnumerator(); } diff --git a/Prebuild/src/Core/Nodes/MatchNode.cs b/Prebuild/src/Core/Nodes/MatchNode.cs index 656d7d0718..9735265f05 100644 --- a/Prebuild/src/Core/Nodes/MatchNode.cs +++ b/Prebuild/src/Core/Nodes/MatchNode.cs @@ -25,7 +25,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O using System; using System.Collections.Generic; -using System.Collections.Specialized; using System.IO; using System.Text.RegularExpressions; using System.Xml; @@ -33,7 +32,6 @@ using System.Xml; using Prebuild.Core.Attributes; using Prebuild.Core.Interfaces; using Prebuild.Core.Utilities; -using System.Collections; namespace Prebuild.Core.Nodes { @@ -45,7 +43,7 @@ namespace Prebuild.Core.Nodes { #region Fields - private readonly StringCollection m_Files = new StringCollection(); + private readonly List m_Files = new List(); private Regex m_Regex; private BuildAction? m_BuildAction; private SubType? m_SubType; @@ -63,7 +61,7 @@ namespace Prebuild.Core.Nodes /// /// /// - public StringCollection Files + public IEnumerable Files { get { @@ -97,7 +95,7 @@ namespace Prebuild.Core.Nodes { get { - return this.m_CopyToOutput; + return m_CopyToOutput; } } @@ -105,7 +103,7 @@ namespace Prebuild.Core.Nodes { get { - return this.m_Link; + return m_Link; } } @@ -113,7 +111,7 @@ namespace Prebuild.Core.Nodes { get { - return this.m_LinkPath; + return m_LinkPath; } } /// @@ -149,21 +147,35 @@ namespace Prebuild.Core.Nodes private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex, List exclusions) { Match match; - Boolean excludeFile; - try + try { string[] files; - if(!useRegex) + Boolean excludeFile; + if(!useRegex) { - files = Directory.GetFiles(path, pattern); + try + { + files = Directory.GetFiles(path, pattern); + } + catch (IOException) + { + // swallow weird IOException error when running in a virtual box + // guest OS on a network share when the host OS is not Windows. + // This seems to happen on network shares + // when no files match, and may be related to this report: + // http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=254546 + + files = null; + } + if(files != null) { - string fileTemp; - foreach (string file in files) + foreach (string file in files) { excludeFile = false; - if (file.Substring(0,2) == "./" || file.Substring(0,2) == ".\\") + string fileTemp; + if (file.Substring(0,2) == "./" || file.Substring(0,2) == ".\\") { fileTemp = file.Substring(2); } @@ -187,47 +199,64 @@ namespace Prebuild.Core.Nodes } } - else - { - return; - } + + // don't call return here, because we may need to recursively search directories below + // this one, even if no matches were found in this directory. } else { - files = Directory.GetFiles(path); - foreach(string file in files) - { - excludeFile = false; - - match = m_Regex.Match(file); - if(match.Success) - { - // Check all excludions and set flag if there are any hits. - foreach ( ExcludeNode exclude in exclusions ) - { - Regex exRegEx = new Regex( exclude.Pattern ); - match = exRegEx.Match( file ); - excludeFile |= !match.Success; - } - - if ( !excludeFile ) - { - m_Files.Add( file ); - } - } + try + { + files = Directory.GetFiles(path); } + catch (IOException) + { + // swallow weird IOException error when running in a virtual box + // guest OS on a network share. + files = null; + } + + if (files != null) + { + foreach (string file in files) + { + excludeFile = false; + + match = m_Regex.Match(file); + if (match.Success) + { + // Check all excludions and set flag if there are any hits. + foreach (ExcludeNode exclude in exclusions) + { + Regex exRegEx = new Regex(exclude.Pattern); + match = exRegEx.Match(file); + excludeFile |= !match.Success; + } + + if (!excludeFile) + { + m_Files.Add(file); + } + } + } + } } if(recurse) { string[] dirs = Directory.GetDirectories(path); if(dirs != null && dirs.Length > 0) - { - foreach(string str in dirs) - { - RecurseDirectories(Helper.NormalizePath(str), pattern, recurse, useRegex, exclusions); - } - } + { + foreach (string str in dirs) + { + // hack to skip subversion folders. Not having this can cause + // a significant performance hit when running on a network drive. + if (str.EndsWith(".svn")) + continue; + + RecurseDirectories(Helper.NormalizePath(str), pattern, recurse, useRegex, exclusions); + } + } } } catch(DirectoryNotFoundException) @@ -266,14 +295,14 @@ namespace Prebuild.Core.Nodes //string subType = Helper.AttributeValue(node, "subType", string.Empty); //if (subType != String.Empty) // m_SubType = (SubType)Enum.Parse(typeof(SubType), subType); - m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString()); - this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString())); - this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString)); - if ( this.m_Link == true ) + m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName); + m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", m_CopyToOutput.ToString())); + m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString)); + if ( m_Link ) { - this.m_LinkPath = Helper.AttributeValue( node, "linkPath", string.Empty ); + m_LinkPath = Helper.AttributeValue( node, "linkPath", string.Empty ); } - this.m_PreservePath = bool.Parse( Helper.AttributeValue( node, "preservePath", bool.FalseString ) ); + m_PreservePath = bool.Parse( Helper.AttributeValue( node, "preservePath", bool.FalseString ) ); if(path != null && path.Length == 0) @@ -318,11 +347,19 @@ namespace Prebuild.Core.Nodes RecurseDirectories( path, pattern, recurse, useRegex, m_Exclusions ); - if(m_Files.Count < 1) - { - throw new WarningException("Match returned no files: {0}{1}", Helper.EndPath(path), pattern); - } - m_Regex = null; + if (m_Files.Count < 1) + { + // Include the project name when the match node returns no matches to provide extra + // debug info. + ProjectNode project = Parent.Parent as ProjectNode; + string projectName = ""; + + if (project != null) + projectName = " in project " + project.AssemblyName; + + throw new WarningException("Match" + projectName + " returned no files: {0}{1}", Helper.EndPath(path), pattern); + } + m_Regex = null; } #endregion diff --git a/Prebuild/src/Core/Nodes/OptionsNode.cs b/Prebuild/src/Core/Nodes/OptionsNode.cs index b63034bfe8..577de710ed 100644 --- a/Prebuild/src/Core/Nodes/OptionsNode.cs +++ b/Prebuild/src/Core/Nodes/OptionsNode.cs @@ -24,8 +24,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O #endregion using System; -using System.Collections; -using System.Collections.Specialized; +using System.Collections.Generic; using System.Reflection; using System.Xml; @@ -43,7 +42,7 @@ namespace Prebuild.Core.Nodes { #region Fields - private static Hashtable m_OptionFields; + private static readonly Dictionary m_OptionFields = new Dictionary(); [OptionNode("CompilerDefines")] private string m_CompilerDefines = ""; @@ -495,7 +494,7 @@ namespace Prebuild.Core.Nodes } } - private StringCollection m_FieldsDefined; + private readonly List m_FieldsDefined = new List(); #endregion @@ -508,7 +507,6 @@ namespace Prebuild.Core.Nodes { Type t = typeof(OptionsNode); - m_OptionFields = new Hashtable(); foreach(FieldInfo f in t.GetFields(BindingFlags.NonPublic | BindingFlags.Instance)) { object[] attrs = f.GetCustomAttributes(typeof(OptionNodeAttribute), false); @@ -522,14 +520,6 @@ namespace Prebuild.Core.Nodes } } - /// - /// Initializes a new instance of the class. - /// - public OptionsNode() - { - m_FieldsDefined = new StringCollection(); - } - #endregion #region Properties @@ -547,7 +537,7 @@ namespace Prebuild.Core.Nodes return null; } - FieldInfo f = (FieldInfo)m_OptionFields[index]; + FieldInfo f = m_OptionFields[index]; return f.GetValue(this); } } @@ -591,7 +581,7 @@ namespace Prebuild.Core.Nodes return; } - FieldInfo f = (FieldInfo)m_OptionFields[nodeName]; + FieldInfo f = m_OptionFields[nodeName]; f.SetValue(this, Helper.TranslateValue(f.FieldType, val)); FlagDefined(f.Name); } diff --git a/Prebuild/src/Core/Nodes/ProcessNode.cs b/Prebuild/src/Core/Nodes/ProcessNode.cs index 6bfbe16be3..8ca8e493d2 100644 --- a/Prebuild/src/Core/Nodes/ProcessNode.cs +++ b/Prebuild/src/Core/Nodes/ProcessNode.cs @@ -24,8 +24,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O #endregion using System; -using System.Collections; -using System.Collections.Specialized; using System.Xml; using Prebuild.Core.Attributes; diff --git a/Prebuild/src/Core/Nodes/ProjectNode.cs b/Prebuild/src/Core/Nodes/ProjectNode.cs index 04af7a3582..fb92b32e73 100644 --- a/Prebuild/src/Core/Nodes/ProjectNode.cs +++ b/Prebuild/src/Core/Nodes/ProjectNode.cs @@ -24,7 +24,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O #endregion using System; -using System.Collections; using System.Collections.Generic; using System.IO; using System.Xml; @@ -90,10 +89,10 @@ namespace Prebuild.Core.Nodes /// .NET 3.5 /// v3_5, - /// - /// .NET 4.0 - /// - v4_0, + /// + /// .NET 4.0 + /// + v4_0, } /// /// The Node object representing /Prebuild/Solution/Project elements @@ -121,7 +120,7 @@ namespace Prebuild.Core.Nodes private Guid m_Guid; private string m_DebugStartParameters; - private Hashtable m_Configurations = new Hashtable(); + private readonly Dictionary m_Configurations = new Dictionary(); private readonly List m_ReferencePaths = new List(); private readonly List m_References = new List(); private readonly List m_Authors = new List(); @@ -149,7 +148,7 @@ namespace Prebuild.Core.Nodes { get { - return this.m_Framework; + return m_Framework; } } /// @@ -283,7 +282,7 @@ namespace Prebuild.Core.Nodes } } - private bool m_GenerateAssemblyInfoFile = false; + private bool m_GenerateAssemblyInfoFile; /// /// @@ -328,11 +327,11 @@ namespace Prebuild.Core.Nodes /// Gets the configurations. /// /// The configurations. - public IList Configurations + public List Configurations { get { - ArrayList tmp = new ArrayList(ConfigurationsTable.Values); + List tmp = new List(ConfigurationsTable.Values); tmp.Sort(); return tmp; } @@ -342,7 +341,7 @@ namespace Prebuild.Core.Nodes /// Gets the configurations table. /// /// The configurations table. - public Hashtable ConfigurationsTable + public Dictionary ConfigurationsTable { get { @@ -420,7 +419,7 @@ namespace Prebuild.Core.Nodes SolutionNode parent = (SolutionNode)base.Parent; foreach(ConfigurationNode conf in parent.Configurations) { - m_Configurations[conf.Name] = conf.Clone(); + m_Configurations[conf.NameAndPlatform] = (ConfigurationNode) conf.Clone(); } } } @@ -455,19 +454,19 @@ namespace Prebuild.Core.Nodes if(String.Compare(conf.Name, "all", true) == 0) //apply changes to all, this may not always be applied first, //so it *may* override changes to the same properties for configurations defines at the project level { - foreach(ConfigurationNode confNode in this.m_Configurations.Values) + foreach(ConfigurationNode confNode in m_Configurations.Values) { conf.CopyTo(confNode);//update the config templates defines at the project level with the overrides } } - if(m_Configurations.ContainsKey(conf.Name)) + if(m_Configurations.ContainsKey(conf.NameAndPlatform)) { - ConfigurationNode parentConf = (ConfigurationNode)m_Configurations[conf.Name]; + ConfigurationNode parentConf = m_Configurations[conf.NameAndPlatform]; conf.CopyTo(parentConf);//update the config templates defines at the project level with the overrides } else { - m_Configurations[conf.Name] = conf; + m_Configurations[conf.NameAndPlatform] = conf; } } @@ -504,12 +503,12 @@ namespace Prebuild.Core.Nodes m_GenerateAssemblyInfoFile = Helper.ParseBoolean(node, "generateAssemblyInfoFile", false); m_DebugStartParameters = Helper.AttributeValue(node, "debugStartParameters", string.Empty); - if(m_AssemblyName == null || m_AssemblyName.Length < 1) + if(string.IsNullOrEmpty(m_AssemblyName)) { m_AssemblyName = m_Name; } - if(m_RootNamespace == null || m_RootNamespace.Length < 1) + if(string.IsNullOrEmpty(m_RootNamespace)) { m_RootNamespace = m_Name; } @@ -572,7 +571,7 @@ namespace Prebuild.Core.Nodes public int CompareTo(object obj) { ProjectNode that = (ProjectNode)obj; - return this.m_Name.CompareTo(that.m_Name); + return m_Name.CompareTo(that.m_Name); } #endregion diff --git a/Prebuild/src/Core/Nodes/ReferencePathNode.cs b/Prebuild/src/Core/Nodes/ReferencePathNode.cs index f0543c267e..7331cd7b58 100644 --- a/Prebuild/src/Core/Nodes/ReferencePathNode.cs +++ b/Prebuild/src/Core/Nodes/ReferencePathNode.cs @@ -24,8 +24,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O #endregion using System; -using System.Collections; -using System.Collections.Specialized; using System.Xml; using Prebuild.Core.Attributes; diff --git a/Prebuild/src/Core/Nodes/SolutionNode.cs b/Prebuild/src/Core/Nodes/SolutionNode.cs index 2a1b8e2c55..10c02234da 100644 --- a/Prebuild/src/Core/Nodes/SolutionNode.cs +++ b/Prebuild/src/Core/Nodes/SolutionNode.cs @@ -24,10 +24,8 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O #endregion using System; -using System.Collections; using System.Collections.Generic; using System.Diagnostics; -using System.IO; using System.Xml; using Prebuild.Core.Attributes; @@ -50,18 +48,19 @@ namespace Prebuild.Core.Nodes private string m_Name = "unknown"; private string m_Path = ""; private string m_FullPath = ""; - private string m_ActiveConfig = "Debug"; + private string m_ActiveConfig; private string m_Version = "1.0.0"; private OptionsNode m_Options; private FilesNode m_Files; - private readonly Hashtable m_Configurations = new Hashtable(); - private readonly Hashtable m_Projects = new Hashtable(); - private readonly Hashtable m_DatabaseProjects = new Hashtable(); + private readonly ConfigurationNodeCollection m_Configurations = new ConfigurationNodeCollection(); + private readonly Dictionary m_Projects = new Dictionary(); + private readonly Dictionary m_DatabaseProjects = new Dictionary(); private readonly List m_ProjectsOrder = new List(); - private readonly Hashtable m_Solutions = new Hashtable(); + private readonly Dictionary m_Solutions = new Dictionary(); + private CleanupNode m_Cleanup; - #endregion + #endregion #region Properties public override IDataNode Parent @@ -77,7 +76,7 @@ namespace Prebuild.Core.Nodes SolutionNode solution = (SolutionNode)value; foreach (ConfigurationNode conf in solution.Configurations) { - m_Configurations[conf.Name] = conf.Clone(); + m_Configurations[conf.Name] = (ConfigurationNode) conf.Clone(); } } @@ -85,6 +84,18 @@ namespace Prebuild.Core.Nodes } } + public CleanupNode Cleanup + { + get + { + return m_Cleanup; + } + set + { + m_Cleanup = value; + } + } + public Guid Guid { get @@ -188,13 +199,13 @@ namespace Prebuild.Core.Nodes /// Gets the configurations. /// /// The configurations. - public ICollection Configurations + public ConfigurationNodeCollection Configurations { get { - ArrayList tmp = new ArrayList(ConfigurationsTable.Values); - tmp.Sort(); - return tmp; + ConfigurationNodeCollection tmp = new ConfigurationNodeCollection(); + tmp.AddRange(ConfigurationsTable); + return tmp; } } @@ -202,7 +213,7 @@ namespace Prebuild.Core.Nodes /// Gets the configurations table. /// /// The configurations table. - public Hashtable ConfigurationsTable + public ConfigurationNodeCollection ConfigurationsTable { get { @@ -212,7 +223,7 @@ namespace Prebuild.Core.Nodes /// /// Gets the database projects. /// - public ICollection DatabaseProjects + public ICollection DatabaseProjects { get { @@ -222,7 +233,7 @@ namespace Prebuild.Core.Nodes /// /// Gets the nested solutions. /// - public ICollection Solutions + public ICollection Solutions { get { @@ -232,22 +243,22 @@ namespace Prebuild.Core.Nodes /// /// Gets the nested solutions hash table. /// - public Hashtable SolutionsTable + public Dictionary SolutionsTable { get { - return this.m_Solutions; + return m_Solutions; } } /// /// Gets the projects. /// /// The projects. - public ICollection Projects + public ICollection Projects { get { - ArrayList tmp = new ArrayList(m_Projects.Values); + List tmp = new List(m_Projects.Values); tmp.Sort(); return tmp; } @@ -257,7 +268,7 @@ namespace Prebuild.Core.Nodes /// Gets the projects table. /// /// The projects table. - public Hashtable ProjectsTable + public Dictionary ProjectsTable { get { @@ -325,16 +336,23 @@ namespace Prebuild.Core.Nodes } else if(dataNode is ConfigurationNode) { - m_Configurations[((ConfigurationNode)dataNode).Name] = dataNode; + ConfigurationNode configurationNode = (ConfigurationNode) dataNode; + m_Configurations[configurationNode.NameAndPlatform] = configurationNode; + + // If the active configuration is null, then we populate it. + if (ActiveConfig == null) + { + ActiveConfig = configurationNode.Name; + } } else if(dataNode is ProjectNode) { - m_Projects[((ProjectNode)dataNode).Name] = dataNode; + m_Projects[((ProjectNode)dataNode).Name] = (ProjectNode) dataNode; m_ProjectsOrder.Add((ProjectNode)dataNode); } else if(dataNode is SolutionNode) { - m_Solutions[((SolutionNode)dataNode).Name] = dataNode; + m_Solutions[((SolutionNode)dataNode).Name] = (SolutionNode) dataNode; } else if (dataNode is ProcessNode) { @@ -343,7 +361,13 @@ namespace Prebuild.Core.Nodes } else if (dataNode is DatabaseProjectNode) { - m_DatabaseProjects[((DatabaseProjectNode)dataNode).Name] = dataNode; + m_DatabaseProjects[((DatabaseProjectNode)dataNode).Name] = (DatabaseProjectNode) dataNode; + } + else if(dataNode is CleanupNode) + { + if(m_Cleanup != null) + throw new WarningException("There can only be one Cleanup node."); + m_Cleanup = (CleanupNode)dataNode; } } } diff --git a/Prebuild/src/Core/Parse/Preprocessor.cs b/Prebuild/src/Core/Parse/Preprocessor.cs index b2306e43db..0648fad8d8 100644 --- a/Prebuild/src/Core/Parse/Preprocessor.cs +++ b/Prebuild/src/Core/Parse/Preprocessor.cs @@ -24,7 +24,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O #endregion using System; -using System.Collections; +using System.Collections.Generic; using System.IO; using System.Text.RegularExpressions; using System.Xml; @@ -83,9 +83,9 @@ namespace Prebuild.Core.Parse #region Fields - XmlDocument m_OutDoc; - Stack m_IfStack; - Hashtable m_Variables; + readonly XmlDocument m_OutDoc = new XmlDocument(); + readonly Stack m_IfStack = new Stack(); + readonly Dictionary m_Variables = new Dictionary(); #endregion @@ -96,10 +96,6 @@ namespace Prebuild.Core.Parse /// public Preprocessor() { - m_OutDoc = new XmlDocument(); - m_IfStack = new Stack(); - m_Variables = new Hashtable(); - RegisterVariable("OS", GetOS()); RegisterVariable("RuntimeVersion", Environment.Version.Major); RegisterVariable("RuntimeMajor", Environment.Version.Major); @@ -237,11 +233,10 @@ namespace Prebuild.Core.Parse string str = ""; OperatorSymbol oper = OperatorSymbol.None; bool inStr = false; - char c; - - for(int i = 0; i < exp.Length; i++) + + for(int i = 0; i < exp.Length; i++) { - c = exp[i]; + char c = exp[i]; if(Char.IsWhiteSpace(c)) { continue; @@ -326,16 +321,16 @@ namespace Prebuild.Core.Parse { throw new WarningException("Expected operator in expression"); } - else if(id.Length < 1) - { - throw new WarningException("Expected identifier in expression"); - } - else if(str.Length < 1) - { - throw new WarningException("Expected value in expression"); - } + if(id.Length < 1) + { + throw new WarningException("Expected identifier in expression"); + } + if(str.Length < 1) + { + throw new WarningException("Expected value in expression"); + } - bool ret = false; + bool ret; try { object val = m_Variables[id.ToLower()]; @@ -344,19 +339,17 @@ namespace Prebuild.Core.Parse throw new WarningException("Unknown identifier '{0}'", id); } - int numVal, numVal2; - string strVal, strVal2; - Type t = val.GetType(); + Type t = val.GetType(); if(t.IsAssignableFrom(typeof(int))) { - numVal = (int)val; - numVal2 = Int32.Parse(str); + int numVal = (int)val; + int numVal2 = Int32.Parse(str); ret = CompareNum(oper, numVal, numVal2); } else { - strVal = val.ToString(); - strVal2 = str; + string strVal = val.ToString(); + string strVal2 = str; ret = CompareStr(oper, strVal, strVal2); } } @@ -369,6 +362,70 @@ namespace Prebuild.Core.Parse return ret; } + /// + /// Taken from current Prebuild included in OpenSim 0.7.x + /// + /// + /// A + /// + /// + /// A + /// + private static void WildCardInclude (Stack readerStack, string include) + { + if (!include.Contains ("*")) { + return; + } + + // Console.WriteLine("Processing {0}", include); + + // Break up the include into pre and post wildcard sections + string preWildcard = include.Substring (0, include.IndexOf ("*")); + string postWildcard = include.Substring (include.IndexOf ("*") + 2); + + // If preWildcard is a directory, recurse + if (Directory.Exists (preWildcard)) { + string[] directories = Directory.GetDirectories (preWildcard); + Array.Sort (directories); + Array.Reverse (directories); + foreach (string dirPath in directories) { + //Console.WriteLine ("Scanning : {0}", dirPath); + + string includeFile = Path.Combine (dirPath, postWildcard); + if (includeFile.Contains ("*")) { + // postWildcard included another wildcard, recurse. + WildCardInclude (readerStack, includeFile); + } else { + FileInfo file = new FileInfo (includeFile); + if (file.Exists) { + //Console.WriteLine ("Including File: {0}", includeFile); + XmlReader newReader = new XmlTextReader (file.Open (FileMode.Open, FileAccess.Read, FileShare.Read)); + readerStack.Push (newReader); + } + } + } + } else { + // preWildcard is not a path to a directory, so the wildcard is in the filename + string searchFilename = Path.GetFileName (preWildcard.Substring (preWildcard.IndexOf ("/") + 1) + "*" + postWildcard); + Console.WriteLine ("searchFilename: {0}", searchFilename); + + string searchDirectory = Path.GetDirectoryName (preWildcard); + Console.WriteLine ("searchDirectory: {0}", searchDirectory); + + string[] files = Directory.GetFiles (searchDirectory, searchFilename); + Array.Sort (files); + Array.Reverse (files); + foreach (string includeFile in files) { + FileInfo file = new FileInfo (includeFile); + if (file.Exists) { + // Console.WriteLine ("Including File: {0}", includeFile); + XmlReader newReader = new XmlTextReader (file.Open (FileMode.Open, FileAccess.Read, FileShare.Read)); + readerStack.Push (newReader); + } + } + } + } + #endregion #region Public Methods @@ -392,7 +449,7 @@ namespace Prebuild.Core.Parse /// Performs validation on the xml source as well as evaluates conditional and flow expresions /// /// For invalid use of conditional expressions or for invalid XML syntax. If a XmlValidatingReader is passed, then will also throw exceptions for non-schema-conforming xml - /// + /// /// the output xml public string Process(XmlReader initialReader) { @@ -411,13 +468,13 @@ namespace Prebuild.Core.Parse // readers which lets the operation add more // readers to generate a multi-file parser and not require // XML fragments that a recursive version would use. - Stack readerStack = new Stack(); + Stack readerStack = new Stack(); readerStack.Push(initialReader); while(readerStack.Count > 0) { // Pop off the next reader. - XmlReader reader = (XmlReader) readerStack.Pop(); + XmlReader reader = readerStack.Pop(); // Process through this XML reader until it is // completed (or it is replaced by the include @@ -437,7 +494,7 @@ namespace Prebuild.Core.Parse case "include": // use regular expressions to parse out the attributes. MatchCollection matches = includeFileRegex.Matches(reader.Value); - + // make sure there is only one file attribute. if(matches.Count > 1) { @@ -448,38 +505,37 @@ namespace Prebuild.Core.Parse { throw new WarningException("An node was found, but it did not specify the file attribute."); } - + + // ***** Adding for wildcard handling // Push current reader back onto the stack. - readerStack.Push(reader); - - // Pull the file out from the regex and make sure it is a valid file before using it. - string filename = matches[0].Groups[1].Value; - - filename = String.Join(Path.DirectorySeparatorChar.ToString(), filename.Split(new char[] { '/', '\\' })); - - if (!filename.Contains("*")) - { - FileInfo includeFile = new FileInfo(filename); - - if (!includeFile.Exists) - { - throw new WarningException("Cannot include file: " + includeFile.FullName); + readerStack.Push (reader); + + // Pull the file out from the regex and make sure it is a valid file before using it. + string filename = matches[0].Groups[1].Value; + + filename = String.Join (Path.DirectorySeparatorChar.ToString (), filename.Split (new char[] { '/', '\\' })); + + if (!filename.Contains ("*")) { + + FileInfo includeFile = new FileInfo (filename); + if (!includeFile.Exists) { + throw new WarningException ("Cannot include file: " + includeFile.FullName); } - - // Create a new reader object for this file, and push it onto the stack - XmlReader newReader = new XmlTextReader(includeFile.Open(FileMode.Open, FileAccess.Read, FileShare.Read)); - readerStack.Push(newReader); + + // Create a new reader object for this file. Then put the old reader back on the stack and start + // processing using this new XML reader. + + XmlReader newReader = new XmlTextReader (includeFile.Open (FileMode.Open, FileAccess.Read, FileShare.Read)); + reader = newReader; + readerStack.Push (reader); + + } else { + WildCardInclude (readerStack, filename); } - else - { - WildCardInclude(readerStack, filename); - } - - // continue reading with whatever reader is on the top of the stack - reader = (XmlReader)readerStack.Pop(); + + reader = (XmlReader)readerStack.Pop (); ignore = true; - - break; + break; case "if": m_IfStack.Push(context); @@ -492,12 +548,12 @@ namespace Prebuild.Core.Parse { throw new WarningException("Unexpected 'elseif' outside of 'if'"); } - else if(context.State != IfState.If && context.State != IfState.ElseIf) - { - throw new WarningException("Unexpected 'elseif' outside of 'if'"); - } + if(context.State != IfState.If && context.State != IfState.ElseIf) + { + throw new WarningException("Unexpected 'elseif' outside of 'if'"); + } - context.State = IfState.ElseIf; + context.State = IfState.ElseIf; if(!context.EverKept) { context.Keep = ParseExpression(reader.Value); @@ -515,12 +571,12 @@ namespace Prebuild.Core.Parse { throw new WarningException("Unexpected 'else' outside of 'if'"); } - else if(context.State != IfState.If && context.State != IfState.ElseIf) - { - throw new WarningException("Unexpected 'else' outside of 'if'"); - } + if(context.State != IfState.If && context.State != IfState.ElseIf) + { + throw new WarningException("Unexpected 'else' outside of 'if'"); + } - context.State = IfState.Else; + context.State = IfState.Else; context.Keep = !context.EverKept; ignore = true; break; @@ -531,7 +587,7 @@ namespace Prebuild.Core.Parse throw new WarningException("Unexpected 'endif' outside of 'if'"); } - context = (IfContext)m_IfStack.Pop(); + context = m_IfStack.Pop(); ignore = true; break; } @@ -591,73 +647,6 @@ namespace Prebuild.Core.Parse return xmlText.ToString(); } - private static void WildCardInclude(Stack readerStack, string include) - { - if (!include.Contains("*")) - { - return; - } - -// Console.WriteLine("Processing {0}", include); - - // Break up the include into pre and post wildcard sections - string preWildcard = include.Substring(0, include.IndexOf("*")); - string postWildcard = include.Substring(include.IndexOf("*") + 2); - - // If preWildcard is a directory, recurse - if (Directory.Exists(preWildcard)) - { - string[] directories = Directory.GetDirectories(preWildcard); - Array.Sort(directories); - Array.Reverse(directories); - foreach (string dirPath in directories ) - { - Console.WriteLine("Scanning : {0}", dirPath); - - string includeFile = Path.Combine(dirPath, postWildcard); - if (includeFile.Contains("*")) - { - // postWildcard included another wildcard, recurse. - WildCardInclude(readerStack, includeFile); - } - else - { - FileInfo file = new FileInfo(includeFile); - if (file.Exists) - { - Console.WriteLine("Including File: {0}", includeFile); - XmlReader newReader = new XmlTextReader(file.Open(FileMode.Open, FileAccess.Read, FileShare.Read)); - readerStack.Push(newReader); - } - } - } - } - else - { - // preWildcard is not a path to a directory, so the wildcard is in the filename - string searchFilename = Path.GetFileName(preWildcard.Substring(preWildcard.IndexOf("/") + 1) + "*" + postWildcard); - // Console.WriteLine("searchFilename: {0}", searchFilename); - - string searchDirectory = Path.GetDirectoryName(preWildcard); - // Console.WriteLine("searchDirectory: {0}", searchDirectory); - - string[] files = Directory.GetFiles(searchDirectory, searchFilename); - Array.Sort(files); - Array.Reverse(files); - foreach (string includeFile in files) - { - FileInfo file = new FileInfo(includeFile); - if (file.Exists) - { - Console.WriteLine("Including File: {0}", includeFile); - XmlReader newReader = new XmlTextReader(file.Open(FileMode.Open, FileAccess.Read, FileShare.Read)); - readerStack.Push(newReader); - } - } - } - - } - #endregion } } diff --git a/Prebuild/src/Core/Targets/.NAntTarget.cs.swp b/Prebuild/src/Core/Targets/.NAntTarget.cs.swp new file mode 100644 index 0000000000..afec61c43b Binary files /dev/null and b/Prebuild/src/Core/Targets/.NAntTarget.cs.swp differ diff --git a/Prebuild/src/Core/Targets/AutotoolsTarget.cs b/Prebuild/src/Core/Targets/AutotoolsTarget.cs index 5dcbb38269..485e4dd724 100644 --- a/Prebuild/src/Core/Targets/AutotoolsTarget.cs +++ b/Prebuild/src/Core/Targets/AutotoolsTarget.cs @@ -66,9 +66,7 @@ POSSIBILITY OF SUCH DAMAGE. #endregion using System; -using System.Collections; using System.Collections.Generic; -using System.Collections.Specialized; using System.IO; using System.Reflection; using System.Text; @@ -81,7 +79,6 @@ using System.Diagnostics; using Prebuild.Core.Attributes; using Prebuild.Core.Interfaces; using Prebuild.Core.Nodes; -using Prebuild.Core.Parse; using Prebuild.Core.Utilities; namespace Prebuild.Core.Targets @@ -170,16 +167,16 @@ namespace Prebuild.Core.Targets XmlDocument autotoolsDoc; XmlUrlResolver xr; System.Security.Policy.Evidence e; - Hashtable assemblyPathToPackage = new Hashtable(); - Hashtable assemblyFullNameToPath = new Hashtable(); - Hashtable packagesHash = new Hashtable(); + readonly Dictionary assemblyPathToPackage = new Dictionary(); + readonly Dictionary assemblyFullNameToPath = new Dictionary(); + readonly Dictionary packagesHash = new Dictionary(); readonly List packages = new List(); #endregion #region Private Methods - private void mkdirDashP(string dirName) + private static void mkdirDashP(string dirName) { DirectoryInfo di = new DirectoryInfo(dirName); if (di.Exists) @@ -193,7 +190,7 @@ namespace Prebuild.Core.Targets di.Create(); } - private void chkMkDir(string dirName) + private static void chkMkDir(string dirName) { System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(dirName); @@ -222,13 +219,12 @@ namespace Prebuild.Core.Targets (m_Kernel.CurrentDoc, argList, templateWriter, xr); } - string NormalizeAsmName(string name) + static string NormalizeAsmName(string name) { int i = name.IndexOf(", PublicKeyToken=null"); if (i != -1) return name.Substring(0, i).Trim(); - else - return name; + return name; } private void AddAssembly(string assemblyfile, SystemPackage package) @@ -247,7 +243,7 @@ namespace Prebuild.Core.Targets } } - private List GetAssembliesWithLibInfo(string line, string file) + private static List GetAssembliesWithLibInfo(string line, string file) { List references = new List(); List libdirs = new List(); @@ -278,7 +274,7 @@ namespace Prebuild.Core.Targets return retval; } - private List GetAssembliesWithoutLibInfo(string line, string file) + private static List GetAssembliesWithoutLibInfo(string line, string file) { List references = new List(); foreach (string reference in line.Split(' ')) @@ -292,7 +288,7 @@ namespace Prebuild.Core.Targets return references; } - private string ProcessPiece(string piece, string pcfile) + private static string ProcessPiece(string piece, string pcfile) { int start = piece.IndexOf("${"); if (start == -1) @@ -307,7 +303,7 @@ namespace Prebuild.Core.Targets return ProcessPiece(piece.Replace("${" + variable + "}", interp), pcfile); } - private string GetVariableFromPkgConfig(string var, string pcfile) + private static string GetVariableFromPkgConfig(string var, string pcfile) { ProcessStartInfo psi = new ProcessStartInfo("pkg-config"); psi.RedirectStandardOutput = true; @@ -327,7 +323,7 @@ namespace Prebuild.Core.Targets { // Don't register the package twice string pname = Path.GetFileNameWithoutExtension(pcfile); - if (packagesHash.Contains(pname)) + if (packagesHash.ContainsKey(pname)) return; List fullassemblies = null; @@ -507,158 +503,6 @@ namespace Prebuild.Core.Targets WriteProject(solution, project); } } - private static string PrependPath(string path) - { - string tmpPath = Helper.NormalizePath(path, '/'); - Regex regex = new Regex(@"(\w):/(\w+)"); - Match match = regex.Match(tmpPath); - if (match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') - { - tmpPath = Helper.NormalizePath(tmpPath); - } - else - { - tmpPath = Helper.NormalizePath("./" + tmpPath); - } - - return tmpPath; - } - - private static string BuildReference(SolutionNode solution, - ReferenceNode refr) - { - string ret = ""; - if (solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode project = - (ProjectNode)solution.ProjectsTable[refr.Name]; - string fileRef = FindFileReference(refr.Name, project); - string finalPath = - Helper.NormalizePath(Helper.MakeFilePath(project.FullPath + - "/$(BUILD_DIR)/$(CONFIG)/", - refr.Name, "dll"), - '/'); - ret += finalPath; - return ret; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - if (refr.Path != null || fileRef != null) - { - string finalPath = ((refr.Path != null) ? - Helper.NormalizePath(refr.Path + "/" + - refr.Name + ".dll", - '/') : - fileRef - ); - ret += Path.Combine(project.Path, finalPath); - return ret; - } - - try - { - //Assembly assem = Assembly.Load(refr.Name); - //if (assem != null) - //{ - // int index = refr.Name.IndexOf(","); - // if ( index > 0) - // { - // ret += assem.Location; - // //Console.WriteLine("Location1: " + assem.Location); - // } - // else - // { - // ret += (refr.Name + ".dll"); - // //Console.WriteLine("Location2: " + assem.Location); - // } - //} - //else - //{ - int index = refr.Name.IndexOf(","); - if (index > 0) - { - ret += refr.Name.Substring(0, index) + ".dll"; - //Console.WriteLine("Location3: " + assem.Location); - } - else - { - ret += (refr.Name + ".dll"); - //Console.WriteLine("Location4: " + assem.Location); - } - //} - } - catch (System.NullReferenceException e) - { - e.ToString(); - int index = refr.Name.IndexOf(","); - if (index > 0) - { - ret += refr.Name.Substring(0, index) + ".dll"; - //Console.WriteLine("Location5: " + assem.Location); - } - else - { - ret += (refr.Name + ".dll"); - //Console.WriteLine("Location6: " + assem.Location); - } - } - } - return ret; - } - - private static string BuildReferencePath(SolutionNode solution, - ReferenceNode refr) - { - string ret = ""; - if (solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode project = - (ProjectNode)solution.ProjectsTable[refr.Name]; - string finalPath = - Helper.NormalizePath(Helper.MakeReferencePath(project.FullPath + - "/${build.dir}/"), - '/'); - ret += finalPath; - return ret; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - if (refr.Path != null || fileRef != null) - { - string finalPath = ((refr.Path != null) ? - Helper.NormalizePath(refr.Path, '/') : - fileRef - ); - ret += finalPath; - return ret; - } - - try - { - Assembly assem = Assembly.Load(refr.Name); - if (assem != null) - { - ret += ""; - } - else - { - ret += ""; - } - } - catch (System.NullReferenceException e) - { - e.ToString(); - ret += ""; - } - } - return ret; - } private static string FindFileReference(string refName, ProjectNode project) @@ -831,7 +675,7 @@ namespace Prebuild.Core.Targets } catch { - Console.WriteLine("Error! '{0}'", e.ToString()); + Console.WriteLine("Error! '{0}'", e); } } @@ -865,7 +709,7 @@ namespace Prebuild.Core.Targets // Set up references for (int refNum = 0; refNum < project.References.Count; refNum++) { - ReferenceNode refr = (ReferenceNode)project.References[refNum]; + ReferenceNode refr = project.References[refNum]; Assembly refAssembly = Assembly.LoadWithPartialName(refr.Name); /* Determine which pkg-config (.pc) file refers to @@ -873,25 +717,28 @@ namespace Prebuild.Core.Targets SystemPackage package = null; - if (packagesHash.Contains(refr.Name)){ - package = (SystemPackage)packagesHash[refr.Name]; + if (packagesHash.ContainsKey(refr.Name)) + { + package = packagesHash[refr.Name]; - }else{ - string assemblyFullName = string.Empty; - if (refAssembly != null) - assemblyFullName = refAssembly.FullName; + } + else + { + string assemblyFullName = string.Empty; + if (refAssembly != null) + assemblyFullName = refAssembly.FullName; - string assemblyFileName = string.Empty; - if (assemblyFullName != string.Empty && - assemblyFullNameToPath.Contains(assemblyFullName) - ) - assemblyFileName = - (string)assemblyFullNameToPath[assemblyFullName]; + string assemblyFileName = string.Empty; + if (assemblyFullName != string.Empty && + assemblyFullNameToPath.ContainsKey(assemblyFullName) + ) + assemblyFileName = + assemblyFullNameToPath[assemblyFullName]; - if (assemblyFileName != string.Empty && - assemblyPathToPackage.Contains(assemblyFileName) - ) - package = (SystemPackage)assemblyPathToPackage[assemblyFileName]; + if (assemblyFileName != string.Empty && + assemblyPathToPackage.ContainsKey(assemblyFileName) + ) + package = assemblyPathToPackage[assemblyFileName]; } @@ -958,7 +805,7 @@ namespace Prebuild.Core.Targets */ ProjectNode sourcePrj = - ((ProjectNode)(solution.ProjectsTable[refr.Name])); + ((solution.ProjectsTable[refr.Name])); string target = String.Format("{0}:\n" + @@ -1067,564 +914,6 @@ namespace Prebuild.Core.Targets transformToFile(Path.Combine(projectDir, project.Name.ToLower() + ".in"), argList, "/Autotools/ProjectWrapperScriptIn"); } - private void WriteProjectOld(SolutionNode solution, ProjectNode project) - { - string projFile = Helper.MakeFilePath(project.FullPath, "Include", "am"); - StreamWriter ss = new StreamWriter(projFile); - ss.NewLine = "\n"; - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); - - using (ss) - { - ss.WriteLine(Helper.AssemblyFullName(project.AssemblyName, project.Type) + ":"); - ss.WriteLine("\tmkdir -p " + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/"); - foreach (string file in project.Files) - { - if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) - { - ss.Write("\tresgen "); - ss.Write(Helper.NormalizePath(Path.Combine(project.Path, file.Substring(0, file.LastIndexOf('.')) + ".resx "), '/')); - if (project.Files.GetResourceName(file) != "") - { - ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/')); - } - else - { - ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/')); - } - } - } - ss.WriteLine("\t$(CSC)\t/out:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " \\"); - ss.WriteLine("\t\t/target:" + project.Type.ToString().ToLower() + " \\"); - if (project.References.Count > 0) - { - ss.Write("\t\t/reference:"); - bool firstref = true; - foreach (ReferenceNode refr in project.References) - { - if (firstref) - { - firstref = false; - } - else - { - ss.Write(","); - } - ss.Write("{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(solution.FullPath, BuildReference(solution, refr)), '/')); - } - ss.WriteLine(" \\"); - } - //ss.WriteLine("\t\tProperties/AssemblyInfo.cs \\"); - - foreach (string file in project.Files) - { - switch (project.Files.GetBuildAction(file)) - { - case BuildAction.EmbeddedResource: - ss.Write("\t\t/resource:"); - ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, file), '/') + " \\"); - break; - default: - if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) - { - ss.Write("\t\t/resource:"); - if (project.Files.GetResourceName(file) != "") - { - ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/') + "," + project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources" + " \\"); - } - else - { - ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/') + "," + project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources" + " \\"); - } - } - break; - } - } - - foreach (ConfigurationNode conf in project.Configurations) - { - if (conf.Options.KeyFile != "") - { - ss.WriteLine("\t\t/keyfile:" + Helper.NormalizePath(Path.Combine(project.Path, conf.Options.KeyFile), '/') + " \\"); - break; - } - } - foreach (ConfigurationNode conf in project.Configurations) - { - if (conf.Options.AllowUnsafe) - { - ss.WriteLine("\t\t/unsafe \\"); - break; - } - } - if (project.AppIcon != "") - { - ss.WriteLine("\t\t/win32icon:" + Helper.NormalizePath(Path.Combine(project.Path, project.AppIcon), '/') + " \\"); - } - - foreach (ConfigurationNode conf in project.Configurations) - { - ss.WriteLine("\t\t/define:{0}", conf.Options.CompilerDefines.Replace(';', ',') + " \\"); - break; - } - - foreach (ConfigurationNode conf in project.Configurations) - { - if (GetXmlDocFile(project, conf) != "") - { - ss.WriteLine("\t\t/doc:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + project.Name + ".xml \\"); - break; - } - } - foreach (string file in project.Files) - { - switch (project.Files.GetBuildAction(file)) - { - case BuildAction.Compile: - ss.WriteLine("\t\t\\"); - ss.Write("\t\t" + NormalizePath(Path.Combine(Helper.MakePathRelativeTo(solution.FullPath, project.Path), file))); - break; - default: - break; - } - } - ss.WriteLine(); - ss.WriteLine(); - - if (project.Type == ProjectType.Library) - { - ss.WriteLine("install-data-local:"); - ss.WriteLine(" echo \"$(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS)\"; \\"); - ss.WriteLine(" $(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS) || exit 1;"); - ss.WriteLine(); - ss.WriteLine("uninstall-local:"); - ss.WriteLine(" echo \"$(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS)\"; \\"); - ss.WriteLine(" $(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS) || exit 1;"); - ss.WriteLine(); - } - ss.WriteLine("CLEANFILES = $(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " $(BUILD_DIR)/$(CONFIG)/" + project.AssemblyName + ".mdb $(BUILD_DIR)/$(CONFIG)/" + project.AssemblyName + ".pdb " + project.AssemblyName + ".xml"); - ss.WriteLine("EXTRA_DIST = \\"); - ss.Write(" $(FILES)"); - foreach (ConfigurationNode conf in project.Configurations) - { - if (conf.Options.KeyFile != "") - { - ss.Write(" \\"); - ss.WriteLine("\t" + conf.Options.KeyFile); - } - break; - } - } - m_Kernel.CurrentWorkingDirectory.Pop(); - } - bool hasLibrary = false; - - private void WriteCombineOld(SolutionNode solution) - { - - /* TODO: These vars should be pulled from the prebuild.xml file */ - string releaseVersion = "2.0.0"; - string assemblyVersion = "2.1.0.0"; - string description = - "Tao Framework " + solution.Name + " Binding For .NET"; - - hasLibrary = false; - m_Kernel.Log.Write("Creating Autotools make files"); - foreach (ProjectNode project in solution.Projects) - { - if (m_Kernel.AllowProject(project.FilterGroups)) - { - m_Kernel.Log.Write("...Creating makefile: {0}", project.Name); - WriteProject(solution, project); - } - } - - m_Kernel.Log.Write(""); - string combFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am"); - StreamWriter ss = new StreamWriter(combFile); - ss.NewLine = "\n"; - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); - - using (ss) - { - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - if (project.Type == ProjectType.Library) - { - hasLibrary = true; - break; - } - } - - if (hasLibrary) - { - ss.Write("pkgconfig_in_files = "); - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - if (project.Type == ProjectType.Library) - { - string combFilepc = Helper.MakeFilePath(solution.FullPath, project.Name, "pc.in"); - ss.Write(" " + project.Name + ".pc.in "); - StreamWriter sspc = new StreamWriter(combFilepc); - sspc.NewLine = "\n"; - using (sspc) - { - sspc.WriteLine("prefix=@prefix@"); - sspc.WriteLine("exec_prefix=${prefix}"); - sspc.WriteLine("libdir=${exec_prefix}/lib"); - sspc.WriteLine(); - sspc.WriteLine("Name: @PACKAGE_NAME@"); - sspc.WriteLine("Description: @DESCRIPTION@"); - sspc.WriteLine("Version: @ASSEMBLY_VERSION@"); - sspc.WriteLine("Libs: -r:${libdir}/mono/gac/@PACKAGE_NAME@/@ASSEMBLY_VERSION@__@PUBKEY@/@PACKAGE_NAME@.dll"); - } - } - } - - ss.WriteLine(); - ss.WriteLine("pkgconfigdir=$(prefix)/lib/pkgconfig"); - ss.WriteLine("pkgconfig_DATA=$(pkgconfig_in_files:.pc.in=.pc)"); - } - ss.WriteLine(); - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.WriteLine("-include x {0}", - Helper.NormalizePath(Helper.MakeFilePath(path, "Include", "am"), '/')); - } - ss.WriteLine(); - ss.WriteLine("all: \\"); - ss.Write("\t"); - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(Helper.AssemblyFullName(project.AssemblyName, project.Type) + " "); - - } - ss.WriteLine(); - if (hasLibrary) - { - ss.WriteLine("EXTRA_DIST = \\"); - ss.WriteLine("\t$(pkgconfig_in_files)"); - } - else - { - ss.WriteLine("EXTRA_DIST = "); - } - ss.WriteLine(); - ss.WriteLine("DISTCLEANFILES = \\"); - ss.WriteLine("\tconfigure \\"); - ss.WriteLine("\tMakefile.in \\"); - ss.WriteLine("\taclocal.m4"); - } - combFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac"); - StreamWriter ts = new StreamWriter(combFile); - ts.NewLine = "\n"; - using (ts) - { - if (this.hasLibrary) - { - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - if (project.Type == ProjectType.Library) - { - ts.WriteLine("AC_INIT(" + project.Name + ".pc.in)"); - break; - } - } - } - else - { - ts.WriteLine("AC_INIT(Makefile.am)"); - } - ts.WriteLine("AC_PREREQ(2.53)"); - ts.WriteLine("AC_CANONICAL_SYSTEM"); - - ts.WriteLine("PACKAGE_NAME={0}", solution.Name); - ts.WriteLine("PACKAGE_VERSION={0}", releaseVersion); - ts.WriteLine("DESCRIPTION=\"{0}\"", description); - ts.WriteLine("AC_SUBST(DESCRIPTION)"); - ts.WriteLine("AM_INIT_AUTOMAKE([$PACKAGE_NAME],[$PACKAGE_VERSION],[$DESCRIPTION])"); - - ts.WriteLine("ASSEMBLY_VERSION={0}", assemblyVersion); - ts.WriteLine("AC_SUBST(ASSEMBLY_VERSION)"); - - ts.WriteLine("PUBKEY=`sn -t $PACKAGE_NAME.snk | grep 'Public Key Token' | awk -F: '{print $2}' | sed -e 's/^ //'`"); - ts.WriteLine("AC_SUBST(PUBKEY)"); - - ts.WriteLine(); - ts.WriteLine("AM_MAINTAINER_MODE"); - ts.WriteLine(); - ts.WriteLine("dnl AC_PROG_INTLTOOL([0.25])"); - ts.WriteLine(); - ts.WriteLine("AC_PROG_INSTALL"); - ts.WriteLine(); - ts.WriteLine("MONO_REQUIRED_VERSION=1.1"); - ts.WriteLine(); - ts.WriteLine("AC_MSG_CHECKING([whether we're compiling from CVS])"); - ts.WriteLine("if test -f \"$srcdir/.cvs_version\" ; then"); - ts.WriteLine(" from_cvs=yes"); - ts.WriteLine("else"); - ts.WriteLine(" if test -f \"$srcdir/.svn\" ; then"); - ts.WriteLine(" from_cvs=yes"); - ts.WriteLine(" else"); - ts.WriteLine(" from_cvs=no"); - ts.WriteLine(" fi"); - ts.WriteLine("fi"); - ts.WriteLine(); - ts.WriteLine("AC_MSG_RESULT($from_cvs)"); - ts.WriteLine(); - ts.WriteLine("AC_PATH_PROG(MONO, mono)"); - ts.WriteLine("AC_PATH_PROG(GMCS, gmcs)"); - ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil)"); - ts.WriteLine(); - ts.WriteLine("AC_MSG_CHECKING([for mono])"); - ts.WriteLine("dnl if test \"x$MONO\" = \"x\" ; then"); - ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"mono\" in your PATH])"); - ts.WriteLine("dnl else"); - ts.WriteLine(" AC_MSG_RESULT([found])"); - ts.WriteLine("dnl fi"); - ts.WriteLine(); - ts.WriteLine("AC_MSG_CHECKING([for gmcs])"); - ts.WriteLine("dnl if test \"x$GMCS\" = \"x\" ; then"); - ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"gmcs\" in your PATH])"); - ts.WriteLine("dnl else"); - ts.WriteLine(" AC_MSG_RESULT([found])"); - ts.WriteLine("dnl fi"); - ts.WriteLine(); - //ts.WriteLine("AC_MSG_CHECKING([for gacutil])"); - //ts.WriteLine("if test \"x$GACUTIL\" = \"x\" ; then"); - //ts.WriteLine(" AC_MSG_ERROR([Can't find \"gacutil\" in your PATH])"); - //ts.WriteLine("else"); - //ts.WriteLine(" AC_MSG_RESULT([found])"); - //ts.WriteLine("fi"); - ts.WriteLine(); - ts.WriteLine("AC_SUBST(PATH)"); - ts.WriteLine("AC_SUBST(LD_LIBRARY_PATH)"); - ts.WriteLine(); - ts.WriteLine("dnl CSFLAGS=\"-debug -nowarn:1574\""); - ts.WriteLine("CSFLAGS=\"\""); - ts.WriteLine("AC_SUBST(CSFLAGS)"); - ts.WriteLine(); - // ts.WriteLine("AC_MSG_CHECKING(--disable-sdl argument)"); - // ts.WriteLine("AC_ARG_ENABLE(sdl,"); - // ts.WriteLine(" [ --disable-sdl Disable Sdl interface.],"); - // ts.WriteLine(" [disable_sdl=$disableval],"); - // ts.WriteLine(" [disable_sdl=\"no\"])"); - // ts.WriteLine("AC_MSG_RESULT($disable_sdl)"); - // ts.WriteLine("if test \"$disable_sdl\" = \"yes\"; then"); - // ts.WriteLine(" AC_DEFINE(FEAT_SDL)"); - // ts.WriteLine("fi"); - ts.WriteLine(); - ts.WriteLine("dnl Find pkg-config"); - ts.WriteLine("AC_PATH_PROG(PKGCONFIG, pkg-config, no)"); - ts.WriteLine("if test \"x$PKG_CONFIG\" = \"xno\"; then"); - ts.WriteLine(" AC_MSG_ERROR([You need to install pkg-config])"); - ts.WriteLine("fi"); - ts.WriteLine(); - ts.WriteLine("PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false)"); - ts.WriteLine("BUILD_DIR=\"bin\""); - ts.WriteLine("AC_SUBST(BUILD_DIR)"); - ts.WriteLine("CONFIG=\"Release\""); - ts.WriteLine("AC_SUBST(CONFIG)"); - ts.WriteLine(); - ts.WriteLine("if test \"x$has_mono\" = \"xtrue\"; then"); - ts.WriteLine(" AC_PATH_PROG(RUNTIME, mono, no)"); - ts.WriteLine(" AC_PATH_PROG(CSC, gmcs, no)"); - ts.WriteLine(" if test `uname -s` = \"Darwin\"; then"); - ts.WriteLine(" LIB_PREFIX="); - ts.WriteLine(" LIB_SUFFIX=.dylib"); - ts.WriteLine(" else"); - ts.WriteLine(" LIB_PREFIX=.so"); - ts.WriteLine(" LIB_SUFFIX="); - ts.WriteLine(" fi"); - ts.WriteLine("else"); - ts.WriteLine(" AC_PATH_PROG(CSC, csc.exe, no)"); - ts.WriteLine(" if test x$CSC = \"xno\"; then"); - ts.WriteLine(" AC_MSG_ERROR([You need to install either mono or .Net])"); - ts.WriteLine(" else"); - ts.WriteLine(" RUNTIME="); - ts.WriteLine(" LIB_PREFIX="); - ts.WriteLine(" LIB_SUFFIX=.dylib"); - ts.WriteLine(" fi"); - ts.WriteLine("fi"); - ts.WriteLine(); - ts.WriteLine("AC_SUBST(LIB_PREFIX)"); - ts.WriteLine("AC_SUBST(LIB_SUFFIX)"); - ts.WriteLine(); - ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_CFLAGS)"); - ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_LIBS)"); - ts.WriteLine(); - ts.WriteLine("dnl Find monodoc"); - ts.WriteLine("MONODOC_REQUIRED_VERSION=1.0"); - ts.WriteLine("AC_SUBST(MONODOC_REQUIRED_VERSION)"); - ts.WriteLine("PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, enable_monodoc=yes, enable_monodoc=no)"); - ts.WriteLine(); - ts.WriteLine("if test \"x$enable_monodoc\" = \"xyes\"; then"); - ts.WriteLine(" AC_PATH_PROG(MONODOC, monodoc, no)"); - ts.WriteLine(" if test x$MONODOC = xno; then"); - ts.WriteLine(" enable_monodoc=no"); - ts.WriteLine(" fi"); - ts.WriteLine("else"); - ts.WriteLine(" MONODOC="); - ts.WriteLine("fi"); - ts.WriteLine(); - ts.WriteLine("AC_SUBST(MONODOC)"); - ts.WriteLine("AM_CONDITIONAL(ENABLE_MONODOC, test \"x$enable_monodoc\" = \"xyes\")"); - ts.WriteLine(); - ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil, no)"); - ts.WriteLine("if test \"x$GACUTIL\" = \"xno\" ; then"); - ts.WriteLine(" AC_MSG_ERROR([No gacutil tool found])"); - ts.WriteLine("fi"); - ts.WriteLine(); - // foreach(ProjectNode project in solution.ProjectsTableOrder) - // { - // if (project.Type == ProjectType.Library) - // { - // } - // } - ts.WriteLine("GACUTIL_FLAGS='/package $(PACKAGE_NAME) /gacdir $(DESTDIR)$(prefix)'"); - ts.WriteLine("AC_SUBST(GACUTIL_FLAGS)"); - ts.WriteLine(); - ts.WriteLine("winbuild=no"); - ts.WriteLine("case \"$host\" in"); - ts.WriteLine(" *-*-mingw*|*-*-cygwin*)"); - ts.WriteLine(" winbuild=yes"); - ts.WriteLine(" ;;"); - ts.WriteLine("esac"); - ts.WriteLine("AM_CONDITIONAL(WINBUILD, test x$winbuild = xyes)"); - ts.WriteLine(); - // ts.WriteLine("dnl Check for SDL"); - // ts.WriteLine(); - // ts.WriteLine("AC_PATH_PROG([SDL_CONFIG], [sdl-config])"); - // ts.WriteLine("have_sdl=no"); - // ts.WriteLine("if test -n \"${SDL_CONFIG}\"; then"); - // ts.WriteLine(" have_sdl=yes"); - // ts.WriteLine(" SDL_CFLAGS=`$SDL_CONFIG --cflags`"); - // ts.WriteLine(" SDL_LIBS=`$SDL_CONFIG --libs`"); - // ts.WriteLine(" #"); - // ts.WriteLine(" # sdl-config sometimes emits an rpath flag pointing at its library"); - // ts.WriteLine(" # installation directory. We don't want this, as it prevents users from"); - // ts.WriteLine(" # linking sdl-viewer against, for example, a locally compiled libGL when a"); - // ts.WriteLine(" # version of the library also exists in SDL's library installation"); - // ts.WriteLine(" # directory, typically /usr/lib."); - // ts.WriteLine(" #"); - // ts.WriteLine(" SDL_LIBS=`echo $SDL_LIBS | sed 's/-Wl,-rpath,[[^ ]]* //'`"); - // ts.WriteLine("fi"); - // ts.WriteLine("AC_SUBST([SDL_CFLAGS])"); - // ts.WriteLine("AC_SUBST([SDL_LIBS])"); - ts.WriteLine(); - ts.WriteLine("AC_OUTPUT(["); - ts.WriteLine("Makefile"); - // TODO: this does not work quite right. - //ts.WriteLine("Properties/AssemblyInfo.cs"); - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - if (project.Type == ProjectType.Library) - { - ts.WriteLine(project.Name + ".pc"); - } - // string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - // ts.WriteLine(Helper.NormalizePath(Helper.MakeFilePath(path, "Include"),'/')); - } - ts.WriteLine("])"); - ts.WriteLine(); - ts.WriteLine("#po/Makefile.in"); - ts.WriteLine(); - ts.WriteLine("echo \"---\""); - ts.WriteLine("echo \"Configuration summary\""); - ts.WriteLine("echo \"\""); - ts.WriteLine("echo \" * Installation prefix: $prefix\""); - ts.WriteLine("echo \" * compiler: $CSC\""); - ts.WriteLine("echo \" * Documentation: $enable_monodoc ($MONODOC)\""); - ts.WriteLine("echo \" * Package Name: $PACKAGE_NAME\""); - ts.WriteLine("echo \" * Version: $PACKAGE_VERSION\""); - ts.WriteLine("echo \" * Public Key: $PUBKEY\""); - ts.WriteLine("echo \"\""); - ts.WriteLine("echo \"---\""); - ts.WriteLine(); - } - - ts.NewLine = "\n"; - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - if (project.GenerateAssemblyInfoFile) - { - GenerateAssemblyInfoFile(solution, combFile); - } - } - } - - private static void GenerateAssemblyInfoFile(SolutionNode solution, string combFile) - { - System.IO.Directory.CreateDirectory(Helper.MakePathRelativeTo(solution.FullPath, "Properties")); - combFile = Helper.MakeFilePath(solution.FullPath + "/Properties/", "AssemblyInfo.cs", "in"); - StreamWriter ai = new StreamWriter(combFile); - - using (ai) - { - ai.WriteLine("#region License"); - ai.WriteLine("/*"); - ai.WriteLine("MIT License"); - ai.WriteLine("Copyright (c)2003-2006 Tao Framework Team"); - ai.WriteLine("http://www.taoframework.com"); - ai.WriteLine("All rights reserved."); - ai.WriteLine(""); - ai.WriteLine("Permission is hereby granted, free of charge, to any person obtaining a copy"); - ai.WriteLine("of this software and associated documentation files (the \"Software\"), to deal"); - ai.WriteLine("in the Software without restriction, including without limitation the rights"); - ai.WriteLine("to use, copy, modify, merge, publish, distribute, sublicense, and/or sell"); - ai.WriteLine("copies of the Software, and to permit persons to whom the Software is"); - ai.WriteLine("furnished to do so, subject to the following conditions:"); - ai.WriteLine(""); - ai.WriteLine("The above copyright notice and this permission notice shall be included in all"); - ai.WriteLine("copies or substantial portions of the Software."); - ai.WriteLine(""); - ai.WriteLine("THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR"); - ai.WriteLine("IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,"); - ai.WriteLine("FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE"); - ai.WriteLine("AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER"); - ai.WriteLine("LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,"); - ai.WriteLine("OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE"); - ai.WriteLine("SOFTWARE."); - ai.WriteLine("*/"); - ai.WriteLine("#endregion License"); - ai.WriteLine(""); - ai.WriteLine("using System;"); - ai.WriteLine("using System.Reflection;"); - ai.WriteLine("using System.Runtime.InteropServices;"); - ai.WriteLine("using System.Security;"); - ai.WriteLine("using System.Security.Permissions;"); - ai.WriteLine(""); - ai.WriteLine("[assembly: AllowPartiallyTrustedCallers]"); - ai.WriteLine("[assembly: AssemblyCompany(\"Tao Framework -- http://www.taoframework.com\")]"); - ai.WriteLine("[assembly: AssemblyConfiguration(\"Retail\")]"); - ai.WriteLine("[assembly: AssemblyCopyright(\"Copyright (c)2003-2006 Tao Framework Team. All rights reserved.\")]"); - ai.WriteLine("[assembly: AssemblyCulture(\"\")]"); - ai.WriteLine("[assembly: AssemblyDefaultAlias(\"@PACKAGE_NAME@\")]"); - ai.WriteLine("[assembly: AssemblyDelaySign(false)]"); - ai.WriteLine("[assembly: AssemblyDescription(\"@DESCRIPTION@\")]"); - ai.WriteLine("[assembly: AssemblyFileVersion(\"@ASSEMBLY_VERSION@\")]"); - ai.WriteLine("[assembly: AssemblyInformationalVersion(\"@ASSEMBLY_VERSION@\")]"); - ai.WriteLine("[assembly: AssemblyKeyName(\"\")]"); - ai.WriteLine("[assembly: AssemblyProduct(\"@PACKAGE_NAME@.dll\")]"); - ai.WriteLine("[assembly: AssemblyTitle(\"@DESCRIPTION@\")]"); - ai.WriteLine("[assembly: AssemblyTrademark(\"Tao Framework -- http://www.taoframework.com\")]"); - ai.WriteLine("[assembly: AssemblyVersion(\"@ASSEMBLY_VERSION@\")]"); - ai.WriteLine("[assembly: CLSCompliant(true)]"); - ai.WriteLine("[assembly: ComVisible(false)]"); - ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.Execution)]"); - ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.SkipVerification)]"); - ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.UnmanagedCode)]"); - - } - //return combFile; - } - private void CleanProject(ProjectNode project) { m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); @@ -1677,7 +966,7 @@ namespace Prebuild.Core.Targets m_Kernel.Log.Write("Parsing system pkg-config files"); RunInitialization(); - string streamName = "autotools.xml"; + const string streamName = "autotools.xml"; string fqStreamName = String.Format("Prebuild.data.{0}", streamName ); @@ -1727,10 +1016,9 @@ namespace Prebuild.Core.Targets string pwd = Directory.GetCurrentDirectory(); //string pwd = System.Environment.GetEnvironmentVariable("PWD"); - string rootDir = ""; //if (pwd.Length != 0) //{ - rootDir = Path.Combine(pwd, "autotools"); + string rootDir = Path.Combine(pwd, "autotools"); //} //else //{ diff --git a/Prebuild/src/Core/Targets/DebugTarget.cs b/Prebuild/src/Core/Targets/DebugTarget.cs index dc4e666ebd..650007ecc6 100644 --- a/Prebuild/src/Core/Targets/DebugTarget.cs +++ b/Prebuild/src/Core/Targets/DebugTarget.cs @@ -27,7 +27,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O /* * $Source$ * $Author: jendave $ - * $Date: 2006-09-20 09:42:51 +0200 (on, 20 sep 2006) $ + * $Date: 2006-09-20 08:42:51 +0100 (Wed, 20 Sep 2006) $ * $Revision: 164 $ */ #endregion diff --git a/Prebuild/src/Core/Targets/MakefileTarget.cs b/Prebuild/src/Core/Targets/MakefileTarget.cs index 86676d08cb..54046dd9bb 100644 --- a/Prebuild/src/Core/Targets/MakefileTarget.cs +++ b/Prebuild/src/Core/Targets/MakefileTarget.cs @@ -24,8 +24,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O #endregion using System; -using System.Collections; -using System.Collections.Specialized; using System.IO; using System.Text.RegularExpressions; @@ -110,7 +108,7 @@ namespace Prebuild.Core.Targets { string path; // Project references change with configurations. - if (solution.ProjectsTable.Contains(refr.Name)) + if (solution.ProjectsTable.ContainsKey(refr.Name)) continue; path = FindFileReference(refr.Name, project); if (path != null) @@ -220,7 +218,7 @@ namespace Prebuild.Core.Targets } // Dependencies on other projects. foreach (ReferenceNode refr in project.References) - if (solution.ProjectsTable.Contains(refr.Name)) + if (solution.ProjectsTable.ContainsKey(refr.Name)) { ProjectNode refProj = (ProjectNode)solution.ProjectsTable[refr.Name]; if (ProjectClashes(refProj)) @@ -256,7 +254,7 @@ namespace Prebuild.Core.Targets // Build references to other projects. Now that sux. // We have to reference the other project in the same conf. foreach (ReferenceNode refr in project.References) - if (solution.ProjectsTable.Contains(refr.Name)) + if (solution.ProjectsTable.ContainsKey(refr.Name)) { ProjectNode refProj; refProj = (ProjectNode)solution.ProjectsTable[refr.Name]; @@ -274,7 +272,7 @@ namespace Prebuild.Core.Targets { string outPath, srcPath, destPath; outPath = Helper.NormalizePath((string)conf.Options["OutputPath"]); - if (solution.ProjectsTable.Contains(refr.Name)) + if (solution.ProjectsTable.ContainsKey(refr.Name)) { ProjectNode refProj; refProj = (ProjectNode)solution.ProjectsTable[refr.Name]; diff --git a/Prebuild/src/Core/Targets/MonoDevelopTarget.cs b/Prebuild/src/Core/Targets/MonoDevelopTarget.cs index c8401fd42a..ea6d2c2233 100644 --- a/Prebuild/src/Core/Targets/MonoDevelopTarget.cs +++ b/Prebuild/src/Core/Targets/MonoDevelopTarget.cs @@ -24,8 +24,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O #endregion using System; -using System.Collections; -using System.Collections.Specialized; using System.IO; using System.Reflection; using System.Text.RegularExpressions; @@ -274,7 +272,11 @@ namespace Prebuild.Core.Targets ss.WriteLine(" "); foreach(string file in project.Files) { - string buildAction = "Compile"; + string buildAction; + string dependson = ""; + string resource_id = ""; + string copyToOutput = ""; + switch(project.Files.GetBuildAction(file)) { case BuildAction.None: @@ -294,9 +296,58 @@ namespace Prebuild.Core.Targets break; } + if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never) + buildAction = "FileCopy"; + // Sort of a hack, we try and resolve the path and make it relative, if we can. - string filePath = PrependPath(file); - ss.WriteLine(" ", filePath, buildAction); + string extension = Path.GetExtension(file); + string designer_format = string.Format(".Designer{0}", extension); + + if (file.EndsWith(designer_format)) + { + string basename = file.Substring(0, file.LastIndexOf(designer_format)); + string[] extensions = new string[] { ".cs", ".resx", ".settings" }; + + foreach(string ext in extensions) + { + if (project.Files.Contains(basename + ext)) + { + dependson = string.Format(" dependson=\"{0}{1}\"", basename, ext); + break; + } + } + } + if (extension == ".resx") + { + buildAction = "EmbedAsResource"; + string basename = file.Substring(0, file.LastIndexOf(".resx")); + + // Visual Studio type resx + form dependency + if (project.Files.Contains(basename + ".cs")) + { + dependson = string.Format(" dependson=\"{0}{1}\"", basename, ".cs"); + } + + // We need to specify a resources file name to avoid MissingManifestResourceExceptions + // in libraries that are built. + resource_id = string.Format(" resource_id=\"{0}.{1}.resources\"", + project.AssemblyName, basename.Replace("/", ".")); + } + + switch(project.Files.GetCopyToOutput(file)) + { + case CopyToOutput.Always: + copyToOutput = string.Format(" copyToOutputDirectory=\"Always\""); + break; + case CopyToOutput.PreserveNewest: + copyToOutput = string.Format(" copyToOutputDirectory=\"PreserveNewest\""); + break; + } + + // Sort of a hack, we try and resolve the path and make it relative, if we can. + string filePath = PrependPath(file); + ss.WriteLine(" ", + filePath, buildAction, dependson, resource_id, copyToOutput); } ss.WriteLine(" "); diff --git a/Prebuild/src/Core/Targets/NAntTarget.cs b/Prebuild/src/Core/Targets/NAntTarget.cs index 9a6ee17819..d4a33f8d3b 100644 --- a/Prebuild/src/Core/Targets/NAntTarget.cs +++ b/Prebuild/src/Core/Targets/NAntTarget.cs @@ -36,10 +36,8 @@ POSSIBILITY OF SUCH DAMAGE. #endregion using System; -using System.Collections; -using System.Collections.Specialized; +using System.Collections.Generic; using System.IO; -using System.Reflection; using System.Text.RegularExpressions; using Prebuild.Core.Attributes; @@ -255,9 +253,12 @@ namespace Prebuild.Core.Targets ss.WriteLine(" {0}", ""); ss.WriteLine(" {0}", ""); - ss.Write(" "); + // This disables a very different behavior between VS and NAnt. With Nant, + // If you have using System.Xml; it will ensure System.Xml.dll is referenced, + // but not in VS. This will force the behaviors to match, so when it works + // in nant, it will work in VS. + ss.Write(" noconfig=\"true\""); + ss.WriteLine(">"); ss.WriteLine(" ", project.RootNamespace); foreach (string file in project.Files) { @@ -357,7 +363,20 @@ namespace Prebuild.Core.Targets foreach (ReferenceNode refr in project.References) { string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/'); - ss.WriteLine(" "); + if (refr.Path != null) { + if (ExtensionSpecified(refr.Name)) + { + ss.WriteLine (" "); + } + else + { + ss.WriteLine (" "); + } + } + else + { + ss.WriteLine (" "); + } } ss.WriteLine(" "); @@ -490,15 +509,32 @@ namespace Prebuild.Core.Targets ss.WriteLine(" "); ss.WriteLine(" "); - // actually use active config out of prebuild.xml - ss.WriteLine(" ", solution.ActiveConfig); + // Use the active configuration, which is the first configuration name in the prebuild file. + Dictionary emittedConfigurations = new Dictionary(); + + ss.WriteLine(" ", solution.ActiveConfig); + ss.WriteLine(); foreach (ConfigurationNode conf in solution.Configurations) { - ss.WriteLine(); - ss.WriteLine(" ", conf.Name); + // If the name isn't in the emitted configurations, we give a high level target to the + // platform specific on. This lets "Debug" point to "Debug-AnyCPU". + if (!emittedConfigurations.ContainsKey(conf.Name)) + { + // Add it to the dictionary so we only emit one. + emittedConfigurations.Add(conf.Name, conf.Platform); + + // Write out the target block. + ss.WriteLine(" ", conf.Name, conf.Platform); + ss.WriteLine(" "); + ss.WriteLine(); + } + + // Write out the target for the configuration. + ss.WriteLine(" ", conf.Name, conf.Platform); ss.WriteLine(" ", conf.Name); ss.WriteLine(" ", conf.Options["DebugInformation"].ToString().ToLower()); + ss.WriteLine("\t\t ", conf.Platform); ss.WriteLine(" "); ss.WriteLine(); } @@ -559,19 +595,19 @@ namespace Prebuild.Core.Targets if (item is DirectoryInfo) { } else if (item is FileInfo) { - if (re.Match(((FileInfo)item).FullName) != + if (re.Match(item.FullName) != System.Text.RegularExpressions.Match.Empty) { - Console.WriteLine("Including file: " + ((FileInfo)item).FullName); + Console.WriteLine("Including file: " + item.FullName); - using (FileStream fs = new FileStream(((FileInfo)item).FullName, + using (FileStream fs = new FileStream(item.FullName, FileMode.Open, FileAccess.Read, FileShare.None)) { using (StreamReader sr = new StreamReader(fs)) { - ss.WriteLine("", ((FileInfo)item).FullName); + ss.WriteLine("", (item).FullName); while (sr.Peek() != -1) { ss.WriteLine(sr.ReadLine()); @@ -601,6 +637,10 @@ namespace Prebuild.Core.Targets ss.WriteLine(" "); ss.WriteLine(" "); //ss.WriteLine(" "); + + // justincc: FIXME FIXME FIXME - A temporary OpenSim hack to clean up files when "nant clean" is executed. + // Should be replaced with extreme prejudice once anybody finds out if the CleanFiles stuff works or there is + // another working mechanism for specifying this stuff ss.WriteLine(" "); ss.WriteLine(" "); ss.WriteLine(" "); @@ -611,7 +651,21 @@ namespace Prebuild.Core.Targets ss.WriteLine(" "); ss.WriteLine(" "); ss.WriteLine(" "); - ss.WriteLine(" "); + + if (solution.Cleanup != null && solution.Cleanup.CleanFiles.Count > 0) + { + foreach (CleanFilesNode cleanFile in solution.Cleanup.CleanFiles) + { + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" ", cleanFile.Pattern); + ss.WriteLine(" ", cleanFile.Pattern); + ss.WriteLine(" "); + ss.WriteLine(" "); + } + } + + ss.WriteLine(" "); foreach (ProjectNode project in solution.Projects) { string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); diff --git a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs index cf7ce0260b..8e3205025f 100644 --- a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs +++ b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs @@ -24,11 +24,8 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O #endregion using System; -using System.Collections; -using System.Collections.Specialized; using System.IO; using System.Text.RegularExpressions; -using System.Reflection; using Prebuild.Core.Attributes; using Prebuild.Core.Interfaces; diff --git a/Prebuild/src/Core/Targets/VS2003Target.cs b/Prebuild/src/Core/Targets/VS2003Target.cs index 1bcb7dce0d..10e2dc4a71 100644 --- a/Prebuild/src/Core/Targets/VS2003Target.cs +++ b/Prebuild/src/Core/Targets/VS2003Target.cs @@ -24,8 +24,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O #endregion using System; -using System.Collections; -using System.Collections.Specialized; +using System.Collections.Generic; using System.IO; using Prebuild.Core.Attributes; @@ -47,7 +46,7 @@ namespace Prebuild.Core.Targets string versionName = "2003"; VSVersion version = VSVersion.VS71; - Hashtable m_Tools; + readonly Dictionary m_Tools = new Dictionary(); Kernel m_Kernel; /// @@ -58,11 +57,11 @@ namespace Prebuild.Core.Targets { get { - return this.solutionVersion; + return solutionVersion; } set { - this.solutionVersion = value; + solutionVersion = value; } } /// @@ -73,11 +72,11 @@ namespace Prebuild.Core.Targets { get { - return this.productVersion; + return productVersion; } set { - this.productVersion = value; + productVersion = value; } } /// @@ -88,11 +87,11 @@ namespace Prebuild.Core.Targets { get { - return this.schemaVersion; + return schemaVersion; } set { - this.schemaVersion = value; + schemaVersion = value; } } /// @@ -103,11 +102,11 @@ namespace Prebuild.Core.Targets { get { - return this.versionName; + return versionName; } set { - this.versionName = value; + versionName = value; } } /// @@ -118,11 +117,11 @@ namespace Prebuild.Core.Targets { get { - return this.version; + return version; } set { - this.version = value; + version = value; } } @@ -135,8 +134,6 @@ namespace Prebuild.Core.Targets /// public VS2003Target() { - m_Tools = new Hashtable(); - m_Tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP"); m_Tools["VB.NET"] = new ToolInfo("VB.NET", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic"); } @@ -178,23 +175,20 @@ namespace Prebuild.Core.Targets throw new UnknownLanguageException("Unknown .NET language: " + project.Language); } - ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; + ToolInfo toolInfo = m_Tools[project.Language]; string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); StreamWriter ps = new StreamWriter(projectFile); m_Kernel.CurrentWorkingDirectory.Push(); Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); - IEnumerator enumerator; - //ConfigurationNode scripts; - using(ps) { ps.WriteLine(""); ps.WriteLine(" <{0}", toolInfo.XmlTag); ps.WriteLine("\t\t\t\tProjectType = \"Local\""); - ps.WriteLine("\t\t\t\tProductVersion = \"{0}\"", this.ProductVersion); - ps.WriteLine("\t\t\t\tSchemaVersion = \"{0}\"", this.SchemaVersion); + ps.WriteLine("\t\t\t\tProductVersion = \"{0}\"", ProductVersion); + ps.WriteLine("\t\t\t\tSchemaVersion = \"{0}\"", SchemaVersion); ps.WriteLine("\t\t\t\tProjectGuid = \"{{{0}}}\"", project.Guid.ToString().ToUpper()); ps.WriteLine("\t\t>"); @@ -209,16 +203,13 @@ namespace Prebuild.Core.Targets ps.WriteLine("\t\t\t\t DefaultTargetSchema = \"IE50\""); ps.WriteLine("\t\t\t\t DelaySign = \"false\""); - if(this.Version == VSVersion.VS70) + if(Version == VSVersion.VS70) { ps.WriteLine("\t\t\t\t NoStandardLibraries = \"false\""); } - ps.WriteLine("\t\t\t\t OutputType = \"{0}\"", project.Type.ToString()); + ps.WriteLine("\t\t\t\t OutputType = \"{0}\"", project.Type); - enumerator = project.Configurations.GetEnumerator(); - enumerator.Reset(); - enumerator.MoveNext(); foreach(ConfigurationNode conf in project.Configurations) { if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0) @@ -266,7 +257,7 @@ namespace Prebuild.Core.Targets ps.WriteLine("\t\t\t\t FileAlignment = \"{0}\"", conf.Options["FileAlignment"]); ps.WriteLine("\t\t\t\t IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"].ToString().ToLower()); - if(this.Version == VSVersion.VS71) + if(Version == VSVersion.VS71) { ps.WriteLine("\t\t\t\t NoStdLib = \"{0}\"", conf.Options["NoStdLib"].ToString().ToLower()); ps.WriteLine("\t\t\t\t NoWarn = \"{0}\"", conf.Options["SuppressWarnings"].ToString().ToLower()); @@ -293,9 +284,9 @@ namespace Prebuild.Core.Targets if(solution.ProjectsTable.ContainsKey(refr.Name)) { - ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; + ProjectNode refProject = solution.ProjectsTable[refr.Name]; ps.WriteLine(" Project = \"{{{0}}}\"", refProject.Guid.ToString().ToUpper()); - ps.WriteLine(" Package = \"{0}\"", toolInfo.Guid.ToString().ToUpper()); + ps.WriteLine(" Package = \"{0}\"", toolInfo.Guid.ToUpper()); } else { @@ -409,7 +400,7 @@ namespace Prebuild.Core.Targets private void WriteSolution(SolutionNode solution) { - m_Kernel.Log.Write("Creating Visual Studio {0} solution and project files", this.VersionName); + m_Kernel.Log.Write("Creating Visual Studio {0} solution and project files", VersionName); foreach(ProjectNode project in solution.Projects) { @@ -429,7 +420,7 @@ namespace Prebuild.Core.Targets using(ss) { - ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); + ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", SolutionVersion); foreach(ProjectNode project in solution.Projects) { if(!m_Tools.ContainsKey(project.Language)) @@ -437,7 +428,7 @@ namespace Prebuild.Core.Targets throw new UnknownLanguageException("Unknown .NET language: " + project.Language); } - ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; + ToolInfo toolInfo = m_Tools[project.Language]; string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"", @@ -464,10 +455,10 @@ namespace Prebuild.Core.Targets { for(int i = 0; i < project.References.Count; i++) { - ReferenceNode refr = (ReferenceNode)project.References[i]; + ReferenceNode refr = project.References[i]; if(solution.ProjectsTable.ContainsKey(refr.Name)) { - ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; + ProjectNode refProject = solution.ProjectsTable[refr.Name]; ss.WriteLine("\t\t({{{0}}}).{1} = ({{{2}}})", project.Guid.ToString().ToUpper() , i, @@ -519,7 +510,7 @@ namespace Prebuild.Core.Targets { m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; + ToolInfo toolInfo = m_Tools[project.Language]; string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); string userFile = projectFile + ".user"; @@ -529,7 +520,7 @@ namespace Prebuild.Core.Targets private void CleanSolution(SolutionNode solution) { - m_Kernel.Log.Write("Cleaning Visual Studio {0} solution and project files", this.VersionName, solution.Name); + m_Kernel.Log.Write("Cleaning Visual Studio {0} solution and project files", VersionName, solution.Name); string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); diff --git a/Prebuild/src/Core/Targets/VS2005Target.cs b/Prebuild/src/Core/Targets/VS2005Target.cs index 63461c9fe5..9c70e26a37 100644 --- a/Prebuild/src/Core/Targets/VS2005Target.cs +++ b/Prebuild/src/Core/Targets/VS2005Target.cs @@ -24,8 +24,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O #endregion using System; -using System.Collections; -using System.Collections.Specialized; using System.IO; using System.Text; diff --git a/Prebuild/src/Core/Targets/VS2008Target.cs b/Prebuild/src/Core/Targets/VS2008Target.cs index e685962b5a..fee4f7f27f 100644 --- a/Prebuild/src/Core/Targets/VS2008Target.cs +++ b/Prebuild/src/Core/Targets/VS2008Target.cs @@ -1,6 +1,4 @@ using System; -using System.Collections; -using System.Collections.Specialized; using System.IO; using System.Text; @@ -27,9 +25,6 @@ namespace Prebuild.Core.Targets string name = "vs2008"; VSVersion version = VSVersion.VS90; - Hashtable tools; - Kernel kernel; - /// /// Gets or sets the solution version. /// @@ -120,7 +115,7 @@ namespace Prebuild.Core.Targets #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// public VS2008Target() : base() diff --git a/Prebuild/src/Core/Targets/VS2010Target.cs b/Prebuild/src/Core/Targets/VS2010Target.cs index 8772d18595..b16120c389 100644 --- a/Prebuild/src/Core/Targets/VS2010Target.cs +++ b/Prebuild/src/Core/Targets/VS2010Target.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections; -using System.Collections.Specialized; +using System; using System.IO; using System.Text; @@ -13,98 +11,104 @@ using System.CodeDom.Compiler; namespace Prebuild.Core.Targets { - /// - /// - /// - [Target("vs2010")] - public class VS2010Target : VSGenericTarget - { - #region Fields - string solutionVersion = "11.00"; - string productVersion = "9.0.21022"; - string schemaVersion = "2.0"; - string versionName = "Visual Studio 2010"; - string name = "vs2008"; - VSVersion version = VSVersion.VS10; + /// + /// + /// + [Target("vs2010")] + public class VS2010Target : VSGenericTarget + { + #region Fields + + string solutionVersion = "11.00"; + string productVersion = "9.0.30729"; + string schemaVersion = "2.0"; + string versionName = "Visual Studio 2010"; + string name = "vs2010"; + VSVersion version = VSVersion.VS10; - Hashtable tools; - Kernel kernel; - - /// - /// Gets or sets the solution version. - /// - /// The solution version. - public override string SolutionVersion - { - get - { - return solutionVersion; - } - } - /// - /// Gets or sets the product version. - /// - /// The product version. - public override string ProductVersion - { - get - { - return productVersion; - } - } - /// - /// Gets or sets the schema version. - /// - /// The schema version. - public override string SchemaVersion - { - get - { - return schemaVersion; - } - } - /// - /// Gets or sets the name of the version. - /// - /// The name of the version. - public override string VersionName - { - get - { - return versionName; - } - } - /// - /// Gets or sets the version. - /// - /// The version. - public override VSVersion Version - { - get - { - return version; - } - } - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get - { - return name; - } - } + #endregion + + #region Properties + + /// + /// Gets or sets the solution version. + /// + /// The solution version. + public override string SolutionVersion + { + get + { + return solutionVersion; + } + } + + /// + /// Gets or sets the product version. + /// + /// The product version. + public override string ProductVersion + { + get + { + return productVersion; + } + } + + /// + /// Gets or sets the schema version. + /// + /// The schema version. + public override string SchemaVersion + { + get + { + return schemaVersion; + } + } + + /// + /// Gets or sets the name of the version. + /// + /// The name of the version. + public override string VersionName + { + get + { + return versionName; + } + } + + /// + /// Gets or sets the version. + /// + /// The version. + public override VSVersion Version + { + get + { + return version; + } + } + + /// + /// Gets the name. + /// + /// The name. + public override string Name + { + get + { + return name; + } + } protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion) { switch (frameworkVersion) { - case FrameworkVersion.v4_0: - return "ToolsVersion=\"4.0\""; + case FrameworkVersion.v4_0: case FrameworkVersion.v3_5: - return "ToolsVersion=\"3.5\""; + return "ToolsVersion=\"4.0\""; case FrameworkVersion.v3_0: return "ToolsVersion=\"3.0\""; default: @@ -117,18 +121,18 @@ namespace Prebuild.Core.Targets get { return "# Visual Studio 2010"; } } - #endregion + #endregion - #region Constructors + #region Constructors - /// - /// Initializes a new instance of the class. - /// - public VS2010Target() - : base() - { - } + /// + /// Initializes a new instance of the class. + /// + public VS2010Target() + : base() + { + } - #endregion - } + #endregion + } } diff --git a/Prebuild/src/Core/Targets/VSGenericTarget.cs b/Prebuild/src/Core/Targets/VSGenericTarget.cs index fdcc2b909a..cd3f5bbe1d 100644 --- a/Prebuild/src/Core/Targets/VSGenericTarget.cs +++ b/Prebuild/src/Core/Targets/VSGenericTarget.cs @@ -5,32 +5,27 @@ Copyright (c) 2008 Matthew Holmes (matthew@wildfiregames.com), John Anderson (so Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ + */ #endregion using System; -using System.Collections; using System.Collections.Generic; -using System.Collections.Specialized; using System.IO; -using System.Text; - -using Prebuild.Core.Attributes; using Prebuild.Core.Interfaces; using Prebuild.Core.Nodes; using Prebuild.Core.Utilities; @@ -46,59 +41,59 @@ namespace Prebuild.Core.Targets { #region Fields - readonly Hashtable tools = new Hashtable(); + readonly Dictionary tools = new Dictionary(); Kernel kernel; #endregion - #region Properties - /// - /// Gets or sets the solution version. - /// - /// The solution version. - public abstract string SolutionVersion { get; } - /// - /// Gets or sets the product version. - /// - /// The product version. - public abstract string ProductVersion { get; } - /// - /// Gets or sets the schema version. - /// - /// The schema version. - public abstract string SchemaVersion { get; } - /// - /// Gets or sets the name of the version. - /// - /// The name of the version. - public abstract string VersionName { get; } - /// - /// Gets or sets the version. - /// - /// The version. - public abstract VSVersion Version { get; } - /// - /// Gets the name. - /// - /// The name. - public abstract string Name { get; } + #region Properties + /// + /// Gets or sets the solution version. + /// + /// The solution version. + public abstract string SolutionVersion { get; } + /// + /// Gets or sets the product version. + /// + /// The product version. + public abstract string ProductVersion { get; } + /// + /// Gets or sets the schema version. + /// + /// The schema version. + public abstract string SchemaVersion { get; } + /// + /// Gets or sets the name of the version. + /// + /// The name of the version. + public abstract string VersionName { get; } + /// + /// Gets or sets the version. + /// + /// The version. + public abstract VSVersion Version { get; } + /// + /// Gets the name. + /// + /// The name. + public abstract string Name { get; } - protected abstract string GetToolsVersionXml(FrameworkVersion version); - public abstract string SolutionTag { get; } + protected abstract string GetToolsVersionXml(FrameworkVersion version); + public abstract string SolutionTag { get; } - #endregion + #endregion #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// protected VSGenericTarget() { - this.tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets"); - this.tools["Database"] = new ToolInfo("Database", "{4F174C21-8C12-11D0-8340-0000F80270F8}", "dbp", "UNKNOWN"); - this.tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets"); - this.tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets"); - this.tools["Folder"] = new ToolInfo("Folder", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", null, null); + tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets"); + tools["Database"] = new ToolInfo("Database", "{4F174C21-8C12-11D0-8340-0000F80270F8}", "dbp", "UNKNOWN"); + tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets"); + tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets"); + tools["Folder"] = new ToolInfo("Folder", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", null, null); } #endregion @@ -124,7 +119,7 @@ namespace Prebuild.Core.Targets } catch (ArgumentException) { - this.kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); + kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); } } @@ -144,7 +139,7 @@ namespace Prebuild.Core.Targets private static ProjectNode FindProjectInSolutionRecursively(string name, SolutionNode solution) { if (solution.ProjectsTable.ContainsKey(name)) - return (ProjectNode)solution.ProjectsTable[name]; + return solution.ProjectsTable[name]; foreach (SolutionNode child in solution.Solutions) { @@ -163,7 +158,7 @@ namespace Prebuild.Core.Targets throw new UnknownLanguageException("Unknown .NET language: " + project.Language); } - ToolInfo toolInfo = (ToolInfo)tools[project.Language]; + ToolInfo toolInfo = tools[project.Language]; string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); StreamWriter ps = new StreamWriter(projectFile); @@ -173,83 +168,83 @@ namespace Prebuild.Core.Targets #region Project File using (ps) { - ps.WriteLine("", this.Version == VSVersion.VS10 ? "4.0" : "3.5"); - ps.WriteLine(" "); - ps.WriteLine(" Local"); - ps.WriteLine(" {0}", this.ProductVersion); - ps.WriteLine(" {0}", this.SchemaVersion); - ps.WriteLine(" {{{0}}}", project.Guid.ToString().ToUpper()); + ps.WriteLine("", GetToolsVersionXml(project.FrameworkVersion)); + ps.WriteLine(" "); + ps.WriteLine(" Local"); + ps.WriteLine(" {0}", ProductVersion); + ps.WriteLine(" {0}", SchemaVersion); + ps.WriteLine(" {{{0}}}", project.Guid.ToString().ToUpper()); // Visual Studio has a hard coded guid for the project type if (project.Type == ProjectType.Web) - ps.WriteLine(" {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}"); - ps.WriteLine(" Debug"); - ps.WriteLine(" AnyCPU"); - ps.WriteLine(" {0}", project.AppIcon); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" {0}", project.AssemblyName); + ps.WriteLine(" {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}"); + ps.WriteLine(" Debug"); + ps.WriteLine(" {0}", project.AppIcon); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" {0}", project.AssemblyName); foreach (ConfigurationNode conf in project.Configurations) { if (conf.Options.KeyFile != "") { - ps.WriteLine(" {0}", conf.Options.KeyFile); - ps.WriteLine(" true"); + ps.WriteLine(" {0}", conf.Options.KeyFile); + ps.WriteLine(" true"); break; } } - ps.WriteLine(" JScript"); - ps.WriteLine(" Grid"); - ps.WriteLine(" IE50"); - ps.WriteLine(" false"); - ps.WriteLine(" {0}", project.FrameworkVersion.ToString().Replace("_", ".")); + ps.WriteLine(" JScript"); + ps.WriteLine(" Grid"); + ps.WriteLine(" IE50"); + ps.WriteLine(" false"); + ps.WriteLine(" {0}", project.FrameworkVersion.ToString().Replace("_", ".")); - ps.WriteLine(" {0}", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString()); - ps.WriteLine(" {0}", project.DesignerFolder); - ps.WriteLine(" {0}", project.RootNamespace); - ps.WriteLine(" {0}", project.StartupObject); - if (string.IsNullOrEmpty(project.DebugStartParameters)) - { - ps.WriteLine(" {0}", project.DebugStartParameters); - } - ps.WriteLine(" "); - ps.WriteLine(" "); + ps.WriteLine(" {0}", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString()); + ps.WriteLine(" {0}", project.DesignerFolder); + ps.WriteLine(" {0}", project.RootNamespace); + ps.WriteLine(" {0}", project.StartupObject); + if (string.IsNullOrEmpty(project.DebugStartParameters)) + { + ps.WriteLine(" {0}", project.DebugStartParameters); + } + ps.WriteLine(" "); + ps.WriteLine(" "); - ps.WriteLine(" "); + ps.WriteLine(" "); foreach (ConfigurationNode conf in project.Configurations) { - ps.Write(" ", conf.Name); - ps.WriteLine(" {0}", conf.Options["AllowUnsafe"]); - ps.WriteLine(" {0}", conf.Options["BaseAddress"]); - ps.WriteLine(" {0}", conf.Options["CheckUnderflowOverflow"]); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" {0}", conf.Options["CompilerDefines"]); - ps.WriteLine(" {0}", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString())); - ps.WriteLine(" {0}", conf.Options["DebugInformation"]); - ps.WriteLine(" {0}", conf.Options["FileAlignment"]); - ps.WriteLine(" {0}", conf.Options["OptimizeCode"]); + ps.Write(" ", conf.Name, conf.Platform); + ps.WriteLine(" {0}", conf.Options["AllowUnsafe"]); + ps.WriteLine(" {0}", conf.Options["BaseAddress"]); + ps.WriteLine(" {0}", conf.Options["CheckUnderflowOverflow"]); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" {0}", conf.Options["CompilerDefines"]); + ps.WriteLine(" {0}", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString())); + ps.WriteLine(" {0}", conf.Options["DebugInformation"]); + ps.WriteLine(" {0}", conf.Options["FileAlignment"]); + ps.WriteLine(" {0}", conf.Options["OptimizeCode"]); if (project.Type != ProjectType.Web) - ps.WriteLine(" {0}", - Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); + ps.WriteLine(" {0}", + Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); else - ps.WriteLine(" {0}", - Helper.EndPath(Helper.NormalizePath("bin\\"))); + ps.WriteLine(" {0}", + Helper.EndPath(Helper.NormalizePath("bin\\"))); - ps.WriteLine(" {0}", conf.Options["RegisterComInterop"]); - ps.WriteLine(" {0}", conf.Options["RemoveIntegerChecks"]); - ps.WriteLine(" {0}", conf.Options["WarningsAsErrors"]); - ps.WriteLine(" {0}", conf.Options["WarningLevel"]); - ps.WriteLine(" {0}", conf.Options["NoStdLib"]); - ps.WriteLine(" {0}", conf.Options["SuppressWarnings"]); - ps.WriteLine(" "); + ps.WriteLine(" {0}", conf.Options["RegisterComInterop"]); + ps.WriteLine(" {0}", conf.Options["RemoveIntegerChecks"]); + ps.WriteLine(" {0}", conf.Options["WarningsAsErrors"]); + ps.WriteLine(" {0}", conf.Options["WarningLevel"]); + ps.WriteLine(" {0}", conf.Options["NoStdLib"]); + ps.WriteLine(" {0}", conf.Options["SuppressWarnings"]); + ps.WriteLine(" {0}", conf.Platform); + ps.WriteLine(" "); } - //ps.WriteLine(" "); + //ps.WriteLine(" "); - List projectReferences = new List(); + Dictionary projectReferences = new Dictionary(); List otherReferences = new List(); foreach (ReferenceNode refr in project.References) @@ -259,57 +254,75 @@ namespace Prebuild.Core.Targets if (projectNode == null) otherReferences.Add(refr); else - projectReferences.Add(projectNode); + projectReferences.Add(refr, projectNode); } // Assembly References - ps.WriteLine(" "); + ps.WriteLine(" "); foreach (ReferenceNode refr in otherReferences) { - ps.Write(" "); - ps.Write(" "); + ps.Write(" "); ps.Write(refr.Name); ps.WriteLine(""); - // TODO: Allow reference to *.exe files - ps.WriteLine(" {0}", refr.LocalCopy); - ps.WriteLine(" "); + + if(!String.IsNullOrEmpty(refr.Path)) + { + // Use absolute path to assembly (for determining assembly type) + string absolutePath = Path.Combine(project.FullPath, refr.Path); + if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "exe"))) { + // Assembly is an executable (exe) + ps.WriteLine(" {0}", Helper.MakeFilePath(refr.Path, refr.Name, "exe")); + } else if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "dll"))) { + // Assembly is an library (dll) + ps.WriteLine(" {0}", Helper.MakeFilePath(refr.Path, refr.Name, "dll")); + } else { + string referencePath = Helper.MakeFilePath(refr.Path, refr.Name, "dll"); + kernel.Log.Write(LogType.Warning, "Reference \"{0}\": The specified file doesn't exist.", referencePath); + ps.WriteLine(" {0}", Helper.MakeFilePath(refr.Path, refr.Name, "dll")); + } + } + + ps.WriteLine(" {0}", refr.LocalCopy); + ps.WriteLine(" "); } - ps.WriteLine(" "); + ps.WriteLine(" "); //Project References - ps.WriteLine(" "); - foreach (ProjectNode projectReference in projectReferences) + ps.WriteLine(" "); + foreach (KeyValuePair pair in projectReferences) { - ToolInfo tool = (ToolInfo)tools[projectReference.Language]; - if (tools == null) - throw new UnknownLanguageException(); + ToolInfo tool = tools[pair.Value.Language]; + if (tools == null) + throw new UnknownLanguageException(); - string path = - Helper.MakePathRelativeTo(project.FullPath, - Helper.MakeFilePath(projectReference.FullPath, projectReference.Name, tool.FileExtension)); - ps.WriteLine(" ", path); + string path = + Helper.MakePathRelativeTo(project.FullPath, + Helper.MakeFilePath(pair.Value.FullPath, pair.Value.Name, tool.FileExtension)); + ps.WriteLine(" ", path); // TODO: Allow reference to visual basic projects - ps.WriteLine(" {0}", projectReference.Name); - ps.WriteLine(" {0}", projectReference.Guid.ToString("B").ToUpper()); - ps.WriteLine(" {0}", tool.Guid.ToUpper()); + ps.WriteLine(" {0}", pair.Value.Name); + ps.WriteLine(" {0}", pair.Value.Guid.ToString("B").ToUpper()); + ps.WriteLine(" {0}", tool.Guid.ToUpper()); - ps.WriteLine(" False" ); + //This is the Copy Local flag in VS + ps.WriteLine(" {0}", pair.Key.LocalCopy); - ps.WriteLine(" "); + ps.WriteLine(" "); } - ps.WriteLine(" "); + ps.WriteLine(" "); - // ps.WriteLine(" "); - ps.WriteLine(" "); + // ps.WriteLine(" "); + ps.WriteLine(" "); - // ps.WriteLine(" "); + // ps.WriteLine(" "); List list = new List(); - foreach (string path in project.Files) + foreach (string path in project.Files) { string lower = path.ToLower(); if (lower.EndsWith(".resx")) @@ -318,93 +331,106 @@ namespace Prebuild.Core.Targets if (!list.Contains(codebehind)) list.Add(codebehind); } + } - foreach (string file in project.Files) + foreach (string filePath in project.Files) { // if (file == "Properties\\Bind.Designer.cs") // { // Console.WriteLine("Wait a minute!"); // Console.WriteLine(project.Files.GetSubType(file).ToString()); // } - - SubType subType = project.Files.GetSubType(file); + SubType subType = project.Files.GetSubType(filePath); + + // Visual Studio chokes on file names if forward slash is used as a path separator + // instead of backslash. So we must make sure that all file paths written to the + // project file use \ as a path separator. + string file = filePath.Replace(@"/", @"\"); if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer - && subType != SubType.CodeBehind) + && subType != SubType.CodeBehind) { - ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - ps.WriteLine(" {0}", Path.GetFileName(file)); - ps.WriteLine(" Designer"); - ps.WriteLine(" "); + ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); + ps.WriteLine(" {0}", Path.GetFileName(file)); + ps.WriteLine(" Designer"); + ps.WriteLine(" "); // } if (subType == SubType.Designer) { - ps.WriteLine(" ", file); - ps.WriteLine(" " + subType + ""); - ps.WriteLine(" ResXFileCodeGenerator"); + ps.WriteLine(" ", file); string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"; - string dependent_name = file.Substring(0, file.LastIndexOf('.')) + ".cs"; + string dependent_name = filePath.Substring(0, file.LastIndexOf('.')) + ".cs"; - ps.WriteLine(" {0}", autogen_name); - - // Check for a parent .cs file with the same name as this designer file - if (File.Exists(dependent_name)) - ps.WriteLine(" {0}", Path.GetFileName(dependent_name)); - - ps.WriteLine(" "); - if (File.Exists(autogen_name)) + // Check for a parent .cs file with the same name as this designer file + if (File.Exists(Helper.NormalizePath(dependent_name))) { - ps.WriteLine(" ", autogen_name); - ps.WriteLine(" True"); - ps.WriteLine(" True"); + ps.WriteLine(" {0}", Path.GetFileName(dependent_name)); + } + else + { + ps.WriteLine(" ResXFileCodeGenerator"); + ps.WriteLine(" {0}", Path.GetFileName(autogen_name)); + ps.WriteLine(" " + subType + ""); + } + + ps.WriteLine(" "); + if (File.Exists(Helper.NormalizePath(autogen_name))) + { + ps.WriteLine(" ", autogen_name); + //ps.WriteLine(" True"); - // If a parent .cs file exists, link this autogen file to it. Otherwise link - // to the designer file - if (File.Exists(dependent_name)) - ps.WriteLine(" {0}", Path.GetFileName(dependent_name)); - else - ps.WriteLine(" {0}", Path.GetFileName(file)); - - ps.WriteLine(" "); + // If a parent .cs file exists, link this autogen file to it. Otherwise link + // to the designer file + if (File.Exists(dependent_name)) + { + ps.WriteLine(" {0}", Path.GetFileName(dependent_name)); + } + else + { + ps.WriteLine(" True"); + ps.WriteLine(" {0}", Path.GetFileName(filePath)); + } + + ps.WriteLine(" "); } list.Add(autogen_name); } if (subType == SubType.Settings) { - ps.Write(" <{0} ", project.Files.GetBuildAction(file)); + ps.Write(" <{0} ", project.Files.GetBuildAction(filePath)); ps.WriteLine("Include=\"{0}\">", file); - string fileName = Path.GetFileName(file); - if (project.Files.GetBuildAction(file) == BuildAction.None) + string fileName = Path.GetFileName(filePath); + if (project.Files.GetBuildAction(filePath) == BuildAction.None) { - ps.WriteLine(" SettingsSingleFileGenerator"); - ps.WriteLine(" {0}", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); + ps.WriteLine(" SettingsSingleFileGenerator"); + ps.WriteLine(" {0}", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); } else { - ps.WriteLine(" Code"); - ps.WriteLine(" True"); - ps.WriteLine(" True"); + ps.WriteLine(" Code"); + ps.WriteLine(" True"); + ps.WriteLine(" True"); string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.')); string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.')); - ps.WriteLine(" {0}", Path.GetFileName(fileNameShorter + ".settings")); + ps.WriteLine(" {0}", Path.GetFileName(fileNameShorter + ".settings")); } - ps.WriteLine(" ", project.Files.GetBuildAction(file)); + ps.WriteLine(" ", project.Files.GetBuildAction(filePath)); } else if (subType != SubType.Designer) { string path = Helper.NormalizePath(file); - string path_lower = path.ToLower(); + string path_lower = path.ToLower(); - if (!list.Contains(file)) + if (!list.Contains(filePath)) { - ps.Write(" <{0} ", project.Files.GetBuildAction(path)); + ps.Write(" <{0} ", project.Files.GetBuildAction(filePath)); int startPos = 0; - if (project.Files.GetPreservePath(file)) + if (project.Files.GetPreservePath(filePath)) { while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1) startPos++; @@ -415,60 +441,75 @@ namespace Prebuild.Core.Targets startPos = file.LastIndexOf(Path.GetFileName(path)); } - ps.WriteLine("Include=\"{0}\">", path); + // be sure to write out the path with backslashes so VS recognizes + // the file properly. + ps.WriteLine("Include=\"{0}\">", file); int last_period_index = file.LastIndexOf('.'); string short_file_name = file.Substring(0, last_period_index); string extension = Path.GetExtension(path); - string designer_format = string.Format(".designer{0}", extension); + // make this upper case, so that when File.Exists tests for the + // existence of a designer file on a case-sensitive platform, + // it is correctly identified. + string designer_format = string.Format(".Designer{0}", extension); - if (path_lower.EndsWith(designer_format)) + if (path_lower.EndsWith(designer_format.ToLowerInvariant())) { - int designer_index = path_lower.IndexOf(designer_format); + int designer_index = path.IndexOf(designer_format); string file_name = path.Substring(0, designer_index); - if (File.Exists(file_name)) - ps.WriteLine(" {0}", Path.GetFileName(file_name)); + // There are two corrections to the next lines: + // 1. Fix the connection between a designer file and a form + // or usercontrol that don't have an associated resx file. + // 2. Connect settings files to associated designer files. + if (File.Exists(file_name + extension)) + ps.WriteLine(" {0}", Path.GetFileName(file_name + extension)); else if (File.Exists(file_name + ".resx")) - ps.WriteLine(" {0}", Path.GetFileName(file_name + ".resx")); + ps.WriteLine(" {0}", Path.GetFileName(file_name + ".resx")); + else if (File.Exists(file_name + ".settings")) + { + ps.WriteLine(" {0}", Path.GetFileName(file_name + ".settings")); + ps.WriteLine(" True"); + ps.WriteLine(" True"); + } } else if (subType == SubType.CodeBehind) { - ps.WriteLine(" {0}", Path.GetFileName(short_file_name)); + ps.WriteLine(" {0}", Path.GetFileName(short_file_name)); } - if (project.Files.GetIsLink(file)) + if (project.Files.GetIsLink(filePath)) { - string alias = project.Files.GetLinkPath(file); + string alias = project.Files.GetLinkPath(filePath); alias += file.Substring(startPos); alias = Helper.NormalizePath(alias); - ps.WriteLine(" {0}", alias); + ps.WriteLine(" {0}", alias); } - else if (project.Files.GetBuildAction(file) != BuildAction.None) + else if (project.Files.GetBuildAction(filePath) != BuildAction.None) { - if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource) + if (project.Files.GetBuildAction(filePath) != BuildAction.EmbeddedResource) { - ps.WriteLine(" {0}", subType); + ps.WriteLine(" {0}", subType); } } - if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never) + if (project.Files.GetCopyToOutput(filePath) != CopyToOutput.Never) { - ps.WriteLine(" {0}", project.Files.GetCopyToOutput(file)); + ps.WriteLine(" {0}", project.Files.GetCopyToOutput(filePath)); } - ps.WriteLine(" ", project.Files.GetBuildAction(file)); + ps.WriteLine(" ", project.Files.GetBuildAction(filePath)); } } } - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); ps.WriteLine(""); } #endregion @@ -478,23 +519,36 @@ namespace Prebuild.Core.Targets ps = new StreamWriter(projectFile + ".user"); using (ps) { + // Get the first configuration from the project. + ConfigurationNode firstConfiguration = null; + + if (project.Configurations.Count > 0) + { + firstConfiguration = project.Configurations[0]; + } + ps.WriteLine(""); //ps.WriteLine( "" ); //ps.WriteLine(" <{0}>", toolInfo.XMLTag); - //ps.WriteLine(" "); - ps.WriteLine(" "); - //ps.WriteLine(" ", MakeRefPath(project)); - ps.WriteLine(" Debug"); - ps.WriteLine(" AnyCPU"); - ps.WriteLine(" {0}", MakeRefPath(project)); - ps.WriteLine(" {0}", this.ProductVersion); - ps.WriteLine(" ProjectFiles"); - ps.WriteLine(" 0"); - ps.WriteLine(" "); + //ps.WriteLine(" "); + ps.WriteLine(" "); + //ps.WriteLine(" ", MakeRefPath(project)); + + if (firstConfiguration != null) + { + ps.WriteLine(" {0}", firstConfiguration.Name); + ps.WriteLine(" {0}", firstConfiguration.Platform); + } + + ps.WriteLine(" {0}", MakeRefPath(project)); + ps.WriteLine(" {0}", ProductVersion); + ps.WriteLine(" ProjectFiles"); + ps.WriteLine(" 0"); + ps.WriteLine(" "); foreach (ConfigurationNode conf in project.Configurations) { - ps.Write(" "); } ps.WriteLine(""); @@ -504,9 +558,9 @@ namespace Prebuild.Core.Targets kernel.CurrentWorkingDirectory.Pop(); } - private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk) + private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk) { - kernel.Log.Write("Creating {0} solution and project files", this.VersionName); + kernel.Log.Write("Creating {0} solution and project files", VersionName); foreach (SolutionNode child in solution.Solutions) { @@ -531,13 +585,13 @@ namespace Prebuild.Core.Targets kernel.Log.Write(""); string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); - using (StreamWriter ss = new StreamWriter(solutionFile)) - { - kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); + using (StreamWriter ss = new StreamWriter(solutionFile)) + { + kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); - ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); - ss.WriteLine(SolutionTag); + ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", SolutionVersion); + ss.WriteLine(SolutionTag); WriteProjectDeclarations(ss, solution, solution); @@ -546,7 +600,7 @@ namespace Prebuild.Core.Targets ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution"); foreach (ConfigurationNode conf in solution.Configurations) { - ss.WriteLine("\t\t{0}|Any CPU = {0}|Any CPU", conf.Name); + ss.WriteLine("\t\t{0} = {0}", conf.NameAndPlatform); } ss.WriteLine("\tEndGlobalSection"); @@ -571,7 +625,7 @@ namespace Prebuild.Core.Targets } } - private void WriteProjectDeclarations(StreamWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution) + private void WriteProjectDeclarations(TextWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution) { foreach (SolutionNode childSolution in embeddedSolution.Solutions) { @@ -595,7 +649,7 @@ namespace Prebuild.Core.Targets } } - private static void WriteNestedProjectMap(StreamWriter writer, SolutionNode embeddedSolution) + private static void WriteNestedProjectMap(TextWriter writer, SolutionNode embeddedSolution) { foreach (ProjectNode project in embeddedSolution.Projects) { @@ -614,31 +668,31 @@ namespace Prebuild.Core.Targets } } - private static void WriteNestedProject(StreamWriter writer, SolutionNode solution, Guid projectGuid) + private static void WriteNestedProject(TextWriter writer, SolutionNode solution, Guid projectGuid) { WriteNestedFolder(writer, solution.Guid, projectGuid); } - private static void WriteNestedFolder(StreamWriter writer, Guid parentGuid, Guid childGuid) + private static void WriteNestedFolder(TextWriter writer, Guid parentGuid, Guid childGuid) { writer.WriteLine("\t\t{0} = {1}", - childGuid.ToString("B").ToUpper(), - parentGuid.ToString("B").ToUpper()); + childGuid.ToString("B").ToUpper(), + parentGuid.ToString("B").ToUpper()); } - private static void WriteConfigurationLines(ICollection configurations, SolutionNode solution, StreamWriter ss) + private static void WriteConfigurationLines(IEnumerable configurations, SolutionNode solution, TextWriter ss) { foreach (ProjectNode project in solution.Projects) { foreach (ConfigurationNode conf in configurations) { - ss.WriteLine("\t\t{0}.{1}|Any CPU.ActiveCfg = {1}|Any CPU", - project.Guid.ToString("B").ToUpper(), - conf.Name); + ss.WriteLine("\t\t{0}.{1}.ActiveCfg = {1}", + project.Guid.ToString("B").ToUpper(), + conf.NameAndPlatform); - ss.WriteLine("\t\t{0}.{1}|Any CPU.Build.0 = {1}|Any CPU", - project.Guid.ToString("B").ToUpper(), - conf.Name); + ss.WriteLine("\t\t{0}.{1}.Build.0 = {1}", + project.Guid.ToString("B").ToUpper(), + conf.NameAndPlatform); } } @@ -648,54 +702,37 @@ namespace Prebuild.Core.Targets } } - private void WriteSolutionFiles(SolutionNode solution, StreamWriter ss) + private void WriteSolutionFiles(SolutionNode solution, TextWriter ss) { - if (solution.Files != null && solution.Files.Count > 0) - { - WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files); - } + if(solution.Files != null && solution.Files.Count > 0) + WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files); } - private void WriteEmbeddedSolution(StreamWriter writer, SolutionNode embeddedSolution) + private void WriteEmbeddedSolution(TextWriter writer, SolutionNode embeddedSolution) { WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files); } - private void WriteProject(SolutionNode solution, StreamWriter ss, ProjectNode project) + private void WriteProject(SolutionNode solution, TextWriter ss, ProjectNode project) { WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath); } - private void WriteProject(SolutionNode solution, StreamWriter ss, DatabaseProjectNode dbProject) + private void WriteProject(SolutionNode solution, TextWriter ss, DatabaseProjectNode dbProject) { if (solution.Files != null && solution.Files.Count > 0) WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath); } - private static bool ExtensionSpecified(string refName) - { - return refName.EndsWith(".dll") || refName.EndsWith(".exe"); - } - - private static string GetProjectExtension(ProjectNode project) - { - string extension = ".dll"; - if (project.Type == ProjectType.Exe) - { - extension = ".exe"; - } - return extension; - } - const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\""; const string ProjectDeclarationEndFormat = "EndProject"; - private void WriteProject(StreamWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath) + private void WriteProject(TextWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath) { if (!tools.ContainsKey(language)) throw new UnknownLanguageException("Unknown .NET language: " + language); - ToolInfo toolInfo = (ToolInfo)tools[language]; + ToolInfo toolInfo = tools[language]; string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath); @@ -704,23 +741,23 @@ namespace Prebuild.Core.Targets WriteProject(ss, language, guid, name, path); } - private void WriteProject(StreamWriter writer, string language, Guid projectGuid, string name, string location) + private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location) { WriteProject(writer, language, projectGuid, name, location, null); } - private void WriteProject(StreamWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files) + private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files) { if (!tools.ContainsKey(language)) throw new UnknownLanguageException("Unknown .NET language: " + language); - ToolInfo toolInfo = (ToolInfo)tools[language]; + ToolInfo toolInfo = tools[language]; writer.WriteLine(ProjectDeclarationBeginFormat, - toolInfo.Guid, - name, - location, - projectGuid.ToString("B").ToUpper()); + toolInfo.Guid, + name, + location, + projectGuid.ToString("B").ToUpper()); if (files != null) { @@ -738,7 +775,7 @@ namespace Prebuild.Core.Targets private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project) { string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp"); - IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), " "); + IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), " "); kernel.CurrentWorkingDirectory.Push(); @@ -777,12 +814,10 @@ namespace Prebuild.Core.Targets kernel.CurrentWorkingDirectory.Pop(); } - private bool ContainsSqlFiles(string folder) + private static bool ContainsSqlFiles(string folder) { - foreach (string file in Directory.GetFiles(folder, "*.sql")) - { + if(Directory.GetFiles(folder, "*.sql").Length > 0) return true; // if the folder contains 1 .sql file, that's good enough - } foreach (string child in Directory.GetDirectories(folder)) { @@ -793,7 +828,7 @@ namespace Prebuild.Core.Targets return false; } - private void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder) + private static void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder) { foreach (string child in Directory.GetDirectories(folder)) { @@ -816,7 +851,7 @@ namespace Prebuild.Core.Targets { kernel.Log.Write("...Cleaning project: {0}", project.Name); - ToolInfo toolInfo = (ToolInfo)tools[project.Language]; + ToolInfo toolInfo = tools[project.Language]; string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); string userFile = projectFile + ".user"; @@ -826,7 +861,7 @@ namespace Prebuild.Core.Targets private void CleanSolution(SolutionNode solution) { - kernel.Log.Write("Cleaning {0} solution and project files", this.VersionName, solution.Name); + kernel.Log.Write("Cleaning {0} solution and project files", VersionName, solution.Name); string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); diff --git a/Prebuild/src/Core/Targets/VSVersion.cs b/Prebuild/src/Core/Targets/VSVersion.cs index 59549b00a9..699b5ca019 100644 --- a/Prebuild/src/Core/Targets/VSVersion.cs +++ b/Prebuild/src/Core/Targets/VSVersion.cs @@ -45,10 +45,10 @@ namespace Prebuild.Core.Targets /// /// Visual Studio 2008 /// - VS90, - /// - /// Visual Studio 2010 - /// - VS10 + VS90, + /// + /// Visual Studio 2010 + /// + VS10 } } diff --git a/Prebuild/src/Core/Targets/XcodeTarget.cs b/Prebuild/src/Core/Targets/XcodeTarget.cs index d96f65b86d..5393cec05f 100644 --- a/Prebuild/src/Core/Targets/XcodeTarget.cs +++ b/Prebuild/src/Core/Targets/XcodeTarget.cs @@ -24,8 +24,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O #endregion using System; -using System.Collections; -using System.Collections.Specialized; using System.IO; using System.Reflection; using System.Text.RegularExpressions; diff --git a/Prebuild/src/Core/Utilities/CommandLineCollection.cs b/Prebuild/src/Core/Utilities/CommandLineCollection.cs index 22752aa1e1..786fa1e49d 100644 --- a/Prebuild/src/Core/Utilities/CommandLineCollection.cs +++ b/Prebuild/src/Core/Utilities/CommandLineCollection.cs @@ -23,10 +23,8 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O */ #endregion -using System; using System.Collections; -using System.Collections.Specialized; -using System.Diagnostics; +using System.Collections.Generic; namespace Prebuild.Core.Utilities { @@ -34,15 +32,15 @@ namespace Prebuild.Core.Utilities /// The CommandLine class parses and interprets the command-line arguments passed to /// prebuild. /// - public class CommandLineCollection + public class CommandLineCollection : IEnumerable> { #region Fields // The raw OS arguments - private string[] m_RawArgs; + private readonly string[] m_RawArgs; // Command-line argument storage - private Hashtable m_Arguments; + private readonly Dictionary m_Arguments = new Dictionary(); #endregion @@ -54,8 +52,7 @@ namespace Prebuild.Core.Utilities public CommandLineCollection(string[] args) { m_RawArgs = args; - m_Arguments = new Hashtable(); - + Parse(); } @@ -69,11 +66,11 @@ namespace Prebuild.Core.Utilities return; int idx = 0; - string arg = null, lastArg = null; + string lastArg = null; while(idx 2 && arg[0] == '/') { @@ -119,16 +116,13 @@ namespace Prebuild.Core.Utilities /// null string if no parameter was specified, and the value if a parameter was specified public string this[string index] { - get + get { - if(m_Arguments.ContainsKey(index)) + if(m_Arguments.ContainsKey(index)) { - return (string)(m_Arguments[index]); - } - else - { - return null; + return (m_Arguments[index]); } + return null; } } @@ -143,11 +137,16 @@ namespace Prebuild.Core.Utilities /// An /// that can be used to iterate through the collection. /// - public IDictionaryEnumerator GetEnumerator() + public IEnumerator> GetEnumerator() { - return m_Arguments.GetEnumerator(); + return m_Arguments.GetEnumerator(); } - #endregion + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + #endregion } } diff --git a/Prebuild/src/Core/Utilities/CurrentDirectory.cs b/Prebuild/src/Core/Utilities/CurrentDirectory.cs index 5fabdf0943..9624c35ed5 100644 --- a/Prebuild/src/Core/Utilities/CurrentDirectory.cs +++ b/Prebuild/src/Core/Utilities/CurrentDirectory.cs @@ -24,7 +24,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O #endregion using System; -using System.Collections; +using System.Collections.Generic; namespace Prebuild.Core.Utilities { @@ -35,19 +35,7 @@ namespace Prebuild.Core.Utilities { #region Fields - private Stack m_Stack; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public CurrentDirectory() - { - m_Stack = new Stack(); - } + private readonly Stack m_Stack = new Stack(); #endregion @@ -71,7 +59,7 @@ namespace Prebuild.Core.Utilities return; } - string cwd = (string)m_Stack.Pop(); + string cwd = m_Stack.Pop(); Helper.SetCurrentDir(cwd); } diff --git a/Prebuild/src/Core/Utilities/Helper.cs b/Prebuild/src/Core/Utilities/Helper.cs index 9a0d131c7e..8c3e9680c5 100644 --- a/Prebuild/src/Core/Utilities/Helper.cs +++ b/Prebuild/src/Core/Utilities/Helper.cs @@ -24,7 +24,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O #endregion using System; -using System.Collections; +using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; @@ -42,8 +42,6 @@ namespace Prebuild.Core.Utilities { #region Fields - private static Stack dirStack; - private static Regex varRegex; static bool checkForOSVariables; /// @@ -61,61 +59,13 @@ namespace Prebuild.Core.Utilities } } - #endregion - - #region Constructors - - /// - /// Initializes the class. - /// - static Helper() - { - dirStack = new Stack(); - //m_VarRegex = new Regex(@"\${(?[\w|_]+)}"); - } - - #endregion - - #region Properties - - /// - /// - /// - public static Stack DirStack - { - get - { - return dirStack; - } - } - - /// - /// - /// - public static Regex VarRegex - { - get - { - return varRegex; - } - set - { - varRegex = value; - } - } - #endregion #region Public Methods #region String Parsing - #region Inner Classes and Delegates - /// - /// - /// + public delegate string StringLookup(string key); - - #endregion /// /// Gets a collection of StringLocationPair objects that represent the matches @@ -545,35 +495,6 @@ namespace Prebuild.Core.Utilities return attrs[0]; } - /* A bit of overhead for simple group parsing, there are problems with Regex in Mono - public static string ParseValue(string val) - { - if(val == null || val.Length < 1 || !CheckForOSVariables) - return val; - - string tmp = val; - Match m = m_VarRegex.Match(val); - while(m.Success) - { - if(m.Groups["var"] == null) - continue; - - Capture c = m.Groups["var"].Captures[0]; - if(c == null) - continue; - - string var = c.Value; - string envVal = Environment.GetEnvironmentVariable(var); - if(envVal == null) - envVal = ""; - - tmp = tmp.Replace("${" + var + "}", envVal); - m = m.NextMatch(); - } - - return tmp; - }*/ - /// /// Attributes the value. /// diff --git a/Prebuild/src/Core/Utilities/Log.cs b/Prebuild/src/Core/Utilities/Log.cs index 548e987690..4df3defdd0 100644 --- a/Prebuild/src/Core/Utilities/Log.cs +++ b/Prebuild/src/Core/Utilities/Log.cs @@ -82,7 +82,7 @@ namespace Prebuild.Core.Utilities { #region Fields - private StreamWriter m_Writer; + private TextWriter m_Writer; private LogTargets m_Target = LogTargets.Null; bool disposed; @@ -96,14 +96,20 @@ namespace Prebuild.Core.Utilities /// The target. /// Name of the file. public Log(LogTargets target, string fileName) - { - m_Target = target; - - if((m_Target & LogTargets.File) != 0) - { - m_Writer = new StreamWriter(fileName, false); - } - } + { + m_Target = target; + + if ((m_Target & LogTargets.File) != 0) + { + m_Writer = new StreamWriter(fileName, false); + } + else if ((m_Target & LogTargets.Console) != 0) + { + // Prevents null reference exceptions when outputing to the log file. + // This seems to only happen when running on a network drive. + m_Writer = Console.Out; + } + } #endregion diff --git a/Prebuild/src/Core/WarningException.cs b/Prebuild/src/Core/WarningException.cs index df90dc8d7d..b7c3668cce 100644 --- a/Prebuild/src/Core/WarningException.cs +++ b/Prebuild/src/Core/WarningException.cs @@ -31,7 +31,7 @@ namespace Prebuild.Core /// /// /// - [Serializable()] + [Serializable] public class WarningException : Exception { #region Constructors diff --git a/Prebuild/src/Prebuild.cs b/Prebuild/src/Prebuild.cs index 2d12b53066..081c89c404 100644 --- a/Prebuild/src/Prebuild.cs +++ b/Prebuild/src/Prebuild.cs @@ -26,9 +26,9 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O #region CVS Information /* * $Source$ - * $Author: jendave $ - * $Date: 2006-09-26 23:43:35 +0200 (ti, 26 sep 2006) $ - * $Revision: 168 $ + * $Author: kunnis $ + * $Date: 2009-04-15 02:33:14 +0100 (Wed, 15 Apr 2009) $ + * $Revision: 308 $ */ #endregion @@ -86,17 +86,17 @@ namespace Prebuild { kernel.Process(); } - } - catch(Exception ex) - { - Console.WriteLine("Unhandled error: {0}", ex.Message); - //#if DEBUG - Console.WriteLine("{0}", ex.StackTrace); - //#endif - } - finally - { - if(kernel.PauseAfterFinish) + } +#if !DEBUG + catch (Exception ex) + { + Console.WriteLine("Unhandled error: {0}", ex.Message); + Console.WriteLine("{0}", ex.StackTrace); + } +#endif + finally + { + if(kernel != null && kernel.PauseAfterFinish) { Console.WriteLine("\nPress enter to continue..."); Console.ReadLine(); diff --git a/Prebuild/src/Properties/AssemblyInfo.cs b/Prebuild/src/Properties/AssemblyInfo.cs index 65c8736add..f3ac30f39d 100644 --- a/Prebuild/src/Properties/AssemblyInfo.cs +++ b/Prebuild/src/Properties/AssemblyInfo.cs @@ -61,16 +61,17 @@ using System.Resources; [assembly: AssemblyConfiguration(".NET CLR")] [assembly: AssemblyCompany("The Prebuild Project")] [assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("Copyright 2004-2008 " + +[assembly: AssemblyCopyright("Copyright 2004-2010 " + "Matthew Holmes, " + "Dan Moorehead, " + "C.J. Adams-Collier, " + "Rob Loach, " + - "David Hudson,")] + "David Hudson," + + "John Hurliman")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguageAttribute("en-US")] -[assembly: AssemblyVersion("2.0.4.*")] +[assembly: AssemblyVersion("2.0.5.*")] // // Version information for an assembly consists of the following four values: diff --git a/Prebuild/src/data/prebuild-1.7.xsd b/Prebuild/src/data/prebuild-1.7.xsd index c3f8d6bb67..3675503bab 100644 --- a/Prebuild/src/data/prebuild-1.7.xsd +++ b/Prebuild/src/data/prebuild-1.7.xsd @@ -40,7 +40,7 @@ - + @@ -57,6 +57,7 @@ + @@ -224,6 +225,7 @@ + @@ -232,6 +234,7 @@ + @@ -275,6 +278,7 @@ + @@ -322,10 +326,25 @@ + + + + + + + + + + + + + + + diff --git a/Prebuild/src/data/prebuild-1.8.xsd b/Prebuild/src/data/prebuild-1.8.xsd new file mode 100644 index 0000000000..8f5c1a4566 --- /dev/null +++ b/Prebuild/src/data/prebuild-1.8.xsd @@ -0,0 +1,331 @@ + + + + + Copyright (c) 2004-2007 + Matthew Holmes (calefaction at houston . rr . com), + Dan Moorehead (dan05a at gmail . com), + David Hudson (jendave at yahoo dot com), + C.J. Adams-Collier (cjac at colliertech dot com) + + .NET Prebuild is a cross-platform XML-driven pre-build tool which + allows developers to easily generate project or make files for major + IDE's and .NET development tools including: Visual Studio .NET 2002, + 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools. + + BSD License: + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Prebuild/src/data/prebuild-1.9.xsd b/Prebuild/src/data/prebuild-1.9.xsd new file mode 100644 index 0000000000..fbca556f19 --- /dev/null +++ b/Prebuild/src/data/prebuild-1.9.xsd @@ -0,0 +1,336 @@ + + + + + Copyright (c) 2004-2007 + Matthew Holmes (calefaction at houston . rr . com), + Dan Moorehead (dan05a at gmail . com), + David Hudson (jendave at yahoo dot com), + C.J. Adams-Collier (cjac at colliertech dot com) + + .NET Prebuild is a cross-platform XML-driven pre-build tool which + allows developers to easily generate project or make files for major + IDE's and .NET development tools including: Visual Studio .NET 2002, + 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools. + + BSD License: + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 9fd7e4632c..ef8f73a40e 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -106,33 +106,6 @@ ; ## PRIM STORAGE ; ## - ; *** Prim Storage - only leave one storage_plugin uncommented *** - ; --- Null stores nothing - effectively disabling persistence: - ;storage_plugin = "OpenSim.Data.Null.dll" - - ; --- To use sqlite as region storage: - ; - ; PLEASE NOTE: Unfortunately, the current SQLite database plugin (necessary to use SQLite with Mono on Linux) is - ; not compatible with the sqlite3 library installed on Mac OSX. If you're using Mono 2.4 you can still use the old sqlite - ; library by uncommenting the SQLiteLegacy.dll storage plugin (and commenting out SQLite.dll). Unfortunately, the older library - ; will not work with Mono 2.6 on Mac OSX so you will either need to replace the OSX sqlite3 system library or use MySQL instead - ; - ; You will also need to do the same thing in config-include/StandaloneCommon.ini if you are running in standalone mode - storage_plugin = "OpenSim.Data.SQLite.dll" - ;storage_plugin = "OpenSim.Data.SQLiteLegacy.dll" - storage_connection_string="URI=file:OpenSim.db,version=3"; - - ; --- To use MySQL storage, supply your own connection string (this is only an example): - ; note that the supplied account needs create privilegies if you want it to auto-create needed tables. - ; - ; -->>> There are multiple connection strings defined in several places. Check it carefully! - ; - ; storage_plugin="OpenSim.Data.MySQL.dll" - ; storage_connection_string="Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;Old Guids=true;"; - ; If you want to use a different database/server for estate data, then - ; uncomment and change this connect string. Defaults to the above if not set - ; estate_connection_string="Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;"; - ; Persistence of changed objects happens during regular sweeps. The following control that behaviour to ; prevent frequently changing objects from heavily loading the region data store. ; If both of these values are set to zero then persistence of all changed objects will happen on every sweep. diff --git a/bin/Prebuild.exe b/bin/Prebuild.exe index eb4c224ac5..d79227c6da 100755 Binary files a/bin/Prebuild.exe and b/bin/Prebuild.exe differ diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index dae7a19e21..deceb86cdd 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -21,7 +21,7 @@ ; * [[@]/][:] ; * [Startup] -ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8002/OpenSim.Server.Handlers.dll:GatekeeperServiceInConnector,8002/OpenSim.Server.Handlers.dll:UserAgentServerConnector,HGInventoryService@8002/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:AssetServiceConnector" +ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8002/OpenSim.Server.Handlers.dll:GatekeeperServiceInConnector,8002/OpenSim.Server.Handlers.dll:UserAgentServerConnector,HGInventoryService@8002/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:AssetServiceConnector,8002/OpenSim.Server.Handlers.dll:HeloServiceInConnector" ; * This is common for all services, it's the network setup for the entire ; * server instance, if none if specified above diff --git a/bin/config-include/Grid.ini b/bin/config-include/Grid.ini index 9a75f19845..4a6a082f0e 100644 --- a/bin/config-include/Grid.ini +++ b/bin/config-include/Grid.ini @@ -27,6 +27,11 @@ SimulationServiceInConnector = true LibraryModule = true +[SimulationDataStore] + LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService" + +[EstateDataStore] + LocalServiceModule = "OpenSim.Services.Connectors.dll:EstateDataService" [GridService] LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" diff --git a/bin/config-include/GridCommon.ini.example b/bin/config-include/GridCommon.ini.example index a19591bfaa..c2cd5c3ec5 100644 --- a/bin/config-include/GridCommon.ini.example +++ b/bin/config-include/GridCommon.ini.example @@ -1,3 +1,24 @@ +[DatabaseService] + ; + ; ### Choose the DB + ; + + ; SQLite + Include-Storage = "config-include/storage/SQLiteStandalone.ini"; + + ; Unfortunately the current SQLite database plugin is not compatible with Mac OSX. You can still use the older + ; legacy sqlite library if you are using Mono 2.4. Please see the notes in OpenSim.ini (search for sqlite) + ; for more details + ;Include-Storage = "config-include/storage/SQLiteLegacyStandalone.ini"; + + ; MySql + ; Uncomment these lines if you want to use mysql storage + ; Change the connection string to your db details + ;StorageProvider = "OpenSim.Data.MySQL.dll" + ;ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;" + ; Uncomment this line if you are using MySQL and want to use a different database for estates + ;EstateConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;" + [AssetService] DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll" diff --git a/bin/config-include/GridHypergrid.ini b/bin/config-include/GridHypergrid.ini index ab29018084..d69a94550b 100644 --- a/bin/config-include/GridHypergrid.ini +++ b/bin/config-include/GridHypergrid.ini @@ -30,6 +30,12 @@ SimulationServiceInConnector = true LibraryModule = true +[SimulationDataStore] + LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService" + +[EstateDataStore] + LocalServiceModule = "OpenSim.Services.Connectors.dll:EstateDataService" + [AssetService] LocalGridAssetService = "OpenSim.Services.Connectors.dll:AssetServicesConnector" HypergridAssetService = "OpenSim.Services.Connectors.dll:HGAssetServiceConnector" diff --git a/bin/config-include/HyperSimianGrid.ini b/bin/config-include/HyperSimianGrid.ini index 87ffe69f0e..29b51deacd 100644 --- a/bin/config-include/HyperSimianGrid.ini +++ b/bin/config-include/HyperSimianGrid.ini @@ -21,13 +21,13 @@ Include-Common = "config-include/GridCommon.ini" [Modules] - GridServices = "OpenSim.Services.Connectors.dll:SimianGridServiceConnector" - PresenceServices = "OpenSim.Services.Connectors.dll:SimianPresenceServiceConnector" - UserAccountServices = "OpenSim.Services.Connectors.dll:SimianUserAccountServiceConnector" - AuthenticationServices = "OpenSim.Services.Connectors.dll:SimianAuthenticationServiceConnector" + GridServices = "SimianGridServiceConnector" + PresenceServices = "SimianPresenceServiceConnector" + UserAccountServices = "SimianUserAccountServiceConnector" + AuthenticationServices = "SimianAuthenticationServiceConnector" AssetServices = "HGAssetBroker" InventoryServices = "HGInventoryBroker" - AvatarServices = "OpenSim.Services.Connectors.dll:SimianAvatarServiceConnector" + AvatarServices = "SimianAvatarServiceConnector" NeighbourServices = "RemoteNeighbourServicesConnector" SimulationServices = "RemoteSimulationConnectorModule" @@ -41,6 +41,12 @@ AssetCaching = "FlotsamAssetCache" +[SimulationDataStore] + LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService" + +[EstateDataStore] + LocalServiceModule = "OpenSim.Services.Connectors.dll:EstateDataService" + [Friends] Connector = "OpenSim.Services.Connectors.dll:SimianFriendsServiceConnector" @@ -74,4 +80,4 @@ ServicesConnectorModule = SimianGroupsServicesConnector [Profiles] - Module = SimianProfiles + Module = "SimianProfiles" diff --git a/bin/config-include/SimianGrid.ini b/bin/config-include/SimianGrid.ini index 65d4ea60df..239ce3093c 100644 --- a/bin/config-include/SimianGrid.ini +++ b/bin/config-include/SimianGrid.ini @@ -21,13 +21,13 @@ Include-Common = "config-include/GridCommon.ini" [Modules] - GridServices = "OpenSim.Services.Connectors.dll:SimianGridServiceConnector" - PresenceServices = "OpenSim.Services.Connectors.dll:SimianPresenceServiceConnector" - UserAccountServices = "OpenSim.Services.Connectors.dll:SimianUserAccountServiceConnector" - AuthenticationServices = "OpenSim.Services.Connectors.dll:SimianAuthenticationServiceConnector" - AssetServices = "OpenSim.Services.Connectors.dll:SimianAssetServiceConnector" - InventoryServices = "OpenSim.Services.Connectors.dll:SimianInventoryServiceConnector" - AvatarServices = "OpenSim.Services.Connectors.dll:SimianAvatarServiceConnector" + GridServices = "SimianGridServiceConnector" + PresenceServices = "SimianPresenceServiceConnector" + UserAccountServices = "SimianUserAccountServiceConnector" + AuthenticationServices = "SimianAuthenticationServiceConnector" + AssetServices = "SimianAssetServiceConnector" + InventoryServices = "SimianInventoryServiceConnector" + AvatarServices = "SimianAvatarServiceConnector" NeighbourServices = "RemoteNeighbourServicesConnector" SimulationServices = "RemoteSimulationConnectorModule" @@ -41,6 +41,12 @@ AssetCaching = "FlotsamAssetCache" +[SimulationDataStore] + LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService" + +[EstateDataStore] + LocalServiceModule = "OpenSim.Services.Connectors.dll:EstateDataService" + [Friends] Connector = "OpenSim.Services.Connectors.dll:SimianFriendsServiceConnector" @@ -67,4 +73,4 @@ ServicesConnectorModule = SimianGroupsServicesConnector [Profiles] - Module = SimianProfiles + Module = "SimianProfiles" diff --git a/bin/config-include/Standalone.ini b/bin/config-include/Standalone.ini index eae98016d3..d74b50ef76 100644 --- a/bin/config-include/Standalone.ini +++ b/bin/config-include/Standalone.ini @@ -22,6 +22,12 @@ LLLoginServiceInConnector = true GridInfoServiceInConnector = true +[SimulationDataStore] + LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService" + +[EstateDataStore] + LocalServiceModule = "OpenSim.Services.Connectors.dll:EstateDataService" + [AssetService] LocalServiceModule = "OpenSim.Services.AssetService.dll:AssetService" diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index f86296087b..96ef602a03 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example @@ -18,6 +18,8 @@ ; Change the connection string to your db details ;StorageProvider = "OpenSim.Data.MySQL.dll" ;ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;Old Guids=true;" + ; Uncomment this line if you are using MySQL and want to use a different database for estates + ;EstateConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;Old Guids=true;" [AssetService] DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll" diff --git a/prebuild.xml b/prebuild.xml index 8df4d73144..6a995f7ba2 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1,6 +1,6 @@ - - - + + + TRACE;DEBUG @@ -9,7 +9,7 @@ false 4 false - + bin true true @@ -24,7 +24,7 @@ false 4 false - + bin false true @@ -71,23 +71,23 @@ - - - - - + + + + + - + - - - - - - + + + + + + @@ -108,10 +108,10 @@ - - + + - + @@ -158,17 +158,17 @@ - - - - - + + + + + - - - - + + + + @@ -190,9 +190,9 @@ ../../../bin/ - - - + + + @@ -216,9 +216,9 @@ ../../../bin/ - - - + + + @@ -242,16 +242,16 @@ - - - + + + - - + + - + @@ -270,8 +270,8 @@ ../../../../bin/ - - + + @@ -295,13 +295,13 @@ ../../../../bin/ - - + + - + @@ -324,9 +324,9 @@ - - - + + + @@ -347,12 +347,12 @@ ../../../../bin/ - - + + - - + + @@ -373,11 +373,11 @@ ../../../../bin/ - - + + - + @@ -403,11 +403,11 @@ - - - - - + + + + + @@ -429,13 +429,13 @@ ../../../../bin/ - - + + - - - + + + @@ -457,8 +457,8 @@ ../../../../bin/ - - + + @@ -480,8 +480,8 @@ ../../../../bin/ - - + + @@ -503,12 +503,12 @@ ../../../../bin/ - - - + + + - + @@ -529,13 +529,13 @@ ../../../../bin/ - - + + - - + + @@ -588,14 +588,14 @@ ../../../../bin/ - - + + - - - + + + @@ -617,14 +617,14 @@ ../../../../bin/ - - - - + + + + - + @@ -645,14 +645,14 @@ ../../../../bin/ - - + + - - - + + + @@ -673,14 +673,14 @@ ../../../bin/ - - - + + + - - + + @@ -709,16 +709,16 @@ - + - - + + - + @@ -740,26 +740,26 @@ - + - - + + - - - - + + + + - + @@ -782,14 +782,14 @@ - - - + + + - + @@ -797,16 +797,16 @@ - + - - - - + + + + - + @@ -832,13 +832,13 @@ - - + + - - + + @@ -859,13 +859,13 @@ ../../../bin/ - - + + - - + + @@ -887,16 +887,16 @@ ../../../bin/ - - + + - - + + @@ -918,16 +918,16 @@ ../../../bin/ - - + + - - + + @@ -948,22 +948,25 @@ ../../../bin/ + - - - - + + + + - - - - + + + + + + @@ -984,8 +987,8 @@ ../../../bin/ - - + + @@ -993,8 +996,8 @@ - - + + @@ -1015,8 +1018,8 @@ ../../../bin/ - - + + @@ -1024,8 +1027,8 @@ - - + + @@ -1046,8 +1049,8 @@ ../../../bin/ - - + + @@ -1055,8 +1058,8 @@ - - + + @@ -1077,8 +1080,8 @@ ../../../bin/ - - + + @@ -1086,8 +1089,8 @@ - - + + @@ -1109,8 +1112,8 @@ ../../../bin/ - - + + @@ -1119,8 +1122,8 @@ - - + + @@ -1141,8 +1144,8 @@ ../../../bin/ - - + + @@ -1150,8 +1153,8 @@ - - + + @@ -1172,8 +1175,8 @@ ../../../bin/ - - + + @@ -1181,8 +1184,8 @@ - - + + @@ -1204,8 +1207,8 @@ ../../../bin/ - - + + @@ -1214,8 +1217,8 @@ - - + + @@ -1245,11 +1248,11 @@ - - - - - + + + + + @@ -1271,8 +1274,8 @@ ../../../bin/ - - + + @@ -1281,8 +1284,8 @@ - - + + @@ -1306,23 +1309,23 @@ - - - + + + - + - - - - + + + + - + @@ -1343,20 +1346,20 @@ ../../bin/ - - - + + + - - + + - + @@ -1376,19 +1379,19 @@ ../../bin/ - - - + + + - - + + - + @@ -1411,21 +1414,21 @@ - - - - - + + + + + - - - - - - - + + + + + + + @@ -1433,24 +1436,24 @@ - + - + - - - + + + - + - + - + - + @@ -1471,40 +1474,40 @@ - - - - + + + + - - - + + + - - - - - - + + + + + + - + - - - + + + - + - + @@ -1523,26 +1526,26 @@ ../../../bin/ - - + + - - - + + + - - - + + + - + - - + + @@ -1561,7 +1564,7 @@ ../../../bin/ - + @@ -1572,9 +1575,9 @@ - - - + + + @@ -1598,9 +1601,9 @@ - - - + + + @@ -1611,12 +1614,12 @@ - - - - - - + + + + + + @@ -1640,11 +1643,11 @@ - + - + @@ -1667,10 +1670,10 @@ ../../../bin/ - - - - + + + + @@ -1682,9 +1685,10 @@ - - - + + + + @@ -1704,11 +1708,11 @@ ../../../bin/ - + - - + + @@ -1718,11 +1722,11 @@ - + - + @@ -1739,8 +1743,8 @@ ../../../bin/ - - + + @@ -1748,11 +1752,11 @@ - + - + @@ -1769,14 +1773,14 @@ ../../../bin/ - + - - - - - + + + + + @@ -1787,17 +1791,16 @@ - + - + - + ../../../bin/ @@ -1810,12 +1813,12 @@ ../../../bin/ - + - - - + + + @@ -1825,15 +1828,14 @@ - + - + ../../../../bin/ @@ -1846,12 +1848,12 @@ ../../../../bin/ - + - - - + + + @@ -1862,16 +1864,15 @@ - + - + - + ../../../../bin/ @@ -1884,14 +1885,14 @@ ../../../../bin/ - + - - - - + + + + @@ -1903,11 +1904,11 @@ - + - + @@ -1940,11 +1941,11 @@ - - - - - + + + + + @@ -1964,13 +1965,13 @@ ../../../../bin/ - - + + - - + + @@ -1992,17 +1993,17 @@ ../../../bin/ - - + + - - + + - + @@ -2024,8 +2025,8 @@ ../../../bin/ - - + + @@ -2034,9 +2035,9 @@ - - - + + + @@ -2056,8 +2057,8 @@ ../../../bin/ - - + + @@ -2066,8 +2067,8 @@ - - + + @@ -2087,26 +2088,26 @@ ../../../bin/ - - + + - - + + - + - + - + @@ -2132,21 +2133,21 @@ - - - + + + - - + + - - + + - - - + + + @@ -2171,16 +2172,16 @@ - - - - + + + + - - - + + + @@ -2200,25 +2201,25 @@ - + - - + + - - + + - - + + - - - + + + @@ -2243,20 +2244,20 @@ - - - + + + - - + + - - + + - - - + + + @@ -2279,18 +2280,18 @@ - - + + - - + + - - - - + + + + @@ -2317,18 +2318,18 @@ - - + + - - + + - - - - + + + + @@ -2352,17 +2353,17 @@ - - + + - + - - - - + + + + @@ -2387,22 +2388,22 @@ - - - + + + - - - + + + - - - - + + + + @@ -2423,20 +2424,20 @@ ../../../../../bin/ - - + + - - - - - - + + + + + + - + @@ -2458,22 +2459,22 @@ - - + + - - + + - - - - + + + + @@ -2497,27 +2498,27 @@ - - - + + + - - + + - - - + + + - + - + @@ -2542,13 +2543,13 @@ - - - + + + - - - + + + @@ -2559,15 +2560,15 @@ - + - - - + + + - + @@ -2588,12 +2589,12 @@ ../../../bin/ - - + + - - + + @@ -2614,13 +2615,13 @@ ../../../bin/ - - + + - - + + @@ -2642,8 +2643,8 @@ ../../../bin/ - - + + @@ -2665,13 +2666,13 @@ ../../bin/ - - + + - - + + @@ -2693,13 +2694,13 @@ ../../../../bin/ - - + + - - - - + + + + @@ -2720,13 +2721,13 @@ ../../../../bin/ - - + + - - - - + + + + @@ -2747,13 +2748,13 @@ ../../../../bin/ - - + + - - - - + + + + @@ -2779,11 +2780,11 @@ - - - - - + + + + + @@ -2815,9 +2816,9 @@ ../../bin/ - - - + + + @@ -2841,27 +2842,27 @@ - - + + - - - - + + + + - - + + - + @@ -2882,16 +2883,16 @@ - - - - + + + + - - + + @@ -2911,16 +2912,16 @@ ../../../../bin/ - - - + + + - - + + @@ -2948,9 +2949,9 @@ - - - + + + @@ -2975,8 +2976,8 @@ - - + + @@ -2992,15 +2993,15 @@ - - + + - + - - - + + + - - - - - - - - + + + + + + + + @@ -3038,8 +3039,8 @@ - - + + @@ -3055,15 +3056,15 @@ - - + + - + - - - + + + - + @@ -3093,11 +3094,11 @@ ../../../../../bin/ - - - - - + + + + + @@ -3134,12 +3135,12 @@ - - - + + + - + - - - + + + @@ -3174,14 +3175,14 @@ ../../../../bin/ - - + + - - - + + + @@ -3192,58 +3193,4 @@ - - - - - DEBUG;TRACE - false - bin/Debug - true - 1595 - - - - - TRACE - bin/Release - true - false - 1595 - - - - - - - DEBUG;TRACE - false - ..\..\bin\ - true - Prebuild.snk - 1595 - - - - - TRACE - ..\..\bin\ - true - false - Prebuild.snk - 1595 - - - ../../bin/ - - - - - - - - - - - diff --git a/runprebuild.sh b/runprebuild.sh index 3e1417aaa6..b3b5c9d1d3 100755 --- a/runprebuild.sh +++ b/runprebuild.sh @@ -1,7 +1,4 @@ #!/bin/sh mono bin/Prebuild.exe /target nant -# needed until we break up OpenSim.exe -perl -pi -e 's{OpenSim.dll}{OpenSim.exe}' OpenSim/ApplicationPlugins/LoadRegions/OpenSim.ApplicationPlugins.LoadRegions.dll.build -mono bin/Prebuild.exe /target monodev mono bin/Prebuild.exe /target vs2008