private bool MusicFileBelongsToInactiveMod(String file) { if (file.StartsWith(ConversionManager.ConvertedMusicPackMusicFolder)) { String modid = Path.GetFileName(Path.GetDirectoryName(file)); PluginManager.PluginInfo info = ModHelper.GetSourceModFromId(modid); if (info != null) { return(!info.isEnabled); } } else { PluginManager.PluginInfo info = ModHelper.GetSourceModFromFolder(file); if (info != null) { return(!info.isEnabled); } } return(false); }
private void ConvertCustomMusic_AddConversionTasks(String folder, Dictionary <String, String> conversiontasks, bool mod) { Debug.Log("[CSLMusic] Conversion looking for files @ " + folder); if (Directory.Exists(folder)) { PluginManager.PluginInfo modification = null; if (mod) { modification = ModHelper.GetSourceModFromFolder(folder); if (modification == null) { Debug.LogError("[CSLMusic] Cannot add folder " + folder + " as mod! Mod could not be identified"); return; } if (!modification.isEnabled) { //Don't convert if mod is not active return; } } //Get music in pack folder and look if the file has a corresponding *.raw file //If not, convert the file to raw foreach (String file in Directory.GetFiles(folder)) { if (ModOptions.SupportedNonRawFileFormats.Contains(Path.GetExtension(file))) { String srcfile = file; String dstfile; if (mod) { //We need to change the folder! dstfile = Path.Combine(CreateModConvertedMusicFolder(modification), Path.GetFileNameWithoutExtension(srcfile) + ".raw"); } else { dstfile = Path.ChangeExtension(file, ".raw"); //We can work in out own folder } if (!File.Exists(dstfile)) { //Add task conversiontasks[srcfile] = dstfile; } } } } else { Debug.LogError("ERROR: " + folder + " is not existing!"); } }