public void Load(IProgress <ProgressInfo> progress) { _progressActionText = "Loading dsi model"; CompressedFile <ProgressInfo> modelFile = new CompressedFile <ProgressInfo>(_filename); modelFile.ReadFile(ReadDsiXml, progress); }
/// <summary> /// Disassemble the .unity3d file. /// </summary> public void Disassemble() { _compressedFile.ReadFile(); _compressedFile.FileReader.BaseStream.Position = _compressedFile.Header.CompressedFileHeaderSize; byte[] compressed_file_body = _compressedFile.FileReader.ReadByteArray(_compressedFile.Header.CompressedFileSizeWithoutHeader); //Get the body of the compressed file ConsoleIO.Log("Decompressing the .unity3d with Lzma..."); _decompressedFile = new DecompressedFile(LzmaUtils.Decompress(compressed_file_body)); _decompressedFile.ReadFile(); }
public void GiveFileIsCompressedWhenReadFileIsCalledThenTheContentIsReadCorrectly() { CompressedFile <int> file = new CompressedFile <int>(CompressedFilePath); Assert.IsTrue(file.FileExists); file.ReadFile(ReadContent, this); Assert.AreEqual(4, _progress); Assert.AreEqual(4, _lines.Count); Assert.AreEqual("line0", _lines[0]); Assert.AreEqual("line1", _lines[1]); Assert.AreEqual("line2", _lines[2]); Assert.AreEqual("line3", _lines[3]); }
public void WhenContentIsWrittenUncompressedToAFileThenTheReadBackContentIsIdentical() { string newPath = NewFilePath; CompressedFile <int> writtenFile = new CompressedFile <int>(newPath); Assert.IsFalse(writtenFile.FileExists); writtenFile.WriteFile(WriteContent, this, false); Assert.IsTrue(writtenFile.FileExists); Assert.AreEqual(4, _progress); _progress = 0; CompressedFile <int> readFile = new CompressedFile <int>(newPath); Assert.IsTrue(readFile.FileExists); readFile.ReadFile(ReadContent, this); Assert.AreEqual(4, _progress); Assert.AreEqual(4, _lines.Count); Assert.AreEqual("line0", _lines[0]); Assert.AreEqual("line1", _lines[1]); Assert.AreEqual("line2", _lines[2]); Assert.AreEqual("line3", _lines[3]); }