diff options
author | Mike Mazur | 2009-03-12 06:03:59 +0000 |
---|---|---|
committer | Mike Mazur | 2009-03-12 06:03:59 +0000 |
commit | f784620780e7364d10bb821719eb684eed3b4903 (patch) | |
tree | cc4a5d2af1fb69017be4b56b5966913283c7fb9d /OpenSim/Framework/Archive/TarArchiveReader.cs | |
parent | Minor bug fix. Thanks daTwitch. (diff) | |
download | opensim-SC_OLD-f784620780e7364d10bb821719eb684eed3b4903.zip opensim-SC_OLD-f784620780e7364d10bb821719eb684eed3b4903.tar.gz opensim-SC_OLD-f784620780e7364d10bb821719eb684eed3b4903.tar.bz2 opensim-SC_OLD-f784620780e7364d10bb821719eb684eed3b4903.tar.xz |
Moving TarArchive to OpenSim.Framework.Archive
We now build OpenSim.Framework.Archive.dll which aims to contain code
used for archiving various things in OpenSim. Also remove trailing
whitespace.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Archive/TarArchiveReader.cs (renamed from OpenSim/Region/CoreModules/World/Archiver/TarArchiveReader.cs) | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/TarArchiveReader.cs b/OpenSim/Framework/Archive/TarArchiveReader.cs index 070f597..eee65f5 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/TarArchiveReader.cs +++ b/OpenSim/Framework/Archive/TarArchiveReader.cs | |||
@@ -31,7 +31,7 @@ using System.Reflection; | |||
31 | using System.Text; | 31 | using System.Text; |
32 | using log4net; | 32 | using log4net; |
33 | 33 | ||
34 | namespace OpenSim.Region.CoreModules.World.Archiver | 34 | namespace OpenSim.Framework.Archive |
35 | { | 35 | { |
36 | /// <summary> | 36 | /// <summary> |
37 | /// Temporary code to do the bare minimum required to read a tar archive for our purposes | 37 | /// Temporary code to do the bare minimum required to read a tar archive for our purposes |
@@ -39,8 +39,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
39 | public class TarArchiveReader | 39 | public class TarArchiveReader |
40 | { | 40 | { |
41 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 41 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
42 | 42 | ||
43 | public enum TarEntryType | 43 | public enum TarEntryType |
44 | { | 44 | { |
45 | TYPE_UNKNOWN = 0, | 45 | TYPE_UNKNOWN = 0, |
46 | TYPE_NORMAL_FILE = 1, | 46 | TYPE_NORMAL_FILE = 1, |
@@ -89,7 +89,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
89 | return null; | 89 | return null; |
90 | 90 | ||
91 | entryType = header.EntryType; | 91 | entryType = header.EntryType; |
92 | filePath = header.FilePath; | 92 | filePath = header.FilePath; |
93 | return ReadData(header.FileSize); | 93 | return ReadData(header.FileSize); |
94 | } | 94 | } |
95 | 95 | ||
@@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
104 | // If we've reached the end of the archive we'll be in null block territory, which means | 104 | // If we've reached the end of the archive we'll be in null block territory, which means |
105 | // the next byte will be 0 | 105 | // the next byte will be 0 |
106 | if (header[0] == 0) | 106 | if (header[0] == 0) |
107 | return null; | 107 | return null; |
108 | 108 | ||
109 | TarHeader tarHeader = new TarHeader(); | 109 | TarHeader tarHeader = new TarHeader(); |
110 | 110 | ||
@@ -117,15 +117,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
117 | header = m_br.ReadBytes(512); | 117 | header = m_br.ReadBytes(512); |
118 | } | 118 | } |
119 | else | 119 | else |
120 | { | 120 | { |
121 | tarHeader.FilePath = m_asciiEncoding.GetString(header, 0, 100); | 121 | tarHeader.FilePath = m_asciiEncoding.GetString(header, 0, 100); |
122 | tarHeader.FilePath = tarHeader.FilePath.Trim(m_nullCharArray); | 122 | tarHeader.FilePath = tarHeader.FilePath.Trim(m_nullCharArray); |
123 | //m_log.DebugFormat("[TAR ARCHIVE READER]: Got short file name {0}", tarHeader.FilePath); | 123 | //m_log.DebugFormat("[TAR ARCHIVE READER]: Got short file name {0}", tarHeader.FilePath); |
124 | } | 124 | } |
125 | 125 | ||
126 | tarHeader.FileSize = ConvertOctalBytesToDecimal(header, 124, 11); | 126 | tarHeader.FileSize = ConvertOctalBytesToDecimal(header, 124, 11); |
127 | 127 | ||
128 | switch (header[156]) | 128 | switch (header[156]) |
129 | { | 129 | { |
130 | case 0: | 130 | case 0: |
131 | tarHeader.EntryType = TarEntryType.TYPE_NORMAL_FILE; | 131 | tarHeader.EntryType = TarEntryType.TYPE_NORMAL_FILE; |
@@ -154,11 +154,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
154 | case (byte)'7': | 154 | case (byte)'7': |
155 | tarHeader.EntryType = TarEntryType.TYPE_CONTIGUOUS_FILE; | 155 | tarHeader.EntryType = TarEntryType.TYPE_CONTIGUOUS_FILE; |
156 | break; | 156 | break; |
157 | } | 157 | } |
158 | 158 | ||
159 | return tarHeader; | 159 | return tarHeader; |
160 | } | 160 | } |
161 | 161 | ||
162 | /// <summary> | 162 | /// <summary> |
163 | /// Read data following a header | 163 | /// Read data following a header |
164 | /// </summary> | 164 | /// </summary> |
@@ -179,7 +179,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
179 | 179 | ||
180 | m_br.ReadBytes(paddingLeft); | 180 | m_br.ReadBytes(paddingLeft); |
181 | } | 181 | } |
182 | 182 | ||
183 | return data; | 183 | return data; |
184 | } | 184 | } |
185 | 185 | ||