Exemplo n.º 1
0
        public static void MoveQuery(this BitmapMetadata bitmapMetadata, string sourceQuery, string destinationQuery, bool overWriteExistingData)
        {
            // Check Source Query exists
            if (bitmapMetadata.ContainsQuery(sourceQuery))
            {
                bool existingData = bitmapMetadata.ContainsQuery(destinationQuery);

                if (existingData && !overWriteExistingData)
                {
                    // Skip the copy and source the value
                    bitmapMetadata.RemoveQuery(sourceQuery);
                }
                else
                {
                    // Copy the Query
                    bitmapMetadata.CopyQuery(sourceQuery, destinationQuery);

                    // Finally remove old query
                    bitmapMetadata.RemoveQuery(sourceQuery);

                    // Ensure old query has been removed
                    if (!bitmapMetadata.ContainsQuery(destinationQuery))
                    {
                        throw new Exception("Move Query Failed");
                    }
                }
            }
        }