Skip to content

Commit

Permalink
.NET Core sample cleanup
Browse files Browse the repository at this point in the history
Remove unnecessary using directives
Remove unused variables
Remove redundant type qualifications
  • Loading branch information
datalogics-bruceh committed Sep 9, 2022
1 parent 7951feb commit 212e4c6
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static void Main(string[] args)
{
Console.WriteLine("PDF Optimizer:");

using (Library lib = new Library())
using (new Library())
{
Console.WriteLine("Initialized the library.");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Datalogics.PDFL;

/*
Expand All @@ -23,7 +21,7 @@ static void Main(string[] args)
{
Console.WriteLine("AddRegexRedaction Sample:");

using (Library lib = new Library())
using (new Library())
{
Console.WriteLine("Initialized the library.");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.Json;
using System.Text.Json.Serialization;
using Datalogics.PDFL;
using ExtractTextNameSpace;
/*
Expand Down Expand Up @@ -34,7 +32,7 @@ static void Main(string[] args)
{
Console.WriteLine("ExtractAcroFormFieldData Sample:");

using (Library lib = new Library())
using (new Library())
{
Console.WriteLine("Initialized the library.");
using (Document doc = new Document(sInput))
Expand All @@ -51,7 +49,7 @@ static void Main(string[] args)
// Save the output to a JSON file.
Console.WriteLine("Writing JSON to " + sOutput);
JsonSerializerOptions options = new JsonSerializerOptions { WriteIndented = true };
string json = JsonSerializer.Serialize<List<AcroFormTextFieldObject>>(result, options);
string json = JsonSerializer.Serialize(result, options);
System.IO.File.WriteAllText(sOutput, json);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ static void Main(string[] args)
{
Console.WriteLine("ExtractCJKTextByPatternMatch Sample:");

using (Library lib = new Library())
using (new Library())
{
Console.WriteLine("Initialized the library.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ static void Main(string[] args)
{
Console.WriteLine("ExtractTextByPatternMatch Sample:");

using (Library lib = new Library())
using (new Library())
{
Console.WriteLine("Initialized the library.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static void Main(string[] args)
{
Console.WriteLine("ExtractTextByRegion Sample:");

using (Library lib = new Library())
using (new Library())
{
Console.WriteLine("Initialized the library.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static void Main(string[] args)
{
Console.WriteLine("Annotations Sample:");

using (Library lib = new Library())
using (new Library())
{
Console.WriteLine("Initialized the library.");

Expand All @@ -54,7 +54,7 @@ static void Main(string[] args)
// Save the output to a JSON file.
Console.WriteLine("Writing JSON to " + sOutput);
JsonSerializerOptions options = new JsonSerializerOptions { WriteIndented = true };
string json = JsonSerializer.Serialize<List<AnnotationTextObject>>(result, options);
string json = JsonSerializer.Serialize(result, options);
System.IO.File.WriteAllText(sOutput, json);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static void Main(string[] args)
{
Console.WriteLine("ExtractTextFromMultiRegions Sample:");

using (Library lib = new Library())
using (new Library())
{
Console.WriteLine("Initialized the library.");
using (System.IO.StreamWriter outfile = new System.IO.StreamWriter(sOutput))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static void Main(string[] args)
{
Console.WriteLine("ExtractTextPreservingStyleAndPositionInfo Sample:");

using (Library lib = new Library())
using (new Library())
{
Console.WriteLine("Initialized the library.");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using Datalogics.PDFL;
Expand Down Expand Up @@ -96,7 +94,7 @@ static void Main(string[] args)
{
Console.WriteLine("RegexExtractText Sample:");

using (Library lib = new Library())
using (new Library())
{
Console.WriteLine("Initialized the library.");

Expand Down Expand Up @@ -188,7 +186,7 @@ static void Main(string[] args)
// Save the output JSON file.
Console.WriteLine("Writing JSON to " + sOutput);
JsonSerializerOptions options = new JsonSerializerOptions { WriteIndented = true };
string json = JsonSerializer.Serialize<List<MatchObject>>(result.documentJson, options);
string json = JsonSerializer.Serialize(result.documentJson, options);
System.IO.File.WriteAllText(sOutput, json);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Datalogics.PDFL;

/*
Expand All @@ -23,7 +21,7 @@ static void Main(string[] args)
{
Console.WriteLine("RegexTextSearch Sample:");

using (Library lib = new Library())
using (new Library())
{
Console.WriteLine("Initialized the library.");

Expand Down
3 changes: 0 additions & 3 deletions DotNETCore/Sample_Source/_Common/ExtractText.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using Datalogics.PDFL;

Expand Down

0 comments on commit 212e4c6

Please sign in to comment.