Ejemplo n.º 1
0
    public static ZipFile GetFAFZipFileInstance(string scd)
    {
        Initialize();

        if (FafNotInstalled)
        {
            return(null);
        }

        if (!ScdFiles.ContainsKey(scd))
        {
            // Original files not loaded, return
            Debug.LogWarning("Original files were not loaded before loading FAF, return");
            return(null);
        }

        if (!FAFScdFiles.ContainsKey(scd))
        {
            string ScdPath = EnvPaths.FAFGamedataPath + scd.Replace("scd", "nx2");
            if (!Directory.Exists(Path.GetDirectoryName(ScdPath)) || !File.Exists(ScdPath))
            {
                FAFScdFiles.Add(scd, null);
                return(null);
            }
            FileStream fs         = File.OpenRead(ScdPath);
            ZipFile    NewZipFile = new ZipFile(fs);
            FAFScdFiles.Add(scd, NewZipFile);

            LoadNewEntriesPaths(scd);
        }

        return(FAFScdFiles[scd]);
    }
Ejemplo n.º 2
0
    public static ZipFile GetFAFZipFileInstance(string scd)
    {
        if (!Init)
        {
            FafNotInstalled = !System.IO.Directory.Exists(EnvPaths.FAFGamedataPath);
            ZipConstants.DefaultCodePage = 0;
            Init = true;
        }

        if (FafNotInstalled)
        {
            return(null);
        }

        if (!ScdFiles.ContainsKey(scd))
        {
            // Original files not loaded, return
            return(null);
        }

        if (!FAFScdFiles.ContainsKey(scd))
        {
            string ScdPath = EnvPaths.FAFGamedataPath + scd.Replace("scd", "nx2");
            if (!System.IO.Directory.Exists(System.IO.Path.GetDirectoryName(ScdPath)) || !System.IO.File.Exists(ScdPath))
            {
                FAFScdFiles.Add(scd, null);
                return(null);
            }
            FileStream fs         = File.OpenRead(ScdPath);
            ZipFile    NewZipFile = new ZipFile(fs);
            FAFScdFiles.Add(scd, NewZipFile);

            LoadNewEntriesPaths(scd);
        }

        return(FAFScdFiles[scd]);
    }