コード例 #1
0
 public DesktopInfo GetDesktopInfo()
 {
     try
     {
         lock (lock_GetDesktopInfo)
         {
             lock (syncObject)
             {
                 if (!Maintain())
                 {
                     return(new DesktopInfo());
                 }
                 sm.WriteByte((byte)Command.GetDesktopInfo);
             }
             DesktopInfo info;
             if (newDesktopInfo.Consume(new AbortFlag(), out info))
             {
                 return(info);
             }
             else
             {
                 return(null);
             }
         }
     }
     catch (StreamDisconnectedException ex)
     {
         Logger.Debug(ex.Message);
     }
     catch (Exception ex)
     {
         Logger.Debug(ex);
     }
     return(new DesktopInfo());
 }
コード例 #2
0
 /// <summary>
 /// Returns a buffer containing serialized ImageFragments.
 /// May return null in case of error.
 /// This method blocks until a frame is received from the Streamer process.
 /// </summary>
 /// <returns></returns>
 public FragmentedImage GetRawDesktopCapture(ImgFlags imgFlags, byte jpegQuality, AbortFlag abortFlag)
 {
     try
     {
         lock (lock_GetRawDesktopCapture)
         {
             lock (syncObject)
             {
                 if (!Maintain())
                 {
                     return(new FragmentedImage());
                 }
                 sm.WriteByte((byte)Command.GetScreenCapture);
                 sm.WriteByte((byte)imgFlags);
                 sm.WriteByte(jpegQuality);
             }
             FragmentedImage img;
             if (newFrame.Consume(abortFlag, out img))
             {
                 return(img);
             }
             else
             {
                 return(null);
             }
         }
     }
     catch (ThreadAbortException) { throw; }
     catch (StreamDisconnectedException ex)
     {
         Logger.Info(ex.Message);
     }
     catch (Exception ex)
     {
         Logger.Debug(ex);
     }
     return(new FragmentedImage());
 }