Exemplo n.º 1
0
        public void AddOrUpdate(InstallFileEntry fileEntry, params string[] tags)
        {
            int index;

            if (!_FileEntries.ContainsKey(fileEntry.FilePath))
            {
                index = _FileEntries.Count;
                _FileEntries.Add(fileEntry.FilePath, fileEntry);
            }
            else
            {
                index = _FileEntries.IndexOfKey(x => x.IndexOf(fileEntry.FilePath, StringComparison.OrdinalIgnoreCase) >= 0);
                _FileEntries[fileEntry.FilePath] = fileEntry;
            }

            // update the tag masks
            SetTags(index, true, tags);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds a CASRecord to the InstallFile, this will overwrite existing entries
        /// </summary>
        /// <param name="record"></param>
        /// <param name="tactRepo">If provided, will add the entry to all relevant system files</param>
        /// <param name="tags"></param>
        public void AddOrUpdate(CASRecord record, TACTRepo tactRepo = null)
        {
            var entry = new InstallFileEntry()
            {
                FilePath         = record.FileName,
                CKey             = record.CKey,
                DecompressedSize = record.EBlock.DecompressedSize,
            };

            AddOrUpdate(entry, record.Tags);

            // add the record to all referenced files
            if (tactRepo != null)
            {
                tactRepo.EncodingFile?.AddOrUpdate(record);
                tactRepo.IndexContainer?.Enqueue(record);
                tactRepo.DownloadFile?.AddOrUpdate(record, 2);
                tactRepo.DownloadSizeFile?.AddOrUpdate(record);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Returns a InstallFileEntry by name
 /// </summary>
 /// <param name="filename"></param>
 /// <param name="fileEntry"></param>
 /// <returns></returns>
 public bool TryGet(string filename, out InstallFileEntry fileEntry)
 {
     return(_FileEntries.TryGetValue(filename, out fileEntry));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Removes a InstallFileEntry from the InstallFile
 /// </summary>
 /// <param name="fileEntry"></param>
 public bool Remove(InstallFileEntry fileEntry)
 {
     return(Remove(fileEntry.FilePath));
 }