mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-27 15:44:00 +08:00
use FormatCatalog.ReadFileList method to read file lists.
This commit is contained in:
parent
4517bd55e8
commit
ac27791ea3
@ -167,23 +167,11 @@ namespace GameRes.Formats.Neko
|
|||||||
static string[] ReadNekoPackLst ()
|
static string[] ReadNekoPackLst ()
|
||||||
{
|
{
|
||||||
try
|
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>();
|
var names = new List<string>();
|
||||||
string line;
|
FormatCatalog.Instance.ReadFileList ("nekopack.lst", name => names.Add (name));
|
||||||
while ((line = input.ReadLine()) != null)
|
|
||||||
{
|
|
||||||
if (line.Length > 0)
|
|
||||||
names.Add (line);
|
|
||||||
}
|
|
||||||
return names.ToArray();
|
return names.ToArray();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception X)
|
catch (Exception X)
|
||||||
{
|
{
|
||||||
Trace.WriteLine (X.Message, "[NEKOPACK]");
|
Trace.WriteLine (X.Message, "[NEKOPACK]");
|
||||||
|
@ -1208,21 +1208,12 @@ namespace GameRes.Formats.KiriKiri
|
|||||||
|
|
||||||
void ReadNames ()
|
void ReadNames ()
|
||||||
{
|
{
|
||||||
var dir = FormatCatalog.Instance.DataDirectory;
|
|
||||||
var names_file = Path.Combine (dir, FileListName);
|
|
||||||
var names = new Dictionary<uint, string>();
|
var names = new Dictionary<uint, string>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var reader = new StreamReader (names_file))
|
FormatCatalog.Instance.ReadFileList (FileListName, name => {
|
||||||
{
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
var name = reader.ReadLine();
|
|
||||||
if (null == name)
|
|
||||||
break;
|
|
||||||
names[GetNameHash (name)] = name;
|
names[GetNameHash (name)] = name;
|
||||||
}
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception X)
|
catch (Exception X)
|
||||||
{
|
{
|
||||||
|
@ -209,23 +209,11 @@ namespace GameRes.Formats.Tanuki
|
|||||||
static string[] ReadTanukiLst ()
|
static string[] ReadTanukiLst ()
|
||||||
{
|
{
|
||||||
try
|
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>();
|
var names = new List<string>();
|
||||||
string line;
|
FormatCatalog.Instance.ReadFileList (ListFileName, name => names.Add (name));
|
||||||
while ((line = input.ReadLine()) != null)
|
|
||||||
{
|
|
||||||
if (line.Length > 0)
|
|
||||||
names.Add (line);
|
|
||||||
}
|
|
||||||
return names.ToArray();
|
return names.ToArray();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception X)
|
catch (Exception X)
|
||||||
{
|
{
|
||||||
System.Diagnostics.Trace.WriteLine (X.Message, "[TAC]");
|
System.Diagnostics.Trace.WriteLine (X.Message, "[TAC]");
|
||||||
|
Loading…
Reference in New Issue
Block a user