Skip to content

Commit 84d55f2

Browse files
committed
more code style
1 parent 8069d67 commit 84d55f2

File tree

2 files changed

+22
-25
lines changed

2 files changed

+22
-25
lines changed

PdfAValidator/PdfAValidator.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
using System.Xml.Serialization;
99

1010
// TODOS:
11-
// Performance - now every call causes verapdf to be unpacked
12-
// Codestyle - make this code great again
1311
// Fix the generated casing in report.cs
1412

1513
namespace PdfAValidator
@@ -40,7 +38,6 @@ public PdfAValidator()
4038

4139
private string _pathVeraPdfDirectory;
4240
public string PathJava { private set; get; }
43-
private string _pathZipVeraPdf;
4441
public string VeraPdfStarterScript { private set; get; }
4542

4643
public bool Validate(string pathToPdfFile)
@@ -131,32 +128,32 @@ private void intiPathToVeraPdfBinAndJava()
131128
{
132129
_pathVeraPdfDirectory = Path.Combine(Path.GetTempPath(), "VeraPdf" + Guid.NewGuid());
133130
Directory.CreateDirectory(_pathVeraPdfDirectory);
134-
_pathZipVeraPdf = Path.Combine(_pathVeraPdfDirectory, "VeraPdf.zip");
131+
var pathZipVeraPdf = Path.Combine(_pathVeraPdfDirectory, "VeraPdf.zip");
135132

136133
var assembly = Assembly.GetExecutingAssembly();
137134

138135
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
139136
{
140137
using (var stream = assembly.GetManifestResourceStream("PdfAValidator.VeraPdf.Windows.zip"))
141-
using (var fileStream = File.Create(_pathZipVeraPdf))
138+
using (var fileStream = File.Create(pathZipVeraPdf))
142139
{
143140
stream.Seek(0, SeekOrigin.Begin);
144141
stream.CopyTo(fileStream);
145142
}
146-
ZipFile.ExtractToDirectory(_pathZipVeraPdf, _pathVeraPdfDirectory);
143+
ZipFile.ExtractToDirectory(pathZipVeraPdf, _pathVeraPdfDirectory);
147144
VeraPdfStarterScript = Path.Combine(_pathVeraPdfDirectory, "verapdf", "verapdf.bat");
148145
// took from https://adoptopenjdk.net/releases.html?variant=openjdk8&jvmVariant=hotspot#x64_win
149146
PathJava = Path.Combine(_pathVeraPdfDirectory, "verapdf", "jdk8u202-b08-jre", "bin", "java");
150147
}
151148
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
152149
{
153150
using (var stream = assembly.GetManifestResourceStream("PdfAValidator.VeraPdf.Linux.zip"))
154-
using (var fileStream = File.Create(_pathZipVeraPdf))
151+
using (var fileStream = File.Create(pathZipVeraPdf))
155152
{
156153
stream.Seek(0, SeekOrigin.Begin);
157154
stream.CopyTo(fileStream);
158155
}
159-
ZipFile.ExtractToDirectory(_pathZipVeraPdf, _pathVeraPdfDirectory);
156+
ZipFile.ExtractToDirectory(pathZipVeraPdf, _pathVeraPdfDirectory);
160157

161158
VeraPdfStarterScript = Path.Combine(_pathVeraPdfDirectory, "verapdf", "verapdf");
162159
SetLinuxFileExecuteable(VeraPdfStarterScript);

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,33 @@ Install it using nuget package [PdfAValidatorApi](https://www.nuget.org/packages
99

1010
Install-Package PdfAValidator
1111

12-
Sample - e.g. use it in your unit test to check compliance of some pdf:
12+
Sample - e.g. use it in your unit test to check compliance of some pdf:
1313

1414
```C#
15-
[Fact]
16-
public void ShouldDetectCompliantPdfA()
17-
{
18-
using (var pdfAValidator = new PdfAValidator.PdfAValidator())
15+
[Fact]
16+
public void ShouldDetectCompliantPdfA()
1917
{
20-
var result = pdfAValidator.Validate(@"./TestPdfFiles/FromLibreOffice.pdf");
21-
Assert.True(result);
18+
using (var pdfAValidator = new PdfAValidator.PdfAValidator())
19+
{
20+
var result = pdfAValidator.Validate(@"./TestPdfFiles/FromLibreOffice.pdf");
21+
Assert.True(result);
22+
}
2223
}
23-
}
2424
```
2525

26-
Sample - e.g. use it in your unit test to check the used sub standard of some pdf:
26+
Sample - e.g. use it in your unit test to check the used sub standard of some pdf:
2727

2828
```C#
29-
[Fact]
30-
public void ShouldGetDetailedReportFromPdfA()
31-
{
32-
using (var pdfAValidator = new PdfAValidator.PdfAValidator())
29+
[Fact]
30+
public void ShouldGetDetailedReportFromPdfA()
3331
{
34-
var result = pdfAValidator.ValidateWithDetailedReport(@"./TestPdfFiles/FromLibreOffice.pdf");
35-
Assert.True(result.jobs.job.validationReport.isCompliant);
36-
Assert.True(result.jobs.job.validationReport.profileName == "PDF/A-1A validation profile");
32+
using (var pdfAValidator = new PdfAValidator.PdfAValidator())
33+
{
34+
var result = pdfAValidator.ValidateWithDetailedReport(@"./TestPdfFiles/FromLibreOffice.pdf");
35+
Assert.True(result.jobs.job.validationReport.isCompliant);
36+
Assert.True(result.jobs.job.validationReport.profileName == "PDF/A-1A validation profile");
37+
}
3738
}
38-
}
3939
```
4040

4141
[![NuGet Status](http://nugetstatus.com/PdfAValidator.png)](http://nugetstatus.com/packages/PdfAValidator)

0 commit comments

Comments
 (0)