Skip to content

Commit

Permalink
Fixed an issue with the DAT File save as functionality where the DAT …
Browse files Browse the repository at this point in the history
…header was not being written in the new file.
  • Loading branch information
dreasgrech committed May 17, 2022
1 parent f81bf96 commit 487230c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
9 changes: 9 additions & 0 deletions DROMsM/Forms/DATFileViewerForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,15 @@ private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
var rootNodeXMLOpeningTag = currentDATFile.GetRootNodeXMLOpeningTag();
fullXMLFileStringBuilder.AppendLine(rootNodeXMLOpeningTag);

// If this file has a header, write the header now
var datFileHeader = currentDATFile.Header;
if (datFileHeader != null)
{
var headerXMLValue = datFileHeader.XMLValue;
fullXMLFileStringBuilder.Append("\t");
fullXMLFileStringBuilder.AppendLine(headerXMLValue);
}

// Write all the filtered nodes
var filteredObjectList = datFileMachineVirtualListDataSource.FilteredObjectList;
foreach (DATFileMachine datFileMachine in filteredObjectList)
Expand Down
3 changes: 3 additions & 0 deletions DROMsM/U8XMLDATFileHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ public DATFile ParseDATFile(string filePath, out HashSet<DATFileMachineField> us
}
}

// Save the header XML node
datFileHeader.XMLValue = firstMachineNode.AsRawString().ToString();

datFile.Header = datFileHeader;

// Skip the first node since we've now already processed it and determined it's a header node
Expand Down
14 changes: 8 additions & 6 deletions DRomsMUtils/Entities/DATFileHeader.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
public class DATFileHeader
{
public string Name { get; set; }
public string Description { get; set; }
public string Version { get; set; }
public string Author { get; set; }
public string Homepage { get; set; }
public string URL { get; set; }
public string Name;// { get; set; }
public string Description;// { get; set; }
public string Version;// { get; set; }
public string Author;// { get; set; }
public string Homepage;// { get; set; }
public string URL;// { get; set; }

public string XMLValue;// { get; set; }
}

0 comments on commit 487230c

Please sign in to comment.