From ac27791ea3b1b2c3d1a44fa4f2b492158ff22e97 Mon Sep 17 00:00:00 2001 From: morkt Date: Sat, 28 Oct 2017 11:49:15 +0400 Subject: [PATCH] use FormatCatalog.ReadFileList method to read file lists. --- ArcFormats/ArcNEKO.cs | 18 +++--------------- ArcFormats/KiriKiri/CryptAlgorithms.cs | 15 +++------------ ArcFormats/TanukiSoft/ArcTAC.cs | 18 +++--------------- 3 files changed, 9 insertions(+), 42 deletions(-) diff --git a/ArcFormats/ArcNEKO.cs b/ArcFormats/ArcNEKO.cs index e7dc9125..5f2bd054 100644 --- a/ArcFormats/ArcNEKO.cs +++ b/ArcFormats/ArcNEKO.cs @@ -168,21 +168,9 @@ namespace GameRes.Formats.Neko { try { - var dir = FormatCatalog.Instance.DataDirectory; - var lst_file = Path.Combine (dir, "nekopack.lst"); - if (!File.Exists (lst_file)) - return new string[0]; - using (var input = new StreamReader (lst_file)) - { - var names = new List(); - string line; - while ((line = input.ReadLine()) != null) - { - if (line.Length > 0) - names.Add (line); - } - return names.ToArray(); - } + var names = new List(); + FormatCatalog.Instance.ReadFileList ("nekopack.lst", name => names.Add (name)); + return names.ToArray(); } catch (Exception X) { diff --git a/ArcFormats/KiriKiri/CryptAlgorithms.cs b/ArcFormats/KiriKiri/CryptAlgorithms.cs index 69f697f6..1b9c83e3 100644 --- a/ArcFormats/KiriKiri/CryptAlgorithms.cs +++ b/ArcFormats/KiriKiri/CryptAlgorithms.cs @@ -1208,21 +1208,12 @@ namespace GameRes.Formats.KiriKiri void ReadNames () { - var dir = FormatCatalog.Instance.DataDirectory; - var names_file = Path.Combine (dir, FileListName); var names = new Dictionary(); try { - using (var reader = new StreamReader (names_file)) - { - for (;;) - { - var name = reader.ReadLine(); - if (null == name) - break; - names[GetNameHash (name)] = name; - } - } + FormatCatalog.Instance.ReadFileList (FileListName, name => { + names[GetNameHash (name)] = name; + }); } catch (Exception X) { diff --git a/ArcFormats/TanukiSoft/ArcTAC.cs b/ArcFormats/TanukiSoft/ArcTAC.cs index f79a030a..11800931 100644 --- a/ArcFormats/TanukiSoft/ArcTAC.cs +++ b/ArcFormats/TanukiSoft/ArcTAC.cs @@ -210,21 +210,9 @@ namespace GameRes.Formats.Tanuki { try { - var dir = FormatCatalog.Instance.DataDirectory; - var lst_file = Path.Combine (dir, ListFileName); - if (!File.Exists (lst_file)) - return new string[0]; - using (var input = new StreamReader (lst_file)) - { - var names = new List(); - string line; - while ((line = input.ReadLine()) != null) - { - if (line.Length > 0) - names.Add (line); - } - return names.ToArray(); - } + var names = new List(); + FormatCatalog.Instance.ReadFileList (ListFileName, name => names.Add (name)); + return names.ToArray(); } catch (Exception X) {