/// <summary> /// Import the specified Zip file into the SoundManager sound scheme /// </summary> /// <param name="zipfile">Input Zip file</param> public static void Import(string zipfile) { using (ZipFile zip = ZipFile.Read(zipfile)) { foreach (SoundEvent soundEvent in SoundEvent.GetAll()) { if (TryExtract(zip, soundEvent.FileName, SoundEvent.DataDirectory) || TryExtract(zip, soundEvent.LegacyFileName, SoundEvent.DataDirectory, soundEvent.FileName)) { SoundScheme.Update(soundEvent, soundEvent.FilePath); } else { SoundScheme.Remove(soundEvent); } } SchemeMeta.ResetAll(); if (!TryExtract(zip, Path.GetFileName(SchemeMeta.SchemeImageFilePath), SoundEvent.DataDirectory)) { TryExtract(zip, "visuel.bmp", SoundEvent.DataDirectory, Path.GetFileName(SchemeMeta.SchemeImageFilePath)); } if (!TryExtract(zip, Path.GetFileName(SchemeMeta.SchemeInfoFilePath), SoundEvent.DataDirectory)) { TryExtract(zip, "infos.ini", SoundEvent.DataDirectory, Path.GetFileName(SchemeMeta.SchemeInfoFilePath)); } SchemeMeta.ReloadFromDisk(); SoundScheme.Apply(SoundScheme.GetSchemeSoundManager(), Settings.MissingSoundUseDefault); } }
/// <summary> /// Remove a sound event /// </summary> private void soundContextMenu_Remove_Click(object sender, EventArgs e) { if (soundList.FocusedItem != null) { SoundEvent soundEvent = soundList.FocusedItem.Tag as SoundEvent; SoundScheme.Remove(soundEvent); } }