Skip to content

Commit e3235d7

Browse files
authored
Merge pull request #781 from adamhathcock/fix-formatting
Update csharpier and fix formatting
2 parents 7d9c875 + dc89c88 commit e3235d7

40 files changed

+208
-180
lines changed

.config/dotnet-tools.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"csharpier": {
6-
"version": "0.25.0",
6+
"version": "0.26.1",
77
"commands": [
88
"dotnet-csharpier"
99
]

src/SharpCompress/Archives/ArchiveFactory.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ public static IArchive Open(Stream stream, ReaderOptions? readerOptions = null)
2525

2626
public static IWritableArchive Create(ArchiveType type)
2727
{
28-
var factory = Factory.Factories
28+
var factory = Factory
29+
.Factories
2930
.OfType<IWriteableArchiveFactory>()
3031
.FirstOrDefault(item => item.KnownArchiveType == type);
3132

src/SharpCompress/Archives/Rar/RarArchive.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ protected override IEnumerable<RarVolume> LoadVolumes(SourceStream srcStream)
4040
streams[1].Position = 0;
4141
SrcStream.Position = 0;
4242

43-
return srcStream.Streams.Select(
44-
a => new StreamRarArchiveVolume(a, ReaderOptions, idx++)
45-
);
43+
return srcStream
44+
.Streams
45+
.Select(a => new StreamRarArchiveVolume(a, ReaderOptions, idx++));
4646
}
4747
else //split mode or single file
4848
{

src/SharpCompress/Archives/SevenZip/SevenZipArchive.cs

+7-5
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,13 @@ var group in entries.Where(x => !x.IsDirectory).GroupBy(x => x.FilePart.Folder)
236236
}
237237
else
238238
{
239-
currentStream = archive.database.GetFolderStream(
240-
stream,
241-
currentFolder,
242-
new PasswordProvider(Options.Password)
243-
);
239+
currentStream = archive
240+
.database
241+
.GetFolderStream(
242+
stream,
243+
currentFolder,
244+
new PasswordProvider(Options.Password)
245+
);
244246
}
245247
foreach (var entry in group)
246248
{

src/SharpCompress/Common/Rar/Headers/FileHeader.cs

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#nullable disable
22

3+
using System;
4+
using System.IO;
5+
using System.Text;
6+
using SharpCompress.IO;
37
#if !Rar2017_64bit
48
using size_t = System.UInt32;
59
#else
@@ -8,11 +12,6 @@
812
using size_t = System.UInt64;
913
#endif
1014

11-
using SharpCompress.IO;
12-
using System;
13-
using System.IO;
14-
using System.Text;
15-
1615
namespace SharpCompress.Common.Rar.Headers;
1716

1817
internal class FileHeader : RarHeader

src/SharpCompress/Common/Rar/RarVolume.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ internal IEnumerable<RarFilePart> GetVolumeFileParts()
7070
var part = CreateFilePart(lastMarkHeader!, fh);
7171
var buffer = new byte[fh.CompressedSize];
7272
part.GetCompressedStream().Read(buffer, 0, buffer.Length);
73-
Comment = System.Text.Encoding.UTF8.GetString(
74-
buffer,
75-
0,
76-
buffer.Length - 1
77-
);
73+
Comment = System
74+
.Text
75+
.Encoding
76+
.UTF8
77+
.GetString(buffer, 0, buffer.Length - 1);
7878
}
7979
}
8080
break;

src/SharpCompress/Common/ReaderCancelledException.cs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace SharpCompress.Common;
44

55
public class ReaderCancelledException : Exception
6-
76
{
87
public ReaderCancelledException(string message)
98
: base(message) { }

src/SharpCompress/Common/Tar/TarReadOnlySubStream.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using SharpCompress.IO;
2-
using System;
1+
using System;
32
using System.IO;
3+
using SharpCompress.IO;
44

55
namespace SharpCompress.Common.Tar;
66

src/SharpCompress/Common/Zip/ZipHeaderFactory.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ private void LoadHeader(ZipFileEntry entryHeader, Stream stream)
142142

143143
if (entryHeader.CompressionMethod == ZipCompressionMethod.WinzipAes)
144144
{
145-
var data = entryHeader.Extra.SingleOrDefault(
146-
x => x.Type == ExtraDataType.WinZipAes
147-
);
145+
var data = entryHeader
146+
.Extra
147+
.SingleOrDefault(x => x.Type == ExtraDataType.WinZipAes);
148148
if (data != null)
149149
{
150150
var keySize = (WinzipAesKeySize)data.DataBytes[4];

src/SharpCompress/Compressors/Deflate/DeflateManager.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
// -----------------------------------------------------------------------
7070

7171
using System;
72-
7372
using SharpCompress.Algorithms;
7473

7574
namespace SharpCompress.Compressors.Deflate;
@@ -1959,7 +1958,9 @@ _codec.OutputBuffer is null
19591958
// returning Z_STREAM_END instead of Z_BUFF_ERROR.
19601959
}
19611960
else if (
1962-
_codec.AvailableBytesIn == 0 && (int)flush <= old_flush && flush != FlushType.Finish
1961+
_codec.AvailableBytesIn == 0
1962+
&& (int)flush <= old_flush
1963+
&& flush != FlushType.Finish
19631964
)
19641965
{
19651966
// workitem 8557

src/SharpCompress/Compressors/Deflate/Inflate.cs

-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
// -----------------------------------------------------------------------
6565

6666
using System;
67-
6867
using SharpCompress.Algorithms;
6968

7069
namespace SharpCompress.Compressors.Deflate;

src/SharpCompress/Compressors/Deflate/ZlibBaseStream.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
using System.Buffers.Binary;
3131
using System.Collections.Generic;
3232
using System.IO;
33-
using SharpCompress.Common.Tar.Headers;
3433
using System.Text;
34+
using SharpCompress.Common.Tar.Headers;
3535

3636
namespace SharpCompress.Compressors.Deflate;
3737

src/SharpCompress/Compressors/Deflate64/Deflate64Stream.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
#nullable disable
66

7-
using SharpCompress.Common.Zip;
87
using System;
98
using System.Diagnostics;
109
using System.IO;
1110
using System.Runtime.CompilerServices;
11+
using SharpCompress.Common.Zip;
1212

1313
namespace SharpCompress.Compressors.Deflate64;
1414

src/SharpCompress/Compressors/PPMd/I1/Model.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,8 @@ PpmContext foundStateSuccessor
866866
);
867867
}
868868
else if (
869-
(currentContext.SummaryFrequency += 4) > 128 + (4 * currentContext.NumberStatistics)
869+
(currentContext.SummaryFrequency += 4)
870+
> 128 + (4 * currentContext.NumberStatistics)
870871
)
871872
{
872873
Refresh((uint)((currentContext.NumberStatistics + 2) >> 1), true, currentContext);

src/SharpCompress/Compressors/Rar/UnpackV1/Unpack.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1269,9 +1269,10 @@ private bool AddVMCode(int firstByte, List<byte> vmCode, int length)
12691269
if (CurSize < DataSize + RarVM.VM_FIXEDGLOBALSIZE)
12701270
{
12711271
// StackFilter->Prg.GlobalData.Add(DataSize+VM_FIXEDGLOBALSIZE-CurSize);
1272-
StackFilter.Program.GlobalData.SetSize(
1273-
DataSize + RarVM.VM_FIXEDGLOBALSIZE - CurSize
1274-
);
1272+
StackFilter
1273+
.Program
1274+
.GlobalData
1275+
.SetSize(DataSize + RarVM.VM_FIXEDGLOBALSIZE - CurSize);
12751276
}
12761277
var offset = RarVM.VM_FIXEDGLOBALSIZE;
12771278
globalData = StackFilter.Program.GlobalData;

src/SharpCompress/Compressors/Rar/UnpackV1/UnpackUtility.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
32
using SharpCompress.Compressors.Rar.VM;
43

54
namespace SharpCompress.Compressors.Rar.UnpackV1;

src/SharpCompress/Compressors/Rar/UnpackV2017/FragmentedWindow.unpack50frag_cpp.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#nullable disable
22

3+
using System;
34
#if !Rar2017_64bit
45
using size_t = System.UInt32;
56
#else
67
using nint = System.Int64;
78
using nuint = System.UInt64;
89
using size_t = System.UInt64;
910
#endif
10-
using System;
1111

1212
namespace SharpCompress.Compressors.Rar.UnpackV2017;
1313

src/SharpCompress/Compressors/Rar/UnpackV2017/Unpack.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
#if !Rar2017_64bit
1+
using System;
2+
using System.IO;
3+
using SharpCompress.Common.Rar.Headers;
4+
#if !Rar2017_64bit
25
using size_t = System.UInt32;
36
#else
47
using nint = System.Int64;
58
using nuint = System.UInt64;
69
using size_t = System.UInt64;
710
#endif
8-
using System;
9-
using System.IO;
10-
using SharpCompress.Common.Rar.Headers;
1111

1212
namespace SharpCompress.Compressors.Rar.UnpackV2017;
1313

src/SharpCompress/Compressors/Rar/UnpackV2017/Unpack.rawint_hpp.cs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
#if !Rar2017_64bit
1+
using uint32 = System.UInt32;
2+
3+
/*#if !Rar2017_64bit
24
#else
35
using nint = System.Int64;
46
using nuint = System.UInt64;
57
using size_t = System.UInt64;
6-
#endif
7-
using uint32 = System.UInt32;
8+
#endif*/
9+
810

911
namespace SharpCompress.Compressors.Rar.UnpackV2017;
1012

src/SharpCompress/Compressors/Rar/UnpackV2017/Unpack.unpack20_cpp.cs

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
#if !Rar2017_64bit
1+
using System;
2+
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
3+
using static SharpCompress.Compressors.Rar.UnpackV2017.Unpack.Unpack20Local;
4+
5+
/*#if !Rar2017_64bit
26
#else
37
using nint = System.Int64;
48
using nuint = System.UInt64;
59
using size_t = System.UInt64;
6-
#endif
7-
using System;
8-
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
9-
using static SharpCompress.Compressors.Rar.UnpackV2017.Unpack.Unpack20Local;
10+
#endif*/
11+
1012

1113
namespace SharpCompress.Compressors.Rar.UnpackV2017;
1214

src/SharpCompress/Compressors/Rar/UnpackV2017/Unpack.unpack50_cpp.cs

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
#nullable disable
22

3+
using System;
4+
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
5+
using static SharpCompress.Compressors.Rar.UnpackV2017.UnpackGlobal;
6+
using int64 = System.Int64;
37
#if !Rar2017_64bit
48
using size_t = System.UInt32;
59
#else
610
using nint = System.Int64;
711
using nuint = System.UInt64;
812
using size_t = System.UInt64;
913
#endif
10-
using int64 = System.Int64;
11-
12-
using System;
13-
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
14-
using static SharpCompress.Compressors.Rar.UnpackV2017.UnpackGlobal;
1514

1615
namespace SharpCompress.Compressors.Rar.UnpackV2017;
1716

src/SharpCompress/Compressors/Rar/UnpackV2017/Unpack.unpack_cpp.cs

+25-26
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#nullable disable
22

3+
using System;
4+
using SharpCompress.Common;
5+
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
6+
using static SharpCompress.Compressors.Rar.UnpackV2017.UnpackGlobal;
37
#if !Rar2017_64bit
48
using size_t = System.UInt32;
59
#else
@@ -8,11 +12,6 @@
812
using size_t = System.UInt64;
913
#endif
1014

11-
using System;
12-
using SharpCompress.Common;
13-
using static SharpCompress.Compressors.Rar.UnpackV2017.UnpackGlobal;
14-
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
15-
1615
namespace SharpCompress.Compressors.Rar.UnpackV2017;
1716

1817
internal sealed partial class Unpack : BitInput
@@ -30,12 +29,12 @@ public Unpack( /* ComprDataIO *DataIO */
3029
Suspended = false;
3130
UnpAllBuf = false;
3231
UnpSomeRead = false;
33-
#if RarV2017_RAR_SMP
34-
MaxUserThreads = 1;
35-
UnpThreadPool = CreateThreadPool();
36-
ReadBufMT = null;
37-
UnpThreadData = null;
38-
#endif
32+
/*#if RarV2017_RAR_SMP
33+
MaxUserThreads = 1;
34+
UnpThreadPool = CreateThreadPool();
35+
ReadBufMT = null;
36+
UnpThreadData = null;
37+
#endif*/
3938
MaxWinSize = 0;
4039
MaxWinMask = 0;
4140

@@ -199,21 +198,21 @@ private void DoUnpack(uint Method, bool Solid)
199198
break;
200199
#endif
201200
case 50: // RAR 5.0 compression algorithm.
202-
#if RarV2017_RAR_SMP
203-
if (MaxUserThreads > 1)
204-
{
205-
// We do not use the multithreaded unpack routine to repack RAR archives
206-
// in 'suspended' mode, because unlike the single threaded code it can
207-
// write more than one dictionary for same loop pass. So we would need
208-
// larger buffers of unknown size. Also we do not support multithreading
209-
// in fragmented window mode.
210-
if (!Fragmented)
211-
{
212-
Unpack5MT(Solid);
213-
break;
214-
}
215-
}
216-
#endif
201+
/*#if RarV2017_RAR_SMP
202+
if (MaxUserThreads > 1)
203+
{
204+
// We do not use the multithreaded unpack routine to repack RAR archives
205+
// in 'suspended' mode, because unlike the single threaded code it can
206+
// write more than one dictionary for same loop pass. So we would need
207+
// larger buffers of unknown size. Also we do not support multithreading
208+
// in fragmented window mode.
209+
if (!Fragmented)
210+
{
211+
Unpack5MT(Solid);
212+
break;
213+
}
214+
}
215+
#endif*/
217216
Unpack5(Solid);
218217
break;
219218
#if !Rar2017_NOSTRICT

src/SharpCompress/Compressors/Rar/UnpackV2017/Unpack.unpackinline_cpp.cs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
#if !Rar2017_64bit
1+
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
2+
3+
/*#if !Rar2017_64bit
24
#else
35
using nint = System.Int64;
46
using nuint = System.UInt64;
57
using size_t = System.UInt64;
6-
#endif
7-
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
8+
#endif*/
9+
810

911
namespace SharpCompress.Compressors.Rar.UnpackV2017;
1012

0 commit comments

Comments
 (0)