Exemple #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);
                        }
                }
            }
        }
        private Stream OpenFileLocal(byte[] key)
        {
            Stream stream = GetLocalDataStream(key);

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

            using (BLTEHandler blte = new BLTEHandler(stream, key))
            {
                blte.ExtractToFile(path, name);
            }
        }
Exemple #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());
                }
            }
        }
Exemple #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));
             }
     }
 }
Exemple #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);
             }
     }
 }
        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));
                    }
            }
        }
        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);
                    }
            }
        }
        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);
                }
            }
        }
Exemple #10
0
        private void ExtractFileLocal(byte[] key, string path, string name)
        {
            Stream stream = GetLocalIndexData(key);

            using (BLTEHandler blte = new BLTEHandler(stream, key))
            {
                blte.ExtractToFile(path, name);
            }
        }
Exemple #11
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
            {
                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");
                }
            }
        }
Exemple #12
0
        private Stream OpenFileLocal(byte[] key)
        {
            Stream stream = GetLocalIndexData(key);

            using (BLTEHandler blte = new BLTEHandler(stream, key))
            {
                return blte.OpenFile(true);
            }
        }
Exemple #13
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);
                    }
                }
            }
        }
Exemple #14
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();
                }
            }
        }