/// <summary> /// </summary> /// <param name="entryId"></param> /// <param name="entry"></param> /// <exception cref="NotImplementedException"></exception> public void AddEntry(int entryId, CacheFileBase entry) { var binaryFileEntry = entry.ToBinaryFile(); if (binaryFileEntry.Info == null) { binaryFileEntry.Info = new CacheFileInfo(); } binaryFileEntry.Info.Index = this.Info.Index; binaryFileEntry.Info.FileId = this.Info.FileId; binaryFileEntry.Info.EntryId = entryId; this._entries.Add(entryId, binaryFileEntry); }
public static void Output(CacheFileBase c, System.IO.StreamWriter s, sound_cache_file_gestalt_group def) { CT.sound_gestalt_platform_codec_block.Output(s, def.PlatformCodecs); s.WriteLine("{0}\tsound_gestalt_playback_block", def.Playbacks.Count); s.WriteLine("{0}\tsound_gestalt_scale_block", def.Scales.Count); s.WriteLine("{0}\tsound_gestalt_import_names_block", def.ImportNames.Count); s.WriteLine("{0}\tsound_gestalt_pitch_range_parameters_block", def.PitchRangeParameters.Count); sound_gestalt_pitch_ranges_block.Output(c, s, def, def.PitchRanges); sound_gestalt_permutations_block.Output(c, s, def, def.Permutations); s.WriteLine("{0}\tsound_gestalt_custom_playback_block", def.CustomPlaybacks.Count); sound_gestalt_60_block.Output(s, def.Unknown60); s.WriteLine("{0}\tsound_gestalt_runtime_permutation_bit_vector_block", def.RuntimePermutationFlags.Count); sound_permutation_chunk_block.Output(s, def.Chunks); s.WriteLine("{0}\tsound_gestalt_promotions_block", def.Promotions.Count); s.WriteLine("{0}\tsound_gestalt_extra_info_block", def.ExtraInfos.Count); }
public static void Output(CacheFileBase c, System.IO.StreamWriter s, sound_cache_file_gestalt_group owner, TI.Block <sound_gestalt_permutations_block> block) { const string format = "\t{0}\t\t{1}\t{2}\t{3}\t{4}\t{5}"; s.WriteLine("{0}\tsound_gestalt_permutations_block", block.Count); int x = 0; foreach (sound_gestalt_permutations_block def in block) { int name_index = def.Name.Value; Blam.StringId name = name_index >= 0 ? owner.ImportNames[name_index].ImportName.Handle : Blam.StringId.Null; s.WriteLine(format, (x++).ToString(), def.PermutationInfoIndex.ToString(), def.FirstChunk.Value.ToString(), def.ChunkCount.Value.ToString(), def.GetPermutationIndex().ToString(), c.StringIds.GetStringIdValue(name)); } }
/// <summary> /// Writes a file to the cache. /// The file's info will be used to determine where and how to put the file in the cache. /// </summary> /// <param name="file"></param> /// <exception cref="ArgumentException"></exception> public void PutFile(CacheFileBase file) { if (file.Info.Index == CacheIndex.Undefined || file.Info.FileId == null) { throw new ArgumentException("A file must have an index and file id to be written."); } // TODO: #57 if (file.Info.EntryId != null) { throw new ArgumentException("Entries can not be directly written to the cache. Use an entry file containing entries or remove the entry id from its info."); } var binaryFile = file.ToBinaryFile(); this.PutBinaryFile(binaryFile); this.PutFileInfo(binaryFile.Info); }
public static void Output(CacheFileBase c, System.IO.StreamWriter s, sound_cache_file_gestalt_group owner, TI.Block <sound_gestalt_pitch_ranges_block> block) { const string format = "\t{0}\t\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}"; s.WriteLine("{0}\tsound_gestalt_pitch_ranges_block", block.Count); int x = 0; foreach (sound_gestalt_pitch_ranges_block def in block) { int name_index = def.Name.Value; Blam.StringId name = name_index >= 0 ? owner.ImportNames[name_index].ImportName.Handle : Blam.StringId.Null; s.WriteLine(format, (x++).ToString(), def.Parameters.Value.ToString(), def.Unknown04.Value.ToString(), def.EncodedPermutationData.Value.ToString("X4"), def.FirstPermutation.Value.ToString(), def.GetPermutationCount().ToString(), c.StringIds.GetStringIdValue(name)); } }
public static void Output(CacheFileBase c, System.IO.StreamWriter s, sound_cache_file_gestalt_group owner, TI.Block<sound_gestalt_permutations_block> block) { const string format = "\t{0}\t\t{1}\t{2}\t{3}\t{4}\t{5}"; s.WriteLine("{0}\tsound_gestalt_permutations_block", block.Count); int x = 0; foreach (sound_gestalt_permutations_block def in block) { int name_index = def.Name.Value; Blam.StringId name = name_index >= 0 ? owner.ImportNames[name_index].ImportName.Handle : Blam.StringId.Null; s.WriteLine(format, (x++).ToString(), def.PermutationInfoIndex.ToString(), def.FirstChunk.Value.ToString(), def.ChunkCount.Value.ToString(), def.GetPermutationIndex().ToString(), c.StringIds.GetStringIdValue(name)); } }
public static void Output(CacheFileBase c, System.IO.StreamWriter s, sound_cache_file_gestalt_group owner, TI.Block<sound_gestalt_pitch_ranges_block> block) { const string format = "\t{0}\t\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}"; s.WriteLine("{0}\tsound_gestalt_pitch_ranges_block", block.Count); int x = 0; foreach (sound_gestalt_pitch_ranges_block def in block) { int name_index = def.Name.Value; Blam.StringId name = name_index >= 0 ? owner.ImportNames[name_index].ImportName.Handle : Blam.StringId.Null; s.WriteLine(format, (x++).ToString(), def.Parameters.Value.ToString(), def.Unknown04.Value.ToString(), def.EncodedPermutationData.Value.ToString("X4"), def.FirstPermutation.Value.ToString(), def.GetPermutationCount().ToString(), c.StringIds.GetStringIdValue(name)); } }