diff --git a/App.xaml.cs b/App.xaml.cs index 6cd6a9f5..ba88a117 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -113,7 +113,7 @@ namespace GARbro.GUI { if (0 != (file.Attributes & (FileAttributes.System))) continue; - var entry = FormatCatalog.Instance.CreateEntry (file.Name); + var entry = FormatCatalog.Instance.Create (file.Name); entry.Size = (uint)Math.Min (file.Length, uint.MaxValue); list.Add (entry); } diff --git a/ArcFormats/AZSys/ArcAZSys.cs b/ArcFormats/AZSys/ArcAZSys.cs index a8076eba..f47ad54d 100644 --- a/ArcFormats/AZSys/ArcAZSys.cs +++ b/ArcFormats/AZSys/ArcAZSys.cs @@ -71,7 +71,7 @@ namespace GameRes.Formats.AZSys var name = Binary.GetCString (index, index_offset + 0x10, 0x30); if (name.Length > 0) { - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = base_offset + LittleEndian.ToUInt32 (index, index_offset); entry.Size = LittleEndian.ToUInt32 (index, index_offset + 4); if (entry.CheckPlacement (file.MaxOffset)) diff --git a/ArcFormats/ActiveSoft/ArcADPACK.cs b/ArcFormats/ActiveSoft/ArcADPACK.cs index 6ecb99ee..df38bfe1 100644 --- a/ArcFormats/ActiveSoft/ArcADPACK.cs +++ b/ArcFormats/ActiveSoft/ArcADPACK.cs @@ -64,7 +64,7 @@ namespace GameRes.Formats.AdPack string ext = file.View.ReadString (index_offset+8, 4).TrimEnd (null); if (0 != ext.Length) name += '.'+ext; - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); uint offset = file.View.ReadUInt32 (index_offset+12); uint next_offset = file.View.ReadUInt32 (index_offset+0x10+12); entry.Size = next_offset - offset; @@ -107,7 +107,7 @@ namespace GameRes.Formats.AdPack for (uint i = 0; i < count; ++i) { string name = file.View.ReadString (index_offset, 0x18); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); uint offset = file.View.ReadUInt32 (index_offset+0x1c); uint next_offset = file.View.ReadUInt32 (index_offset+0x20+0x1c); entry.Size = next_offset - offset; diff --git a/ArcFormats/AdvSys/ArcAdvSysT.cs b/ArcFormats/AdvSys/ArcAdvSysT.cs index 0ee96d1a..5c4c3c32 100644 --- a/ArcFormats/AdvSys/ArcAdvSysT.cs +++ b/ArcFormats/AdvSys/ArcAdvSysT.cs @@ -60,7 +60,7 @@ namespace GameRes.Formats.AdvSys for (int i = 0; i < count; ++i) { var name = file.View.ReadString (index_offset, 0x18); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Size = file.View.ReadUInt32 (index_offset+0x18); entry.Offset = file.View.ReadUInt32 (index_offset+0x1C); if (entry.Offset < data_offset || !entry.CheckPlacement (file.MaxOffset)) diff --git a/ArcFormats/ArcAVC.cs b/ArcFormats/ArcAVC.cs index 3b619c52..aa4c530b 100644 --- a/ArcFormats/ArcAVC.cs +++ b/ArcFormats/ArcAVC.cs @@ -167,7 +167,7 @@ namespace GameRes.Formats.AVC continue; } var name = Encodings.cp932.GetString (m_index, index_offset, name_length); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); index_offset += 0x107; entry.Offset = m_header_offset + LittleEndian.ToUInt32 (m_index, index_offset); entry.Size = LittleEndian.ToUInt32 (m_index, index_offset+4); diff --git a/ArcFormats/ArcEGO.cs b/ArcFormats/ArcEGO.cs index 74444ff3..d52f9506 100644 --- a/ArcFormats/ArcEGO.cs +++ b/ArcFormats/ArcEGO.cs @@ -60,7 +60,7 @@ namespace GameRes.Formats.Ego if (entry_len <= 0x10 || entry_len > 0x100 || index_offset + entry_len > data_offset) return null; var name = file.View.ReadString (index_offset+0x10, entry_len-0x10); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = file.View.ReadUInt32 (index_offset+8); entry.Size = file.View.ReadUInt32 (index_offset+12); if (entry.Offset < data_offset || !entry.CheckPlacement (file.MaxOffset)) diff --git a/ArcFormats/ArcFVP.cs b/ArcFormats/ArcFVP.cs index f65fa9c0..3d51576d 100644 --- a/ArcFormats/ArcFVP.cs +++ b/ArcFormats/ArcFVP.cs @@ -60,7 +60,7 @@ namespace GameRes.Formats.FVP for (int i = 0; i < count; ++i) { string name = file.View.ReadString (index_offset, 0x20); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = file.View.ReadUInt32 (index_offset+0x20); entry.Size = file.View.ReadUInt32 (index_offset+0x24); if (!entry.CheckPlacement (file.MaxOffset)) diff --git a/ArcFormats/ArcIKS.cs b/ArcFormats/ArcIKS.cs index a3871fcd..858346f7 100644 --- a/ArcFormats/ArcIKS.cs +++ b/ArcFormats/ArcIKS.cs @@ -65,7 +65,7 @@ namespace GameRes.Formats.X return null; file.View.Read (index_offset+1, name_buffer, 0, name_length); string name = Encodings.cp932.GetString (name_buffer, 0, name_length); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = file.View.ReadUInt32 (index_offset+0x20); entry.Size = file.View.ReadUInt32 (index_offset+0x1C); if (entry.Offset < data_offset || !entry.CheckPlacement (file.MaxOffset)) diff --git a/ArcFormats/ArcISA.cs b/ArcFormats/ArcISA.cs index 4afa0826..17b97005 100644 --- a/ArcFormats/ArcISA.cs +++ b/ArcFormats/ArcISA.cs @@ -53,7 +53,7 @@ namespace GameRes.Formats.ISM for (int i = 0; i < count; ++i) { var name = file.View.ReadString (index_offset, 0x0c); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = file.View.ReadUInt32 (index_offset+0x10); entry.Size = file.View.ReadUInt32 (index_offset+0x14); if (!entry.CheckPlacement (file.MaxOffset)) diff --git a/ArcFormats/ArcInnGrey.cs b/ArcFormats/ArcInnGrey.cs index 1bf29e46..98a5d215 100644 --- a/ArcFormats/ArcInnGrey.cs +++ b/ArcFormats/ArcInnGrey.cs @@ -64,8 +64,7 @@ namespace GameRes.Formats.SystemEpsylon for (int i = 0; i < count; ++i) { string name = file.View.ReadString (index_offset, 0x20); - var entry = new PackDatEntry { Name = name }; - entry.Type = FormatCatalog.Instance.GetTypeFromName (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = file.View.ReadUInt32 (index_offset+0x20); entry.Flags = file.View.ReadUInt32 (index_offset+0x24); entry.Size = file.View.ReadUInt32 (index_offset+0x28); diff --git a/ArcFormats/ArcKogado.cs b/ArcFormats/ArcKogado.cs index 511c07b8..9eb435f0 100644 --- a/ArcFormats/ArcKogado.cs +++ b/ArcFormats/ArcKogado.cs @@ -96,8 +96,7 @@ namespace GameRes.Formats.Kogado name = i.ToString ("D5"); if (0 != ext.Length) name += '.'+ext; - var entry = new KogadoEntry { Name = name }; - entry.Type = FormatCatalog.Instance.GetTypeFromName (entry.Name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = data_offset + file.View.ReadUInt32 (index_offset + 0x18); if (version >= 0x200) { diff --git a/ArcFormats/ArcLST.cs b/ArcFormats/ArcLST.cs index f7d1f5fe..525e5813 100644 --- a/ArcFormats/ArcLST.cs +++ b/ArcFormats/ArcLST.cs @@ -84,7 +84,7 @@ namespace GameRes.Formats.Nexton string name = ReadName (lst, index_offset+8, 0x24, 0xcccccccc, cp932); if (0 == name.Length) return null; - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = lst.View.ReadUInt32 (index_offset) ^ 0xcccccccc; entry.Size = lst.View.ReadUInt32 (index_offset+4) ^ 0xcccccccc; if (!entry.CheckPlacement (max_offset)) diff --git a/ArcFormats/ArcMGPK.cs b/ArcFormats/ArcMGPK.cs index 39df3f7a..77ea6cd3 100644 --- a/ArcFormats/ArcMGPK.cs +++ b/ArcFormats/ArcMGPK.cs @@ -51,7 +51,7 @@ namespace GameRes.Formats.Mg { uint name_length = file.View.ReadByte (cur_offset); string name = file.View.ReadString (cur_offset+1, name_length, Encoding.UTF8); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = file.View.ReadUInt32 (cur_offset+0x20); entry.Size = file.View.ReadUInt32 (cur_offset+0x24); if (!entry.CheckPlacement (file.MaxOffset)) diff --git a/ArcFormats/ArcQLIE.cs b/ArcFormats/ArcQLIE.cs index 2fa7c85d..307b664f 100644 --- a/ArcFormats/ArcQLIE.cs +++ b/ArcFormats/ArcQLIE.cs @@ -87,8 +87,7 @@ namespace GameRes.Formats.Qlie name_buffer[k] ^= (byte)(((k + 1) ^ key) + k + 1); string name = Encodings.cp932.GetString (name_buffer, 0, name_length); - var entry = new QlieEntry { Name = name }; - entry.Type = FormatCatalog.Instance.GetTypeFromName (name); + var entry = FormatCatalog.Instance.Create (name); index_offset += 2 + name_length; entry.Offset = file.View.ReadInt64 (index_offset); diff --git a/ArcFormats/BlackCyc/ArcGPK.cs b/ArcFormats/BlackCyc/ArcGPK.cs index 75ceab2e..8b2c16d8 100644 --- a/ArcFormats/BlackCyc/ArcGPK.cs +++ b/ArcFormats/BlackCyc/ArcGPK.cs @@ -71,7 +71,7 @@ namespace GameRes.Formats.BlackCyc return null; string name = gtb.View.ReadString (name_offset, (uint)(gtb.MaxOffset-name_offset)); name += ".dwq"; - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = next_offset; if (i + 1 == count) next_offset = (uint)file.MaxOffset; diff --git a/ArcFormats/BlackCyc/ArcVPK.cs b/ArcFormats/BlackCyc/ArcVPK.cs index 1b843dff..78995e18 100644 --- a/ArcFormats/BlackCyc/ArcVPK.cs +++ b/ArcFormats/BlackCyc/ArcVPK.cs @@ -61,7 +61,7 @@ namespace GameRes.Formats.BlackCyc for (int i = 0; i < count; ++i) { string name = vtb.View.ReadString (index_offset, 8) + ".vaw"; - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = next_offset; index_offset += 0xC; next_offset = vtb.View.ReadUInt32 (index_offset+8); diff --git a/ArcFormats/CatSystem/ArcINT.cs b/ArcFormats/CatSystem/ArcINT.cs index 8cdcf111..adc04de3 100644 --- a/ArcFormats/CatSystem/ArcINT.cs +++ b/ArcFormats/CatSystem/ArcINT.cs @@ -109,7 +109,7 @@ namespace GameRes.Formats.CatSystem for (uint i = 0; i < entry_count; ++i) { string name = file.View.ReadString (current_offset, 0x40); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = file.View.ReadUInt32 (current_offset+0x40); entry.Size = file.View.ReadUInt32 (current_offset+0x44); if (!entry.CheckPlacement (file.MaxOffset)) @@ -150,7 +150,7 @@ namespace GameRes.Formats.CatSystem uint key = twister.Twist (main_key + i); string name = DecipherName (name_info, key); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = eax; entry.Size = edx; if (!entry.CheckPlacement (file.MaxOffset)) diff --git a/ArcFormats/Circus/ArcCircus.cs b/ArcFormats/Circus/ArcCircus.cs index 485f7fd3..bc4032a3 100644 --- a/ArcFormats/Circus/ArcCircus.cs +++ b/ArcFormats/Circus/ArcCircus.cs @@ -70,7 +70,7 @@ namespace GameRes.Formats.Circus if (0 == file.View.ReadByte (index_offset)) return null; string name = file.View.ReadString (index_offset, (uint)name_length); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); index_offset += name_length; uint offset = next_offset; if (i+1 == count) diff --git a/ArcFormats/DraftArc.cs b/ArcFormats/DraftArc.cs index 118947c8..2d71f2a8 100644 --- a/ArcFormats/DraftArc.cs +++ b/ArcFormats/DraftArc.cs @@ -45,7 +45,7 @@ namespace GameRes.Formats.?????? var dir = new List (count); for (int i = 0; i < count; ++i) { - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); if (!entry.CheckPlacement (file.MaxOffset)) return null; dir.Add (entry); diff --git a/ArcFormats/Eagls/ArcEAGLS.cs b/ArcFormats/Eagls/ArcEAGLS.cs index be84cfb6..71bc5eca 100644 --- a/ArcFormats/Eagls/ArcEAGLS.cs +++ b/ArcFormats/Eagls/ArcEAGLS.cs @@ -70,7 +70,7 @@ namespace GameRes.Formats.Eagls break; var name = Binary.GetCString (index, index_offset, name_size); index_offset += name_size; - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); if (name.EndsWith (".dat", StringComparison.InvariantCultureIgnoreCase)) entry.Type = "script"; if (long_offsets) diff --git a/ArcFormats/Emic/ArcPACK.cs b/ArcFormats/Emic/ArcPACK.cs index 8f3372cd..4e3f37ee 100644 --- a/ArcFormats/Emic/ArcPACK.cs +++ b/ArcFormats/Emic/ArcPACK.cs @@ -119,7 +119,7 @@ namespace GameRes.Formats.Emic index_offset += 4; Read (index_offset, index_buf, 0, name_len+8); string name = Binary.GetCString (index_buf, 0, name_len); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = LittleEndian.ToUInt32 (index_buf, name_len+4); entry.Size = LittleEndian.ToUInt32 (index_buf, name_len); if (!entry.CheckPlacement (m_file.MaxOffset)) diff --git a/ArcFormats/Ethornell/ArcBGI.cs b/ArcFormats/Ethornell/ArcBGI.cs index 99c27a74..320faf9f 100644 --- a/ArcFormats/Ethornell/ArcBGI.cs +++ b/ArcFormats/Ethornell/ArcBGI.cs @@ -61,7 +61,7 @@ namespace GameRes.Formats.BGI for (uint i = 0; i < count; ++i) { string name = file.View.ReadString (index_offset, 0x10); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = base_offset + file.View.ReadUInt32 (index_offset+0x10); entry.Size = file.View.ReadUInt32 (index_offset+0x14); if (!entry.CheckPlacement (file.MaxOffset)) @@ -121,7 +121,7 @@ namespace GameRes.Formats.BGI for (uint i = 0; i < count; ++i) { string name = file.View.ReadString (index_offset, 0x60); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = base_offset + file.View.ReadUInt32 (index_offset+0x60); entry.Size = file.View.ReadUInt32 (index_offset+0x64); if (!entry.CheckPlacement (file.MaxOffset)) diff --git a/ArcFormats/Ffa/ArcBlackPackage.cs b/ArcFormats/Ffa/ArcBlackPackage.cs index 4a72aa6e..8ca924dc 100644 --- a/ArcFormats/Ffa/ArcBlackPackage.cs +++ b/ArcFormats/Ffa/ArcBlackPackage.cs @@ -64,7 +64,7 @@ namespace GameRes.Formats.Ffa for (int i = 0; i < count; ++i) { string name = lst.View.ReadString (index_offset, 14); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = lst.View.ReadUInt32 (index_offset+14); entry.Size = lst.View.ReadUInt32 (index_offset+18); if (!entry.CheckPlacement (file.MaxOffset)) diff --git a/ArcFormats/Ffa/ArcFFA.cs b/ArcFormats/Ffa/ArcFFA.cs index b671bd10..e366f3d0 100644 --- a/ArcFormats/Ffa/ArcFFA.cs +++ b/ArcFormats/Ffa/ArcFFA.cs @@ -70,7 +70,7 @@ namespace GameRes.Formats.Ffa for (int i = 0; i < count; ++i) { var name = file.View.ReadString (index_offset, 0x10); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = file.View.ReadUInt32 (index_offset+0x10); entry.Size = file.View.ReadUInt32 (index_offset+0x14); if (!entry.CheckPlacement (file.MaxOffset)) diff --git a/ArcFormats/FlyingShine/ArcPD.cs b/ArcFormats/FlyingShine/ArcPD.cs index ed027e22..d3bcd493 100644 --- a/ArcFormats/FlyingShine/ArcPD.cs +++ b/ArcFormats/FlyingShine/ArcPD.cs @@ -71,7 +71,7 @@ namespace GameRes.Formats.Fs for (uint i = 0; i < count; ++i) { string name = file.View.ReadString (cur_offset, 0x80); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = file.View.ReadInt64 (cur_offset+0x80); entry.Size = file.View.ReadUInt32 (cur_offset+0x88); if (!entry.CheckPlacement (file.MaxOffset)) @@ -258,7 +258,7 @@ namespace GameRes.Formats.Fs if (len <= 0 || len >= 0x24) return null; string name = enc.GetString (buf, 0, len); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); uint shift = LittleEndian.ToUInt32 (buf, 0x24); entry.Offset = LittleEndian.ToUInt32 (buf, 0x28) - shift; entry.Size = LittleEndian.ToUInt32 (buf, 0x2c) - shift; diff --git a/ArcFormats/GSD/ArcGSP.cs b/ArcFormats/GSD/ArcGSP.cs index afb4b7ea..57549a35 100644 --- a/ArcFormats/GSD/ArcGSP.cs +++ b/ArcFormats/GSD/ArcGSP.cs @@ -54,7 +54,7 @@ namespace GameRes.Formats.BlackRainbow for (int i = 0; i < count; ++i) { string name = file.View.ReadString (index_offset+8, 0x38); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = file.View.ReadUInt32 (index_offset); entry.Size = file.View.ReadUInt32 (index_offset+4); if (entry.Offset < data_offset || !entry.CheckPlacement (file.MaxOffset)) @@ -104,7 +104,7 @@ namespace GameRes.Formats.BlackRainbow { long offset = index[i]; string name = file.View.ReadString (offset, 0x20); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = offset + 0x24; entry.Size = file.View.ReadUInt32 (offset+0x20); dir.Add (entry); diff --git a/ArcFormats/Ikura/ArcDRS.cs b/ArcFormats/Ikura/ArcDRS.cs index 121c2150..7b846afb 100644 --- a/ArcFormats/Ikura/ArcDRS.cs +++ b/ArcFormats/Ikura/ArcDRS.cs @@ -84,7 +84,7 @@ namespace GameRes.Formats.Ikura if (next_offset > file.MaxOffset || next_offset < offset) return null; string name = encoding.GetString (name_raw, 0, name_length).ToLowerInvariant(); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = offset; entry.Size = next_offset - offset; dir.Add (entry); @@ -155,7 +155,7 @@ namespace GameRes.Formats.Ikura has_scripts = true; } else - entry = FormatCatalog.Instance.CreateEntry (name); + entry = FormatCatalog.Instance.Create (name); entry.Offset = file.View.ReadUInt32 (dir_offset+12); entry.Size = file.View.ReadUInt32 (dir_offset+16); if (!entry.CheckPlacement (file.MaxOffset)) diff --git a/ArcFormats/Interheart/ArcFPK.cs b/ArcFormats/Interheart/ArcFPK.cs index 759825b4..d7745935 100644 --- a/ArcFormats/Interheart/ArcFPK.cs +++ b/ArcFormats/Interheart/ArcFPK.cs @@ -68,7 +68,7 @@ namespace GameRes.Formats.CandySoft for (int i = 0; i < count; ++i) { string name = file.View.ReadString (index_offset+8, (uint)name_size); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = file.View.ReadUInt32 (index_offset); entry.Size = file.View.ReadUInt32 (index_offset+4); if (entry.Offset < index_size || !entry.CheckPlacement (file.MaxOffset)) diff --git a/ArcFormats/Liar/ArcXFL.cs b/ArcFormats/Liar/ArcXFL.cs index c612b1cb..8031fbf3 100644 --- a/ArcFormats/Liar/ArcXFL.cs +++ b/ArcFormats/Liar/ArcXFL.cs @@ -63,7 +63,7 @@ namespace GameRes.Formats.Liar if (cur_offset+40 > base_offset) return null; string name = file.View.ReadString (cur_offset, 32); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = base_offset + file.View.ReadUInt32 (cur_offset+32); entry.Size = file.View.ReadUInt32 (cur_offset+36); if (!entry.CheckPlacement (max_offset)) diff --git a/ArcFormats/Lilim/ArcAOS.cs b/ArcFormats/Lilim/ArcAOS.cs index 0877fe76..0b3107d3 100644 --- a/ArcFormats/Lilim/ArcAOS.cs +++ b/ArcFormats/Lilim/ArcAOS.cs @@ -78,7 +78,7 @@ namespace GameRes.Formats.Lilim if (-1 == name_length) name_length = name_buf.Length; var name = Encodings.cp932.GetString (name_buf, 0, name_length); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = file.View.ReadUInt32 (current_offset+0x10); entry.Size = file.View.ReadUInt32 (current_offset+0x14); current_offset += 0x20; diff --git a/ArcFormats/Majiro/ArcMajiro.cs b/ArcFormats/Majiro/ArcMajiro.cs index becb5696..79459d3c 100644 --- a/ArcFormats/Majiro/ArcMajiro.cs +++ b/ArcFormats/Majiro/ArcMajiro.cs @@ -93,7 +93,7 @@ namespace GameRes.Formats.Majiro names_pos = zero+1; uint offset = offset_next; offset_next = file.View.ReadUInt32 (table_pos + entry_size + hash_size); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = offset; if (1 == version) entry.Size = offset_next >= offset ? offset_next - offset : 0; diff --git a/ArcFormats/Malie/ArcLIB.cs b/ArcFormats/Malie/ArcLIB.cs index 26b37517..283c9975 100644 --- a/ArcFormats/Malie/ArcLIB.cs +++ b/ArcFormats/Malie/ArcLIB.cs @@ -96,7 +96,7 @@ namespace GameRes.Formats.Malie if (offset < data_offset || offset + entry_size > base_offset + size) return false; - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = offset; entry.Size = entry_size; m_dir.Add (entry); @@ -226,7 +226,7 @@ namespace GameRes.Formats.Malie continue; } long entry_offset = m_base_offset + ((long)m_offset_table[offset] << 10); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); if (entry.CheckPlacement (m_max_offset)) { entry.Offset = entry_offset; diff --git a/ArcFormats/NScripter/ArcNSA.cs b/ArcFormats/NScripter/ArcNSA.cs index 19e13688..dd0ec41c 100644 --- a/ArcFormats/NScripter/ArcNSA.cs +++ b/ArcFormats/NScripter/ArcNSA.cs @@ -87,7 +87,7 @@ namespace GameRes.Formats.ONScripter return null; string name = Encodings.cp932.GetString (name_buffer, 0, name_len); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = Binary.BigEndian (file.View.ReadUInt32 (cur_offset)) + (long)base_offset; entry.Size = Binary.BigEndian (file.View.ReadUInt32 (cur_offset+4)); if (!entry.CheckPlacement (file.MaxOffset)) @@ -222,12 +222,9 @@ namespace GameRes.Formats.ONScripter if (base_offset - cur_offset < 13) return null; - var entry = new NsaEntry - { - Name = Encodings.cp932.GetString (name_buffer, 0, name_len), - }; + var name = Encodings.cp932.GetString (name_buffer, 0, name_len); + var entry = FormatCatalog.Instance.Create (name); byte compression_type = file.View.ReadByte (cur_offset); - entry.Type = FormatCatalog.Instance.GetTypeFromName (entry.Name); entry.Offset = Binary.BigEndian (file.View.ReadUInt32 (cur_offset+1)) + (long)base_offset; entry.Size = Binary.BigEndian (file.View.ReadUInt32 (cur_offset+5)); if (!entry.CheckPlacement (file.MaxOffset)) diff --git a/ArcFormats/NitroPlus/ArcNitro.cs b/ArcFormats/NitroPlus/ArcNitro.cs index 585efe98..2d60e2c5 100644 --- a/ArcFormats/NitroPlus/ArcNitro.cs +++ b/ArcFormats/NitroPlus/ArcNitro.cs @@ -101,8 +101,7 @@ namespace GameRes.Formats.NitroPlus if (name_length != header.Read (name_buf, 0, name_length)) return null; var name = Encodings.cp932.GetString (name_buf, 0, name_length); - var entry = new PackedEntry { Name = name }; - entry.Type = FormatCatalog.Instance.GetTypeFromName (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = base_offset + header.ReadUInt32(); entry.UnpackedSize = header.ReadUInt32(); entry.Size = header.ReadUInt32(); diff --git a/ArcFormats/NitroPlus/ArcSteinsGate.cs b/ArcFormats/NitroPlus/ArcSteinsGate.cs index 87df14f0..13cfb380 100644 --- a/ArcFormats/NitroPlus/ArcSteinsGate.cs +++ b/ArcFormats/NitroPlus/ArcSteinsGate.cs @@ -85,7 +85,7 @@ namespace GameRes.Formats Encoding enc = GuessEncoding (name_raw); string filename = enc.GetString (name_raw); - var entry = FormatCatalog.Instance.CreateEntry (filename); + var entry = FormatCatalog.Instance.Create (filename); entry.Size = header.ReadUInt32(); entry.Offset = header.ReadInt64(); if (!entry.CheckPlacement (file.MaxOffset)) diff --git a/ArcFormats/Pajamas/ArcGameDat.cs b/ArcFormats/Pajamas/ArcGameDat.cs index 27fc89eb..5a76c2a4 100644 --- a/ArcFormats/Pajamas/ArcGameDat.cs +++ b/ArcFormats/Pajamas/ArcGameDat.cs @@ -70,7 +70,7 @@ namespace GameRes.Formats.Pajamas for (int i = 0; i < count; ++i) { var name = file.View.ReadString (name_offset, (uint)name_length); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = base_offset + file.View.ReadUInt32 (index_offset); entry.Size = file.View.ReadUInt32 (index_offset+4); if (!entry.CheckPlacement (file.MaxOffset)) diff --git a/ArcFormats/Properties/AssemblyInfo.cs b/ArcFormats/Properties/AssemblyInfo.cs index 5f866893..6e38de22 100644 --- a/ArcFormats/Properties/AssemblyInfo.cs +++ b/ArcFormats/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion ("1.1.9.418")] -[assembly: AssemblyFileVersion ("1.1.9.418")] +[assembly: AssemblyVersion ("1.1.9.419")] +[assembly: AssemblyFileVersion ("1.1.9.419")] diff --git a/ArcFormats/RenPy/ArcRPA.cs b/ArcFormats/RenPy/ArcRPA.cs index 641a55b5..4c181f8e 100644 --- a/ArcFormats/RenPy/ArcRPA.cs +++ b/ArcFormats/RenPy/ArcRPA.cs @@ -98,14 +98,10 @@ namespace GameRes.Formats.RenPy Trace.WriteLine ("invalid index tuple", "RpaOpener.TryOpen"); return null; } - var entry = new RpaEntry - { - Name = name, - Type = FormatCatalog.Instance.GetTypeFromName (name), - Offset = (uint)((int)tuple[0] ^ key), - UnpackedSize = (uint)((int)tuple[1] ^ key), - }; - entry.Size = entry.UnpackedSize; + var entry = FormatCatalog.Instance.Create (name); + entry.Offset = (uint)((int)tuple[0] ^ key); + entry.UnpackedSize = (uint)((int)tuple[1] ^ key); + entry.Size = entry.UnpackedSize; if (tuple.Count > 2) { entry.Header = tuple[2] as byte[]; diff --git a/ArcFormats/ShiinaRio/ArcWARC.cs b/ArcFormats/ShiinaRio/ArcWARC.cs index a94edb99..68e613f6 100644 --- a/ArcFormats/ShiinaRio/ArcWARC.cs +++ b/ArcFormats/ShiinaRio/ArcWARC.cs @@ -117,10 +117,7 @@ namespace GameRes.Formats.ShiinaRio // 椎名里緒 while (name_buf.Length == header.Read (name_buf, 0, name_buf.Length)) { var name = Binary.GetCString (name_buf, 0, name_buf.Length); - var entry = new WarcEntry { - Name = name, - Type = FormatCatalog.Instance.GetTypeFromName (name) - }; + var entry = FormatCatalog.Instance.Create (name); entry.Offset = header.ReadUInt32(); entry.Size = header.ReadUInt32(); if (!entry.CheckPlacement (file.MaxOffset)) diff --git a/ArcFormats/Silky/ArcIFL.cs b/ArcFormats/Silky/ArcIFL.cs index eaec80ae..9df7eac6 100644 --- a/ArcFormats/Silky/ArcIFL.cs +++ b/ArcFormats/Silky/ArcIFL.cs @@ -55,7 +55,7 @@ namespace GameRes.Formats.Silky string name = file.View.ReadString (index_offset, 0x10); if (0 == name.Length) return null; - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = file.View.ReadUInt32 (index_offset+0x10); entry.Size = file.View.ReadUInt32 (index_offset+0x14); if (!entry.CheckPlacement (file.MaxOffset)) diff --git a/ArcFormats/UMeSoft/ArcPK.cs b/ArcFormats/UMeSoft/ArcPK.cs index 9f8a60dd..1de5925f 100644 --- a/ArcFormats/UMeSoft/ArcPK.cs +++ b/ArcFormats/UMeSoft/ArcPK.cs @@ -66,7 +66,7 @@ namespace GameRes.Formats.UMeSoft return null; string name = file.View.ReadString (index_offset, name_len); index_offset += name_len+6; - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Size = file.View.ReadUInt32 (index_offset); entry.Offset = file.View.ReadUInt32 (index_offset+4); if (!entry.CheckPlacement (index_offset)) diff --git a/ArcFormats/WildBug/ArcWBP.cs b/ArcFormats/WildBug/ArcWBP.cs index 4c7a1eae..0a34625d 100644 --- a/ArcFormats/WildBug/ArcWBP.cs +++ b/ArcFormats/WildBug/ArcWBP.cs @@ -60,7 +60,7 @@ namespace GameRes.Formats.WildBug string name = file.View.ReadString (index_offset+0x14, name_length); if (0 == name.Length) return null; - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = file.View.ReadUInt32 (index_offset); entry.Size = file.View.ReadUInt32 (index_offset+4); if (!entry.CheckPlacement (file.MaxOffset)) diff --git a/ArcFormats/Will/ArcWILL.cs b/ArcFormats/Will/ArcWILL.cs index 12f94fc8..81a9ae0a 100644 --- a/ArcFormats/Will/ArcWILL.cs +++ b/ArcFormats/Will/ArcWILL.cs @@ -97,7 +97,7 @@ namespace GameRes.Formats.Will if (string.IsNullOrEmpty (name)) return null; name = name.ToLowerInvariant()+'.'+ext.Extension; - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Size = file.View.ReadUInt32 (dir_offset+name_size); entry.Offset = file.View.ReadUInt32 (dir_offset+name_size+4); if (!entry.CheckPlacement (file.MaxOffset)) diff --git a/ArcFormats/Xuse/ArcWAG.cs b/ArcFormats/Xuse/ArcWAG.cs index 9c1f707e..8e4160d2 100644 --- a/ArcFormats/Xuse/ArcWAG.cs +++ b/ArcFormats/Xuse/ArcWAG.cs @@ -163,7 +163,7 @@ namespace GameRes.Formats.Xuse if (!string.IsNullOrEmpty (filename)) { filename = DriveRe.Replace (filename, ""); - entry = FormatCatalog.Instance.CreateEntry (filename); + entry = FormatCatalog.Instance.Create (filename); } else { diff --git a/ArcFormats/Xuse/ArcXuse.cs b/ArcFormats/Xuse/ArcXuse.cs index 2fca484f..d9cea12f 100644 --- a/ArcFormats/Xuse/ArcXuse.cs +++ b/ArcFormats/Xuse/ArcXuse.cs @@ -97,7 +97,7 @@ namespace GameRes.Formats.Xuse name_buf[n] ^= 0x56; var name = Encodings.cp932.GetString (name_buf, 0, name_length); - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Offset = cadr_view.ReadInt64 (cadr_offset); if (entry.Offset >= file.MaxOffset) return null; diff --git a/ArcFormats/elf/ArcAi5Win.cs b/ArcFormats/elf/ArcAi5Win.cs index ca08424e..a61eb3b6 100644 --- a/ArcFormats/elf/ArcAi5Win.cs +++ b/ArcFormats/elf/ArcAi5Win.cs @@ -84,7 +84,7 @@ namespace GameRes.Formats.Elf if (0 == name.Length) return null; index_offset += scheme.NameLength; - var entry = FormatCatalog.Instance.CreateEntry (name); + var entry = FormatCatalog.Instance.Create (name); entry.Size = file.View.ReadUInt32 (index_offset) ^ scheme.SizeKey; entry.Offset = file.View.ReadUInt32 (index_offset+4) ^ scheme.OffsetKey; if (entry.Offset < index_size+4 || !entry.CheckPlacement (file.MaxOffset)) diff --git a/ArcFormats/elf/ArcHED.cs b/ArcFormats/elf/ArcHED.cs index 5d5e5bd6..c42c108b 100644 --- a/ArcFormats/elf/ArcHED.cs +++ b/ArcFormats/elf/ArcHED.cs @@ -84,7 +84,7 @@ namespace GameRes.Formats.Elf var dir = new List (file_map.Count); for (int i = 0; i < file_map.Count; ++i) { - var entry = FormatCatalog.Instance.CreateEntry (file_map[i]); + var entry = FormatCatalog.Instance.Create (file_map[i]); entry.Offset = pak.View.ReadUInt32 (index_offset); entry.Size = pak.View.ReadUInt32 (index_offset + 4); if (!entry.CheckPlacement (bin.MaxOffset)) @@ -104,7 +104,7 @@ namespace GameRes.Formats.Elf var dir = new List (file_map.Count); for (int i = 0; i < file_map.Count; ++i) { - var entry = FormatCatalog.Instance.CreateEntry (file_map[i]); + var entry = FormatCatalog.Instance.Create (file_map[i]); entry.Offset = pak.View.ReadUInt32 (index_offset); entry.Size = pak.View.ReadUInt32 (index_offset + 4); if (!entry.CheckPlacement (bin.MaxOffset)) diff --git a/GameRes/FileSystem.cs b/GameRes/FileSystem.cs index 5bbb806a..e4ea47dd 100644 --- a/GameRes/FileSystem.cs +++ b/GameRes/FileSystem.cs @@ -103,7 +103,7 @@ namespace GameRes private Entry EntryFromFileInfo (FileInfo file) { - var entry = FormatCatalog.Instance.CreateEntry (file.FullName); + var entry = FormatCatalog.Instance.Create (file.FullName); entry.Size = (uint)Math.Min (file.Length, uint.MaxValue); return entry; } diff --git a/GameRes/GameRes.cs b/GameRes/GameRes.cs index 7440e896..3a6f5ec9 100644 --- a/GameRes/GameRes.cs +++ b/GameRes/GameRes.cs @@ -91,9 +91,9 @@ namespace GameRes /// /// Create empty Entry that corresponds to implemented resource. /// - public virtual Entry CreateEntry () + public EntryType Create () where EntryType : Entry, new() { - return new Entry { Type = this.Type }; + return new EntryType { Type = this.Type }; } protected IResource () @@ -363,19 +363,14 @@ namespace GameRes /// May be thrown if filename contains invalid /// characters. /// - public Entry CreateEntry (string filename) + public EntryType Create (string filename) where EntryType : Entry, new() { - Entry entry = null; - string ext = Path.GetExtension (filename); - if (!string.IsNullOrEmpty (ext)) - { - ext = ext.TrimStart ('.').ToUpperInvariant(); - var range = m_extension_map.GetValues (ext, false); - if (null != range) - entry = range.First().CreateEntry(); - } + EntryType entry = null; + var formats = LookupFileName (filename); + if (formats.Any()) + entry = formats.First().Create(); if (null == entry) - entry = new Entry(); + entry = new EntryType(); entry.Name = filename; return entry; } diff --git a/GameRes/Image.cs b/GameRes/Image.cs index dd8a7580..6c1723e3 100644 --- a/GameRes/Image.cs +++ b/GameRes/Image.cs @@ -173,11 +173,6 @@ namespace GameRes return null; } - public override Entry CreateEntry () - { - return new ImageEntry(); - } - public bool IsBuiltin { get { return this.GetType().Assembly == typeof(ImageFormat).Assembly; } diff --git a/GameRes/Properties/AssemblyInfo.cs b/GameRes/Properties/AssemblyInfo.cs index 7557cdbd..71ab3354 100644 --- a/GameRes/Properties/AssemblyInfo.cs +++ b/GameRes/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion ("1.1.6.8")] -[assembly: AssemblyFileVersion ("1.1.6.8")] +[assembly: AssemblyVersion ("1.1.7.89")] +[assembly: AssemblyFileVersion ("1.1.7.89")] diff --git a/GarCreate.cs b/GarCreate.cs index f51e412d..c6f9d6f3 100644 --- a/GarCreate.cs +++ b/GarCreate.cs @@ -231,7 +231,7 @@ namespace GARbro.GUI if (file.Length >= uint.MaxValue) continue; string name = Path.Combine (path, file.Name); - var e = FormatCatalog.Instance.CreateEntry (name); + var e = FormatCatalog.Instance.Create (name); e.Size = (uint)file.Length; list.Add (e); } diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 6dd989f2..120ff092 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -51,5 +51,5 @@ using System.Windows; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion ("1.1.5.642")] -[assembly: AssemblyFileVersion ("1.1.5.642")] +[assembly: AssemblyVersion ("1.1.5.656")] +[assembly: AssemblyFileVersion ("1.1.5.656")]