Example #1
0
        private string GetSoundsDirAndEnsureExists()
        {
            var sosAppDataFolder = SirenOfShameSettings.GetSosAppDataFolder();
            var soundsDir        = Path.Combine(sosAppDataFolder, "Sounds");

            if (!Directory.Exists(soundsDir))
            {
                Directory.CreateDirectory(soundsDir);
            }
            return(soundsDir);
        }
Example #2
0
        public void DeleteSound(SirenOfShameSettings settings, Sound sound)
        {
            try
            {
                settings.Sounds.Remove(sound);
                settings.Save();

                var sosAppDataFolder  = SirenOfShameSettings.GetSosAppDataFolder();
                var fileIsInOurFolder = sound.Location.StartsWith(sosAppDataFolder);
                // should be, but we can't assume someone hasn't tampered with the settings file
                if (fileIsInOurFolder)
                {
                    File.Delete(sound.Location);
                }
            }
            catch (Exception ex)
            {
                _log.Warn("Unable to delete file", ex);
            }
        }