From 16c749eac751d6b87c8bc209234fb3ad2c9f0943 Mon Sep 17 00:00:00 2001 From: Michael Vrhel Date: Wed, 19 Feb 2014 10:44:40 -0800 Subject: Fix issues related to canceling gs, opening new files, and gs errors. Bug fixes that I have found as I attempt to beat on this in various ways --- platform/winrt/gsview/ghostsharp.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'platform/winrt/gsview/ghostsharp.cs') diff --git a/platform/winrt/gsview/ghostsharp.cs b/platform/winrt/gsview/ghostsharp.cs index 905bf2b9..f945ee1f 100644 --- a/platform/winrt/gsview/ghostsharp.cs +++ b/platform/winrt/gsview/ghostsharp.cs @@ -133,7 +133,7 @@ namespace gsview static class gsConstants { public const int E_QUIT = -101; - public const int GS_READ_BUFFER = 2048; + public const int GS_READ_BUFFER = 32768; } @@ -409,6 +409,11 @@ namespace gsview while ((count = fs.Read(Buffer, 0, gsConstants.GS_READ_BUFFER)) > 0) { gsapi_run_string_continue(gsInstance, FeedPtr, count, 0, ref exitcode); + if (exitcode < 0) + { + code = exitcode; + break; + } total = total + count; perc = 100.0 * (double) total / (double) len; worker.ReportProgress((int)perc); @@ -419,6 +424,8 @@ namespace gsview } } gsapi_run_string_end(gsInstance, 0, ref exitcode); + if (code == 0) + code = exitcode; } /* All the pinned items need to be freed so the GC can do its job */ @@ -498,6 +505,14 @@ namespace gsview return RunGhostscript(Params); } + public gsStatus GetStatus() + { + if (m_worker != null && m_worker.IsBusy) + return gsStatus.GS_BUSY; + else + return gsStatus.GS_READY; + } + private gsStatus RunGhostscript(gsParams_t Params) { /* Create background task for rendering the thumbnails. Allow -- cgit v1.2.3