* Put extensions on all assets in an archive
* Choice of extensions is a scratch set, may not yet be correct * This facility is not useable yet - not least because I've just come across a significant save bug I need to investigate0.6.0-stable
parent
314181a70d
commit
fa5f27acfa
|
@ -25,6 +25,9 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using libsecondlife;
|
||||
|
||||
namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -37,11 +40,6 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|||
/// </summary>
|
||||
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 assets metadata file
|
||||
/// </summary>
|
||||
|
@ -51,5 +49,60 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|||
/// Path for the prims file
|
||||
/// </summary>
|
||||
public static readonly string OBJECTS_PATH = "objects/";
|
||||
|
||||
/// <summary>
|
||||
/// Extensions used for asset types in the archive
|
||||
/// </summary>
|
||||
public static readonly IDictionary<sbyte, string> ASSET_TYPE_TO_EXTENSION = new Dictionary<sbyte, string>();
|
||||
public static readonly IDictionary<string, sbyte> EXTENSION_TO_ASSET_TYPE = new Dictionary<string, sbyte>();
|
||||
|
||||
static ArchiveConstants()
|
||||
{
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Animation] = ".bvh";
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Bodypart] = ".bpt.txt";
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.CallingCard] = ".ccd.txt";
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Clothing] = ".clo.txt";
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Folder] = ".fld.txt"; // Not sure if we'll ever see this
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Gesture] = ".gst.txt";
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.ImageJPEG] = ".jpg";
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.ImageTGA] = ".img.tga";
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LostAndFoundFolder] = ".lff.txt"; // Not sure if we'll ever see this
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLBytecode] = ".lso";
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLText] = ".lsl";
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Notecard] = ".ncd.txt";
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Object] = ".obj.xml";
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.RootFolder] = ".rof.txt"; // Not sure if we'll ever see this
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Script] = ".spt"; // Not sure if we'll ever see this
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Simstate] = ".sst"; // Not sure if we'll ever see this
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SnapshotFolder] = ".ssf.txt"; // Not sure if we'll ever see this
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Sound] = ".ogg";
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV] = ".wav";
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Texture] = ".jp2";
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TextureTGA] = ".tga";
|
||||
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TrashFolder] = ".trf.txt"; // Not sure if we'll ever see this
|
||||
|
||||
EXTENSION_TO_ASSET_TYPE[".bvh"] = (sbyte)AssetType.Animation;
|
||||
EXTENSION_TO_ASSET_TYPE[".bpt.txt"] = (sbyte)AssetType.Bodypart;
|
||||
EXTENSION_TO_ASSET_TYPE[".ccd.txt"] = (sbyte)AssetType.CallingCard;
|
||||
EXTENSION_TO_ASSET_TYPE[".clo.txt"] = (sbyte)AssetType.Clothing;
|
||||
EXTENSION_TO_ASSET_TYPE[".fld.txt"] = (sbyte)AssetType.Folder;
|
||||
EXTENSION_TO_ASSET_TYPE[".gst.txt"] = (sbyte)AssetType.Gesture;
|
||||
EXTENSION_TO_ASSET_TYPE[".jpg"] = (sbyte)AssetType.ImageJPEG;
|
||||
EXTENSION_TO_ASSET_TYPE[".img.tga"] = (sbyte)AssetType.ImageTGA;
|
||||
EXTENSION_TO_ASSET_TYPE[".lff.txt"] = (sbyte)AssetType.LostAndFoundFolder;
|
||||
EXTENSION_TO_ASSET_TYPE[".lso"] = (sbyte)AssetType.LSLBytecode;
|
||||
EXTENSION_TO_ASSET_TYPE[".lsl"] = (sbyte)AssetType.LSLText;
|
||||
EXTENSION_TO_ASSET_TYPE[".ncd.txt"] = (sbyte)AssetType.Notecard;
|
||||
EXTENSION_TO_ASSET_TYPE[".obj.xml"] = (sbyte)AssetType.Object;
|
||||
EXTENSION_TO_ASSET_TYPE[".rof.txt"] = (sbyte)AssetType.RootFolder;
|
||||
EXTENSION_TO_ASSET_TYPE[".spt"] = (sbyte)AssetType.Script;
|
||||
EXTENSION_TO_ASSET_TYPE[".sst"] = (sbyte)AssetType.Simstate;
|
||||
EXTENSION_TO_ASSET_TYPE[".ssf.txt"] = (sbyte)AssetType.SnapshotFolder;
|
||||
EXTENSION_TO_ASSET_TYPE[".ogg"] = (sbyte)AssetType.Sound;
|
||||
EXTENSION_TO_ASSET_TYPE[".wav"] = (sbyte)AssetType.SoundWAV;
|
||||
EXTENSION_TO_ASSET_TYPE[".jp2"] = (sbyte)AssetType.Texture;
|
||||
EXTENSION_TO_ASSET_TYPE[".tga"] = (sbyte)AssetType.TextureTGA;
|
||||
EXTENSION_TO_ASSET_TYPE[".trf.txt"] = (sbyte)AssetType.TrashFolder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,10 +86,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|||
|
||||
string extension = string.Empty;
|
||||
|
||||
if ((sbyte)AssetType.Texture == asset.Type)
|
||||
if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type))
|
||||
{
|
||||
extension = ArchiveConstants.TEXTURE_EXTENSION;
|
||||
}
|
||||
extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type];
|
||||
}
|
||||
|
||||
xtw.WriteElementString("filename", uuid.ToString() + extension);
|
||||
|
||||
|
@ -125,9 +125,9 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|||
{
|
||||
string extension = string.Empty;
|
||||
|
||||
if ((sbyte)AssetType.Texture == asset.Type)
|
||||
if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type))
|
||||
{
|
||||
extension = ArchiveConstants.TEXTURE_EXTENSION;
|
||||
extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type];
|
||||
}
|
||||
|
||||
archive.AddFile(
|
||||
|
|
|
@ -148,11 +148,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|||
{
|
||||
AssetMetadata metadata = m_metadata[filename];
|
||||
|
||||
string extension = String.Empty;
|
||||
|
||||
if ((sbyte)AssetType.Texture == metadata.AssetType)
|
||||
if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(metadata.AssetType))
|
||||
{
|
||||
filename = filename.Remove(filename.Length - ArchiveConstants.TEXTURE_EXTENSION.Length);
|
||||
string extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[metadata.AssetType];
|
||||
filename = filename.Remove(filename.Length - extension.Length);
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename);
|
||||
|
|
Loading…
Reference in New Issue