* Put in preparatory code to restore whole prim textures on archive load

* No user functionality yet
0.6.0-stable
Justin Clarke Casey 2008-05-31 21:20:04 +00:00
parent 47cc1fcf46
commit abaf8e7a37
3 changed files with 35 additions and 3 deletions

View File

@ -35,7 +35,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
/// <summary>
/// Path for the assets held in an archive
/// </summary>
public static readonly string ASSETS_PATH = "assets/";
public static readonly string ASSETS_PATH = "assets/";
/// <summary>
/// Extension used for texture assets in archive
/// </summary>
public static readonly string TEXTURE_EXTENSION = ".jp2";
/// <summary>
/// Path for the prims file

View File

@ -25,11 +25,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using OpenSim.Framework;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Modules.World.Serialiser;
using System;
using System.IO;
using System.Reflection;
using libsecondlife;
using log4net;
namespace OpenSim.Region.Environment.Modules.World.Archiver
@ -66,12 +68,35 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
byte[] data;
while ((data = archive.ReadEntry(out filePath)) != null)
{
m_log.DebugFormat("[ARCHIVER]: Successfully read {0} ({1} bytes) from archive {2}", filePath, data.Length, m_loadPath);
m_log.DebugFormat(
"[ARCHIVER]: Successfully read {0} ({1} bytes) from archive {2}", filePath, data.Length, m_loadPath);
if (filePath.Equals(ArchiveConstants.PRIMS_PATH))
{
serializedPrims = m_asciiEncoding.GetString(data);
}
/*
else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
{
// Right now we're nastily obtaining the lluuid from the filename
string rawId = filePath.Remove(0, ArchiveConstants.ASSETS_PATH.Length);
rawId = rawId.Remove(rawId.Length - ArchiveConstants.TEXTURE_EXTENSION.Length);
m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", rawId);
// Not preserving asset name or description as of yet
AssetBase asset = new AssetBase(new LLUUID(rawId), "imported name");
asset.Description = "imported description";
// Only importing textures right now
asset.Type = (sbyte)AssetType.Texture;
asset.InvType = (sbyte)InventoryType.Texture;
asset.Data = data;
m_scene.AssetCache.AddAsset(asset);
}
*/
}
m_log.DebugFormat("[ARCHIVER]: Reached end of archive");

View File

@ -112,7 +112,9 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
{
if (assets[uuid] != null)
{
archive.AddFile(ArchiveConstants.ASSETS_PATH + uuid.ToString() + ".jp2", assets[uuid].Data);
archive.AddFile(
ArchiveConstants.ASSETS_PATH + uuid.ToString() + ArchiveConstants.TEXTURE_EXTENSION,
assets[uuid].Data);
}
else
{