Пример #1
0
            public bool Extract(NexonArchiveFileEntry file)
            {
                string path       = file.Path;
                int    slashIndex = 0;

                while (path[slashIndex] == Path.DirectorySeparatorChar || path[slashIndex] == Path.AltDirectorySeparatorChar)
                {
                    slashIndex++;
                }
                path = path.Substring(slashIndex);
                path = Path.Combine(this.ExtractPath, path);
                DirectoryInfo pathDirectory = new DirectoryInfo(Path.GetDirectoryName(path));

                if (!pathDirectory.Exists)
                {
                    pathDirectory.Create();
                }
                using (FileStream fileStream = new FileStream(path, FileMode.Create, FileAccess.ReadWrite, FileShare.Read))
                {
                    file.Extract(fileStream);
                    if (this.DecryptModels && string.Compare(Path.GetExtension(path), ".mdl", StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        ModelHelper.DecryptModel(fileStream);
                    }
                }
                return(true);
            }
Пример #2
0
        public bool Extract(NexonArchiveFileEntry entry)
        {
            path = entry.Path;
            while (path[Index] == Path.DirectorySeparatorChar || path[Index] == Path.AltDirectorySeparatorChar)
            {
                Index++;
            }

            path = path.Substring(Index);
            path = Path.Combine(ExtractPath, path);

            DirectoryInfo dir = new DirectoryInfo(Path.GetDirectoryName(path));

            if (!dir.Exists)
            {
                dir.Create();
            }

            using (FileStream fs = new FileStream(path, FileMode.Create, FileAccess.ReadWrite, FileShare.Read))
            {
                entry.Extract(fs);

                if (DecryptModels && String.Compare(Path.GetExtension(path), ".mdl", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    ModelHelper.DecryptModel(fs);
                }
            }
            return(true);
        }