public void SaveArt(ThumbRes result, string filetarget) { Thread t; lock (this) { SaveData s = new SaveData(); s.indexn = result; s.filetargetn = filetarget; t = new Thread(new ParameterizedThreadStart(this.DoSaveArt)); otherthreads.Add(t); t.Start(s); } }
private System.Drawing.Image ProcessStream(ref FileStream f, SaveData s, ThumbRes thumb) { if (f != null) { thumb.FullSize.Seek(0, SeekOrigin.Begin); GetStreamToStream(f, thumb.FullSize, thumb.FullSize.Length, false); return(null); } else { thumb.FullSize.Seek(0, SeekOrigin.Begin); return(System.Drawing.Bitmap.FromStream(thumb.FullSize)); } }
public void PopupateFullSizeStream(ThumbRes thumb) { if (thumb.FullSize == null) { mainForm.CoolInvoke(mainForm.statupdate, "Retrieving image...", null, false, Thread.CurrentThread); mainForm.CoolInvoke(mainForm.produpdate, (int)(0)); object output = thumb.ScriptOwner.GetResult(thumb.CallbackData); if (output is System.IO.Stream) { long length = new long(); Stream ss = output as Stream; if (ss.CanSeek) { length = ss.Length; } else { length = 0; } if (length > 50 * 1024 * 1024) { throw new Exception("Script returned preposterous Stream (greater than 50MB.)"); } thumb.FullSize = new MemoryStream((int)(length)); GetStreamToStream(thumb.FullSize, ss, length, true); } else if (output is String) { long size = new long(); Stream ss = GetHTTPStream(output as String, ref size); if (!ss.CanSeek) { size = 0; } if (size > 50 * 1024 * 1024) { throw new Exception("Server returned preposterous Content-Length (greater than 50MB.)"); } thumb.FullSize = new MemoryStream((int)(size)); GetStreamToStream(thumb.FullSize, ss, size, true); } } }
public void SendThumb(ThumbRes r) { lock (r) mainForm.BeginInvoke(mainForm.thumbupdate, r); }