コード例 #1
0
        void imageCompressor_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker = (BackgroundWorker)sender;

            while (!worker.CancellationPending)
            {
                ImageItem item = null;
                lock (compressLock)
                {
                    while (compressItems.Count == 0)
                    {
                        Monitor.Wait(compressLock);
                    }
                    item = compressItems.Dequeue();
                }
                compressStorage.Save(item.Time + ".jpg", item);
            }
        }
コード例 #2
0
        private void ProcessItem(string id)
        {
            long itemTime = 0;
            bool res      = long.TryParse(id.Split('.')[0], out itemTime);

            if (!res || itemTime <= 0)
            {
                return;
            }
            long lastProcessTime = ((this.lastTime > 0) ? this.lastTime : (itemTime - frameTime - 1));
            long diffTime        = itemTime - lastProcessTime;

            if (!useSourceFPS)
            {
                if (diffTime < frameTime)
                {
                    if (config.Render.DeleteImages)
                    {
                        Remove(id);
                    }
                    return;
                }
            }
            long showTime = diffTime;

            if (!useSourceFPS)
            {
                showTime = frameTime;
            }
            ImageItem item = new ImageItem();

            item.Name     = id;
            item.Time     = itemTime;
            item.ShowTime = showTime;
            this.lastTime = itemTime;
            Load(item);
        }
コード例 #3
0
        void imageLoader_DoWork(object sender, DoWorkEventArgs e)
        {
            Stopwatch        sw     = new Stopwatch();
            BackgroundWorker worker = (BackgroundWorker)sender;

            while (!worker.CancellationPending)
            {
                ImageItem item;
                sw.Reset();
                sw.Start();
                item = GetLoadItem();
                lock (renderLock)
                {
                    while (renderItems.Count > 60)
                    {
                        Monitor.Wait(renderLock);
                    }
                }
                ImageItem ii = imageStorage.Load(item.Name);
                item.ImageData = ii.ImageData;
                sw.Stop();
                worker.ReportProgress(0, item);
            }
        }
コード例 #4
0
 public abstract bool Save(string id, ImageItem image);
コード例 #5
0
        void imageConverter_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            ImageItem item = e.UserState as ImageItem;

            Render(item);
        }
コード例 #6
0
        void imagePuller_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            ImageItem item = (ImageItem)e.UserState;

            ProcessItem(item);
        }