コード例 #1
0
        public async Task <XivTex> GetTexDataPreFetchedIndex(TexTypePath ttp)
        {
            var offset = await _index.GetDataOffset(ttp.Path);

            if (offset == 0)
            {
                throw new Exception($"Could not find offset for {ttp.Path}");
            }

            XivTex xivTex;

            try
            {
                if (ttp.Path.Contains(".atex"))
                {
                    var atex = new ATex(_gameDirectory, ttp.DataFile);
                    xivTex = await atex.GetATexData(offset);
                }
                else
                {
                    xivTex = await _dat.GetType4Data(offset, ttp.DataFile);
                }
            }
            catch (Exception ex)
            {
                throw new Exception($"There was an error reading texture data at offset {offset}");
            }

            xivTex.TextureTypeAndPath = ttp;

            return(xivTex);
        }
コード例 #2
0
ファイル: Tex.cs プロジェクト: 92RED/xivModdingFramework
        public XivTex GetTexData(TexTypePath ttp)
        {
            var folder = Path.GetDirectoryName(ttp.Path);

            folder = folder.Replace("\\", "/");
            var file = Path.GetFileName(ttp.Path);

            var index = new Index(_gameDirectory);
            var dat   = new Dat(_gameDirectory);

            var offset = index.GetDataOffset(HashGenerator.GetHash(folder), HashGenerator.GetHash(file), ttp.DataFile);

            if (offset == 0)
            {
                throw new Exception($"Could not find offest for {ttp.Path}");
            }

            XivTex xivTex;

            if (ttp.Path.Contains(".atex"))
            {
                var atex = new ATex(_gameDirectory, ttp.DataFile);
                xivTex = atex.GetATexData(offset);
            }
            else
            {
                xivTex = dat.GetType4Data(offset, ttp.DataFile);
            }

            xivTex.TextureTypeAndPath = ttp;

            return(xivTex);
        }
コード例 #3
0
        public async Task <XivTex> GetTexData(string path)
        {
            var folder = Path.GetDirectoryName(path);

            folder = folder.Replace("\\", "/");
            var file = Path.GetFileName(path);

            long offset = 0;

            var hashedfolder = 0;
            var hashedfile   = 0;

            hashedfolder = HashGenerator.GetHash(folder);
            hashedfile   = HashGenerator.GetHash(file);
            var df = IOUtil.GetDataFileFromPath(path);

            offset = await _index.GetDataOffset(hashedfolder, hashedfile, df);

            if (offset == 0)
            {
                throw new Exception($"Could not find offset for {path}");
            }

            XivTex xivTex;

            try
            {
                if (path.Contains(".atex"))
                {
                    var atex = new ATex(_gameDirectory, df);
                    xivTex = await atex.GetATexData(offset);
                }
                else
                {
                    xivTex = await _dat.GetType4Data(offset, df);
                }
            }
            catch (Exception ex)
            {
                throw new Exception($"There was an error reading texture data at offset {offset}");
            }

            var ttp = new TexTypePath();

            ttp.DataFile = df;
            ttp.Name     = Path.GetFileName(path);
            ttp.Type     = XivTexType.Other;
            ttp.Path     = path;
            xivTex.TextureTypeAndPath = ttp;

            return(xivTex);
        }
コード例 #4
0
ファイル: Tex.cs プロジェクト: mkocus/xivModdingFramework
        public async Task <XivTex> GetTexData(TexTypePath ttp)
        {
            var folder = Path.GetDirectoryName(ttp.Path);

            folder = folder.Replace("\\", "/");
            var file   = Path.GetFileName(ttp.Path);
            var offset = 0;

            var hashedfolder = 0;
            var hashedfile   = 0;

            lock (texLock)
            {
                hashedfolder = HashGenerator.GetHash(folder);
                hashedfile   = HashGenerator.GetHash(file);
            }

            offset = await _index.GetDataOffset(hashedfolder, hashedfile, ttp.DataFile);

            if (offset == 0)
            {
                throw new Exception($"Could not find offset for {ttp.Path}");
            }

            XivTex xivTex;

            try
            {
                if (ttp.Path.Contains(".atex"))
                {
                    var atex = new ATex(_gameDirectory, ttp.DataFile);
                    xivTex = await atex.GetATexData(offset);
                }
                else
                {
                    xivTex = await _dat.GetType4Data(offset, ttp.DataFile);
                }
            }
            catch (Exception ex)
            {
                throw new Exception($"There was an error reading texture data at offset {offset}");
            }

            xivTex.TextureTypeAndPath = ttp;

            return(xivTex);
        }
コード例 #5
0
ファイル: Tex.cs プロジェクト: Kouzukii/xivModdingFramework
        public async Task <XivTex> GetTexDataPreFetchedIndex(TexTypePath ttp)
        {
            var folder = Path.GetDirectoryName(ttp.Path);

            folder = folder.Replace("\\", "/");
            var file   = Path.GetFileName(ttp.Path);
            var offset = 0;

            lock (texLock)
            {
                offset = _indexFileDictionary[$"{HashGenerator.GetHash(file)}{HashGenerator.GetHash(folder)}"];
            }

            if (offset == 0)
            {
                throw new Exception($"Could not find offest for {ttp.Path}");
            }

            XivTex xivTex;

            try
            {
                if (ttp.Path.Contains(".atex"))
                {
                    var atex = new ATex(_modding, ttp.DataFile);
                    xivTex = await atex.GetATexData(offset);
                }
                else
                {
                    xivTex = await _modding.Dat.GetType4Data(offset, ttp.DataFile);
                }
            }
            catch (Exception ex)
            {
                throw new Exception($"There was an error reading texture data at offset {offset}");
            }

            xivTex.TextureTypeAndPath = ttp;

            return(xivTex);
        }