Exemple #1
0
 public void AssertReady()
 {
     if (!_handle.IsValid)
     {
         throw new ObjectDisposedException("Imageflow JobContext");
     }
     if (HasError)
     {
         throw ImageflowException.FromContext(Handle);
     }
 }
Exemple #2
0
 public ImageInfo GetImageInfo(int ioId)
 {
     AssertReady();
     using (var response = SendJsonBytes("v0.1/get_image_info", JobContext.SerializeToJson(new { io_id = ioId })))
     {
         var responseDynamic = response.DeserializeDynamic();
         if (responseDynamic.success.Value == true)
         {
             return(ImageInfo.FromDynamic(responseDynamic.data.image_info));
         }
         else
         {
             throw ImageflowException.FromContext(this.Handle);
         }
     }
 }
Exemple #3
0
 public VersionInfo GetVersionInfo()
 {
     AssertReady();
     using (var response = SendJsonBytes("v1/get_version_info", JobContext.SerializeToJson(new { })))
     {
         var responseDynamic = response.DeserializeDynamic();
         if (responseDynamic.success.Value == true)
         {
             return(VersionInfo.FromDynamic(responseDynamic.data.version_info));
         }
         else
         {
             throw ImageflowException.FromContext(this.Handle);
         }
     }
 }
        public ImageflowException DisposeAllowingException()
        {
            if (!IsValid)
            {
                return(null);
            }

            try
            {
                if (!NativeMethods.imageflow_context_begin_terminate(this))
                {
                    return(ImageflowException.FromContext(this));
                }
            }
            finally
            {
                Dispose();
            }
            return(null);
        }
Exemple #5
0
        public ImageflowException DisposeAllowingException()
        {
            if (!IsValid)
            {
                return(null);
            }

            try
            {
                if (!NativeMethods.imageflow_json_response_destroy(ParentContext, DangerousGetHandle()))
                {
                    return(ImageflowException.FromContext(ParentContext));
                }
            }
            finally
            {
                Dispose();
            }
            return(null);
        }