ArchiveConstants.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSim Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System.Collections.Generic;
  28. using libsecondlife;
  29. namespace OpenSim.Region.Environment.Modules.World.Archiver
  30. {
  31. /// <summary>
  32. /// Constants for the archiving module
  33. /// </summary>
  34. public class ArchiveConstants
  35. {
  36. /// <summary>
  37. /// The location of the archive control file
  38. /// </summary>
  39. public static readonly string CONTROL_FILE_PATH = "archive.xml";
  40. /// <summary>
  41. /// Path for the assets held in an archive
  42. /// </summary>
  43. public static readonly string ASSETS_PATH = "assets/";
  44. /// <summary>
  45. /// Path for the assets metadata file
  46. /// </summary>
  47. //public static readonly string ASSETS_METADATA_PATH = "assets.xml";
  48. /// <summary>
  49. /// Path for the prims file
  50. /// </summary>
  51. public static readonly string OBJECTS_PATH = "objects/";
  52. /// <summary>
  53. /// Path for terrains. Technically these may be assets, but I think it's quite nice to split them out.
  54. /// </summary>
  55. public static readonly string TERRAINS_PATH = "terrains/";
  56. /// <summary>
  57. /// Extensions used for asset types in the archive
  58. /// </summary>
  59. public static readonly IDictionary<sbyte, string> ASSET_TYPE_TO_EXTENSION = new Dictionary<sbyte, string>();
  60. public static readonly IDictionary<string, sbyte> EXTENSION_TO_ASSET_TYPE = new Dictionary<string, sbyte>();
  61. static ArchiveConstants()
  62. {
  63. ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Animation] = "_animation.bvh";
  64. ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Bodypart] = "_bodypart.txt";
  65. ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.CallingCard] = "_callingcard.txt";
  66. ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Clothing] = "_clothing.txt";
  67. ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Folder] = "_folder.txt"; // Not sure if we'll ever see this
  68. ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Gesture] = "_gesture.txt";
  69. ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.ImageJPEG] = "_image.jpg";
  70. ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.ImageTGA] = "_image.tga";
  71. ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LostAndFoundFolder] = "_lostandfoundfolder.txt"; // Not sure if we'll ever see this
  72. ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLBytecode] = "_bytecode.lso";
  73. ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLText] = "_script.lsl";
  74. ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Notecard] = "_notecard.txt";
  75. ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Object] = "_object.xml";
  76. ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.RootFolder] = "_rootfolder.txt"; // Not sure if we'll ever see this
  77. // disable warning: we know Script is obsolete, but need to support it
  78. // anyhow
  79. #pragma warning disable 0612
  80. ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Script] = "_script.txt"; // Not sure if we'll ever see this
  81. #pragma warning restore 0612
  82. ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Simstate] = "_simstate.bin"; // Not sure if we'll ever see this
  83. ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SnapshotFolder] = "_snapshotfolder.txt"; // Not sure if we'll ever see this
  84. ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Sound] = "_sound.ogg";
  85. ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV] = "_sound.wav";
  86. ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Texture] = "_texture.jp2";
  87. ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TextureTGA] = "_texture.tga";
  88. ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TrashFolder] = "_trashfolder.txt"; // Not sure if we'll ever see this
  89. EXTENSION_TO_ASSET_TYPE["_animation.bvh"] = (sbyte)AssetType.Animation;
  90. EXTENSION_TO_ASSET_TYPE["_bodypart.txt"] = (sbyte)AssetType.Bodypart;
  91. EXTENSION_TO_ASSET_TYPE["_callingcard.txt"] = (sbyte)AssetType.CallingCard;
  92. EXTENSION_TO_ASSET_TYPE["_clothing.txt"] = (sbyte)AssetType.Clothing;
  93. EXTENSION_TO_ASSET_TYPE["_folder.txt"] = (sbyte)AssetType.Folder;
  94. EXTENSION_TO_ASSET_TYPE["_gesture.txt"] = (sbyte)AssetType.Gesture;
  95. EXTENSION_TO_ASSET_TYPE["_image.jpg"] = (sbyte)AssetType.ImageJPEG;
  96. EXTENSION_TO_ASSET_TYPE["_image.tga"] = (sbyte)AssetType.ImageTGA;
  97. EXTENSION_TO_ASSET_TYPE["_lostandfoundfolder.txt"] = (sbyte)AssetType.LostAndFoundFolder;
  98. EXTENSION_TO_ASSET_TYPE["_bytecode.lso"] = (sbyte)AssetType.LSLBytecode;
  99. EXTENSION_TO_ASSET_TYPE["_script.lsl"] = (sbyte)AssetType.LSLText;
  100. EXTENSION_TO_ASSET_TYPE["_notecard.txt"] = (sbyte)AssetType.Notecard;
  101. EXTENSION_TO_ASSET_TYPE["_object.xml"] = (sbyte)AssetType.Object;
  102. EXTENSION_TO_ASSET_TYPE["_rootfolder.txt"] = (sbyte)AssetType.RootFolder;
  103. // disable warning: we know Script is obsolete, but need to support it
  104. // anyhow
  105. #pragma warning disable 0612
  106. EXTENSION_TO_ASSET_TYPE["_script.txt"] = (sbyte)AssetType.Script;
  107. #pragma warning restore 0612
  108. EXTENSION_TO_ASSET_TYPE["_simstate.bin"] = (sbyte)AssetType.Simstate;
  109. EXTENSION_TO_ASSET_TYPE["_snapshotfolder.txt"] = (sbyte)AssetType.SnapshotFolder;
  110. EXTENSION_TO_ASSET_TYPE["_sound.ogg"] = (sbyte)AssetType.Sound;
  111. EXTENSION_TO_ASSET_TYPE["_sound.wav"] = (sbyte)AssetType.SoundWAV;
  112. EXTENSION_TO_ASSET_TYPE["_texture.jp2"] = (sbyte)AssetType.Texture;
  113. EXTENSION_TO_ASSET_TYPE["_texture.tga"] = (sbyte)AssetType.TextureTGA;
  114. EXTENSION_TO_ASSET_TYPE["_trashfolder.txt"] = (sbyte)AssetType.TrashFolder;
  115. }
  116. }
  117. }