diff --git a/ArcFormats/ArcNEKO.cs b/ArcFormats/ArcNEKO.cs index 202ac81a..822d6a59 100644 --- a/ArcFormats/ArcNEKO.cs +++ b/ArcFormats/ArcNEKO.cs @@ -122,7 +122,7 @@ namespace GameRes.Formats.Neko static string[] KnownFileNames { get { return s_known_file_names.Value; } } static string[] s_known_dir_names = { - "image/actor", "image/back", "image/mask", "image/visual", + "image/actor", "image/back", "image/mask", "image/visual", "image/actor/big", "sound/bgm", "sound/env", "sound/se", "voice", "script", "system", "count", }; @@ -177,7 +177,7 @@ namespace GameRes.Formats.Neko { try { - var dir = Path.GetDirectoryName (System.Reflection.Assembly.GetExecutingAssembly().Location); + var dir = FormatCatalog.Instance.DataDirectory; var lst_file = Path.Combine (dir, "nekopack.lst"); if (!File.Exists (lst_file)) return new string[0]; diff --git a/ArcFormats/NonColor/ArcDAT.cs b/ArcFormats/NonColor/ArcDAT.cs index f89eae5d..67c7bee1 100644 --- a/ArcFormats/NonColor/ArcDAT.cs +++ b/ArcFormats/NonColor/ArcDAT.cs @@ -219,7 +219,7 @@ namespace GameRes.Formats.NonColor { if (null != LastAccessedScheme && LastAccessedScheme.Item1 == scheme.Hash) return LastAccessedScheme.Item2; - var dir = Path.GetDirectoryName (System.Reflection.Assembly.GetExecutingAssembly().Location); + var dir = FormatCatalog.Instance.DataDirectory; var lst_file = Path.Combine (dir, PersistentFileMapName); var idx_file = Path.ChangeExtension (lst_file, ".idx"); using (var idx_stream = File.OpenRead (idx_file)) diff --git a/GameRes/FormatCatalog.cs b/GameRes/FormatCatalog.cs index 2f308ad3..f5fe25bc 100644 --- a/GameRes/FormatCatalog.cs +++ b/GameRes/FormatCatalog.cs @@ -70,11 +70,15 @@ namespace GameRes public int CurrentSchemeVersion { get; private set; } public string SchemeID { get { return "GARbroDB"; } } + public string AssemblyLocation { get { return m_gameres_dir.Value; } } + public string DataDirectory { get { return AssemblyLocation; } } public Exception LastError { get; set; } public event ParametersRequestEventHandler ParametersRequest; + private Lazy m_gameres_dir = new Lazy (() => Path.GetDirectoryName (System.Reflection.Assembly.GetExecutingAssembly().Location)); + private FormatCatalog () { //An aggregate catalog that combines multiple catalogs @@ -82,7 +86,7 @@ namespace GameRes //Adds all the parts found in the same assembly as the Program class catalog.Catalogs.Add (new AssemblyCatalog (typeof(FormatCatalog).Assembly)); //Adds parts matching pattern found in the directory of the assembly - catalog.Catalogs.Add (new DirectoryCatalog (Path.GetDirectoryName (System.Reflection.Assembly.GetExecutingAssembly().Location), "Arc*.dll")); + catalog.Catalogs.Add (new DirectoryCatalog (AssemblyLocation, "Arc*.dll")); //Create the CompositionContainer with the parts in the catalog using (var container = new CompositionContainer (catalog))