зеркало из https://github.com/microsoft/2LCS.git
Rework NuGet packages export
- use version information from last line of file description instead of release notes - add a form to do the export, which enables date filters and progress information - limit exported data to relevant information
This commit is contained in:
Родитель
064f6bac57
Коммит
99155496aa
|
@ -0,0 +1,229 @@
|
|||
namespace LCS.AssetLibrary
|
||||
{
|
||||
partial class AssetLibrarySearch
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AssetLibrarySearch));
|
||||
assetsCreatedAfter = new System.Windows.Forms.DateTimePicker();
|
||||
assetsCreatedBefore = new System.Windows.Forms.DateTimePicker();
|
||||
assetsCreatedAfterLabel = new System.Windows.Forms.Label();
|
||||
assetsCreatedBeforeLabel = new System.Windows.Forms.Label();
|
||||
nugetPackagesFilesGroup = new System.Windows.Forms.GroupBox();
|
||||
searchApplicationVersionLabel = new System.Windows.Forms.Label();
|
||||
searchPlatformVersionLabel = new System.Windows.Forms.Label();
|
||||
searchApplicationVersion = new System.Windows.Forms.TextBox();
|
||||
searchPlatformVersion = new System.Windows.Forms.TextBox();
|
||||
searchNameOrDescriptionLabel = new System.Windows.Forms.Label();
|
||||
searchNameOrDescription = new System.Windows.Forms.TextBox();
|
||||
search = new System.Windows.Forms.Button();
|
||||
assetExportProgress = new System.Windows.Forms.ProgressBar();
|
||||
assetExportProgressNumberOfMax = new System.Windows.Forms.Label();
|
||||
assetExportProgressAssetName = new System.Windows.Forms.Label();
|
||||
nugetPackagesFilesGroup.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// assetsCreatedAfter
|
||||
//
|
||||
assetsCreatedAfter.Location = new System.Drawing.Point(157, 12);
|
||||
assetsCreatedAfter.Name = "assetsCreatedAfter";
|
||||
assetsCreatedAfter.Size = new System.Drawing.Size(250, 27);
|
||||
assetsCreatedAfter.TabIndex = 0;
|
||||
//
|
||||
// assetsCreatedBefore
|
||||
//
|
||||
assetsCreatedBefore.Location = new System.Drawing.Point(583, 12);
|
||||
assetsCreatedBefore.Name = "assetsCreatedBefore";
|
||||
assetsCreatedBefore.Size = new System.Drawing.Size(250, 27);
|
||||
assetsCreatedBefore.TabIndex = 1;
|
||||
assetsCreatedBefore.Value = new System.DateTime(2024, 2, 17, 14, 36, 55, 0);
|
||||
//
|
||||
// assetsCreatedAfterLabel
|
||||
//
|
||||
assetsCreatedAfterLabel.AutoSize = true;
|
||||
assetsCreatedAfterLabel.Location = new System.Drawing.Point(12, 17);
|
||||
assetsCreatedAfterLabel.Name = "assetsCreatedAfterLabel";
|
||||
assetsCreatedAfterLabel.Size = new System.Drawing.Size(139, 20);
|
||||
assetsCreatedAfterLabel.TabIndex = 2;
|
||||
assetsCreatedAfterLabel.Text = "Assets created after";
|
||||
//
|
||||
// assetsCreatedBeforeLabel
|
||||
//
|
||||
assetsCreatedBeforeLabel.AutoSize = true;
|
||||
assetsCreatedBeforeLabel.Location = new System.Drawing.Point(425, 17);
|
||||
assetsCreatedBeforeLabel.Name = "assetsCreatedBeforeLabel";
|
||||
assetsCreatedBeforeLabel.Size = new System.Drawing.Size(152, 20);
|
||||
assetsCreatedBeforeLabel.TabIndex = 3;
|
||||
assetsCreatedBeforeLabel.Text = "Assets created before";
|
||||
//
|
||||
// nugetPackagesFilesGroup
|
||||
//
|
||||
nugetPackagesFilesGroup.Controls.Add(searchApplicationVersionLabel);
|
||||
nugetPackagesFilesGroup.Controls.Add(searchPlatformVersionLabel);
|
||||
nugetPackagesFilesGroup.Controls.Add(searchApplicationVersion);
|
||||
nugetPackagesFilesGroup.Controls.Add(searchPlatformVersion);
|
||||
nugetPackagesFilesGroup.Location = new System.Drawing.Point(12, 87);
|
||||
nugetPackagesFilesGroup.Name = "nugetPackagesFilesGroup";
|
||||
nugetPackagesFilesGroup.Size = new System.Drawing.Size(821, 99);
|
||||
nugetPackagesFilesGroup.TabIndex = 4;
|
||||
nugetPackagesFilesGroup.TabStop = false;
|
||||
nugetPackagesFilesGroup.Text = "NuGet packages files";
|
||||
nugetPackagesFilesGroup.Visible = false;
|
||||
//
|
||||
// searchApplicationVersionLabel
|
||||
//
|
||||
searchApplicationVersionLabel.AutoSize = true;
|
||||
searchApplicationVersionLabel.Location = new System.Drawing.Point(6, 62);
|
||||
searchApplicationVersionLabel.Name = "searchApplicationVersionLabel";
|
||||
searchApplicationVersionLabel.Size = new System.Drawing.Size(137, 20);
|
||||
searchApplicationVersionLabel.TabIndex = 3;
|
||||
searchApplicationVersionLabel.Text = "Application version";
|
||||
//
|
||||
// searchPlatformVersionLabel
|
||||
//
|
||||
searchPlatformVersionLabel.AutoSize = true;
|
||||
searchPlatformVersionLabel.Location = new System.Drawing.Point(6, 29);
|
||||
searchPlatformVersionLabel.Name = "searchPlatformVersionLabel";
|
||||
searchPlatformVersionLabel.Size = new System.Drawing.Size(117, 20);
|
||||
searchPlatformVersionLabel.TabIndex = 2;
|
||||
searchPlatformVersionLabel.Text = "Platform version";
|
||||
//
|
||||
// searchApplicationVersion
|
||||
//
|
||||
searchApplicationVersion.Location = new System.Drawing.Point(145, 59);
|
||||
searchApplicationVersion.Name = "searchApplicationVersion";
|
||||
searchApplicationVersion.Size = new System.Drawing.Size(250, 27);
|
||||
searchApplicationVersion.TabIndex = 1;
|
||||
searchApplicationVersion.Text = "10.0.1725.159";
|
||||
//
|
||||
// searchPlatformVersion
|
||||
//
|
||||
searchPlatformVersion.Location = new System.Drawing.Point(145, 26);
|
||||
searchPlatformVersion.Name = "searchPlatformVersion";
|
||||
searchPlatformVersion.Size = new System.Drawing.Size(250, 27);
|
||||
searchPlatformVersion.TabIndex = 0;
|
||||
searchPlatformVersion.Text = "7.0.7068.158";
|
||||
//
|
||||
// searchNameOrDescriptionLabel
|
||||
//
|
||||
searchNameOrDescriptionLabel.AutoSize = true;
|
||||
searchNameOrDescriptionLabel.Location = new System.Drawing.Point(12, 48);
|
||||
searchNameOrDescriptionLabel.Name = "searchNameOrDescriptionLabel";
|
||||
searchNameOrDescriptionLabel.Size = new System.Drawing.Size(145, 20);
|
||||
searchNameOrDescriptionLabel.TabIndex = 5;
|
||||
searchNameOrDescriptionLabel.Text = "Name or description";
|
||||
searchNameOrDescriptionLabel.Visible = false;
|
||||
//
|
||||
// searchNameOrDescription
|
||||
//
|
||||
searchNameOrDescription.Location = new System.Drawing.Point(157, 45);
|
||||
searchNameOrDescription.Name = "searchNameOrDescription";
|
||||
searchNameOrDescription.Size = new System.Drawing.Size(250, 27);
|
||||
searchNameOrDescription.TabIndex = 6;
|
||||
searchNameOrDescription.Visible = false;
|
||||
//
|
||||
// search
|
||||
//
|
||||
search.Location = new System.Drawing.Point(373, 288);
|
||||
search.Name = "search";
|
||||
search.Size = new System.Drawing.Size(94, 29);
|
||||
search.TabIndex = 7;
|
||||
search.Text = "Search";
|
||||
search.UseVisualStyleBackColor = true;
|
||||
search.Click += search_Click;
|
||||
//
|
||||
// assetExportProgress
|
||||
//
|
||||
assetExportProgress.Location = new System.Drawing.Point(239, 192);
|
||||
assetExportProgress.Name = "assetExportProgress";
|
||||
assetExportProgress.Size = new System.Drawing.Size(367, 29);
|
||||
assetExportProgress.TabIndex = 8;
|
||||
//
|
||||
// assetExportProgressNumberOfMax
|
||||
//
|
||||
assetExportProgressNumberOfMax.Location = new System.Drawing.Point(335, 224);
|
||||
assetExportProgressNumberOfMax.Name = "assetExportProgressNumberOfMax";
|
||||
assetExportProgressNumberOfMax.Size = new System.Drawing.Size(169, 20);
|
||||
assetExportProgressNumberOfMax.TabIndex = 9;
|
||||
assetExportProgressNumberOfMax.Text = " ";
|
||||
assetExportProgressNumberOfMax.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// assetExportProgressAssetName
|
||||
//
|
||||
assetExportProgressAssetName.AutoSize = true;
|
||||
assetExportProgressAssetName.Location = new System.Drawing.Point(335, 244);
|
||||
assetExportProgressAssetName.Name = "assetExportProgressAssetName";
|
||||
assetExportProgressAssetName.Size = new System.Drawing.Size(169, 20);
|
||||
assetExportProgressAssetName.TabIndex = 10;
|
||||
assetExportProgressAssetName.Text = " ";
|
||||
assetExportProgressAssetName.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||
//
|
||||
// AssetLibrarySearch
|
||||
//
|
||||
AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
ClientSize = new System.Drawing.Size(841, 329);
|
||||
Controls.Add(assetExportProgressAssetName);
|
||||
Controls.Add(assetExportProgressNumberOfMax);
|
||||
Controls.Add(assetExportProgress);
|
||||
Controls.Add(search);
|
||||
Controls.Add(searchNameOrDescription);
|
||||
Controls.Add(searchNameOrDescriptionLabel);
|
||||
Controls.Add(nugetPackagesFilesGroup);
|
||||
Controls.Add(assetsCreatedBeforeLabel);
|
||||
Controls.Add(assetsCreatedAfterLabel);
|
||||
Controls.Add(assetsCreatedBefore);
|
||||
Controls.Add(assetsCreatedAfter);
|
||||
Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon");
|
||||
Name = "AssetLibrarySearch";
|
||||
Text = "Asset library search";
|
||||
Load += AssetLibrarySearch_Load;
|
||||
nugetPackagesFilesGroup.ResumeLayout(false);
|
||||
nugetPackagesFilesGroup.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.DateTimePicker assetsCreatedAfter;
|
||||
private System.Windows.Forms.DateTimePicker assetsCreatedBefore;
|
||||
private System.Windows.Forms.Label assetsCreatedAfterLabel;
|
||||
private System.Windows.Forms.Label assetsCreatedBeforeLabel;
|
||||
private System.Windows.Forms.GroupBox nugetPackagesFilesGroup;
|
||||
private System.Windows.Forms.Label searchApplicationVersionLabel;
|
||||
private System.Windows.Forms.Label searchPlatformVersionLabel;
|
||||
private System.Windows.Forms.TextBox searchApplicationVersion;
|
||||
private System.Windows.Forms.TextBox searchPlatformVersion;
|
||||
private System.Windows.Forms.Label searchNameOrDescriptionLabel;
|
||||
private System.Windows.Forms.TextBox searchNameOrDescription;
|
||||
private System.Windows.Forms.Button search;
|
||||
private System.Windows.Forms.ProgressBar assetExportProgress;
|
||||
private System.Windows.Forms.Label assetExportProgressNumberOfMax;
|
||||
private System.Windows.Forms.Label assetExportProgressAssetName;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
using AutoMapper;
|
||||
using CsvHelper;
|
||||
using LCS.JsonObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace LCS.AssetLibrary;
|
||||
|
||||
public partial class AssetLibrarySearch : Form
|
||||
{
|
||||
private HttpClientHelper _httpClientHelper;
|
||||
|
||||
internal AssetLibrarySearch(HttpClientHelper httpClientHelper)
|
||||
{
|
||||
InitializeComponent();
|
||||
_httpClientHelper = httpClientHelper;
|
||||
}
|
||||
|
||||
private void AssetLibrarySearch_Load(object sender, EventArgs e)
|
||||
{
|
||||
assetsCreatedAfter.Value = DateTime.Now.AddMonths(-6);
|
||||
assetsCreatedBefore.Value = DateTime.Now;
|
||||
}
|
||||
|
||||
private void search_Click(object sender, EventArgs e)
|
||||
{
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
|
||||
var assets = _httpClientHelper.GetSharedAssetList(AssetFileType.NuGetPackage);
|
||||
|
||||
var assetVersionsForExportList = new List<AssetVersionForExport>();
|
||||
|
||||
var config = new MapperConfiguration(
|
||||
cfg => cfg.CreateMap<AssetVersion, AssetVersionForExport>());
|
||||
var mapper = config.CreateMapper();
|
||||
|
||||
// linear with progress, only assets in date range
|
||||
assetExportProgress.Maximum = assets.Count;
|
||||
assetExportProgress.Value = 0;
|
||||
foreach (var asset in assets)
|
||||
{
|
||||
assetExportProgress.Value++;
|
||||
assetExportProgressNumberOfMax.Text = $"{assetExportProgress.Value} of {assetExportProgress.Maximum}";
|
||||
assetExportProgressAssetName.Text = asset.Name;
|
||||
var assetVersions = _httpClientHelper.GetSharedAssetVersionList(asset.ParentAssetId)
|
||||
.Where(assetVersion => assetVersion.CreatedDate >= assetsCreatedAfter.Value
|
||||
&& assetVersion.CreatedDate <= assetsCreatedBefore.Value);
|
||||
if (assetVersions.Any() == false)
|
||||
{
|
||||
break;
|
||||
}
|
||||
assetVersionsForExportList.AddRange(assetVersions
|
||||
.Select(assetVersion =>
|
||||
{
|
||||
var fileDescription = assetVersion.FileDescription.Split('\n').Last();
|
||||
assetVersion.ApplicationOrPlatformVersion = fileDescription;
|
||||
return mapper.Map<AssetVersionForExport>(assetVersion);
|
||||
}));
|
||||
; }
|
||||
|
||||
Cursor.Current = Cursors.Default;
|
||||
assetExportProgress.Value = 0;
|
||||
assetExportProgressNumberOfMax.Text = string.Empty;
|
||||
assetExportProgressAssetName.Text = string.Empty;
|
||||
|
||||
SaveFileDialog saveFile = new()
|
||||
{
|
||||
FileName = "D365FO NuGet Packages.csv",
|
||||
Filter = "CSV files (*.csv)|*.csv|All files (*.*)|*.*"
|
||||
};
|
||||
|
||||
if (saveFile.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
using StreamWriter sw = new(saveFile.FileName, false, Encoding.Unicode);
|
||||
var csv = new CsvWriter(sw, CultureInfo.CurrentCulture);
|
||||
csv.WriteRecords(assetVersionsForExportList);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,56 +1,26 @@
|
|||
namespace LCS.AssetLibrary;
|
||||
using System;
|
||||
|
||||
namespace LCS.AssetLibrary;
|
||||
|
||||
public class AssetVersionForExport
|
||||
{
|
||||
public string AssetName { get; set; }
|
||||
public string ReleaseNotes { get; set; }
|
||||
public string ApplicationOrPlatformVersion { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public string Id { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public string FileDescription { get; set; }
|
||||
public string DisplaySize { get; set; }
|
||||
public int CommitStatus { get; set; }
|
||||
public int State { get; set; }
|
||||
public int Scope { get; set; }
|
||||
public string FileLocation { get; set; }
|
||||
public int Version { get; set; }
|
||||
public string DisplayVersion { get; set; }
|
||||
public int FileType { get; set; }
|
||||
public string CreatedByName { get; set; }
|
||||
public string ModifiedByName { get; set; }
|
||||
public bool IsGoldBuild { get; set; }
|
||||
public string DataPackageApplicationDetails { get; set; }
|
||||
public int ValidationStatus { get; set; }
|
||||
public string AadTenantId { get; set; }
|
||||
public string ValidationStatusText { get; set; }
|
||||
public string NextValidationDate { get; set; }
|
||||
public int NumValidationAttempts { get; set; }
|
||||
public int NumTenantTaggingAttempts { get; set; }
|
||||
public string ReleaseDetailsAssetId { get; set; }
|
||||
public bool IsMockData { get; set; }
|
||||
public string ReleaseDetailsLink { get; set; }
|
||||
public string ParentAssetId { get; set; }
|
||||
public bool IsInvalid { get; set; }
|
||||
public string DisplayValidationSymbol { get; set; }
|
||||
public string DisplayModifiedDate { get; set; }
|
||||
public string DisplayCreatedDate { get; set; }
|
||||
public string DisplayId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string DisplayScope { get; set; }
|
||||
public string DisplayState { get; set; }
|
||||
public string Location { get; set; }
|
||||
public bool IsAbsoluteLocation { get; set; }
|
||||
public bool CanDelete { get; set; }
|
||||
public bool CanUpdate { get; set; }
|
||||
public bool CanPublish { get; set; }
|
||||
public bool CanNavigate { get; set; }
|
||||
public string DisplayVersion { get; set; }
|
||||
public int OriginalScope { get; set; }
|
||||
public string TelemetryId { get; set; }
|
||||
public int CreatedBy { get; set; }
|
||||
public string CreatedDate { get; set; }
|
||||
public DateTime CreatedDate { get; set; }
|
||||
public int ModifiedBy { get; set; }
|
||||
public string ModifiedDate { get; set; }
|
||||
public string LocalCreatedDate { get; set; }
|
||||
public string LocalModifiedDate { get; set; }
|
||||
public DateTime ModifiedDate { get; set; }
|
||||
}
|
||||
|
|
|
@ -180,9 +180,7 @@
|
|||
notifyIcon = new System.Windows.Forms.NotifyIcon(components);
|
||||
notifyIconContextMenu = new System.Windows.Forms.ContextMenuStrip(components);
|
||||
notifyIconMenuClose = new System.Windows.Forms.ToolStripMenuItem();
|
||||
exportAssetLibraryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
sharedAssetLibraryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
nuGetPackagesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
exportListOfNuGetPackagesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
((System.ComponentModel.ISupportInitialize)cheDataGridView).BeginInit();
|
||||
cheInstanceContextMenu.SuspendLayout();
|
||||
mainMenuStrip.SuspendLayout();
|
||||
|
@ -677,7 +675,7 @@
|
|||
//
|
||||
// exportToolStripMenuItem
|
||||
//
|
||||
exportToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { exportProjectDataToolStripMenuItem1, exportListOfUsersToolStripMenuItem, exportListOfInstancesForAllProjectsToolStripMenuItem, exportUpdateScheduleForAllProjectsToolStripMenuItem, exportListOfEnvChangesToolStripMenuItem, exportAssetLibraryToolStripMenuItem });
|
||||
exportToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { exportProjectDataToolStripMenuItem1, exportListOfUsersToolStripMenuItem, exportListOfInstancesForAllProjectsToolStripMenuItem, exportUpdateScheduleForAllProjectsToolStripMenuItem, exportListOfEnvChangesToolStripMenuItem, exportListOfNuGetPackagesToolStripMenuItem });
|
||||
exportToolStripMenuItem.Enabled = false;
|
||||
exportToolStripMenuItem.Name = "exportToolStripMenuItem";
|
||||
exportToolStripMenuItem.Size = new System.Drawing.Size(66, 24);
|
||||
|
@ -833,7 +831,7 @@
|
|||
cheTabPage.Controls.Add(cheDataGridView);
|
||||
cheTabPage.Location = new System.Drawing.Point(4, 29);
|
||||
cheTabPage.Name = "cheTabPage";
|
||||
cheTabPage.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3);
|
||||
cheTabPage.Padding = new System.Windows.Forms.Padding(3);
|
||||
cheTabPage.Size = new System.Drawing.Size(1307, 756);
|
||||
cheTabPage.TabIndex = 0;
|
||||
cheTabPage.Text = "Cloud-hosted instances";
|
||||
|
@ -844,8 +842,8 @@
|
|||
saasTabPage.Controls.Add(saasDataGridView);
|
||||
saasTabPage.Location = new System.Drawing.Point(4, 29);
|
||||
saasTabPage.Name = "saasTabPage";
|
||||
saasTabPage.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3);
|
||||
saasTabPage.Size = new System.Drawing.Size(1307, 741);
|
||||
saasTabPage.Padding = new System.Windows.Forms.Padding(3);
|
||||
saasTabPage.Size = new System.Drawing.Size(1307, 756);
|
||||
saasTabPage.TabIndex = 1;
|
||||
saasTabPage.Text = "MS-hosted environments";
|
||||
saasTabPage.UseVisualStyleBackColor = true;
|
||||
|
@ -866,7 +864,7 @@
|
|||
saasDataGridView.Name = "saasDataGridView";
|
||||
saasDataGridView.ReadOnly = true;
|
||||
saasDataGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
|
||||
saasDataGridView.Size = new System.Drawing.Size(1301, 735);
|
||||
saasDataGridView.Size = new System.Drawing.Size(1301, 750);
|
||||
saasDataGridView.TabIndex = 1;
|
||||
saasDataGridView.ColumnHeaderMouseClick += SaasDataGridView_ColumnHeaderMouseClick;
|
||||
saasDataGridView.MouseDown += DataGridView_MouseDown;
|
||||
|
@ -1368,26 +1366,12 @@
|
|||
notifyIconMenuClose.Text = "Close 2LCS";
|
||||
notifyIconMenuClose.Click += NotifyIconMenuClose_Click;
|
||||
//
|
||||
// exportAssetLibraryToolStripMenuItem
|
||||
// exportListOfNuGetPackagesToolStripMenuItem
|
||||
//
|
||||
exportAssetLibraryToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { sharedAssetLibraryToolStripMenuItem });
|
||||
exportAssetLibraryToolStripMenuItem.Name = "exportAssetLibraryToolStripMenuItem";
|
||||
exportAssetLibraryToolStripMenuItem.Size = new System.Drawing.Size(445, 26);
|
||||
exportAssetLibraryToolStripMenuItem.Text = "Export asset library";
|
||||
//
|
||||
// sharedAssetLibraryToolStripMenuItem
|
||||
//
|
||||
sharedAssetLibraryToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { nuGetPackagesToolStripMenuItem });
|
||||
sharedAssetLibraryToolStripMenuItem.Name = "sharedAssetLibraryToolStripMenuItem";
|
||||
sharedAssetLibraryToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||
sharedAssetLibraryToolStripMenuItem.Text = "Shared asset library";
|
||||
//
|
||||
// nuGetPackagesToolStripMenuItem
|
||||
//
|
||||
nuGetPackagesToolStripMenuItem.Name = "nuGetPackagesToolStripMenuItem";
|
||||
nuGetPackagesToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||
nuGetPackagesToolStripMenuItem.Text = "NuGet packages";
|
||||
nuGetPackagesToolStripMenuItem.Click += nuGetPackagesToolStripMenuItem_Click;
|
||||
exportListOfNuGetPackagesToolStripMenuItem.Name = "exportListOfNuGetPackagesToolStripMenuItem";
|
||||
exportListOfNuGetPackagesToolStripMenuItem.Size = new System.Drawing.Size(455, 26);
|
||||
exportListOfNuGetPackagesToolStripMenuItem.Text = "Export list of NuGet packages from shared asset library";
|
||||
exportListOfNuGetPackagesToolStripMenuItem.Click += exportListOfNuGetPackagesToolStripMenuItem_Click;
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
|
@ -1574,9 +1558,7 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem currentProjectUsersExportMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem allProjectUsersExportMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem exportAssetLibraryToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem sharedAssetLibraryToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem nuGetPackagesToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem exportListOfNuGetPackagesToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2555,56 +2555,10 @@ namespace LCS.Forms
|
|||
about2LCS.ShowDialog();
|
||||
}
|
||||
|
||||
private void nuGetPackagesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
private void exportListOfNuGetPackagesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var assets = _httpClientHelper.GetSharedAssetList(AssetFileType.NuGetPackage);
|
||||
|
||||
// for each asset in 50 latest assets
|
||||
// get the asset versions
|
||||
// compile all versions into one list that includes the asset name
|
||||
// sort the list by asset name and version
|
||||
|
||||
var assetVersionsForExportList = new List<AssetVersionForExport>();
|
||||
var config = new MapperConfiguration(
|
||||
cfg => cfg.CreateMap<AssetVersion, AssetVersionForExport>());
|
||||
var mapper = config.CreateMapper();
|
||||
assets
|
||||
.Take(4)
|
||||
.ToList()
|
||||
.ForEach(asset =>
|
||||
{
|
||||
var assetVersions = _httpClientHelper.GetSharedAssetVersionList(asset.ParentAssetId);
|
||||
assetVersionsForExportList.AddRange(assetVersions
|
||||
.Select(assetVersion => mapper.Map<AssetVersionForExport>(assetVersion))
|
||||
.Select(assetVersionForExport =>
|
||||
{
|
||||
assetVersionForExport.AssetName = asset.Name;
|
||||
assetVersionForExport.ReleaseNotes =
|
||||
_httpClientHelper.GetAssetReleaseDetails(
|
||||
assetVersionForExport.ReleaseDetailsLink);
|
||||
return assetVersionForExport;
|
||||
}));
|
||||
});
|
||||
|
||||
SaveFileDialog saveFile = new()
|
||||
{
|
||||
FileName = "D365FO NuGet Packages.csv",
|
||||
Filter = "CSV files (*.csv)|*.csv|All files (*.*)|*.*"
|
||||
};
|
||||
|
||||
if (saveFile.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
using StreamWriter sw = new(saveFile.FileName, false, Encoding.Unicode);
|
||||
var csv = new CsvWriter(sw, CultureInfo.CurrentCulture);
|
||||
csv.WriteRecords(assetVersionsForExportList);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
using var form = new AssetLibrarySearch(_httpClientHelper);
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace LCS.JsonObjects
|
||||
{
|
||||
|
@ -67,6 +68,8 @@ namespace LCS.JsonObjects
|
|||
|
||||
public class AssetVersion
|
||||
{
|
||||
public string ApplicationOrPlatformVersion { get; set; }
|
||||
|
||||
public string Id { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public string FileDescription { get; set; }
|
||||
|
@ -110,9 +113,9 @@ namespace LCS.JsonObjects
|
|||
public int OriginalScope { get; set; }
|
||||
public string TelemetryId { get; set; }
|
||||
public int CreatedBy { get; set; }
|
||||
public string CreatedDate { get; set; }
|
||||
public DateTime CreatedDate { get; set; }
|
||||
public int ModifiedBy { get; set; }
|
||||
public string ModifiedDate { get; set; }
|
||||
public DateTime ModifiedDate { get; set; }
|
||||
public string LocalCreatedDate { get; set; }
|
||||
public string LocalModifiedDate { get; set; }
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче