Skip to content

Commit

Permalink
Add filename as ExtendedProp to GameSet's tables
Browse files Browse the repository at this point in the history
This will allow for an easy way to identify which tables came from the
standard gameset (std.set) and which came from RES files in the DBF
format. This should, eventually, help resolve issues #11, #12 and #37.
  • Loading branch information
sraboy committed Dec 19, 2015
1 parent d632aae commit cc4d5ca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions SkaaEditorUI/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ public static Tuple<Sprite, DataSet> LoadResIdxMultiBmp(string filepath, ColorPa
{
Sprite spr = new Sprite();
DataTable dt = new DataTable();
dt.ExtendedProperties.Add("FileName", filepath);
dt.Columns.Add(new DataColumn() { DataType = typeof(string), ColumnName = "FrameName" });
dt.Columns.Add(new DataColumn() { DataType = typeof(uint), ColumnName = "FrameOffset" });

Expand Down Expand Up @@ -359,6 +360,7 @@ public static Tuple<Sprite, DataSet> LoadResDbf(string filepath, ColorPalette pa
throw new Exception("Failed to read DBF file.");

file.DataTable.TableName = Path.GetFileNameWithoutExtension(filepath);
file.DataTable.ExtendedProperties.Add("FileName", filepath);
ds.Tables.Add(file.DataTable);
}

Expand Down
1 change: 1 addition & 0 deletions SkaaGameDataLib/GameSetFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public static bool OpenGameSet(this DataSet ds, Stream str)
DbfFile file = new DbfFile();
if (file.ReadStream(str) != true) return false;
file.DataTable.TableName = Path.GetFileNameWithoutExtension(kv.Key);// + ".dbf");
file.DataTable.ExtendedProperties.Add("FileName", (str as FileStream)?.Name);
ds.Tables.Add(file.DataTable);
}
return true;
Expand Down

0 comments on commit cc4d5ca

Please sign in to comment.