public ExportAssetToAzureStorage(CloudMediaContext contextUploadArg, string MediaServicesStorageAccountKeyArg, IAsset sourceAsset, string StorageSuffix)
        {
            InitializeComponent();
            this.Icon = Bitmaps.Azure_Explorer_ico;
            MediaServicesStorageAccountKey = MediaServicesStorageAccountKeyArg;
            contextUpload = contextUploadArg;

            // list asset files ///////////////////////
            bool bfileinasset = (sourceAsset.AssetFiles.Count() == 0) ? false : true;

            listViewAssetFiles.Items.Clear();
            if (bfileinasset)
            {
                listViewAssetFiles.BeginUpdate();
                foreach (IAssetFile file in sourceAsset.AssetFiles)
                {
                    ListViewItem item = new ListViewItem(file.Name, 0);
                    if (file.IsPrimary)
                    {
                        item.ForeColor = Color.Blue;
                    }
                    item.SubItems.Add(file.LastModified.ToLocalTime().ToString("G"));
                    item.SubItems.Add(AssetInfo.FormatByteSize(file.ContentFileSize));
                    (listViewAssetFiles.Items.Add(item)).Selected = true;
                    listassetfiles.Add(file);
                }

                listViewAssetFiles.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
                listViewAssetFiles.EndUpdate();
            }
            myStorageSuffix = StorageSuffix;
        }
        private void DisplayFilesOfContainer(string containerName)
        {
            CloudBlobContainer          Container  = cloudBlobClient.ListContainers().Where(n => n.Name == containerName).FirstOrDefault();
            IEnumerable <IListBlobItem> mediaBlobs = Container.ListBlobs();

            ListBlobs.Clear();
            listViewFiles.Items.Clear();

            foreach (IListBlobItem b in mediaBlobs)
            {
                if (b.GetType() == typeof(CloudBlockBlob))
                {
                    CloudBlockBlob cloudBlockBlob = b as CloudBlockBlob;
                    string         lastModified   = "";
                    ListViewItem   item           = new ListViewItem(Path.GetFileName(b.Uri.LocalPath), 0);
                    lastModified = cloudBlockBlob.Properties.LastModified.Value.UtcDateTime.ToLocalTime().ToString("G");
                    item.SubItems.Add(lastModified);
                    item.SubItems.Add(AssetInfo.FormatByteSize(cloudBlockBlob.Properties.Length));
                    // Place a check mark next to the item.
                    listViewFiles.Items.Add(item);
                    ListBlobs.Add(b);
                }

                /*
                 * if (b.GetType() == typeof(CloudBlobDirectory))
                 * {
                 *  CloudBlobDirectory cloudBlockDir = b as CloudBlobDirectory;
                 *  ListViewItem item = new ListViewItem(cloudBlockDir.Prefix, 0);
                 *  listViewFiles.Items.Add(item);
                 *  ListBlobs.Add(b);
                 * }
                 */
            }
            listViewFiles.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
        }
Exemple #3
0
        private void LoadWorkflows()
        {
            this.BeginUpdate();
            this.Items.Clear();

            // Server side request
            var query = _context.Files.Where(f => (
                                                 f.Name.EndsWith(".xenio") || // upercase/lowercase ignored
                                                 f.Name.EndsWith(".kayak") ||
                                                 f.Name.EndsWith(".workflow") ||
                                                 f.Name.EndsWith(".blueprint") ||
                                                 f.Name.EndsWith(".graph") ||
                                                 f.Name.EndsWith(".zenium")
                                                 )).ToArray();

            foreach (IAssetFile file in query)
            {
                if (file.Asset.AssetFiles.Count() == 1)
                {
                    ListViewItem item = new ListViewItem(file.Name, 0);
                    item.SubItems.Add(file.LastModified.ToLocalTime().ToString("G"));
                    item.SubItems.Add(AssetInfo.FormatByteSize(file.ContentFileSize));
                    item.SubItems.Add(file.Asset.Name);
                    item.SubItems.Add(file.Asset.Id);
                    if (_selectedworkflow != null && _selectedworkflow.Id == file.Asset.Id)
                    {
                        item.Selected = true;
                    }
                    this.Items.Add(item);
                }
            }
            this.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            this.EndUpdate();
        }
        private void UploadOptions_Load(object sender, System.EventArgs e)
        {
            DpiUtils.InitPerMonitorDpi(this);

            var sizeText = AssetInfo.FormatByteSize(1024 * 1024L * Properties.Settings.Default.DataMovementBlockSize * 50000);

            labelBlockSize.Text = string.Format(labelBlockSize.Text, Properties.Settings.Default.DataMovementBlockSize, sizeText);
        }
        public void LoadJPGs(string searchstring = "")
        {
            this.BeginUpdate();
            this.Items.Clear();

            string searchlower  = searchstring.ToLower();
            bool   bsearchempty = string.IsNullOrEmpty(searchstring);

            // this query is done in the back-end
            var query = _context.Files.Where(f =>
                                             f.Name.EndsWith(Constants.SlateJPGExtension)
                                             &&
                                             f.IsPrimary
                                             &&
                                             f.ContentFileSize <= Constants.maxSlateJPGFileSize
                                             &&
                                             (bsearchempty || f.Name.Contains(searchlower))
                                             ).AsEnumerable();

            // local query
            query = query.Where(f =>
                                bsearchempty || (f.Id.ToLower().Contains(searchlower) || f.Asset.Name.ToLower().Contains(searchlower) || f.Asset.Id.ToLower().Contains(searchlower)));

            string defaultslateassetid = null;

            if (_channelslate != null && _channelslate.DefaultSlateAssetId != null)
            {
                defaultslateassetid = _channelslate.DefaultSlateAssetId;
            }

            foreach (IAssetFile file in query)
            {
                if (file.Asset.AssetFiles.Count() == 1)
                {
                    bool bdefaultchannelslate = defaultslateassetid == file.ParentAssetId;

                    ListViewItem item = new ListViewItem(file.Name + ((bdefaultchannelslate) ? " (default channel slate)" : string.Empty), 0);
                    item.SubItems.Add(file.LastModified.ToLocalTime().ToString("G"));
                    item.SubItems.Add(AssetInfo.FormatByteSize(file.ContentFileSize));
                    item.SubItems.Add(file.Asset.Name);
                    item.SubItems.Add(file.Asset.Id);
                    if (_selectedJPGAsset != null && _selectedJPGAsset.Id == file.Asset.Id)
                    {
                        item.Selected = true;
                    }
                    if (bdefaultchannelslate)
                    {
                        item.ForeColor = Color.Blue;
                    }
                    this.Items.Add(item);
                }
            }
            this.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            this.EndUpdate();
        }
        private void comboBoxBlockSize_SelectedIndexChanged(object sender, EventArgs e)
        {
            bool success = int.TryParse(comboBoxBlockSize.Text, out int x);

            if (success)
            {
                var sizeText = AssetInfo.FormatByteSize(1024 * 1024L * x * 50000);
                labelBlobSizeMax.Text = string.Format((string)labelBlobSizeMax.Tag, sizeText);
            }
            else
            {
                labelBlobSizeMax.Text = string.Empty;
            }
        }
Exemple #7
0
        private void DisplayFilesOfContainer(string containerName)
        {
            CloudBlobContainer          Container  = cloudBlobClient.ListContainers().Where(n => n.Name == containerName).FirstOrDefault();
            IEnumerable <IListBlobItem> mediaBlobs = Container.ListBlobs();

            listViewFiles.Items.Clear();

            foreach (IListBlobItem b in mediaBlobs)
            {
                CloudBlockBlob cloudBlockBlob = b as CloudBlockBlob;
                string         lastModified   = "";
                ListViewItem   item           = new ListViewItem(Path.GetFileName(b.Uri.ToString()), 0);
                lastModified = cloudBlockBlob.Properties.LastModified.Value.UtcDateTime.ToLocalTime().ToString();
                item.SubItems.Add(lastModified);
                item.SubItems.Add(AssetInfo.FormatByteSize(cloudBlockBlob.Properties.Length));
                listViewFiles.Items.Add(item);
            }
            listViewFiles.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
        }
Exemple #8
0
        private void BuildGrid()
        {
            labelAssetNameTitle.Text += _metadata.Name;

            DGMetadataGal.ColumnCount   = 2;
            DGMetadataVideo.ColumnCount = 2;
            DGMetadataAudio.ColumnCount = 2;

            // general metedata
            DGMetadataGal.Columns[0].DefaultCellStyle.BackColor   = Color.Gainsboro;
            DGMetadataVideo.Columns[0].DefaultCellStyle.BackColor = Color.Gainsboro;
            DGMetadataAudio.Columns[0].DefaultCellStyle.BackColor = Color.Gainsboro;
            DGMetadataGal.Rows.Add("Name", _metadata.Name);
            DGMetadataGal.Rows.Add("Duration", _metadata.Duration);
            DGMetadataGal.Rows.Add("Size", AssetInfo.FormatByteSize(_metadata.Size));
            if (_metadata.VideoTracks != null)
            {
                DGMetadataGal.Rows.Add("Video tracks", _metadata.VideoTracks.Count());
            }
            if (_metadata.AudioTracks != null)
            {
                DGMetadataGal.Rows.Add("Audio tracks", _metadata.AudioTracks.Count());
            }

            foreach (var source in _metadata.Sources)
            {
                DGMetadataGal.Rows.Add("Source", source.Name);
            }

            if (_metadata.VideoTracks != null)
            {
                numericUpDownVideoTrack.Maximum = _metadata.VideoTracks.Count() - 1;
            }
            if (_metadata.AudioTracks != null)
            {
                numericUpDownAudioTrack.Maximum = _metadata.AudioTracks.Count() - 1;
            }
            DGMetadataGal.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;

            BuildGridVideo();
            BuildGridAudio();
        }
        private void ListAssetFiles()
        {
            listViewFiles.Items.Clear();

            overlayfiles = myAsset.AssetFiles.ToList().Where(f => IsOverlayFile(f.Name)).ToList();

            if (overlayfiles.Count() > 0)
            {
                listViewFiles.BeginUpdate();
                foreach (IAssetFile file in overlayfiles)
                {
                    ListViewItem item = new ListViewItem(file.Name, 0);
                    if (file.IsPrimary)
                    {
                        item.ForeColor = Color.Blue;
                    }
                    item.SubItems.Add(AssetInfo.FormatByteSize(file.ContentFileSize));
                    listViewFiles.Items.Add(item);
                }
                listViewFiles.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
                listViewFiles.EndUpdate();
            }
        }
        public static string CheckSlateFile(string file) // return null if ok. Otherwise, error is the string.
        {
            string returnString = null;

            bool     Error            = false;
            FileInfo fileInfo         = null;
            Image    fileImage        = null;
            double   aspectRatioImage = 0d;

            try
            {
                fileInfo         = new FileInfo(file);
                fileImage        = Image.FromFile(file);
                aspectRatioImage = (double)fileImage.Size.Width / (double)fileImage.Size.Height;
            }
            catch
            {
                Error        = true;
                returnString = string.Format("Error when accessing the file\n'{0}'.", file);
            }
            if (!Error)
            {
                if (fileInfo.Extension.ToLower() != Constants.SlateJPGExtension)  // file has not an .jpg extension
                {
                    returnString = string.Format("The file\n'{0}'\nhas not a {1} extension", file, Constants.SlateJPGExtension);
                }
                else if (!fileImage.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Jpeg))  // file is not a JPEG
                {
                    returnString = string.Format("The file\n'{0}'\nis not a JPEG file", file);
                }
                else if (fileInfo.Length > Constants.maxSlateJPGFileSize)  // file size > 3 MB, not ok
                {
                    returnString = string.Format("The file\n'{0}'\nhas a size of {1} which is larger than {2}", file, AssetInfo.FormatByteSize(fileInfo.Length), AssetInfo.FormatByteSize(Constants.maxSlateJPGFileSize));
                }
                else if (fileImage.Size.Width > Constants.maxSlateJPGHorizontalResolution || fileImage.Size.Height > Constants.maxSlateJPGVerticalResolution)
                {
                    returnString = string.Format("The file\n'{0}'\nhas a resolution  of {1}x{2} which is larger than {3}x{4}", file, fileImage.Size.Width, fileImage.Size.Height, Constants.maxSlateJPGHorizontalResolution, Constants.maxSlateJPGVerticalResolution);
                }
                else if (!AreClose(aspectRatioImage, Constants.SlateJPGAspectRatio))
                {
                    returnString = string.Format("The file\n'{0}'\nhas an aspect ratio of {1:0.000} which is different from {2:0.000} (16:9)", file, aspectRatioImage, Constants.SlateJPGAspectRatio);
                }
            }
            return(returnString);
        }
Exemple #11
0
        private void LoadWorkflows() // return true if no error or false if partial query was done
        {
            this.BeginUpdate();
            this.Items.Clear();

            // Server side request
            IAssetFile[] query = new IAssetFile[] { };

            if (_context.Files.Count() < 1000000)
            {
                try
                {
                    query = _context.Files.Where(f => (
                                                     f.Name.EndsWith(".workflow")
                                                     )).ToArray();
                }

                catch (Exception ex)
                {
                    ErrorQuery = Program.GetErrorMessage(ex);
                }
            }
            else // to many files. In that case let's try to look up only the last two months
            {
                try
                {
                    query = _context.Files.Where(f =>
                                                 (f.LastModified > DateTime.UtcNow.AddMonths(-2))
                                                 &&
                                                 (f.Name.EndsWith(".workflow"))
                                                 ).ToArray();
                    PartialQueryLast2Months = true;
                }

                catch (Exception ex)
                {
                    ErrorQuery = Program.GetErrorMessage(ex);
                }
            }


            if (ErrorQuery == null)
            {
                foreach (IAssetFile file in query)
                {
                    if (file.Asset.AssetFiles.Count() == 1)
                    {
                        ListViewItem item = new ListViewItem(file.Name, 0);
                        item.SubItems.Add(file.LastModified.ToLocalTime().ToString("G"));
                        item.SubItems.Add(AssetInfo.FormatByteSize(file.ContentFileSize));
                        item.SubItems.Add(file.Asset.Name);
                        item.SubItems.Add(file.Asset.Id);
                        if (_selectedworkflow != null && _selectedworkflow.Id == file.Asset.Id)
                        {
                            item.Selected = true;
                        }
                        this.Items.Add(item);
                    }
                }
            }

            this.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            this.EndUpdate();
        }
        private void WorkerAnalyzeAssets_DoWork(object sender, DoWorkEventArgs e)
        {
            Debug.WriteLine("WorkerAnalyzeAssets_DoWork");
            BackgroundWorker worker = sender as BackgroundWorker;
            Asset            asset  = null;

            var listae = _MyObservAssetV3.OrderBy(a => cacheAssetentriesV3.ContainsKey(a.Name)).ToList(); // as priority, assets not yet analyzed


            // test - let analyze only visible assets

            var visibleRowsCount       = this.DisplayedRowCount(true);
            var firstDisplayedRowIndex = (this.FirstDisplayedCell != null) ? this.FirstDisplayedCell.RowIndex : 0;
            var lastvisibleRowIndex    = (firstDisplayedRowIndex + visibleRowsCount) - 1;
            var VisibleAssets          = new List <String>();

            for (int rowIndex = firstDisplayedRowIndex; rowIndex <= lastvisibleRowIndex; rowIndex++)
            {
                var row = this.Rows[rowIndex];

                var assetname = row.Cells[this.Columns["Name"].Index].Value.ToString();
                VisibleAssets.Add(assetname);
            }

            var query   = from ae in listae join visAsset in VisibleAssets on ae.Name equals visAsset select ae;
            var listae2 = query.ToList();

            _client.RefreshTokenIfNeeded();

            foreach (AssetEntryV3 AE in listae2)
            {
                System.Threading.Thread.Sleep(1000);
                try
                {
                    asset = _client.AMSclient.Assets.Get(_client.credentialsEntry.ResourceGroup, _client.credentialsEntry.AccountName, AE.Name);

                    /*
                     * var firstPage = await MediaServicesArmClient.Assets.ListAsync(TestSettings.CustomerResourceGroup, TestSettings.CustomerAccountName);
                     *
                     * var currentPage = firstPage;
                     * while (currentPage.NextPageLink != null)
                     * {
                     *  currentPage = await MediaServicesArmClient.Assets.ListNextAsync(currentPage.NextPageLink);
                     * }
                     */

                    if (asset != null)
                    {
                        //AssetInfo myAssetInfo = new AssetInfo(asset);
                        AE.AlternateId  = asset.AlternateId;
                        AE.Description  = asset.Description;
                        AE.Created      = asset.Created.ToLocalTime().ToString("G");
                        AE.LastModified = asset.LastModified.ToLocalTime().ToString("G");
                        AE.Name         = asset.Name;
                        // AE.StorageAccountName = asset.StorageAccountName;

                        var assetBitmapAndText = DataGridViewAssets.BuildBitmapPublication(asset.Name, _client);
                        AE.Publication          = assetBitmapAndText.bitmap;
                        AE.PublicationMouseOver = assetBitmapAndText.MouseOverDesc;

                        // var assetfiles =  asset.AssetFiles.ToList();
                        var data = AssetInfo.GetAssetType(asset.Name, _client);
                        AE.Type         = data.Type;
                        AE.SizeLong     = data.Size;
                        AE.Size         = AssetInfo.FormatByteSize(AE.SizeLong);
                        AE.AssetWarning = (AE.SizeLong == 0);// || assetfiles.Any(f => f.ContentFileSize == 0));

                        assetBitmapAndText   = BuildBitmapDynEncryption(asset.Name, _client);
                        AE.DynamicEncryption = assetBitmapAndText.bitmap;
                        //AE.DynamicEncryptionMouseOver = assetBitmapAndText.MouseOverDesc;

                        if (assetBitmapAndText.Locators != null)
                        {
                            DateTime?LocDate = assetBitmapAndText.Locators.Any() ? (DateTime?)assetBitmapAndText.Locators.Min(l => l.EndTime).ToLocalTime() : null;
                            AE.LocatorExpirationDate        = LocDate.HasValue ? ((DateTime)LocDate).ToLocalTime().ToString() : null;
                            AE.LocatorExpirationDateWarning = LocDate.HasValue ? (LocDate < DateTime.Now.ToLocalTime()) : false;
                        }

                        //assetBitmapAndText = BuildBitmapAssetFilters(asset.Name, _client);
                        int?afcount = ReturnNumberAssetFilters(asset.Name, _client);
                        AE.Filters = afcount > 0 ? afcount : null;
                        //AE.FiltersMouseOver = assetBitmapAndText.MouseOverDesc;

                        cacheAssetentriesV3[asset.Name] = AE; // let's put it in cache (or update the cache)
                    }
                }
                catch // in some case, we have a timeout on Assets.Where...
                {
                }
                if (worker.CancellationPending == true)
                {
                    e.Cancel = true;
                    return;
                }
            }
            this.BeginInvoke(new Action(() => this.Refresh()), null);
        }
        private void JobInformation_Load(object sender, EventArgs e)
        {
            labelJobNameTitle.Text += MyJob.Name;

            DGJob.ColumnCount   = 2;
            DGTasks.ColumnCount = 2;
            DGTasks.Columns[0].DefaultCellStyle.BackColor = Color.Gainsboro;

            DGErrors.ColumnCount           = 3;
            DGErrors.Columns[0].HeaderText = AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_Task;
            DGErrors.Columns[1].HeaderText = AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_ErrorDetail;
            DGErrors.Columns[2].HeaderText = AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_Code;

            DGJob.Columns[0].DefaultCellStyle.BackColor = Color.Gainsboro;
            DGJob.Rows.Add(AMSExplorer.Properties.Resources.AssetInformation_AssetInformation_Load_Name, MyJob.Name);
            DGJob.Rows.Add("Id", MyJob.Id);
            DGJob.Rows.Add(AMSExplorer.Properties.Resources.AssetInformation_AssetInformation_Load_State, MyJob.State);
            DGJob.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_Priority, MyJob.Priority);
            DGJob.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_OverallProgress, MyJob.GetOverallProgress());

            if (MyJob.StartTime != null)
            {
                DGJob.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_StartTime, ((DateTime)MyJob.StartTime).ToLocalTime().ToString("G"));
            }
            if (MyJob.EndTime != null)
            {
                DGJob.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_EndTime, ((DateTime)MyJob.EndTime).ToLocalTime().ToString("G"));
            }

            if ((MyJob.StartTime != null) && (MyJob.EndTime != null))
            {
                DGJob.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_JobDuration, ((DateTime)MyJob.EndTime).Subtract((DateTime)MyJob.StartTime));
            }
            DGJob.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_CPUDuration, MyJob.RunningDuration);
            DGJob.Rows.Add(AMSExplorer.Properties.Resources.AssetInformation_AssetInformation_Load_Created, ((DateTime)MyJob.Created).ToLocalTime().ToString("G"));
            DGJob.Rows.Add(AMSExplorer.Properties.Resources.AssetInformation_AssetInformation_Load_LastModified, ((DateTime)MyJob.LastModified).ToLocalTime().ToString("G"));
            DGJob.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_TemplateId, MyJob.TemplateId);


            TaskSize jobSizePrice = JobInfo.CalculateJobSizeAndPrice(MyJob);

            if ((jobSizePrice.InputSize != -1) && (jobSizePrice.OutputSize != -1))
            {
                DGJob.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_InputSize, AssetInfo.FormatByteSize(jobSizePrice.InputSize));
                DGJob.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_OutputSize, AssetInfo.FormatByteSize(jobSizePrice.OutputSize));
                DGJob.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_ProcessedSize, AssetInfo.FormatByteSize(jobSizePrice.InputSize + jobSizePrice.OutputSize));
                //if (jobSizePrice.Price != -1) DGJob.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_EstimatedPrice, string.Format("{0} {1:0.00}", Properties.Settings.Default.Currency, jobSizePrice.Price));
            }
            else
            {
                DGJob.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_InputOutputSize, AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_UndefinedTaskDidNotFinishOrOneOfTheAssetsHasBeenDeleted);
            }

            bool btaskinjob = (MyJob.Tasks.Count() > 0);

            if (btaskinjob)
            {
                foreach (ITask task in MyJob.Tasks)
                {
                    listBoxTasks.Items.Add(task.Name ?? Constants.stringNull);

                    for (int i = 0; i < task.ErrorDetails.Count(); i++)
                    {
                        DGErrors.Rows.Add(task.Name, task.ErrorDetails[i].Message, task.ErrorDetails[i].Code);
                    }
                }
                listBoxTasks.SelectedIndex = 0;
            }

            ListJobAssets();
        }
        private void listBoxTasks_SelectedIndexChanged(object sender, EventArgs e)
        {
            ITask task = MyJob.Tasks.Skip(listBoxTasks.SelectedIndex).Take(1).FirstOrDefault();

            DGTasks.Rows.Clear();

            DGTasks.Rows.Add(AMSExplorer.Properties.Resources.AssetInformation_AssetInformation_Load_Name, task.Name);

            int i = DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_listBoxTasks_SelectedIndexChanged_Configuration, "");
            DataGridViewButtonCell btn = new DataGridViewButtonCell();

            DGTasks.Rows[i].Cells[1]       = btn;
            DGTasks.Rows[i].Cells[1].Value = AMSExplorer.Properties.Resources.JobInformation_listBoxTasks_SelectedIndexChanged_SeeClearValue;
            DGTasks.Rows[i].Cells[1].Tag   = task.GetClearConfiguration();

            i   = DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_listBoxTasks_SelectedIndexChanged_Body, "");
            btn = new DataGridViewButtonCell();
            DGTasks.Rows[i].Cells[1]       = btn;
            DGTasks.Rows[i].Cells[1].Value = AMSExplorer.Properties.Resources.AssetInformation_DoDisplayAuthorizationPolicyOption_SeeValue;
            DGTasks.Rows[i].Cells[1].Tag   = task.TaskBody;

            DGTasks.Rows.Add("Id", task.Id);
            DGTasks.Rows.Add(AMSExplorer.Properties.Resources.AssetInformation_AssetInformation_Load_State, task.State);
            DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_Priority, task.Priority);
            if (task.StartTime != null)
            {
                DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_StartTime, ((DateTime)task.StartTime).ToLocalTime().ToString("G"));
            }
            if (task.EndTime != null)
            {
                DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_EndTime, ((DateTime)task.EndTime).ToLocalTime().ToString("G"));
            }
            DGTasks.Rows.Add(AMSExplorer.Properties.Resources.DataGridViewIngestManifest_Init_Progress, task.Progress);
            DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_listBoxTasks_SelectedIndexChanged_Duration, task.RunningDuration);
            DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_listBoxTasks_SelectedIndexChanged_PerfMessage, task.PerfMessage);
            DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_listBoxTasks_SelectedIndexChanged_EncryptionKeyId, task.EncryptionKeyId);
            DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_listBoxTasks_SelectedIndexChanged_EncryptionScheme, task.EncryptionScheme);
            DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_listBoxTasks_SelectedIndexChanged_EncryptionVersion, task.EncryptionVersion);

            // let's get the name of the processor
            IMediaProcessor processor = JobInfo.GetMediaProcessorFromId(task.MediaProcessorId, _context);

            DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_listBoxTasks_SelectedIndexChanged_MediaprocessorId, task.MediaProcessorId);
            if (processor != null)
            {
                DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_listBoxTasks_SelectedIndexChanged_MediaprocessorName, processor.Name);
            }

            DGTasks.Rows.Add(AMSExplorer.Properties.Resources.AssetInformation_DoDisplayFileProperties_Options, task.Options);
            DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_listBoxTasks_SelectedIndexChanged_InitializationVector, task.InitializationVector);

            string sid = "";

            try
            {
                if (task.InputAssets.Count() > 1)
                {
                    sid = " #{0}";
                }
                else
                {
                    sid = "";
                }
                for (int j = 0; j < task.InputAssets.Count(); j++)
                {
                    var s = string.Format(sid, j + 1);
                    DGTasks.Rows.Add(string.Format("Input asset{0} Name", s), task.InputAssets[j].Name);
                    DGTasks.Rows.Add(string.Format("Input asset{0} Id", s), task.InputAssets[j].Id);
                }
            }
            catch
            {
                DGTasks.Rows.Add("Input asset(s)", "<error, deleted?>");
            }

            try
            {
                if (task.OutputAssets.Count() > 1)
                {
                    sid = " #{0}";
                }
                else
                {
                    sid = "";
                }
                for (int j = 0; j < task.OutputAssets.Count(); j++)
                {
                    var s = string.Format(sid, j + 1);
                    DGTasks.Rows.Add(string.Format("Output asset{0} Name", s), task.OutputAssets[j].Name);
                    DGTasks.Rows.Add(string.Format("Output asset{0} Id", s), task.OutputAssets[j].Id);
                    DGTasks.Rows.Add(string.Format("Output asset{0} Format Option", s), task.OutputAssets[j].FormatOption);
                }
            }
            catch
            {
                DGTasks.Rows.Add("Output asset(s)", "<error, deleted?>");
            }

            TaskSize taskSizePrice = JobInfo.CalculateTaskSize(task, _context);

            if ((taskSizePrice.InputSize != -1) && (taskSizePrice.OutputSize != -1))
            {
                DGTasks.Rows.Add("Input size", AssetInfo.FormatByteSize(taskSizePrice.InputSize));
                DGTasks.Rows.Add("Output size", AssetInfo.FormatByteSize(taskSizePrice.OutputSize));
            }
            else
            {
                DGTasks.Rows.Add("Input/output size", "undefined, task did not finish or one of the assets has been deleted");
            }

            for (int j = 0; j < task.ErrorDetails.Count(); j++)
            {
                DGTasks.Rows.Add("Error", task.ErrorDetails[j].Code + ": " + task.ErrorDetails[j].Message);
            }
        }
Exemple #15
0
        private void listBoxTasks_SelectedIndexChanged(object sender, EventArgs e)
        {
            ITask task = MyJob.Tasks.Skip(listBoxTasks.SelectedIndex).Take(1).FirstOrDefault();

            DGTasks.Rows.Clear();

            DGTasks.Rows.Add("Name", task.Name);
            DGTasks.Rows.Add("Id", task.Id);
            DGTasks.Rows.Add("State", task.State);
            DGTasks.Rows.Add("Priority", task.Priority);
            if (task.StartTime != null)
            {
                DGTasks.Rows.Add("Start Time", ((DateTime)task.StartTime).ToLocalTime());
            }
            if (task.EndTime != null)
            {
                DGTasks.Rows.Add("End Time", ((DateTime)task.EndTime).ToLocalTime());
            }
            DGTasks.Rows.Add("Progress", task.Progress);
            DGTasks.Rows.Add("Duration", task.RunningDuration);
            DGTasks.Rows.Add("Perf Message", task.PerfMessage);
            DGTasks.Rows.Add("Configuration", task.Configuration);
            DGTasks.Rows.Add("Encryption Key Id", task.EncryptionKeyId);
            DGTasks.Rows.Add("Encryption Scheme", task.EncryptionScheme);
            DGTasks.Rows.Add("Encryption Version", task.EncryptionVersion);

            // let's get the name of the processor
            bool            Error     = false;
            IMediaProcessor processor = null;

            try
            {
                var processorquery =
                    from p in _context.MediaProcessors
                    orderby p.Version descending
                    where p.Id == task.MediaProcessorId
                    select p;
                // Reference the asset as an IAsset.
                processor = processorquery.FirstOrDefault(); //lastordefault returns an error so that's why we use first with sorting descending
            }
            catch
            {
                Error = true;
            }
            if (!Error)
            {
                DGTasks.Rows.Add("Mediaprocessor Name", processor.Name);
                DGTasks.Rows.Add("Mediaprocessor Id", task.MediaProcessorId);
            }


            DGTasks.Rows.Add("Task Body", task.TaskBody);
            DGTasks.Rows.Add("Options", task.Options);
            DGTasks.Rows.Add("Initialization Vector", task.InitializationVector);

            string sid = "";

            if (task.InputAssets.Count() > 1)
            {
                sid = " #{0}";
            }
            else
            {
                sid = "";
            }
            for (int i = 0; i < task.InputAssets.Count(); i++)
            {
                DGTasks.Rows.Add("Input asset" + string.Format(sid, i + 1) + " Name", task.InputAssets[i].Name);
                DGTasks.Rows.Add("Input asset" + string.Format(sid, i + 1) + " Id", task.InputAssets[i].Id);
            }

            if (task.OutputAssets.Count() > 1)
            {
                sid = " #{0}";
            }
            else
            {
                sid = "";
            }
            for (int i = 0; i < task.OutputAssets.Count(); i++)
            {
                DGTasks.Rows.Add("Output asset" + string.Format(sid, i + 1) + " Name", task.OutputAssets[i].Name);
                DGTasks.Rows.Add("Output asset" + string.Format(sid, i + 1) + " Id", task.OutputAssets[i].Id);
            }


            long inputsize  = JobInfo.GetInputFilesSize(task);
            long outputsize = JobInfo.GetOutputFilesSize(task);

            if ((inputsize != -1) && (outputsize != -1))
            {
                DGTasks.Rows.Add("Input size", AssetInfo.FormatByteSize(inputsize));
                DGTasks.Rows.Add("Output size", AssetInfo.FormatByteSize(outputsize));
                DGTasks.Rows.Add("Processed size", AssetInfo.FormatByteSize(inputsize + outputsize));
            }
            else
            {
                DGTasks.Rows.Add("Input/output size", "undefined, task did not finished");
            }
            for (int i = 0; i < task.ErrorDetails.Count(); i++)
            {
                DGTasks.Rows.Add("Error", task.ErrorDetails[i].Code + ": " + task.ErrorDetails[i].Message);
            }
        }
Exemple #16
0
        private void listBoxTasks_SelectedIndexChanged(object sender, EventArgs e)
        {
            ITask task = MyJob.Tasks.Skip(listBoxTasks.SelectedIndex).Take(1).FirstOrDefault();

            DGTasks.Rows.Clear();

            DGTasks.Rows.Add("Name", task.Name);
            DGTasks.Rows.Add("Id", task.Id);
            DGTasks.Rows.Add("State", task.State);
            DGTasks.Rows.Add("Priority", task.Priority);
            if (task.StartTime != null)
            {
                DGTasks.Rows.Add("Start Time", ((DateTime)task.StartTime).ToLocalTime());
            }
            if (task.EndTime != null)
            {
                DGTasks.Rows.Add("End Time", ((DateTime)task.EndTime).ToLocalTime());
            }
            DGTasks.Rows.Add("Progress", task.Progress);
            DGTasks.Rows.Add("Duration", task.RunningDuration);
            DGTasks.Rows.Add("Perf Message", task.PerfMessage);
            DGTasks.Rows.Add("Configuration", task.Configuration);
            DGTasks.Rows.Add("Encryption Key Id", task.EncryptionKeyId);
            DGTasks.Rows.Add("Encryption Scheme", task.EncryptionScheme);
            DGTasks.Rows.Add("Encryption Version", task.EncryptionVersion);

            // let's get the name of the processor
            IMediaProcessor processor = JobInfo.GetMediaProcessorFromId(task.MediaProcessorId, _context);

            DGTasks.Rows.Add("Mediaprocessor Id", task.MediaProcessorId);
            if (processor != null)
            {
                DGTasks.Rows.Add("Mediaprocessor Name", processor.Name);
            }


            DGTasks.Rows.Add("Task Body", task.TaskBody);
            DGTasks.Rows.Add("Options", task.Options);
            DGTasks.Rows.Add("Initialization Vector", task.InitializationVector);

            string sid = "";

            if (task.InputAssets.Count() > 1)
            {
                sid = " #{0}";
            }
            else
            {
                sid = "";
            }
            for (int i = 0; i < task.InputAssets.Count(); i++)
            {
                DGTasks.Rows.Add("Input asset" + string.Format(sid, i + 1) + " Name", task.InputAssets[i].Name);
                DGTasks.Rows.Add("Input asset" + string.Format(sid, i + 1) + " Id", task.InputAssets[i].Id);
            }

            if (task.OutputAssets.Count() > 1)
            {
                sid = " #{0}";
            }
            else
            {
                sid = "";
            }
            for (int i = 0; i < task.OutputAssets.Count(); i++)
            {
                DGTasks.Rows.Add("Output asset" + string.Format(sid, i + 1) + " Name", task.OutputAssets[i].Name);
                DGTasks.Rows.Add("Output asset" + string.Format(sid, i + 1) + " Id", task.OutputAssets[i].Id);
            }

            TaskSizeAndPrice taskSizePrice = JobInfo.CalculateTaskSizeAndPrice(task, _context);

            if ((taskSizePrice.InputSize != -1) && (taskSizePrice.OutputSize != -1))
            {
                DGTasks.Rows.Add("Input size", AssetInfo.FormatByteSize(taskSizePrice.InputSize));
                DGTasks.Rows.Add("Output size", AssetInfo.FormatByteSize(taskSizePrice.OutputSize));
                DGTasks.Rows.Add("Processed size", AssetInfo.FormatByteSize(taskSizePrice.InputSize + taskSizePrice.OutputSize));
                if (taskSizePrice.Price != -1)
                {
                    DGTasks.Rows.Add("Estimated price", string.Format("{0} {1:0.00}", Properties.Settings.Default.Currency, taskSizePrice.Price));
                }
            }
            else
            {
                DGTasks.Rows.Add("Input/output size", "undefined, task did not finished or one of the assets has been deleted");
            }

            for (int i = 0; i < task.ErrorDetails.Count(); i++)
            {
                DGTasks.Rows.Add("Error", task.ErrorDetails[i].Code + ": " + task.ErrorDetails[i].Message);
            }
            textBoxConfiguration.Text = task.GetClearConfiguration();
        }
Exemple #17
0
        private void JobInformation_Load(object sender, EventArgs e)
        {
            labelJobNameTitle.Text += MyJob.Name;

            DGJob.ColumnCount   = 2;
            DGTasks.ColumnCount = 2;
            DGTasks.Columns[0].DefaultCellStyle.BackColor = Color.Gainsboro;


            DGErrors.ColumnCount           = 3;
            DGErrors.Columns[0].HeaderText = "Task";
            DGErrors.Columns[1].HeaderText = "Error detail";
            DGErrors.Columns[2].HeaderText = "Code";

            DGJob.Columns[0].DefaultCellStyle.BackColor = Color.Gainsboro;
            DGJob.Rows.Add("Name", MyJob.Name);
            DGJob.Rows.Add("Id", MyJob.Id);
            DGJob.Rows.Add("State", MyJob.State);
            DGJob.Rows.Add("Priority", MyJob.Priority);
            DGJob.Rows.Add("Overall progress", MyJob.GetOverallProgress());

            if (MyJob.StartTime != null)
            {
                DGJob.Rows.Add("Start Time", ((DateTime)MyJob.StartTime).ToLocalTime());
            }
            if (MyJob.EndTime != null)
            {
                DGJob.Rows.Add("End Time", ((DateTime)MyJob.EndTime).ToLocalTime());
            }

            if ((MyJob.StartTime != null) && (MyJob.EndTime != null))
            {
                DGJob.Rows.Add("Job Duration", ((DateTime)MyJob.EndTime).Subtract((DateTime)MyJob.StartTime));
            }
            DGJob.Rows.Add("CPU Duration", MyJob.RunningDuration);
            DGJob.Rows.Add("Created", ((DateTime)MyJob.Created).ToLocalTime());
            DGJob.Rows.Add("Last Modified", ((DateTime)MyJob.LastModified).ToLocalTime());
            DGJob.Rows.Add("Template Id", MyJob.TemplateId);

            string sid = "";

            if (MyJob.InputMediaAssets.Count() > 1)
            {
                sid = " #{0}";
            }
            else
            {
                sid = "";
            }
            for (int i = 0; i < MyJob.InputMediaAssets.Count(); i++)
            {
                DGJob.Rows.Add("Input asset" + string.Format(sid, i) + " Name", MyJob.InputMediaAssets[i].Name);
                DGJob.Rows.Add("Input asset" + string.Format(sid, i) + " Id", MyJob.InputMediaAssets[i].Id);
            }

            if (MyJob.OutputMediaAssets.Count() > 1)
            {
                sid = " #{0}";
            }
            else
            {
                sid = "";
            }
            for (int i = 0; i < MyJob.OutputMediaAssets.Count(); i++)
            {
                DGJob.Rows.Add("Output asset" + string.Format(sid, i) + " Name", MyJob.OutputMediaAssets[i].Name);
                DGJob.Rows.Add("Output asset" + string.Format(sid, i) + " Id", MyJob.OutputMediaAssets[i].Id);
            }


            TaskSizeAndPrice jobSizePrice = JobInfo.CalculateJobSizeAndPrice(MyJob);

            if ((jobSizePrice.InputSize != -1) && (jobSizePrice.OutputSize != -1))
            {
                DGJob.Rows.Add("Input size", AssetInfo.FormatByteSize(jobSizePrice.InputSize));
                DGJob.Rows.Add("Output size", AssetInfo.FormatByteSize(jobSizePrice.OutputSize));
                DGJob.Rows.Add("Processed size", AssetInfo.FormatByteSize(jobSizePrice.InputSize + jobSizePrice.OutputSize));
                if (jobSizePrice.Price != -1)
                {
                    DGJob.Rows.Add("Estimated price", string.Format("{0} {1:0.00}", Properties.Settings.Default.Currency, jobSizePrice.Price));
                }
            }
            else
            {
                DGJob.Rows.Add("Input/output size", "undefined, task did not finished or one of the assets has been deleted");
            }

            bool btaskinjob = (MyJob.Tasks.Count() > 0);

            if (btaskinjob)
            {
                foreach (ITask task in MyJob.Tasks)
                {
                    listBoxTasks.Items.Add(task.Name);

                    for (int i = 0; i < task.ErrorDetails.Count(); i++)
                    {
                        DGErrors.Rows.Add(task.Name, task.ErrorDetails[i].Message, task.ErrorDetails[i].Code);
                    }
                }
                listBoxTasks.SelectedIndex = 0;
            }
        }