コード例 #1
0
ファイル: RemoteFoxitServer.cs プロジェクト: mikhp/greatmaps
		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;
		}
コード例 #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);
 }