/// <summary> /// The get plugin settings paths. /// </summary> /// <param name="pluginPath"> /// The plugin path. /// </param> /// <param name="assembly"> /// The assembly. /// </param> /// <returns> /// The <see cref="IList{T}"/>. /// </returns> private IList <string> GetPluginSettingsPaths(string pluginPath, Assembly assembly) { if (Regex.Match(pluginPath, @"^\.$").Success) { pluginPath = Directory.GetCurrentDirectory(); } const string FileNameFormat = "{0}.PluginSettings.Xml"; var assemblyLocation = assembly.Location; var pluginPathFileName = Path.GetFileName(assemblyLocation); if (string.IsNullOrEmpty(pluginPathFileName)) { PluginLogger.LogError($"Couldn't get filename() of {assemblyLocation}"); return(new List <string>()); } var pluginPathFileNameFullPath = Path.Combine(pluginPath, pluginPathFileName); var settingsPaths = new List <string> { string.Format(FileNameFormat, pluginPathFileNameFullPath) }; if (!pluginPathFileNameFullPath.Equals(assemblyLocation, StringComparison.CurrentCultureIgnoreCase)) { settingsPaths.Add(string.Format(FileNameFormat, assembly.Location)); } return(settingsPaths); }
/// <summary> /// The perform overlay. /// </summary> /// <param name="settingsFilePath"> /// The settings file path. /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> private bool PerformOverlay(string settingsFilePath) { PluginLogger.LogInfo($"Applying plugin settings: [{settingsFilePath}]"); try { StfConfiguration.OverLay(settingsFilePath); } catch (Exception ex) { PluginLogger.LogError($"Error when overlaying plugin settings: {ex.Message}"); return(false); } return(true); }