public static async Task <XmlReader> GetXmlReaderAsync(ContentURI uri, string fullURIPath) { XmlReader reader = null; if (await URIAbsoluteExists(uri, fullURIPath) == false) { return(reader); } if (Path.IsPathRooted(fullURIPath)) { //this reader can be read async reader = XmlFileIO.GetXmlFromFileAsync(fullURIPath); } else { PLATFORM_TYPES ePlatform = uri.URIDataManager.PlatformType; if (ePlatform == PLATFORM_TYPES.azure) { AzureIOAsync azureIO = new AzureIOAsync(uri); reader = await azureIO.GetXmlFromURIAsync(fullURIPath); } } return(reader); }
public async Task <bool> SaveXmlInURIAsync(ContentURI uri, XmlReader reader, string fullURIPath) { bool bFileHasSaved = false; if (Path.IsPathRooted(fullURIPath)) { if (GeneralHelpers.IsXmlFileExt(fullURIPath)) { XmlFileIO xmlIO = new XmlFileIO(); bFileHasSaved = await xmlIO.WriteFileXmlAsync( uri, reader, fullURIPath); } } else { PLATFORM_TYPES ePlatform = uri.URIDataManager.PlatformType; if (ePlatform == PLATFORM_TYPES.azure) { //azure asynch is different than file system AzureIOAsync azureIO = new AzureIOAsync(uri); bFileHasSaved = await azureIO.WriteFileXmlAsync(reader, fullURIPath); } } if (!bFileHasSaved) { uri.ErrorMessage = DevTreks.Exceptions.DevTreksErrors.GetMessage("FILESTORAGE_FILENOSAVEXML"); } return(bFileHasSaved); }
public async Task <bool> SaveFileAsync(ContentURI uri, XmlDocument doc, string fullURIPath) { bool bHasCompleted = false; if (Path.IsPathRooted(fullURIPath)) { //the xml does not need to be .xml (it could be .opf) XmlFileIO xmlIO = new XmlFileIO(); bHasCompleted = await xmlIO.SaveFileAsync(doc, fullURIPath); } else { PLATFORM_TYPES ePlatform = uri.URIDataManager.PlatformType; if (ePlatform == PLATFORM_TYPES.azure) { AzureIOAsync azureIO = new AzureIOAsync(uri); bHasCompleted = await azureIO.SaveBlobAsync(doc, fullURIPath); } } return(bHasCompleted); }