Skip to content

Commit 67dd8f2

Browse files
committed
Merge remote-tracking branch 'origin/develop'
2 parents dd523a5 + 9c5ab32 commit 67dd8f2

File tree

5 files changed

+39
-71
lines changed

5 files changed

+39
-71
lines changed

appveyor.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
version: 1.0.2-{build}
1+
image: Visual Studio 2017
2+
version: 1.0.3-{build}
23
before_build:
34
- ps: nuget restore
45
init:

oslib/packagedef

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Описание
22
.Имя("v8unpack")
3-
.Версия("1.0.2")
3+
.Версия("1.0.3")
44
.Автор("Sergey Batanov")
55
.АдресАвтора("sergey.batanov@dmpas.ru")
66
.Описание("Компонента работы с файлами формата 8")

v8unpack/File8Reader.cs

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This Source Code Form is subject to the terms of the
88
Author: disa_da
99
E-mail: disa_da2@mail.ru
1010
/**
11-
2014-2017 dmpas sergey(dot)batanov(at)dmpas(dot)ru
11+
2014-2018 dmpas sergey(dot)batanov(at)dmpas(dot)ru
1212
*/
1313

1414
using System;
@@ -100,30 +100,39 @@ public void Extract(File8 element, string destDir, bool recursiveUnpack = false)
100100
Directory.CreateDirectory(destDir);
101101
}
102102

103-
_reader.Seek(element.DataOffset, SeekOrigin.Begin);
104-
105103
Stream fileExtractor;
106-
var blockExtractor = new BlockReaderStream(_reader);
107-
if (blockExtractor.IsPacked && _dataPacked)
104+
105+
if (element.DataOffset == FileFormat.V8_FF_SIGNATURE)
108106
{
109-
fileExtractor = new DeflateStream(blockExtractor, CompressionMode.Decompress);
107+
// Файл есть, но пуст
108+
fileExtractor = new MemoryStream();
110109
}
111110
else
112111
{
113-
fileExtractor = blockExtractor;
114-
}
112+
_reader.Seek(element.DataOffset, SeekOrigin.Begin);
115113

116-
if (blockExtractor.IsContainer && recursiveUnpack)
117-
{
118-
string outputDirectory = Path.Combine(destDir, element.Name);
119-
var tmpData = new MemoryStream(); // TODO: переделать MemoryStream --> FileStream
120-
fileExtractor.CopyTo(tmpData);
121-
tmpData.Seek(0, SeekOrigin.Begin);
114+
var blockExtractor = new BlockReaderStream(_reader);
115+
if (blockExtractor.IsPacked && _dataPacked)
116+
{
117+
fileExtractor = new DeflateStream(blockExtractor, CompressionMode.Decompress);
118+
}
119+
else
120+
{
121+
fileExtractor = blockExtractor;
122+
}
122123

123-
var internalContainer = new File8Reader(tmpData, dataPacked: false);
124-
internalContainer.ExtractAll(outputDirectory, recursiveUnpack);
124+
if (blockExtractor.IsContainer && recursiveUnpack)
125+
{
126+
string outputDirectory = Path.Combine(destDir, element.Name);
127+
var tmpData = new MemoryStream(); // TODO: переделать MemoryStream --> FileStream
128+
fileExtractor.CopyTo(tmpData);
129+
tmpData.Seek(0, SeekOrigin.Begin);
125130

126-
return;
131+
var internalContainer = new File8Reader(tmpData, dataPacked: false);
132+
internalContainer.ExtractAll(outputDirectory, recursiveUnpack);
133+
134+
return;
135+
}
127136
}
128137

129138
// Просто файл

v8unpack/FileFormat/BlockReaderStream.cs

Lines changed: 9 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This Source Code Form is subject to the terms of the
88
Author: disa_da
99
E-mail: disa_da2@mail.ru
1010
/**
11-
2014-2017 dmpas sergey(dot)batanov(at)dmpas(dot)ru
11+
2014-2018 dmpas sergey(dot)batanov(at)dmpas(dot)ru
1212
*/
1313
using System;
1414
using System.IO;
@@ -75,65 +75,23 @@ private void MoveNextBlock()
7575
ReadPage();
7676
}
7777

78-
public bool IsPacked
79-
{
80-
get
81-
{
82-
return _isPacked;
83-
}
84-
}
78+
public bool IsPacked => _isPacked;
8579

86-
public bool IsContainer
87-
{
88-
get
89-
{
90-
return _isContainer;
91-
}
92-
}
80+
public bool IsContainer => _isContainer;
9381

94-
public override bool CanRead
95-
{
96-
get
97-
{
98-
return true;
99-
}
100-
}
82+
public override bool CanRead => true;
10183

102-
public override bool CanSeek
103-
{
104-
get
105-
{
106-
return false;
107-
}
108-
}
84+
public override bool CanSeek => false;
10985

110-
public override bool CanWrite
111-
{
112-
get
113-
{
114-
return false;
115-
}
116-
}
86+
public override bool CanWrite => false;
11787

118-
public override long Length
119-
{
120-
get
121-
{
122-
return _dataSize;
123-
}
124-
}
88+
public override long Length => _dataSize;
12589

12690
public override long Position
12791
{
128-
get
129-
{
130-
throw new NotSupportedException();
131-
}
92+
get => throw new NotSupportedException();
13293

133-
set
134-
{
135-
throw new NotSupportedException();
136-
}
94+
set => throw new NotSupportedException();
13795
}
13896

13997
public override void Flush()

v8unpack/v8unpack.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<ConsolePause>false</ConsolePause>
3030
</PropertyGroup>
3131
<ItemGroup>
32-
<Reference Include="ScriptEngine, Version=1.0.19.104, Culture=neutral, PublicKeyToken=null">
32+
<Reference Include="ScriptEngine, Version=1.0.19.105, Culture=neutral, PublicKeyToken=null">
3333
<HintPath>..\packages\OneScript.1.0.19\lib\net452\ScriptEngine.dll</HintPath>
3434
</Reference>
3535
<Reference Include="System" />

0 commit comments

Comments
 (0)