コード例 #1
0
        private void ExtractFile(byte[] key, string path, string name)
        {
            try
            {
                if (config.OnlineMode)
                {
                    throw new Exception();
                }

                var idxInfo = GetLocalIndexInfo(key);

                if (idxInfo == null)
                {
                    throw new Exception("local index missing");
                }

                var stream = GetDataStream(idxInfo.Index);

                stream.Position = idxInfo.Offset;

                stream.Position += 30;
                //byte[] unkHash = reader.ReadBytes(16);
                //int __size = reader.ReadInt32();
                //byte[] unkData1 = reader.ReadBytes(2);
                //byte[] unkData2 = reader.ReadBytes(8);

                using (BLTEHandler blte = new BLTEHandler(stream, idxInfo.Size - 30))
                {
                    blte.ExtractToFile(path, name);
                }
            }
            catch
            {
                if (key.EqualsTo(config.EncodingKey))
                {
                    int len;
                    using (Stream s = cdn.OpenDataFileDirect(key, out len))
                        using (BLTEHandler blte = new BLTEHandler(s, len))
                        {
                            blte.ExtractToFile(path, name);
                        }
                }
                else
                {
                    var idxInfo = cdn.GetCDNIndexInfo(key);

                    if (idxInfo == null)
                    {
                        throw new Exception("CDN index missing");
                    }

                    using (Stream s = cdn.OpenDataFile(key))
                        using (BLTEHandler blte = new BLTEHandler(s, idxInfo.Size))
                        {
                            blte.ExtractToFile(path, name);
                        }
                }
            }
        }
コード例 #2
0
        private Stream OpenFileLocal(byte[] key)
        {
            Stream stream = GetLocalDataStream(key);

            using (BLTEHandler blte = new BLTEHandler(stream, key))
            {
                return(blte.OpenFile(true));
            }
        }
コード例 #3
0
        private void ExtractFileLocal(byte[] key, string path, string name)
        {
            Stream stream = GetLocalDataStream(key);

            using (BLTEHandler blte = new BLTEHandler(stream, key))
            {
                blte.ExtractToFile(path, name);
            }
        }
コード例 #4
0
        private Stream OpenFile(byte[] key)
        {
            try
            {
                if (OnlineMode)
                {
                    throw new Exception();
                }

                var idxInfo = GetLocalIndexInfo(key);

                if (idxInfo == null)
                {
                    throw new Exception("local index missing");
                }

                var stream = GetDataStream(idxInfo.Index);

                stream.Position = idxInfo.Offset;

                stream.Position += 30;
                //byte[] unkHash = reader.ReadBytes(16);
                //int __size = reader.ReadInt32();
                //byte[] unkData1 = reader.ReadBytes(2);
                //byte[] unkData2 = reader.ReadBytes(8);

                using (BLTEHandler blte = new BLTEHandler(stream, idxInfo.Size - 30))
                    return(blte.OpenFile());
            }
            catch
            {
                if (key.EqualsTo(CASCConfig.EncodingKey))
                {
                    using (Stream s = CDNHandler.OpenDataFileDirect(key, out int len))
                        using (BLTEHandler blte = new BLTEHandler(s, len))
                            return(blte.OpenFile());
                }
                else
                {
                    var idxInfo = CDNHandler.GetCDNIndexInfo(key);

                    if (idxInfo == null)
                    {
                        throw new Exception("CDN index missing");
                    }

                    using (Stream s = CDNHandler.OpenDataFile(key))
                        using (BLTEHandler blte = new BLTEHandler(s, idxInfo.Size))
                            return(blte.OpenFile());
                }
            }
        }
コード例 #5
0
 protected Stream OpenFileLocalInternal(IndexEntry idxInfo, MD5Hash key)
 {
     if (idxInfo != null)
     {
         using (Stream s = CDNIndex.OpenDataFile(idxInfo))
             using (BLTEHandler blte = new BLTEHandler(s, key))
             {
                 return(blte.OpenFile(true));
             }
     }
     else
     {
         using (Stream s = CDNIndex.OpenDataFileDirect(key))
             using (BLTEHandler blte = new BLTEHandler(s, key))
             {
                 return(blte.OpenFile(true));
             }
     }
 }
コード例 #6
0
 protected void ExtractFileOnlineInternal(IndexEntry idxInfo, MD5Hash key, string path, string name)
 {
     if (idxInfo != null)
     {
         using (Stream s = CDNIndex.OpenDataFile(idxInfo))
             using (BLTEHandler blte = new BLTEHandler(s, key))
             {
                 blte.ExtractToFile(path, name);
             }
     }
     else
     {
         using (Stream s = CDNIndex.OpenDataFileDirect(key))
             using (BLTEHandler blte = new BLTEHandler(s, key))
             {
                 blte.ExtractToFile(path, name);
             }
     }
 }
コード例 #7
0
        private Stream OpenFileOnline(byte[] key)
        {
            IndexEntry idxInfo = CDNIndex.GetIndexInfo(key);

            if (idxInfo != null)
            {
                using (Stream s = CDNIndex.OpenDataFile(idxInfo))
                    using (BLTEHandler blte = new BLTEHandler(s, key))
                    {
                        return(blte.OpenFile(true));
                    }
            }
            else
            {
                using (Stream s = CDNIndex.OpenDataFileDirect(key))
                    using (BLTEHandler blte = new BLTEHandler(s, key))
                    {
                        return(blte.OpenFile(true));
                    }
            }
        }
コード例 #8
0
        private void ExtractFileOnline(byte[] key, string path, string name)
        {
            IndexEntry idxInfo = CDNIndex.GetIndexInfo(key);

            if (idxInfo != null)
            {
                using (Stream s = CDNIndex.OpenDataFile(idxInfo))
                    using (BLTEHandler blte = new BLTEHandler(s, key))
                    {
                        blte.ExtractToFile(path, name);
                    }
            }
            else
            {
                using (Stream s = CDNIndex.OpenDataFileDirect(key))
                    using (BLTEHandler blte = new BLTEHandler(s, key))
                    {
                        blte.ExtractToFile(path, name);
                    }
            }
        }
コード例 #9
0
        private Stream OpenFileOnline(byte[] key)
        {
            IndexEntry idxInfo = CDNIndex.GetIndexInfo(key);

            if (idxInfo != null)
            {
                using (Stream s = CDNIndex.OpenDataFile(idxInfo))
                using (BLTEHandler blte = new BLTEHandler(s, key))
                {
                    return blte.OpenFile(true);
                }
            }
            else
            {
                using (Stream s = CDNIndex.OpenDataFileDirect(key))
                using (BLTEHandler blte = new BLTEHandler(s, key))
                {
                    return blte.OpenFile(true);
                }
            }
        }
コード例 #10
0
ファイル: CASCHandler.cs プロジェクト: aeo24/WoWMap
        private void ExtractFileLocal(byte[] key, string path, string name)
        {
            Stream stream = GetLocalIndexData(key);

            using (BLTEHandler blte = new BLTEHandler(stream, key))
            {
                blte.ExtractToFile(path, name);
            }
        }
コード例 #11
0
ファイル: CASCHandler.cs プロジェクト: aeo24/WoWMap
        private void ExtractFileOnline(byte[] key, string path, string name)
        {
            IndexEntry idxInfo = CDNIndex.GetIndexInfo(key);

            if (idxInfo != null)
            {
                using (Stream s = CDNIndex.OpenDataFile(idxInfo))
                using (BLTEHandler blte = new BLTEHandler(s, key))
                {
                    blte.ExtractToFile(path, name);
                }
            }
            else
            {
                try
                {
                    using (Stream s = CDNIndex.OpenDataFileDirect(key))
                    using (BLTEHandler blte = new BLTEHandler(s, key))
                    {
                        blte.ExtractToFile(path, name);
                    }
                }
                catch
                {
                    throw new Exception("CDN index missing");
                }
            }
        }
コード例 #12
0
ファイル: CASCHandler.cs プロジェクト: aeo24/WoWMap
        private Stream OpenFileLocal(byte[] key)
        {
            Stream stream = GetLocalIndexData(key);

            using (BLTEHandler blte = new BLTEHandler(stream, key))
            {
                return blte.OpenFile(true);
            }
        }
コード例 #13
0
ファイル: CASCHandler.cs プロジェクト: Ser0ja/CASCExplorer
        private void ExtractFile(byte[] key, string path, string name)
        {
            try
            {
                if (config.OnlineMode)
                    throw new Exception();

                var idxInfo = GetLocalIndexInfo(key);

                if (idxInfo == null)
                    throw new Exception("local index missing");

                var stream = GetDataStream(idxInfo.Index);

                stream.Position = idxInfo.Offset;

                stream.Position += 30;
                //byte[] unkHash = reader.ReadBytes(16);
                //int __size = reader.ReadInt32();
                //byte[] unkData1 = reader.ReadBytes(2);
                //byte[] unkData2 = reader.ReadBytes(8);

                using (BLTEHandler blte = new BLTEHandler(stream, idxInfo.Size - 30))
                {
                    blte.ExtractToFile(path, name);
                }
            }
            catch
            {
                if (key.EqualsTo(config.EncodingKey))
                {
                    int len;
                    using (Stream s = cdn.OpenDataFileDirect(key, out len))
                    using (BLTEHandler blte = new BLTEHandler(s, len))
                    {
                        blte.ExtractToFile(path, name);
                    }
                }
                else
                {
                    var idxInfo = cdn.GetCDNIndexInfo(key);

                    if (idxInfo == null)
                        throw new Exception("CDN index missing");

                    using (Stream s = cdn.OpenDataFile(key))
                    using (BLTEHandler blte = new BLTEHandler(s, idxInfo.Size))
                    {
                        blte.ExtractToFile(path, name);
                    }
                }
            }
        }
コード例 #14
0
ファイル: CASCHandler.cs プロジェクト: yclwll/CASCExplorer
        private Stream OpenFile(byte[] key)
        {
            try
            {
                if (OnlineMode)
                    throw new Exception();

                var idxInfo = GetLocalIndexInfo(key);

                if (idxInfo == null)
                    throw new Exception("local index missing");

                var stream = GetDataStream(idxInfo.Index);

                stream.Position = idxInfo.Offset;

                stream.Position += 30;
                //byte[] unkHash = reader.ReadBytes(16);
                //int __size = reader.ReadInt32();
                //byte[] unkData1 = reader.ReadBytes(2);
                //byte[] unkData2 = reader.ReadBytes(8);

                using (BLTEHandler blte = new BLTEHandler(stream, idxInfo.Size - 30))
                    return blte.OpenFile();
            }
            catch
            {
                if (key.EqualsTo(CASCConfig.EncodingKey))
                {
                    using (Stream s = CDNHandler.OpenDataFileDirect(key, out int len))
                    using (BLTEHandler blte = new BLTEHandler(s, len))
                        return blte.OpenFile();
                }
                else
                {
                    var idxInfo = CDNHandler.GetCDNIndexInfo(key);

                    if (idxInfo == null)
                        throw new Exception("CDN index missing");

                    using (Stream s = CDNHandler.OpenDataFile(key))
                    using (BLTEHandler blte = new BLTEHandler(s, idxInfo.Size))
                        return blte.OpenFile();
                }
            }
        }