Skip to content

Commit

Permalink
Merge branch 'master' of github.com:aurora-sim/Aurora-Sim
Browse files Browse the repository at this point in the history
  • Loading branch information
SignpostMarv committed Jan 3, 2012
2 parents 68c7842 + 09df83e commit 9e09719
Show file tree
Hide file tree
Showing 115 changed files with 1,892 additions and 672 deletions.
13 changes: 12 additions & 1 deletion Aurora/DataManagerPlugins/MySQL/MySQLDataManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ public IDataReader Query(string sql, Dictionary<string, object> parameters)
}

public void ExecuteNonQuery(string sql, Dictionary<string, object> parameters)
{
ExecuteNonQuery(m_connectionString, sql, parameters);
}

public void ExecuteNonQuery(string connStr, string sql, Dictionary<string, object> parameters)
{
try
{
Expand All @@ -91,7 +96,7 @@ public void ExecuteNonQuery(string sql, Dictionary<string, object> parameters)
param[i] = new MySqlParameter(p.Key, p.Value);
i++;
}
MySqlHelper.ExecuteNonQuery(m_connectionString, sql, param);
MySqlHelper.ExecuteNonQuery(connStr, sql, param);
}
catch (Exception e)
{
Expand All @@ -102,6 +107,12 @@ public void ExecuteNonQuery(string sql, Dictionary<string, object> parameters)
public override void ConnectToDatabase(string connectionstring, string migratorName, bool validateTables)
{
m_connectionString = connectionstring;
MySqlConnection c = new MySqlConnection(connectionstring);
int subStrA = connectionstring.IndexOf("Database=");
int subStrB = connectionstring.IndexOf(";", subStrA);
string noDatabaseConnector = m_connectionString.Substring(0, subStrA) + m_connectionString.Substring(subStrB+1);

ExecuteNonQuery(noDatabaseConnector, "create schema IF NOT EXISTS " + c.Database, new Dictionary<string, object>());

var migrationManager = new MigrationManager(this, migratorName, validateTables);
migrationManager.DetermineOperation();
Expand Down
24 changes: 23 additions & 1 deletion Aurora/Framework/ClientInterfaces/AvatarArchive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

using OpenMetaverse.StructuredData;

namespace Aurora.Framework
{
public class AvatarArchive
public class AvatarArchive : IDataTransferable
{
/// <summary>
/// XML of the archive
Expand All @@ -48,5 +50,25 @@ public class AvatarArchive
/// uuid of a text that shows off this archive
/// </summary>
public string Snapshot;

public override OSDMap ToOSD()
{
OSDMap map = new OSDMap();

map["ArchiveXML"] = ArchiveXML;
map["IsPublic"] = IsPublic;
map["Name"] = Name;
map["Snapshot"] = Snapshot;

return map;
}

public override void FromOSD(OSDMap map)
{
ArchiveXML = map["ArchiveXML"];
IsPublic = map["IsPublic"];
Name = map["Name"];
Snapshot = map["Snapshot"];
}
}
}
25 changes: 23 additions & 2 deletions Aurora/Framework/ClientInterfaces/ChildAgentDataUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
using System;
using System.Linq;
using System.Reflection;
using Aurora.Framework;
using OpenMetaverse;
using OpenMetaverse.StructuredData;

Expand All @@ -44,7 +45,7 @@ public interface IAgentData
/// <summary>
/// Replacement for ChildAgentDataUpdate. Used over RESTComms and LocalComms.
/// </summary>
public class AgentPosition : IAgentData
public class AgentPosition : IDataTransferable, IAgentData
{
public Vector3 AtAxis;
public Vector3 Center;
Expand All @@ -61,6 +62,11 @@ public class AgentPosition : IAgentData

public UUID AgentID { get; set; }

public override OSDMap ToOSD()
{
return Pack();
}

public OSDMap Pack()
{
OSDMap args = new OSDMap();
Expand All @@ -83,6 +89,11 @@ public OSDMap Pack()
return args;
}

public override void FromOSD(OSDMap map)
{
Unpack(map);
}

public void Unpack(OSDMap args)
{
if (args.ContainsKey("region_handle"))
Expand Down Expand Up @@ -218,7 +229,7 @@ public void UnpackUpdateMessage(OSDMap args)
}
}

public class AgentData : IAgentData
public class AgentData : IDataTransferable, IAgentData
{
public UUID ActiveGroupID;
public Byte AgentAccess;
Expand Down Expand Up @@ -266,6 +277,11 @@ public class AgentData : IAgentData

// Scripted

public override OSDMap ToOSD()
{
return Pack();
}

public virtual OSDMap Pack()
{
// DEBUG ON
Expand Down Expand Up @@ -335,6 +351,11 @@ public virtual OSDMap Pack()
return args;
}

public override void FromOSD(OSDMap map)
{
Unpack(map);
}

/// <summary>
/// Deserialization of agent data.
/// Avoiding reflection makes it painful to write, but that's the price!
Expand Down
78 changes: 61 additions & 17 deletions Aurora/Framework/ClientInterfaces/EventData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@

using System.Collections.Generic;
using OpenMetaverse;
using OpenMetaverse.StructuredData;

namespace Aurora.Framework
{
public class EventData
public class EventData : IDataTransferable
{
public uint amount;
public string category;
Expand All @@ -53,24 +54,10 @@ public EventData()

public EventData(Dictionary<string, object> KVP)
{
eventID = uint.Parse(KVP["eventID"].ToString());
creator = KVP["creator"].ToString();
name = KVP["name"].ToString();
category = KVP["category"].ToString();
description = KVP["description"].ToString();
date = KVP["date"].ToString();
dateUTC = uint.Parse(KVP["dateUTC"].ToString());
duration = uint.Parse(KVP["duration"].ToString());
cover = uint.Parse(KVP["cover"].ToString());
amount = uint.Parse(KVP["amount"].ToString());
simName = KVP["simName"].ToString();
string[] Pos = KVP["globalPos"].ToString().Split(' ');
globalPos = new Vector3(float.Parse(Pos[0]), float.Parse(Pos[1]), float.Parse(Pos[2]));
eventFlags = uint.Parse(KVP["eventFlags"].ToString());
maturity = int.Parse(KVP["maturity"].ToString());
FromKVP(KVP);
}

public Dictionary<string, object> ToKeyValuePairs()
public override Dictionary<string, object> ToKVP()
{
Dictionary<string, object> KVP = new Dictionary<string, object>();
KVP["eventID"] = eventID;
Expand All @@ -89,5 +76,62 @@ public Dictionary<string, object> ToKeyValuePairs()
KVP["maturity"] = maturity;
return KVP;
}

public override void FromKVP(Dictionary<string, object> KVP)
{
eventID = uint.Parse(KVP["eventID"].ToString());
creator = KVP["creator"].ToString();
name = KVP["name"].ToString();
category = KVP["category"].ToString();
description = KVP["description"].ToString();
date = KVP["date"].ToString();
dateUTC = uint.Parse(KVP["dateUTC"].ToString());
duration = uint.Parse(KVP["duration"].ToString());
cover = uint.Parse(KVP["cover"].ToString());
amount = uint.Parse(KVP["amount"].ToString());
simName = KVP["simName"].ToString();
string[] Pos = KVP["globalPos"].ToString().Split(' ');
globalPos = new Vector3(float.Parse(Pos[0]), float.Parse(Pos[1]), float.Parse(Pos[2]));
eventFlags = uint.Parse(KVP["eventFlags"].ToString());
maturity = int.Parse(KVP["maturity"].ToString());
}

public override OSDMap ToOSD()
{
OSDMap map = new OSDMap();
map["eventID"] = eventID;
map["creator"] = creator;
map["name"] = name;
map["category"] = category;
map["description"] = description;
map["date"] = date;
map["dateUTC"] = dateUTC;
map["duration"] = duration;
map["cover"] = cover;
map["amount"] = amount;
map["simName"] = simName;
map["globalPos"] = globalPos;
map["eventFlags"] = eventFlags;
map["maturity"] = maturity;
return map;
}

public override void FromOSD(OSDMap map)
{
eventID = map["eventID"];
creator = map["creator"];
name = map["name"];
category = map["category"];
description = map["description"];
date = map["date"];
dateUTC = map["dateUTC"];
duration = map["duration"];
cover = map["cover"];
amount = map["amount"];
simName = map["simName"];
globalPos = map["globalPos"];
eventFlags = map["eventFlags"];
maturity = map["maturity"];
}
}
}
7 changes: 0 additions & 7 deletions Aurora/Framework/ClientInterfaces/GridInstantMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,5 @@ public override void FromOSD(OSDMap map)
imSessionID = map["imSessionID"].AsUUID();
timestamp = map["timestamp"].AsUInteger();
}

public override IDataTransferable Duplicate()
{
GridInstantMessage m = new GridInstantMessage();
m.FromOSD(ToOSD());
return m;
}
}
}
Loading

0 comments on commit 9e09719

Please sign in to comment.