[DatFile] Dictionary methods reorg + rename

This commit is contained in:
Matt Nadareski
2017-09-25 14:28:55 -07:00
parent 67e7d12d63
commit 95d6d9829b
4 changed files with 31 additions and 31 deletions

View File

@@ -459,17 +459,6 @@ namespace SabreTools.Library.Dats
return contains; return contains;
} }
/// <summary>
/// Delete the file dictionary
/// </summary>
public void Delete()
{
_items = null;
// Reset statistics
ResetStatistics();
}
/// <summary> /// <summary>
/// Get the keys from the file dictionary /// Get the keys from the file dictionary
/// </summary> /// </summary>
@@ -567,17 +556,6 @@ namespace SabreTools.Library.Dats
} }
} }
/// <summary>
/// Reset the file dictionary
/// </summary>
public void Reset()
{
_items = new SortedDictionary<string, List<DatItem>>();
// Reset statistics
ResetStatistics();
}
#endregion #endregion
#region Constructors #region Constructors
@@ -637,7 +615,7 @@ namespace SabreTools.Library.Dats
/// Clones the files dictionary /// Clones the files dictionary
/// </summary> /// </summary>
/// <returns>A new files dictionary instance</returns> /// <returns>A new files dictionary instance</returns>
public SortedDictionary<string, List<DatItem>> CloneFiles() public SortedDictionary<string, List<DatItem>> CloneDictionary()
{ {
// Create the placeholder dictionary to be used // Create the placeholder dictionary to be used
SortedDictionary<string, List<DatItem>> sorted = new SortedDictionary<string, List<DatItem>>(); SortedDictionary<string, List<DatItem>> sorted = new SortedDictionary<string, List<DatItem>>();
@@ -667,6 +645,28 @@ namespace SabreTools.Library.Dats
return sorted; return sorted;
} }
/// <summary>
/// Delete the file dictionary
/// </summary>
public void DeleteDictionary()
{
_items = null;
// Reset statistics
ResetStatistics();
}
/// <summary>
/// Reset the file dictionary
/// </summary>
public void ResetDictionary()
{
_items = new SortedDictionary<string, List<DatItem>>();
// Reset statistics
ResetStatistics();
}
#endregion #endregion
#endregion // Instance Methods #endregion // Instance Methods

View File

@@ -142,7 +142,7 @@ namespace SabreTools.Library.Dats
} }
// Now remove the file dictionary from the souce DAT to save memory // Now remove the file dictionary from the souce DAT to save memory
datHeaders[i].Delete(); datHeaders[i].DeleteDictionary();
}); });
// Now that we have a merged DAT, filter it // Now that we have a merged DAT, filter it
@@ -282,7 +282,7 @@ namespace SabreTools.Library.Dats
diffData.Name += post; diffData.Name += post;
diffData.Description += post; diffData.Description += post;
} }
diffData.Reset(); diffData.ResetDictionary();
outDatsArray[j] = diffData; outDatsArray[j] = diffData;
}); });
@@ -385,7 +385,7 @@ namespace SabreTools.Library.Dats
outerDiffData.FileName += post; outerDiffData.FileName += post;
outerDiffData.Name += post; outerDiffData.Name += post;
outerDiffData.Description += post; outerDiffData.Description += post;
outerDiffData.Reset(); outerDiffData.ResetDictionary();
} }
// Have External dupes // Have External dupes
@@ -396,7 +396,7 @@ namespace SabreTools.Library.Dats
dupeData.FileName += post; dupeData.FileName += post;
dupeData.Name += post; dupeData.Name += post;
dupeData.Description += post; dupeData.Description += post;
dupeData.Reset(); dupeData.ResetDictionary();
} }
// Create a list of DatData objects representing individual output files // Create a list of DatData objects representing individual output files
@@ -414,7 +414,7 @@ namespace SabreTools.Library.Dats
diffData.FileName += innerpost; diffData.FileName += innerpost;
diffData.Name += innerpost; diffData.Name += innerpost;
diffData.Description += innerpost; diffData.Description += innerpost;
diffData.Reset(); diffData.ResetDictionary();
outDatsArray[j] = diffData; outDatsArray[j] = diffData;
}); });

View File

@@ -46,8 +46,8 @@ namespace SabreTools.Library.Dats
_sortedBy = bucketBy; _sortedBy = bucketBy;
// Clone the current dictionary into a new one for sorting then reset the internal one // Clone the current dictionary into a new one for sorting then reset the internal one
SortedDictionary<string, List<DatItem>> sortable = this.CloneFiles(); SortedDictionary<string, List<DatItem>> sortable = this.CloneDictionary();
this.Reset(); this.ResetDictionary();
Globals.Logger.User("Organizing roms by {0}" + (deduperoms != DedupeType.None ? " and merging" : ""), bucketBy); Globals.Logger.User("Organizing roms by {0}" + (deduperoms != DedupeType.None ? " and merging" : ""), bucketBy);

View File

@@ -984,7 +984,7 @@ namespace SabreTools.Library.Dats
// Setup the fixdat // Setup the fixdat
DatFile matched = new DatFile(this); DatFile matched = new DatFile(this);
matched.Reset(); matched.ResetDictionary();
matched.FileName = "fixDat_" + matched.FileName; matched.FileName = "fixDat_" + matched.FileName;
matched.Name = "fixDat_" + matched.Name; matched.Name = "fixDat_" + matched.Name;
matched.Description = "fixDat_" + matched.Description; matched.Description = "fixDat_" + matched.Description;