コード例 #1
0
 public static Stream OpenFile(ulong guid)
 {
     try {
         return(TankHandler.OpenFile(guid));
     } catch (Exception e) {
         if (e is BLTEKeyException keyException)
         {
             if (MissingKeyLog.Add(keyException.MissingKey) && Debugger.IsAttached)
             {
                 TankLib.Helpers.Logger.Warn("BLTE", $"Missing key: {keyException.MissingKey:X16}");
             }
         }
         TankLib.Helpers.Logger.Debug("Core", $"Unable to load file: {guid:X8}");
         return(null);
     }
 }
コード例 #2
0
        public void AddNewByContentHash(Combo.ComboInfo info, HashSet <CKey> contentHashes, params ushort[] types)
        {
            foreach (KeyValuePair <ulong, ProductHandler_Tank.Asset> asset in TankHandler.m_assets)
            {
                TankHandler.UnpackAsset(asset.Value, out var package, out var record);

                ushort fileType = teResourceGUID.Type(asset.Key);
                if (fileType == 0x9C)
                {
                    continue;                   // bundle
                }
                if (fileType == 0x77)
                {
                    continue;                   // package
                }
                if (!types.Contains(fileType))
                {
                    continue;
                }

                var cmf = TankHandler.GetContentManifestForAsset(asset.Key);
                if (!cmf.TryGet(record.m_GUID, out var cmfData))
                {
                    //throw new FileNotFoundException();
                    // todo: wtf
                    continue;
                }

                if (contentHashes.Contains(cmfData.ContentKey))
                {
                    continue;
                }

                if (fileType == 0x4)
                {
                    var locale = teResourceGUID.Locale(asset.Key);
                    if (locale == 0xF)
                    {
                        continue;                // ?
                    }
                    if (locale == 0x1F)
                    {
                        continue;                 // ?
                    }
                    if (locale == 0x2F)
                    {
                        continue;                 // ?
                    }
                    if (locale == 0x3F)
                    {
                        continue;                 // ?
                    }
                    if (locale == 0x4F)
                    {
                        continue;                 // ?
                    }
                    if (locale == 0x5F)
                    {
                        continue;                 // ?
                    }
                    if (teResourceGUID.Platform(asset.Key) == 0x8)
                    {
                        continue;                                            // effect images
                    }
                }

                Combo.Find(info, asset.Key);
            }
        }