private void UninstallBgm() { var cueSection = file.GetSection(Sections.ACB_Cue); if (cueSection != null) { foreach (var id in cueSection.IDs) { int cueId; if (int.TryParse(id, out cueId)) { acbFile.Cues.RemoveAll(x => x.ID == (uint)cueId); if (file.filePath == AcbInstaller.OPTION_INSTALL_TYPE) { oblFile.RemoveEntry(cueId); foreach (var msgFile in msgFiles) { msgFile.MSG_Entries.RemoveAll(x => x.Name == $"OPT_BGM_{cueId.ToString("D3")}"); } } else if (file.filePath == AcbInstaller.DIRECT_INSTALL_TYPE) { if (cpkAcbFile.Cues.Exists(x => x.ID == (uint)cueId)) { acbFile.CopyCue(cueId, cpkAcbFile); } } } } } }
private void Add(string path, object data, CachedFileType type, bool allowOverwrite = true) { var cachedFile = new CachedFile(path, data, allowOverwrite); if (data.GetType() == typeof(EffectContainerFile)) { EffectContainerFile ecf = EffectContainerFile.New(); ecf.AddEffects(((EffectContainerFile)data).Effects); cachedFile.backupEffectContainerFile = ecf; } else if (data.GetType() == typeof(ACB_File)) { //Might be better to change this to a shallow-copy ACB_File acb = ACB_File.NewXv2Acb(); foreach (var cue in ((ACB_File)data).Cues) { acb.CopyCue((int)cue.ID, (ACB_File)data); } cachedFile.backupBgmFile = acb; } cachedFiles.Add(cachedFile); }
private void RepairCss() { if (enCssFile.Cues.Count == jpnCssFile.Cues.Count) { return; } ACB_File main = (enCssFile.Cues.Count > jpnCssFile.Cues.Count) ? enCssFile : jpnCssFile; ACB_File second = (enCssFile.Cues.Count > jpnCssFile.Cues.Count) ? jpnCssFile : enCssFile; while (main.Cues.Count > second.Cues.Count) { if (main.Cues.Count <= second.Cues.Count) { break; } int newCueId = second.GetFreeCueId(); ACB_Cue cueToCopy = main.GetCue(newCueId); if (cueToCopy != null) { second.CopyCue(newCueId, main); } else { break; } } }
public void CopyCues(IList <Cue_Wrapper> cues) { ACB_File newAcb = ACB_File.NewXv2Acb(); foreach (var cue in cues) { newAcb.CopyCue((int)cue.CueRef.ID, AcbFile); } newAcb.SaveToClipboard(); }
private void Install() { //Force all tracks to be streamed foreach (var waveform in musicPackage.Waveforms.Where(x => !x.Streaming)) { waveform.Streaming = true; } if (musicPackage.MusicPackageType == MusicPackageType.NewOption) { foreach (var cue in musicPackage.Cues) { cue.ID = (uint)GetNextCueId(); bgmAcb.CopyCue((int)cue.ID, musicPackage); oblFile.AddEntry((int)cue.ID); foreach (var msgFile in msgFiles) { msgFile.AddEntry($"OPT_BGM_{cue.ID.ToString("D3")}", cue.Name); } GeneralInfo.Tracker.AddID(OPTION_INSTALL_TYPE, Sections.ACB_Cue, cue.ID.ToString()); } } else if (musicPackage.MusicPackageType == MusicPackageType.Direct) { //Direct mode. Just copy the cues into the BGM. foreach (var cue in musicPackage.Cues) { //Remove cue with matching ID (if exists) bgmAcb.Cues.RemoveAll(x => x.ID == cue.ID); bgmAcb.CopyCue((int)cue.ID, musicPackage); GeneralInfo.Tracker.AddID(DIRECT_INSTALL_TYPE, Sections.ACB_Cue, cue.ID.ToString()); } } }