29 using System.Collections.Generic;
44 public const string CONTROL_FILE_PATH =
"archive.xml";
49 public const string ASSETS_PATH =
"assets/";
54 public const string INVENTORY_PATH =
"inventory/";
59 public const string REGIONS_PATH =
"regions/";
64 public const string OBJECTS_PATH =
"objects/";
69 public const string TERRAINS_PATH =
"terrains/";
74 public const string SETTINGS_PATH =
"settings/";
79 public const string LANDDATA_PATH =
"landdata/";
84 public const string USERS_PATH =
"userprofiles/";
89 public const string ASSET_EXTENSION_SEPARATOR =
"_";
94 public const string INVENTORY_NODE_NAME_COMPONENT_SEPARATOR =
"__";
99 public const string OAR_OBJECT_FILENAME_TEMPLATE =
"{0}_{1:000}-{2:000}-{3:000}__{4}.xml";
104 public static readonly IDictionary<sbyte, string> ASSET_TYPE_TO_EXTENSION =
new Dictionary<sbyte, string>();
105 public static readonly IDictionary<string, sbyte> EXTENSION_TO_ASSET_TYPE =
new Dictionary<string, sbyte>();
109 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Animation] = ASSET_EXTENSION_SEPARATOR +
"animation.bvh";
110 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Bodypart] = ASSET_EXTENSION_SEPARATOR +
"bodypart.txt";
111 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.CallingCard] = ASSET_EXTENSION_SEPARATOR +
"callingcard.txt";
112 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Clothing] = ASSET_EXTENSION_SEPARATOR +
"clothing.txt";
113 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Folder] = ASSET_EXTENSION_SEPARATOR +
"folder.txt";
114 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Gesture] = ASSET_EXTENSION_SEPARATOR +
"gesture.txt";
115 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.ImageJPEG] = ASSET_EXTENSION_SEPARATOR +
"image.jpg";
116 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.ImageTGA] = ASSET_EXTENSION_SEPARATOR +
"image.tga";
117 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Landmark] = ASSET_EXTENSION_SEPARATOR +
"landmark.txt";
118 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLBytecode] = ASSET_EXTENSION_SEPARATOR +
"bytecode.lso";
119 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLText] = ASSET_EXTENSION_SEPARATOR +
"script.lsl";
120 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Mesh] = ASSET_EXTENSION_SEPARATOR +
"mesh.llmesh";
121 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Notecard] = ASSET_EXTENSION_SEPARATOR +
"notecard.txt";
122 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Object] = ASSET_EXTENSION_SEPARATOR +
"object.xml";
123 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Simstate] = ASSET_EXTENSION_SEPARATOR +
"simstate.bin";
124 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Sound] = ASSET_EXTENSION_SEPARATOR +
"sound.ogg";
125 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV] = ASSET_EXTENSION_SEPARATOR +
"sound.wav";
126 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Texture] = ASSET_EXTENSION_SEPARATOR +
"texture.jp2";
127 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TextureTGA] = ASSET_EXTENSION_SEPARATOR +
"texture.tga";
130 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR +
"animation.bvh"] = (sbyte)AssetType.Animation;
131 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR +
"bodypart.txt"] = (sbyte)AssetType.Bodypart;
132 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR +
"callingcard.txt"] = (sbyte)AssetType.CallingCard;
133 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR +
"clothing.txt"] = (sbyte)AssetType.Clothing;
134 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR +
"folder.txt"] = (sbyte)AssetType.Folder;
135 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR +
"gesture.txt"] = (sbyte)AssetType.Gesture;
136 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR +
"image.jpg"] = (sbyte)AssetType.ImageJPEG;
137 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR +
"image.tga"] = (sbyte)AssetType.ImageTGA;
138 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR +
"landmark.txt"] = (sbyte)AssetType.Landmark;
139 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR +
"bytecode.lso"] = (sbyte)AssetType.LSLBytecode;
140 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR +
"script.lsl"] = (sbyte)AssetType.LSLText;
141 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR +
"mesh.llmesh"] = (sbyte)AssetType.Mesh;
142 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR +
"notecard.txt"] = (sbyte)AssetType.Notecard;
143 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR +
"object.xml"] = (sbyte)AssetType.Object;
144 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR +
"simstate.bin"] = (sbyte)AssetType.Simstate;
145 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR +
"sound.ogg"] = (sbyte)AssetType.Sound;
146 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR +
"sound.wav"] = (sbyte)AssetType.SoundWAV;
147 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR +
"texture.jp2"] = (sbyte)AssetType.Texture;
148 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR +
"texture.tga"] = (sbyte)AssetType.TextureTGA;
154 return string.Format(
"{0}{1}.xml", ArchiveConstants.LANDDATA_PATH, ld.GlobalID);
166 return string.Format(
167 OAR_OBJECT_FILENAME_TEMPLATE, objectName,
168 Math.Round(pos.X), Math.Round(pos.Y), Math.Round(pos.Z),
181 return OBJECTS_PATH + CreateOarObjectFilename(objectName, uuid, pos);
191 List<string> plainDirs =
new List<string>();
193 string[] iarDirs = iarPath.Split(
new char[] {
'/' }, StringSplitOptions.RemoveEmptyEntries);
195 foreach (
string iarDir
in iarDirs)
198 plainDirs.Add(iarDir);
200 int i = iarDir.LastIndexOf(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR);
202 plainDirs.Add(iarDir.Remove(i));
205 return string.Join(
"/", plainDirs.ToArray());
Constants for the archiving module
OpenSim.Framework.SLUtil.OpenSimAssetType OpenSimAssetType
OpenSim.Framework.Serialization.ArchiveConstants ArchiveConstants
static string CreateOarLandDataPath(LandData ld)
const string INVENTORY_NODE_NAME_COMPONENT_SEPARATOR
Details of a Parcel of land
static string ExtractPlainPathFromIarPath(string iarPath)
Extract a plain path from an IAR path
Interactive OpenSim region server
static string CreateOarObjectFilename(string objectName, UUID uuid, Vector3 pos)
Create the filename used to store an object in an OpenSim Archive.
static string CreateOarObjectPath(string objectName, UUID uuid, Vector3 pos)
Create the path used to store an object in an OpenSim Archives.
Material
Material type for a primitive