public static ProjectSettings Create(Project project) { if (!project.IsSupported()) return null; string key = project.GetIdentifier(); if (!settings.ContainsKey(key)) { string fullPath = project.GetSettingsFilePath(); ProjectSettings projectSettings = ProjectSettings.Load(fullPath); settings.Add(key, projectSettings); } return settings[key]; }
private static void UpdateCache(Project project) { if (!project.IsSupported()) return; // check if the settings file exists string filePath = project.GetSettingsFilePath(); try { if (File.Exists(filePath)) { string projectId = project.GetIdentifier(); ProjectSettings projectSettings = ProjectSettings.Load(filePath); settings.Remove(projectId); settings.Add(projectId, projectSettings); Logger.Log(" -> Settings file loaded for project '{0}'", project.Name); } else { Logger.Debug(" -> Project '{0}': No settings file exists for publishing", project.Name); } } catch (XmlSerializationException ex) { Logger.Log(Logger.Divider); Logger.Log(ex, "Error in publish settings file '{0}'", Path.Combine(SettingsStore.SettingsFolder, SettingsStore.SettingsFileName)); Logger.Log(Logger.Divider); MessageBox.Show( "The publish settings file contains errors, please correct the errors manually and save the file." + Environment.NewLine + Environment.NewLine + "See the output window for more information.", "Invalid Settings File", MessageBoxButton.OK, MessageBoxImage.Error); } catch (Exception ex) { Logger.Debug(ex, "Error in publish settings file '{0}'", Path.Combine(SettingsStore.SettingsFolder, SettingsStore.SettingsFileName)); } }