Load spectrogram bitmaps without file lock

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@466 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2011-06-07 14:31:49 +00:00
parent 87b6e781b2
commit 48bd1e35b1

View File

@ -4,6 +4,7 @@ using System.Drawing;
using System.Windows.Forms;
using System.Xml;
using Nikse.SubtitleEdit.Logic;
using System.IO;
namespace Nikse.SubtitleEdit.Controls
{
@ -1091,11 +1092,15 @@ namespace Nikse.SubtitleEdit.Controls
void LoadSpectrogramBitmapsAsync(object sender, System.ComponentModel.DoWorkEventArgs e)
{
int count = 0;
string fileName = System.IO.Path.Combine(_spectrogramDirectory, count + ".gif");
while (System.IO.File.Exists(System.IO.Path.Combine(_spectrogramDirectory, count + ".gif")))
{
Bitmap bmp = new Bitmap(System.IO.Path.Combine(_spectrogramDirectory, count + ".gif"));
_spectrogramBitmaps.Add(bmp);
using (var ms = new MemoryStream(File.ReadAllBytes(fileName)))
{
_spectrogramBitmaps.Add((Bitmap)Bitmap.FromStream(ms));
}
count++;
fileName = System.IO.Path.Combine(_spectrogramDirectory, count + ".gif");
}
}