/// <summary> /// Checks if the current loaded voicepack aka globalVoicepack is still the combined voicepack. /// The user may have loaded another voicepack using the main program load functionality. /// If it is changed, update the internal state to reflect the change. /// </summary> public void CheckCombinedVoicepackIsStillGlobal() { if (UseCombinedVoicepack && !CombinedVoicepack.IsGlobal()) { UseCombinedVoicepack = false; GlobalVoicepackBackup.GetFromGlobal(); } }
/// <summary> /// Removes the list of files from the current voicepack list /// </summary> /// <remarks> /// In stead of actually removing, I just recreate the combined voicepack from the updated list. /// My initial tests seem to indicate this is a fast enough operation and seems stable. /// To actually create a real remove, much work is needed. /// </remarks> public void RemoveVoicepacks(List <FileInfo> files) { foreach (var file in files) { VoicepacksFilesToCombine.Remove(file); } RecombineVoicepackFilesToCombine(); SaveVoicepackFilesToCombineToSettings(); CombinedVoicepack.ExportToFile(CombinedVoicepackBackupFilename); }
/// <summary> /// Adds the list of filenames into the current voicepak list, and merges them /// into the CombinedVoicepack. /// </summary> public void AddVoicepacks(List <string> filenames) { if (!VoicepacksFilesToCombine.Any()) { InitializeCombinedVoicepack(); } foreach (var filename in filenames) { if (CombinedVoicepack.Merge(filename)) { VoicepacksFilesToCombine.Add(new FileInfo(filename)); } } SaveVoicepackFilesToCombineToSettings(); CombinedVoicepack.ExportToFile(CombinedVoicepackBackupFilename); }
/// <summary> /// Rebuilds CombinedVoicepack from the VoicepacksFilesToCombine list /// </summary> private void RecombineVoicepackFilesToCombine() { InitializeCombinedVoicepack(); var invalidFilesToRemove = new List <FileInfo>(); foreach (var voicePackFile in VoicepacksFilesToCombine) { if (!CombinedVoicepack.Merge(voicePackFile.FullName)) { invalidFilesToRemove.Add(voicePackFile); } } foreach (var invalidFile in invalidFilesToRemove) { VoicepacksFilesToCombine.Remove(invalidFile); } }