mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Semi-fix DatHeader constructor
This commit is contained in:
@@ -83,24 +83,25 @@ namespace SabreTools.DatFiles
|
|||||||
|
|
||||||
public DatHeader(Models.Metadata.Header header)
|
public DatHeader(Models.Metadata.Header header)
|
||||||
{
|
{
|
||||||
|
// Create a new internal model
|
||||||
|
_internal = new Models.Metadata.Header();
|
||||||
|
|
||||||
// Get all fields to automatically copy without processing
|
// Get all fields to automatically copy without processing
|
||||||
var nonItemFields = TypeHelper.GetConstants(typeof(Models.Metadata.Header));
|
var nonItemFields = TypeHelper.GetConstants(typeof(Models.Metadata.Header));
|
||||||
if (nonItemFields == null)
|
if (nonItemFields != null)
|
||||||
return;
|
{
|
||||||
|
|
||||||
// Populate the internal machine from non-filter fields
|
// Populate the internal machine from non-filter fields
|
||||||
_internal = new Models.Metadata.Header();
|
|
||||||
foreach (string fieldName in nonItemFields)
|
foreach (string fieldName in nonItemFields)
|
||||||
{
|
{
|
||||||
if (header.ContainsKey(fieldName))
|
if (header.ContainsKey(fieldName))
|
||||||
_internal[fieldName] = header[fieldName];
|
_internal[fieldName] = header[fieldName];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Get all fields specific to the DatFiles implementation
|
// Get all fields specific to the DatFiles implementation
|
||||||
var nonStandardFields = TypeHelper.GetConstants(typeof(DatHeader));
|
var nonStandardFields = TypeHelper.GetConstants(typeof(DatHeader));
|
||||||
if (nonStandardFields == null)
|
if (nonStandardFields != null)
|
||||||
return;
|
{
|
||||||
|
|
||||||
// Populate the internal machine from filter fields
|
// Populate the internal machine from filter fields
|
||||||
foreach (string fieldName in nonStandardFields)
|
foreach (string fieldName in nonStandardFields)
|
||||||
{
|
{
|
||||||
@@ -108,6 +109,7 @@ namespace SabreTools.DatFiles
|
|||||||
_internal[fieldName] = header[fieldName];
|
_internal[fieldName] = header[fieldName];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user