private static AssetBitmapAndText BuildBitmapDynEncryption(IAsset asset)
        {
            AssetBitmapAndText ABT = new AssetBitmapAndText();
            AssetEncryptionState assetEncryptionState = asset.GetEncryptionState(AssetDeliveryProtocol.SmoothStreaming | AssetDeliveryProtocol.HLS | AssetDeliveryProtocol.Dash);

            switch (assetEncryptionState)
            {
                case AssetEncryptionState.DynamicCommonEncryption:
                    ABT.bitmap = commonencryptedimage;
                    ABT.MouseOverDesc = "Dynamic Common Encryption (CENC)";
                    break;

                case AssetEncryptionState.DynamicEnvelopeEncryption:
                    ABT.bitmap = envelopeencryptedimage;
                    ABT.MouseOverDesc = "Dynamic Envelope Encryption (AES)";
                    break;

                case AssetEncryptionState.NoDynamicEncryption:
                    ABT.bitmap = storagedecryptedimage;
                    ABT.MouseOverDesc = "No Dynamic Encryption";
                    break;

                case AssetEncryptionState.NoSinglePolicyApplies:
                    AssetEncryptionState assetEncryptionStateHLS = asset.GetEncryptionState(AssetDeliveryProtocol.HLS);
                    AssetEncryptionState assetEncryptionStateSmooth = asset.GetEncryptionState(AssetDeliveryProtocol.SmoothStreaming);
                    AssetEncryptionState assetEncryptionStateDash = asset.GetEncryptionState(AssetDeliveryProtocol.Dash);
                    bool CENCEnable = (assetEncryptionStateHLS == AssetEncryptionState.DynamicCommonEncryption || assetEncryptionStateSmooth == AssetEncryptionState.DynamicCommonEncryption || assetEncryptionStateDash == AssetEncryptionState.DynamicCommonEncryption);
                    bool EnvelopeEnable = (assetEncryptionStateHLS == AssetEncryptionState.DynamicEnvelopeEncryption || assetEncryptionStateSmooth == AssetEncryptionState.DynamicEnvelopeEncryption || assetEncryptionStateDash == AssetEncryptionState.DynamicEnvelopeEncryption);
                    if (CENCEnable && EnvelopeEnable)
                    {
                        ABT.bitmap = new Bitmap((envelopeencryptedimage.Width + commonencryptedimage.Width), envelopeencryptedimage.Height);
                        using (Graphics graphicsObject = Graphics.FromImage(ABT.bitmap))
                        {
                            graphicsObject.DrawImage(envelopeencryptedimage, new Point(0, 0));
                            graphicsObject.DrawImage(commonencryptedimage, new Point(envelopeencryptedimage.Width, 0));
                        }
                    }
                    else
                    {
                        ABT.bitmap = CENCEnable ? commonencryptedimage : envelopeencryptedimage;
                    }
                    ABT.MouseOverDesc = "Multiple policies";
                    break;

                default:
                    break;
            }
            return ABT;
        }
        private AssetBitmapAndText ReturnStaticProtectedBitmap(IAsset asset)
        {
            AssetBitmapAndText ABT = new AssetBitmapAndText();

            switch (asset.Options)
            {
                case AssetCreationOptions.StorageEncrypted:
                    ABT.bitmap = storageencryptedimage;
                    ABT.MouseOverDesc = "Storage encrypted";
                    break;

                case AssetCreationOptions.CommonEncryptionProtected:
                    ABT.bitmap = commonencryptedimage;
                    ABT.MouseOverDesc = "CENC encrypted";
                    break;

                case AssetCreationOptions.EnvelopeEncryptionProtected:
                    ABT.bitmap = envelopeencryptedimage;
                    ABT.MouseOverDesc = "Envelope encrypted";
                    break;

                default:
                    break;
            }
            return ABT;
        }
        public static AssetBitmapAndText BuildBitmapPublication(IAsset asset)
        {
            if (asset == null) return null;

            Bitmap returnedImage = null;
            string returnedText = null;

            foreach (var locator in asset.Locators)
            {
                Bitmap newbitmap = null;
                string newtext = null;
                PublishStatus Status = AssetInfo.GetPublishedStatusForLocator(locator);

                switch (locator.Type)
                {

                    case (LocatorType.OnDemandOrigin):
                        switch (Status)
                        {
                            case PublishStatus.PublishedActive:
                                newbitmap = Streaminglocatorimage;
                                newtext = "Active Streaming locator";
                                break;

                            case PublishStatus.PublishedExpired:
                                newbitmap = Redstreamimage;
                                newtext = "Expired Streaming locator";
                                break;

                            case PublishStatus.PublishedFuture:
                                newbitmap = Bluestreamimage;
                                newtext = "Future Streaming locator";
                                break;

                            case PublishStatus.NotPublished:
                                break;
                        }
                        break;

                    case (LocatorType.Sas):
                        switch (Status)
                        {
                            case PublishStatus.PublishedActive:
                                newbitmap = SASlocatorimage;
                                newtext = "Active SAS locator";
                                break;

                            case PublishStatus.PublishedExpired:
                                newbitmap = Reddownloadimage;
                                newtext = "Expired SAS locator";
                                break;

                            case PublishStatus.PublishedFuture:
                                newbitmap = Bluedownloadimage;
                                newtext = "Future SAS locator";
                                break;

                            case PublishStatus.NotPublished:

                                break;
                        }
                        break;


                    default:
                        break;
                }

                returnedImage = AddBitmap(returnedImage, newbitmap);
                returnedText += !string.IsNullOrEmpty(newtext) ? newtext + Constants.endline : string.Empty;

            }


            AssetBitmapAndText ABT = new AssetBitmapAndText()
            {
                bitmap = returnedImage,
                MouseOverDesc = returnedText ?? "Not published"

            };

            return ABT;
        }
        private static AssetBitmapAndText BuildBitmapAssetFilters(IAsset asset)
        {
            AssetBitmapAndText ABT = new AssetBitmapAndText();
            var filters = _contextDynManifest.ListAssetFilters(asset);

            if (filters.Count > 1)
            {
                ABT.bitmap = AssetFiltersImage;
                ABT.MouseOverDesc = string.Format("{0} filters", filters.Count);
            }
            else if (filters.Count == 1)
            {
                ABT.bitmap = AssetFilterImage;
                ABT.MouseOverDesc = string.Format("1 filter");
            }
            return ABT;
        }
        public static AssetBitmapAndText BuildBitmapDynEncryption(string assetName, AMSClientV3 client)
        {
            client.RefreshTokenIfNeeded();
            IList <AssetStreamingLocator> locators;

            try
            {
                locators = client.AMSclient.Assets.ListStreamingLocators(client.credentialsEntry.ResourceGroup, client.credentialsEntry.AccountName, assetName).StreamingLocators;
            }
            catch
            {
                return(new AssetBitmapAndText()
                {
                    bitmap = BitmapCancel,
                    MouseOverDesc = "Error"
                });
            }

            if (locators.Count == 0)
            {
                return(new AssetBitmapAndText());
            }

            AssetBitmapAndText ABT = new AssetBitmapAndText()
            {
                Locators = locators
            };

            var ClearEnable    = locators.Any(l => l.StreamingPolicyName == PredefinedStreamingPolicy.ClearStreamingOnly || l.StreamingPolicyName == PredefinedStreamingPolicy.DownloadAndClearStreaming);
            var CENCEnable     = locators.Any(l => l.StreamingPolicyName == PredefinedStreamingPolicy.MultiDrmCencStreaming || l.StreamingPolicyName == PredefinedStreamingPolicy.MultiDrmStreaming);
            var CENCCbcsEnable = locators.Any(l => l.StreamingPolicyName == PredefinedStreamingPolicy.MultiDrmStreaming);
            var EnvelopeEnable = locators.Any(l => l.StreamingPolicyName == PredefinedStreamingPolicy.ClearKey);


            int count = (ClearEnable ? 1 : 0) + (CENCEnable ? 1 : 0) + (CENCCbcsEnable ? 1 : 0) + (EnvelopeEnable ? 1 : 0);

            if (count == 0)
            {
                return(new AssetBitmapAndText());
            }

            ABT.bitmap = new Bitmap((envelopeencryptedimage.Width * count), envelopeencryptedimage.Height);
            int x = 0;

            using (Graphics graphicsObject = Graphics.FromImage(ABT.bitmap))
            {
                if (ClearEnable)
                {
                    graphicsObject.DrawImage(clearimage, new Point(x, 0));
                    x += envelopeencryptedimage.Width;
                }

                if (EnvelopeEnable)
                {
                    graphicsObject.DrawImage(envelopeencryptedimage, new Point(x, 0));
                    x += envelopeencryptedimage.Width;
                }

                if (CENCEnable)
                {
                    graphicsObject.DrawImage(CENCencryptedimage, new Point(x, 0));
                    x += CENCencryptedimage.Width;
                }

                if (CENCCbcsEnable)
                {
                    graphicsObject.DrawImage(CENCcbcsEncryptedImage, new Point(x, 0));
                    x += CENCcbcsEncryptedImage.Width;
                }
            }

            return(ABT);
        }