Esempio n. 1
0
 internal bool Server(object genericRequest, ref ISerializable reply)
 {
     if (genericRequest is OpenRequest)
     {
         OpenRequest openRequest = (OpenRequest)genericRequest;
         if (this.foxitViewer != null)
         {
             reply = new ExceptionMessageRecord("Already open");
             return(true);
         }
         try
         {
             this.foxitViewer = new FoxitViewer(openRequest.filename, openRequest.pageNumber);
             reply            = new RectangleFRecord(this.foxitViewer.GetPageSize());
             bool result = true;
             return(result);
         }
         catch (Exception ex)
         {
             reply = new ExceptionMessageRecord(ex.Message);
             bool result = false;
             return(result);
         }
     }
     if (genericRequest is RenderRequest)
     {
         RenderRequest renderRequest = (RenderRequest)genericRequest;
         if (this.foxitViewer == null)
         {
             reply = new ExceptionMessageRecord("Not open");
             return(true);
         }
         try
         {
             reply = this.foxitViewer.RenderBytes(renderRequest.outputSize, renderRequest.topLeft, renderRequest.pageSize, renderRequest.transparentBackground);
             bool result = true;
             return(result);
         }
         catch (Exception ex2)
         {
             reply = new ExceptionMessageRecord(ex2.Message);
             bool result = true;
             return(result);
         }
     }
     if (genericRequest is QuitRequest)
     {
         reply = new AckRecord();
         return(false);
     }
     reply = new ExceptionMessageRecord("Unrecognized request type " + genericRequest.GetType().ToString());
     return(true);
 }
Esempio n. 2
0
		internal bool Server(object genericRequest, ref ISerializable reply)
		{
			if (genericRequest is OpenRequest)
			{
				OpenRequest openRequest = (OpenRequest)genericRequest;
				if (this.foxitViewer != null)
				{
					reply = new ExceptionMessageRecord("Already open");
					return true;
				}
				try
				{
					this.foxitViewer = new FoxitViewer(openRequest.filename, openRequest.pageNumber);
					reply = new RectangleFRecord(this.foxitViewer.GetPageSize());
					bool result = true;
					return result;
				}
				catch (Exception ex)
				{
					reply = new ExceptionMessageRecord(ex.Message);
					bool result = false;
					return result;
				}
			}
			if (genericRequest is RenderRequest)
			{
				RenderRequest renderRequest = (RenderRequest)genericRequest;
				if (this.foxitViewer == null)
				{
					reply = new ExceptionMessageRecord("Not open");
					return true;
				}
				try
				{
					reply = this.foxitViewer.RenderBytes(renderRequest.outputSize, renderRequest.topLeft, renderRequest.pageSize, renderRequest.transparentBackground);
					bool result = true;
					return result;
				}
				catch (Exception ex2)
				{
					reply = new ExceptionMessageRecord(ex2.Message);
					bool result = true;
					return result;
				}
			}
			if (genericRequest is QuitRequest)
			{
				reply = new AckRecord();
				return false;
			}
			reply = new ExceptionMessageRecord("Unrecognized request type " + genericRequest.GetType().ToString());
			return true;
		}
Esempio n. 3
0
        private void Establish()
        {
            if (this.namedPipeServer != null)
            {
                return;
            }
            string text = Guid.NewGuid().ToString();

            this.namedPipeServer = new NamedPipeServer(string.Format("{0} {1}", "-remoteServer", text), text);
            RectangleFRecord rectangleFRecord = (RectangleFRecord)this.namedPipeServer.RPC(new OpenRequest(this.filename, this.pageNumber));

            this.pageSize = rectangleFRecord.rect;
        }