private async Task <CsvLineResult> ExportAssetCSVLineAsync(Asset asset, bool detailed, bool localtime, List <StreamingEndpoint> seList)
        {
            int?nbLocators = null;

            List <string> linec = new List <string>();

            linec.Add(asset.Name);
            linec.Add(asset.Description);
            linec.Add(asset.AlternateId);
            linec.Add(asset.AssetId.ToString());
            linec.Add(returnDate(localtime, asset.Created).ToString());
            linec.Add(returnDate(localtime, asset.LastModified).ToString());
            linec.Add(asset.StorageAccountName);
            linec.Add(asset.Container);

            if (detailed)
            {
                var assetType = await AssetInfo.GetAssetTypeAsync(asset.Name, _amsClient);

                linec.Add(assetType.Type);
                linec.Add(assetType.Size.ToString());
            }

            IList <AssetStreamingLocator> locators = (await _amsClient.AMSclient.Assets.ListStreamingLocatorsAsync(_amsClient.credentialsEntry.ResourceGroup, _amsClient.credentialsEntry.AccountName, asset.Name)).StreamingLocators;

            nbLocators = locators.Count();
            linec.Add(nbLocators.ToString());

            if (detailed)
            {
                foreach (var locator in locators)
                {
                    var paths = _amsClient.AMSclient.StreamingLocators.ListPaths(_amsClient.credentialsEntry.ResourceGroup, _amsClient.credentialsEntry.AccountName, locator.Name);
                    linec.Add(locator.Name);
                    linec.Add(returnDate(localtime, locator.Created).ToString());
                    linec.Add(returnDate(localtime, locator.StartTime).ToString());
                    linec.Add(returnDate(localtime, locator.EndTime).ToString());

                    foreach (var se in seList)
                    {
                        var listPaths = new List <string>();
                        foreach (var spath in paths.StreamingPaths)
                        {
                            listPaths.AddRange(spath.Paths.Select(p => "https://" + se.HostName + p));
                        }
                        linec.Add(string.Join(", ", listPaths));
                    }
                }
            }

            return(new CsvLineResult()
            {
                line = convertToCSVLine(linec), locatorCount = nbLocators
            });
        }
        private async Task <int?> ExportAssetExcelAsync(Asset asset, Excel.Worksheet xlWorkSheet, int row, bool detailed, bool localtime, List <StreamingEndpoint> seList)
        {
            int?nbLocators = null;

            int index = 1;

            xlWorkSheet.Cells[row, index++] = asset.Name;
            xlWorkSheet.Cells[row, index++] = asset.Description;
            xlWorkSheet.Cells[row, index++] = asset.AlternateId;
            xlWorkSheet.Cells[row, index++] = asset.AssetId.ToString();
            xlWorkSheet.Cells[row, index++] = returnDate(localtime, asset.Created);
            xlWorkSheet.Cells[row, index++] = returnDate(localtime, asset.LastModified);
            xlWorkSheet.Cells[row, index++] = asset.StorageAccountName;
            xlWorkSheet.Cells[row, index++] = asset.Container;

            if (detailed)
            {
                var assetType = await AssetInfo.GetAssetTypeAsync(asset.Name, _amsClient);

                xlWorkSheet.Cells[row, index++] = assetType.Type;
                xlWorkSheet.Cells[row, index++] = assetType.Size;
            }

            IList <AssetStreamingLocator> locators = (await _amsClient.AMSclient.Assets.ListStreamingLocatorsAsync(_amsClient.credentialsEntry.ResourceGroup, _amsClient.credentialsEntry.AccountName, asset.Name)).StreamingLocators;

            nbLocators = locators.Count();
            xlWorkSheet.Cells[row, index++] = nbLocators;

            if (detailed)
            {
                foreach (var locator in locators)
                {
                    var paths = _amsClient.AMSclient.StreamingLocators.ListPaths(_amsClient.credentialsEntry.ResourceGroup, _amsClient.credentialsEntry.AccountName, locator.Name);
                    xlWorkSheet.Cells[row, index++] = locator.Name;
                    xlWorkSheet.Cells[row, index++] = returnDate(localtime, locator.Created);
                    xlWorkSheet.Cells[row, index++] = returnDate(localtime, locator.StartTime);
                    xlWorkSheet.Cells[row, index++] = returnDate(localtime, locator.StartTime);
                    foreach (var se in seList)
                    {
                        var listPaths = new List <string>();
                        foreach (var spath in paths.StreamingPaths)
                        {
                            listPaths.AddRange(spath.Paths.Select(p => "https://" + se.HostName + p));
                        }
                        xlWorkSheet.Cells[row, index++] = string.Join("\n", listPaths);
                    }
                }
            }
            return(nbLocators);
        }
Esempio n. 3
0
        private async void listBoxOutputs_SelectedIndexChanged(object sender, EventArgs e)
        {
            JobOutput output = MyJob.Outputs.Skip(listBoxOutputs.SelectedIndex).Take(1).FirstOrDefault();

            DGOutputs.Rows.Clear();

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

            /*
             * int i = DGOutputs.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_listBoxTasks_SelectedIndexChanged_Configuration, "");
             * DataGridViewButtonCell btn = new DataGridViewButtonCell();
             * DGOutputs.Rows[i].Cells[1] = btn;
             * DGOutputs.Rows[i].Cells[1].Value = AMSExplorer.Properties.Resources.JobInformation_listBoxTasks_SelectedIndexChanged_SeeClearValue;
             * DGOutputs.Rows[i].Cells[1].Tag =  task.GetClearConfiguration();
             */

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

            DGOutputs.Rows.Add("Progress", output.Progress);
            DGOutputs.Rows.Add("State", output.State);

            if (output.GetType() == typeof(JobOutputAsset))
            {
                JobOutputAsset outputA = output as JobOutputAsset;
                DGOutputs.Rows.Add("Asset name", outputA.AssetName);
                DGOutputs.Rows.Add("Asset type", (await AssetInfo.GetAssetTypeAsync(outputA.AssetName, _amsClient))?.Type);
            }


            if (output.Error != null && output.Error.Details != null)
            {
                for (int j = 0; j < output.Error.Details.Count(); j++)
                {
                    DGOutputs.Rows.Add("Error", output.Error.Details[j].Code + ": " + output.Error.Details[j].Message);
                }
            }
        }
Esempio n. 4
0
        private async void listBoxInput_SelectedIndexChanged(object sender, EventArgs e)
        {
            dataGridInput.Rows.Clear();

            if (MyJob.Input.GetType() == typeof(JobInputAsset))
            {
                JobInputAsset inputA = MyJob.Input as JobInputAsset;
                dataGridInput.Rows.Add("Input type", "asset");
                dataGridInput.Rows.Add("Asset name", inputA.AssetName);
                dataGridInput.Rows.Add("Asset type", (await AssetInfo.GetAssetTypeAsync(inputA.AssetName, _amsClient))?.Type);
                if (inputA.Start != null && inputA.Start.GetType() == typeof(AbsoluteClipTime))
                {
                    AbsoluteClipTime startA = inputA.Start as AbsoluteClipTime;
                    dataGridInput.Rows.Add("Absolute Clip Time Start", startA.Time.ToString());
                }
                if (inputA.End != null && inputA.End.GetType() == typeof(AbsoluteClipTime))
                {
                    AbsoluteClipTime endA = inputA.End as AbsoluteClipTime;
                    dataGridInput.Rows.Add("Absolute Clip Time End", endA.Time.ToString());
                }
                dataGridInput.Rows.Add("Label", inputA.Label);
                dataGridInput.Rows.Add("Files", string.Join(Constants.endline, inputA.Files));
            }
            else if (MyJob.Input.GetType() == typeof(JobInputHttp))
            {
                JobInputHttp inputH = MyJob.Input as JobInputHttp;
                dataGridInput.Rows.Add("Input type", "http");
                dataGridInput.Rows.Add("Base Url", inputH.BaseUri);
                if (inputH.Start != null && inputH.Start.GetType() == typeof(AbsoluteClipTime))
                {
                    AbsoluteClipTime startA = inputH.Start as AbsoluteClipTime;
                    dataGridInput.Rows.Add("Absolute Clip Time Start", startA.Time.ToString());
                }
                if (inputH.End != null && inputH.End.GetType() == typeof(AbsoluteClipTime))
                {
                    AbsoluteClipTime endA = inputH.End as AbsoluteClipTime;
                    dataGridInput.Rows.Add("Absolute Clip Time End", endA.Time.ToString());
                }
                dataGridInput.Rows.Add("Label", inputH.Label);
                dataGridInput.Rows.Add("Files", string.Join(Constants.endline, inputH.Files));
            }
        }