white space & formatting cleanup
parent
7e08d7da15
commit
20359e8591
|
@ -187,13 +187,12 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver
|
|||
new FileStream(loadPath, FileMode.Open), CompressionMode.Decompress));
|
||||
|
||||
byte[] data;
|
||||
TarArchiveReader.TarEntryType entryType;
|
||||
TarArchiveReader.TarEntryType entryType;
|
||||
while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
|
||||
{
|
||||
if (entryType==TarArchiveReader.TarEntryType.TYPE_DIRECTORY) {
|
||||
m_log.WarnFormat("[ARCHIVER]: Ignoring directory entry {0}",
|
||||
filePath);
|
||||
} else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
|
||||
if (entryType == TarArchiveReader.TarEntryType.TYPE_DIRECTORY) {
|
||||
m_log.WarnFormat("[ARCHIVER]: Ignoring directory entry {0}", filePath);
|
||||
} else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
|
||||
{
|
||||
if (LoadAsset(filePath, data))
|
||||
successfulAssetRestores++;
|
||||
|
|
|
@ -88,15 +88,15 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|||
int failedAssetRestores = 0;
|
||||
|
||||
byte[] data;
|
||||
TarArchiveReader.TarEntryType entryType;
|
||||
TarArchiveReader.TarEntryType entryType;
|
||||
while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
|
||||
{
|
||||
//m_log.DebugFormat(
|
||||
// "[ARCHIVER]: Successfully read {0} ({1} bytes)}", filePath, data.Length);
|
||||
if (entryType==TarArchiveReader.TarEntryType.TYPE_DIRECTORY) {
|
||||
m_log.WarnFormat("[ARCHIVER]: Ignoring directory entry {0}",
|
||||
filePath);
|
||||
}
|
||||
if (entryType==TarArchiveReader.TarEntryType.TYPE_DIRECTORY) {
|
||||
m_log.WarnFormat("[ARCHIVER]: Ignoring directory entry {0}",
|
||||
filePath);
|
||||
}
|
||||
else if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH))
|
||||
{
|
||||
serialisedSceneObjects.Add(m_asciiEncoding.GetString(data));
|
||||
|
@ -122,7 +122,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|||
LoadRegionSettings(filePath, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//m_log.Debug("[ARCHIVER]: Reached end of archive");
|
||||
|
||||
archive.Close();
|
||||
|
@ -131,10 +131,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|||
|
||||
if (failedAssetRestores > 0)
|
||||
m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores);
|
||||
|
||||
|
||||
m_log.Info("[ARCHIVER]: Clearing all existing scene objects");
|
||||
m_scene.DeleteAllSceneObjects();
|
||||
|
||||
|
||||
// Reload serialized prims
|
||||
m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count);
|
||||
|
||||
|
|
|
@ -39,18 +39,18 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|||
public class TarArchiveReader
|
||||
{
|
||||
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
public enum TarEntryType
|
||||
{
|
||||
TYPE_UNKNOWN = 0,
|
||||
TYPE_NORMAL_FILE = 1,
|
||||
TYPE_HARD_LINK = 2,
|
||||
TYPE_SYMBOLIC_LINK = 3,
|
||||
TYPE_CHAR_SPECIAL = 4,
|
||||
TYPE_BLOCK_SPECIAL = 5,
|
||||
TYPE_DIRECTORY = 6,
|
||||
TYPE_FIFO = 7,
|
||||
TYPE_CONTIGUOUS_FILE = 8,
|
||||
}
|
||||
public enum TarEntryType
|
||||
{
|
||||
TYPE_UNKNOWN = 0,
|
||||
TYPE_NORMAL_FILE = 1,
|
||||
TYPE_HARD_LINK = 2,
|
||||
TYPE_SYMBOLIC_LINK = 3,
|
||||
TYPE_CHAR_SPECIAL = 4,
|
||||
TYPE_BLOCK_SPECIAL = 5,
|
||||
TYPE_DIRECTORY = 6,
|
||||
TYPE_FIFO = 7,
|
||||
TYPE_CONTIGUOUS_FILE = 8,
|
||||
}
|
||||
|
||||
protected static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding();
|
||||
|
||||
|
@ -81,13 +81,13 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|||
public byte[] ReadEntry(out string filePath, out TarEntryType entryType)
|
||||
{
|
||||
filePath = String.Empty;
|
||||
entryType = TarEntryType.TYPE_UNKNOWN;
|
||||
entryType = TarEntryType.TYPE_UNKNOWN;
|
||||
TarHeader header = ReadHeader();
|
||||
|
||||
if (null == header)
|
||||
return null;
|
||||
|
||||
entryType = header.EntryType;
|
||||
entryType = header.EntryType;
|
||||
filePath = header.FilePath;
|
||||
byte[] data = m_br.ReadBytes(header.FileSize);
|
||||
|
||||
|
@ -125,36 +125,36 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|||
tarHeader.FilePath = tarHeader.FilePath.Trim(m_nullCharArray);
|
||||
tarHeader.FileSize = ConvertOctalBytesToDecimal(header, 124, 11);
|
||||
|
||||
switch (header[156])
|
||||
{
|
||||
case 0:
|
||||
tarHeader.EntryType = TarEntryType.TYPE_NORMAL_FILE;
|
||||
break;
|
||||
case (byte)'0':
|
||||
tarHeader.EntryType = TarEntryType.TYPE_NORMAL_FILE;
|
||||
break;
|
||||
case (byte)'1':
|
||||
tarHeader.EntryType = TarEntryType.TYPE_HARD_LINK;
|
||||
break;
|
||||
case (byte)'2':
|
||||
tarHeader.EntryType = TarEntryType.TYPE_SYMBOLIC_LINK;
|
||||
break;
|
||||
case (byte)'3':
|
||||
tarHeader.EntryType = TarEntryType.TYPE_CHAR_SPECIAL;
|
||||
break;
|
||||
case (byte)'4':
|
||||
tarHeader.EntryType = TarEntryType.TYPE_BLOCK_SPECIAL;
|
||||
break;
|
||||
case (byte)'5':
|
||||
tarHeader.EntryType = TarEntryType.TYPE_DIRECTORY;
|
||||
break;
|
||||
case (byte)'6':
|
||||
tarHeader.EntryType = TarEntryType.TYPE_FIFO;
|
||||
break;
|
||||
case (byte)'7':
|
||||
tarHeader.EntryType = TarEntryType.TYPE_CONTIGUOUS_FILE;
|
||||
break;
|
||||
}
|
||||
switch (header[156])
|
||||
{
|
||||
case 0:
|
||||
tarHeader.EntryType = TarEntryType.TYPE_NORMAL_FILE;
|
||||
break;
|
||||
case (byte)'0':
|
||||
tarHeader.EntryType = TarEntryType.TYPE_NORMAL_FILE;
|
||||
break;
|
||||
case (byte)'1':
|
||||
tarHeader.EntryType = TarEntryType.TYPE_HARD_LINK;
|
||||
break;
|
||||
case (byte)'2':
|
||||
tarHeader.EntryType = TarEntryType.TYPE_SYMBOLIC_LINK;
|
||||
break;
|
||||
case (byte)'3':
|
||||
tarHeader.EntryType = TarEntryType.TYPE_CHAR_SPECIAL;
|
||||
break;
|
||||
case (byte)'4':
|
||||
tarHeader.EntryType = TarEntryType.TYPE_BLOCK_SPECIAL;
|
||||
break;
|
||||
case (byte)'5':
|
||||
tarHeader.EntryType = TarEntryType.TYPE_DIRECTORY;
|
||||
break;
|
||||
case (byte)'6':
|
||||
tarHeader.EntryType = TarEntryType.TYPE_FIFO;
|
||||
break;
|
||||
case (byte)'7':
|
||||
tarHeader.EntryType = TarEntryType.TYPE_CONTIGUOUS_FILE;
|
||||
break;
|
||||
}
|
||||
return tarHeader;
|
||||
}
|
||||
|
||||
|
@ -188,6 +188,6 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|||
{
|
||||
public string FilePath;
|
||||
public int FileSize;
|
||||
public TarArchiveReader.TarEntryType EntryType;
|
||||
public TarArchiveReader.TarEntryType EntryType;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue