/// <summary> /// Gets the metadata header /// </summary> /// <param name="blob"></param> /// <returns></returns> private HeaderDefinitionMetadata GetHeaderDefinitionMetadata(WrappedPageBlob blob, int index) { string keyToUse = null; if (index == 0) { keyToUse = _primaryHeaderDefinitionKey; } else if (index == 1) { keyToUse = _secondaryHeaderDefinitionKey; } else if (index == 2) { keyToUse = _terciaryHeaderDefintionKey; } else { throw new ArgumentException("value must be 0, 1, or 2 for primary, secondary, or terciary respectively.", "index"); } HeaderDefinitionMetadata headerDefinition = null; string serializedHeaderDefinition; if (blob.Metadata.TryGetValue(keyToUse, out serializedHeaderDefinition)) { headerDefinition = HeaderDefinitionMetadata.FromRaw(Convert.FromBase64String(serializedHeaderDefinition)); } return(headerDefinition); }
/// <summary> /// Gets the metadata header /// </summary> /// <param name="blob"></param> /// <returns></returns> private HeaderDefinitionMetadata GetHeaderDefinitionMetadata(WrappedPageBlob blob, bool useFallback = false) { var keyToUse = useFallback ? _fallbackHeaderDefinitionKey : _primaryHeaderDefinitionKey; HeaderDefinitionMetadata headerDefinition; string serializedHeaderDefinition; if (blob.Metadata.TryGetValue(keyToUse, out serializedHeaderDefinition)) { headerDefinition = HeaderDefinitionMetadata.FromRaw(Convert.FromBase64String(serializedHeaderDefinition)); } else { headerDefinition = new HeaderDefinitionMetadata(); } return(headerDefinition); }