Skip to content

Commit 7602e7d

Browse files
committed
added ConstantsEnums.cs
1 parent 8cb4601 commit 7602e7d

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

PdfScribe/ConstantsEnums.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace PdfScribe
2+
{
3+
public enum NoDistillStripping : int
4+
{
5+
Searching,
6+
Removing,
7+
Complete
8+
}
9+
}

PdfScribe/PdfScribe.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
<Compile Include="..\Common\PdfScribeSharedAssemblyInfo.cs">
100100
<Link>PdfScribeSharedAssemblyInfo.cs</Link>
101101
</Compile>
102+
<Compile Include="ConstantsEnums.cs" />
102103
<Compile Include="GhostScript64.cs" />
103104
<Compile Include="NativeMethods.cs" />
104105
<Compile Include="Program.cs" />

PdfScribe/Program_2.cs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,25 +146,28 @@ static void StripNoDistill(String postscriptFile)
146146
using (StreamReader inputReader = new StreamReader(File.OpenRead(postscriptFile), System.Text.Encoding.UTF8))
147147
using (StreamWriter strippedWriter = new StreamWriter(File.OpenWrite(strippedFile), new UTF8Encoding(false)))
148148
{
149-
bool redistillPhraseFound = false;
149+
NoDistillStripping strippingStatus = NoDistillStripping.Searching;
150150
String inputLine;
151151
while (!inputReader.EndOfStream)
152152
{
153153
inputLine = inputReader.ReadLine();
154154
if (inputLine != null)
155155
{
156-
if (redistillPhraseFound)
156+
switch ((int)strippingStatus)
157157
{
158-
if (inputLine == "%ADOEndClientInjection: DocumentSetup Start \"No Re-Distill\"")
159-
redistillPhraseFound = false;
160-
}
161-
else
162-
{
163-
if (inputLine == "%ADOBeginClientInjection: DocumentSetup Start \"No Re-Distill\"")
164-
redistillPhraseFound = true;
165-
else
158+
case (int)NoDistillStripping.Searching:
159+
if (inputLine == "%ADOBeginClientInjection: DocumentSetup Start \"No Re-Distill\"")
160+
strippingStatus= NoDistillStripping.Removing;
161+
else
162+
strippedWriter.WriteLine(inputLine);
163+
break;
164+
case (int)NoDistillStripping.Removing:
165+
if (inputLine == "%ADOEndClientInjection: DocumentSetup Start \"No Re-Distill\"")
166+
strippingStatus = NoDistillStripping.Complete;
167+
break;
168+
case (int)NoDistillStripping.Complete:
166169
strippedWriter.WriteLine(inputLine);
167-
170+
break;
168171
}
169172
}
170173
}

0 commit comments

Comments
 (0)