Do not recycle filters list as it is not creating new filter instances

just reusing it.
This commit is contained in:
2017-09-11 21:17:47 +01:00
parent e0e2b103a7
commit ec292349ce
8 changed files with 25 additions and 20 deletions

View File

@@ -583,6 +583,8 @@ namespace DiscImageChef.ImagePlugins
if(!string.IsNullOrEmpty(header.subchannelFile)) if(!string.IsNullOrEmpty(header.subchannelFile))
{ {
filtersList = new FiltersList();
do do
{ {
subFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), subFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(),

View File

@@ -590,13 +590,14 @@ namespace DiscImageChef.ImagePlugins
else else
DicConsole.ErrorWriteLine("BlindWrite5 image ends after expected position. Probably new version with different data. Errors may occur."); DicConsole.ErrorWriteLine("BlindWrite5 image ends after expected position. Probably new version with different data. Errors may occur.");
FiltersList filtersList = new FiltersList(); FiltersList filtersList;
filePaths = new List<DataFileCharacteristics>(); filePaths = new List<DataFileCharacteristics>();
foreach(BW5_DataFile dataFile in dataFiles) foreach(BW5_DataFile dataFile in dataFiles)
{ {
DataFileCharacteristics chars = new DataFileCharacteristics(); DataFileCharacteristics chars = new DataFileCharacteristics();
string path = Path.Combine(dataPath, dataFile.filename); string path = Path.Combine(dataPath, dataFile.filename);
filtersList = new FiltersList();
if(filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), path)) != null) if(filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), path)) != null)
{ {

View File

@@ -615,6 +615,7 @@ namespace DiscImageChef.ImagePlugins
{ {
DicConsole.DebugWriteLine("CDRDAO plugin", "Found AUDIOFILE \"{1}\" at line {0}", line, MatchAudioFile.Groups["filename"].Value); DicConsole.DebugWriteLine("CDRDAO plugin", "Found AUDIOFILE \"{1}\" at line {0}", line, MatchAudioFile.Groups["filename"].Value);
filtersList = new FiltersList();
currenttrack.trackfile = new CDRDAOTrackFile(); currenttrack.trackfile = new CDRDAOTrackFile();
currenttrack.trackfile.datafilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), MatchAudioFile.Groups["filename"].Value)); currenttrack.trackfile.datafilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), MatchAudioFile.Groups["filename"].Value));
currenttrack.trackfile.datafile = MatchAudioFile.Groups["filename"].Value; currenttrack.trackfile.datafile = MatchAudioFile.Groups["filename"].Value;
@@ -645,6 +646,7 @@ namespace DiscImageChef.ImagePlugins
{ {
DicConsole.DebugWriteLine("CDRDAO plugin", "Found DATAFILE \"{1}\" at line {0}", line, MatchFile.Groups["filename"].Value); DicConsole.DebugWriteLine("CDRDAO plugin", "Found DATAFILE \"{1}\" at line {0}", line, MatchFile.Groups["filename"].Value);
filtersList = new FiltersList();
currenttrack.trackfile = new CDRDAOTrackFile(); currenttrack.trackfile = new CDRDAOTrackFile();
currenttrack.trackfile.datafilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), MatchFile.Groups["filename"].Value)); currenttrack.trackfile.datafilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), MatchFile.Groups["filename"].Value));
currenttrack.trackfile.datafile = MatchAudioFile.Groups["filename"].Value; currenttrack.trackfile.datafile = MatchAudioFile.Groups["filename"].Value;

View File

@@ -603,9 +603,11 @@ namespace DiscImageChef.ImagePlugins
cuetracks[currenttrack.sequence - 1] = currenttrack; cuetracks[currenttrack.sequence - 1] = currenttrack;
intrack = false; intrack = false;
currenttrack = new CDRWinTrack(); currenttrack = new CDRWinTrack();
currentfile = new CDRWinTrackFile();
filtersList = new FiltersList();
} }
//currentfile = new CDRWinTrackFile();
string datafile = MatchFile.Groups[1].Value; string datafile = MatchFile.Groups[1].Value;
currentfile.filetype = MatchFile.Groups[2].Value; currentfile.filetype = MatchFile.Groups[2].Value;
@@ -674,7 +676,7 @@ namespace DiscImageChef.ImagePlugins
} }
// File does exist, process it // File does exist, process it
DicConsole.DebugWriteLine("CDRWin plugin", "File \"{0}\" found", currentfile.datafilter); DicConsole.DebugWriteLine("CDRWin plugin", "File \"{0}\" found", currentfile.datafilter.GetFilename());
switch(currentfile.filetype) switch(currentfile.filetype)
{ {
@@ -1026,7 +1028,7 @@ namespace DiscImageChef.ImagePlugins
DicConsole.DebugWriteLine("CDRWin plugin", "\t\tTrack has SCMS"); DicConsole.DebugWriteLine("CDRWin plugin", "\t\tTrack has SCMS");
DicConsole.DebugWriteLine("CDRWin plugin", "\t\tTrack resides in file {0}, type defined as {1}, starting at byte {2}", DicConsole.DebugWriteLine("CDRWin plugin", "\t\tTrack resides in file {0}, type defined as {1}, starting at byte {2}",
discimage.tracks[i].trackfile.datafilter, discimage.tracks[i].trackfile.filetype, discimage.tracks[i].trackfile.offset); discimage.tracks[i].trackfile.datafilter.GetFilename(), discimage.tracks[i].trackfile.filetype, discimage.tracks[i].trackfile.offset);
DicConsole.DebugWriteLine("CDRWin plugin", "\t\tIndexes:"); DicConsole.DebugWriteLine("CDRWin plugin", "\t\tIndexes:");
foreach(KeyValuePair<int, ulong> kvp in discimage.tracks[i].indexes) foreach(KeyValuePair<int, ulong> kvp in discimage.tracks[i].indexes)

View File

@@ -228,7 +228,7 @@ namespace DiscImageChef.ImagePlugins
GDITrack currentTrack; GDITrack currentTrack;
densitySeparationSectors = 0; densitySeparationSectors = 0;
FiltersList filtersList = new FiltersList(); FiltersList filtersList;
while(gdiStream.Peek() >= 0) while(gdiStream.Peek() >= 0)
{ {
@@ -253,6 +253,7 @@ namespace DiscImageChef.ImagePlugins
TrackMatch.Groups["track"].Value, TrackMatch.Groups["start"].Value, TrackMatch.Groups["flags"].Value, TrackMatch.Groups["track"].Value, TrackMatch.Groups["start"].Value, TrackMatch.Groups["flags"].Value,
TrackMatch.Groups["type"].Value, TrackMatch.Groups["filename"].Value, TrackMatch.Groups["offset"].Value, line); TrackMatch.Groups["type"].Value, TrackMatch.Groups["filename"].Value, TrackMatch.Groups["offset"].Value, line);
filtersList = new FiltersList();
currentTrack = new GDITrack(); currentTrack = new GDITrack();
currentTrack.bps = ushort.Parse(TrackMatch.Groups["type"].Value); currentTrack.bps = ushort.Parse(TrackMatch.Groups["type"].Value);
currentTrack.flags = (byte)(byte.Parse(TrackMatch.Groups["flags"].Value) * 0x10); currentTrack.flags = (byte)(byte.Parse(TrackMatch.Groups["flags"].Value) * 0x10);

View File

@@ -823,7 +823,7 @@ namespace DiscImageChef.ImagePlugins
int currentLocator = 0; int currentLocator = 0;
bool locatorFound = false; bool locatorFound = false;
string parentPath = null; string parentPath = null;
FiltersList filters = new FiltersList(); FiltersList filters;
while(!locatorFound && currentLocator < 8) while(!locatorFound && currentLocator < 8)
{ {
@@ -852,7 +852,7 @@ namespace DiscImageChef.ImagePlugins
if(parentPath != null) if(parentPath != null)
{ {
DicConsole.DebugWriteLine("VirtualPC plugin", "Possible parent path: \"{0}\"", parentPath); DicConsole.DebugWriteLine("VirtualPC plugin", "Possible parent path: \"{0}\"", parentPath);
Filter parentFilter = filters.GetFilter(Path.Combine(imageFilter.GetParentFolder(), parentPath)); Filter parentFilter = new FiltersList().GetFilter(Path.Combine(imageFilter.GetParentFolder(), parentPath));
if(parentFilter != null) if(parentFilter != null)
locatorFound = true; locatorFound = true;
@@ -868,7 +868,7 @@ namespace DiscImageChef.ImagePlugins
else else
{ {
parentImage = new VHD(); parentImage = new VHD();
Filter parentFilter = filters.GetFilter(Path.Combine(imageFilter.GetParentFolder(), parentPath)); Filter parentFilter = new FiltersList().GetFilter(Path.Combine(imageFilter.GetParentFolder(), parentPath));
if(parentFilter == null) if(parentFilter == null)
throw new ImageNotSupportedException("(VirtualPC plugin): Cannot find parent image filter"); throw new ImageNotSupportedException("(VirtualPC plugin): Cannot find parent image filter");

View File

@@ -602,7 +602,6 @@ namespace DiscImageChef.ImagePlugins
{ {
parentImage = new VHDX(); parentImage = new VHDX();
bool parentWorks = false; bool parentWorks = false;
FiltersList filtersList = new FiltersList();
Filter parentFilter; Filter parentFilter;
foreach(VHDXParentLocatorEntry parentEntry in vPars) foreach(VHDXParentLocatorEntry parentEntry in vPars)
@@ -621,7 +620,7 @@ namespace DiscImageChef.ImagePlugins
try try
{ {
parentFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), entryValue)); parentFilter = new FiltersList().GetFilter(Path.Combine(imageFilter.GetParentFolder(), entryValue));
if(parentFilter != null && parentImage.OpenImage(parentFilter)) if(parentFilter != null && parentImage.OpenImage(parentFilter))
{ {
parentWorks = true; parentWorks = true;
@@ -634,7 +633,7 @@ namespace DiscImageChef.ImagePlugins
try try
{ {
parentFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), relEntry)); parentFilter = new FiltersList().GetFilter(Path.Combine(imageFilter.GetParentFolder(), relEntry));
if(parentFilter != null && parentImage.OpenImage(parentFilter)) if(parentFilter != null && parentImage.OpenImage(parentFilter))
{ {
parentWorks = true; parentWorks = true;
@@ -653,7 +652,7 @@ namespace DiscImageChef.ImagePlugins
try try
{ {
parentFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), entryValue)); parentFilter = new FiltersList().GetFilter(Path.Combine(imageFilter.GetParentFolder(), entryValue));
if(parentFilter != null && parentImage.OpenImage(parentFilter)) if(parentFilter != null && parentImage.OpenImage(parentFilter))
{ {
parentWorks = true; parentWorks = true;

View File

@@ -327,8 +327,6 @@ namespace DiscImageChef.DiscImages
extents = new Dictionary<ulong, VMwareExtent>(); extents = new Dictionary<ulong, VMwareExtent>();
ulong currentSector = 0; ulong currentSector = 0;
FiltersList filtersList = new FiltersList();
bool matchedCyls = false, matchedHds = false, matchedSpt = false; bool matchedCyls = false, matchedHds = false, matchedSpt = false;
if(cowD) if(cowD)
@@ -347,7 +345,7 @@ namespace DiscImageChef.DiscImages
if(!File.Exists(curPath)) if(!File.Exists(curPath))
break; break;
Filter extentFilter = filtersList.GetFilter(curPath); Filter extentFilter = new FiltersList().GetFilter(curPath);
Stream extentStream = extentFilter.GetDataForkStream(); Stream extentStream = extentFilter.GetDataForkStream();
if(stream.Length > Marshal.SizeOf(vmCHdr)) if(stream.Length > Marshal.SizeOf(vmCHdr))
@@ -450,7 +448,7 @@ namespace DiscImageChef.DiscImages
VMwareExtent newExtent = new VMwareExtent(); VMwareExtent newExtent = new VMwareExtent();
newExtent.access = MatchExtent.Groups["access"].Value; newExtent.access = MatchExtent.Groups["access"].Value;
if(!embedded) if(!embedded)
newExtent.filter = filtersList.GetFilter(Path.Combine(Path.GetDirectoryName(imageFilter.GetBasePath()), MatchExtent.Groups["filename"].Value)); newExtent.filter = new FiltersList().GetFilter(Path.Combine(Path.GetDirectoryName(imageFilter.GetBasePath()), MatchExtent.Groups["filename"].Value));
else else
newExtent.filter = imageFilter; newExtent.filter = imageFilter;
uint.TryParse(MatchExtent.Groups["offset"].Value, out newExtent.offset); uint.TryParse(MatchExtent.Groups["offset"].Value, out newExtent.offset);
@@ -672,7 +670,7 @@ namespace DiscImageChef.DiscImages
if(hasParent) if(hasParent)
{ {
Filter parentFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), parentName)); Filter parentFilter = new FiltersList().GetFilter(Path.Combine(imageFilter.GetParentFolder(), parentName));
if(parentFilter == null) if(parentFilter == null)
throw new Exception(string.Format("Cannot find parent \"{0}\".", parentName)); throw new Exception(string.Format("Cannot find parent \"{0}\".", parentName));