/// <summary>
/// Save Datasource metadata in a XML file along-side the workbook file
/// </summary>
/// <param name="wb">Information about the workbook we have downloaded</param>
/// <param name="localDatasourcePath">Local path to the twb/twbx of the workbook</param>
/// <param name="userLookups">If non-NULL contains the mapping of users/ids so we can look up the owner</param>
internal static void CreateSettingsFile(SiteDatasource ds, string localDatasourcePath, KeyedLookup <SiteUser> userLookups)
{
string contentOwnerName = null; //Start off assuming we have no content owner information
if (userLookups != null)
{
contentOwnerName = WorkbookPublishSettings.helper_LookUpOwnerId(ds.OwnerId, userLookups);
}
var xml = System.Xml.XmlWriter.Create(PathForSettingsFile(localDatasourcePath));
xml.WriteStartDocument();
xml.WriteStartElement(XmlElement_DatasourceInfo);
//If we have an owner name, write it out
if (!string.IsNullOrWhiteSpace(contentOwnerName))
{
XmlHelper.WriteValueElement(xml, WorkbookPublishSettings.XmlElement_ContentOwner, contentOwnerName);
}
xml.WriteEndElement(); //end: WorkbookInfo
xml.WriteEndDocument();
xml.Close();
}