Example #1
0
 /// <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);
     }
 }
Example #2
0
        /// <summary>
        /// Reload scheme image and info
        /// </summary>
        private void RefreshSchemeMetadata()
        {
            SchemeMeta.ReloadFromDisk();
            soundImage.Image       = SchemeMeta.Thumbnail;
            soundImageText.Visible = (soundImage.Image == null);

            soundInfoNameBox.Text   = SchemeMeta.Name;
            soundInfoAuthorBox.Text = SchemeMeta.Author;
            soundInfoAboutBox.Text  = SchemeMeta.About;
        }
Example #3
0
 /// <summary>
 /// Reset all sound events to the specified system sound sheme
 /// </summary>
 private void loadSystemScheme(bool warning, SoundScheme scheme)
 {
     if (!warning || MessageBox.Show(
             Translations.Get("reset_warn_text"),
             Translations.Get("reset_warn_title"),
             MessageBoxButtons.OKCancel,
             MessageBoxIcon.Warning
             ) == DialogResult.OK)
     {
         foreach (SoundEvent soundEvent in SoundEvent.GetAll())
         {
             SoundScheme.CopyDefault(soundEvent, scheme);
         }
         SchemeMeta.ResetAll();
         if (scheme != null)
         {
             SchemeMeta.Name   = scheme.ToString();
             SchemeMeta.Author = "";
             SchemeMeta.About  = "";
         }
         RefreshSchemeMetadata();
         imageContextMenu_Remove_Click(this, EventArgs.Empty);
     }
 }