public NewPluginVersion(XtbPlugin plugin) { InitializeComponent(); cbbReminder.SelectedIndex = 0; lblPluginTitle.Text = plugin.Name; lblNewVersion.Text = $@"New version: {plugin.Version}"; rtbReleaseNotes.Text = plugin.LatestReleaseNote; rtbReleaseNotes.BackColor = Color.White; rtbReleaseNotes.Padding = new Padding(10); try { if (!string.IsNullOrEmpty(plugin.LogoUrl)) { pbLogo.Load(plugin.LogoUrl); } else { pbLogo.Visible = false; } } catch { pbLogo.Visible = false; } }
public PluginLicense(XtbPlugin plugin) { InitializeComponent(); lblPluginName.Text = plugin.Name; lblAuthors.Text = string.Format(lblAuthors.Tag.ToString(), plugin.Authors); this.plugin = plugin; }
public NewPluginVersion(XtbPlugin plugin) { InitializeComponent(); cbbReminder.SelectedIndex = 0; lblPluginTitle.Text = plugin.Name; lblNewVersion.Text = $"New version: {plugin.Version}"; rtbReleaseNotes.Text = plugin.LatestReleaseNote; rtbReleaseNotes.BackColor = Color.White; rtbReleaseNotes.Padding = new Padding(10); pbLogo.Load(plugin.LogoUrl ?? "https://raw.githubusercontent.com/wiki/MscrmTools/XrmToolBox/Images/unknown.png"); }
private void BuildPropertiesPanel(XtbPlugin package) { scProperties.Panel1.Controls.Clear(); var bitmap = new PictureBox { Size = new Size(48, 48), Dock = DockStyle.Left, SizeMode = PictureBoxSizeMode.StretchImage }; try { bitmap.Load(package.LogoUrl ?? "https://raw.githubusercontent.com/wiki/MscrmTools/XrmToolBox/Images/unknown.png"); } catch { byte[] bytes = Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAAFzAAABcwHEdCJ9AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAVlQTFRF////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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FxyoZJ4CLZFRLoqnKj8H4TV+mkVBlV9OKHSJSKTkFI/8gKM10/jsKDGpGBSRDZgWHX+hMf10xP4pcYMw4aIr0jJrzrfXG41nF7CVzXGX6Lok3ATJuv2oFF/P8I7kxgDwhI1ReEN0PxpwG0zGqMSh4hdgc/w24yrEYhLEkLW6Z0p4LmZJwRJSUPQSkM/fD8Gvpg6g5CWLAT0+U8BuHhr7g1AVvKULfrde6D045muj5bJ2xSYhW+d+kZcJm/zCrMwq/cGIGvzEa0LBCFtc43WBUKQtAGSdYEIxG2gPAqjem8MoloyXSvj0lKb3mtAWEdnJ3ZFZ42gOLErQdFImhO7ljRzUa2BTQ/Tqqiay3pVTXPZ1zpfVdY1jUVERO6fQ1HDhXpjMW9tVajBK3NfvbVpmquISOs/+HvPXCfrzVXX3kVEHn1KPNSisNbetQOGldQVmoTa7YjjfshyPea5HzTdj7ruh23X4777heMOVh73S5f7te8OFk/3q+8dLN+3W///A5bFM9Y/bySSAAAAAElFTkSuQmCC"); Image errorImage; using (MemoryStream ms = new MemoryStream(bytes)) { errorImage = Image.FromStream(ms); } bitmap.ErrorImage = errorImage; } var lblTitle = new Label { Dock = DockStyle.Top, Text = package.Name.Replace(" for XrmToolBox", ""), Font = new Font("Microsoft Sans Serif", 20F), Height = 32 }; var lblDescription = new Label { Dock = DockStyle.Fill, Text = package.Description, Height = 16 }; var pnlTitle = new Panel { Height = 48, Dock = DockStyle.Top }; if (lblDescription.Text.Contains("\n")) { pnlTitle.Controls.AddRange(new Control[] { lblTitle, bitmap }); var pnlDescription = new Panel { AutoScroll = true, AutoScrollMinSize = new Size(0, 1000), Dock = DockStyle.Fill }; pnlDescription.Controls.Add(lblDescription); var lblDescriptionHeader = new Label { Dock = DockStyle.Top, Text = @"Description", Font = new Font("Microsoft Sans Serif", 8, FontStyle.Bold | FontStyle.Underline, GraphicsUnit.Point), Height = 16 }; scProperties.Panel1.Controls.AddRange(new Control[] { pnlDescription, lblDescriptionHeader, GetPropertiesPanelInformation("Project Url", package.ProjectUrl), GetPropertiesPanelInformation("Downloads count", package.TotalDownloadCount.ToString()), GetPropertiesPanelInformation("Latest release", package.LatestReleaseDate?.ToString("yyyy/MM/dd") ?? "N/A"), GetPropertiesPanelInformation("First release", package.FirstReleaseDate?.ToString("yyyy/MM/dd") ?? "N/A"), GetPropertiesPanelInformation("Authors", string.Join(", ", package.Authors)), GetPropertiesPanelInformation("Version", package.Version), pnlTitle }); } else { pnlTitle.Controls.AddRange(new Control[] { lblDescription, lblTitle, bitmap }); scProperties.Panel1.Controls.AddRange(new Control[] { GetPropertiesPanelInformation("Project Url", package.ProjectUrl), GetPropertiesPanelInformation("Downloads count", package.TotalDownloadCount.ToString()), GetPropertiesPanelInformation("Latest release", package.LatestReleaseDate?.ToString("yyyy/MM/dd") ?? "N/A"), GetPropertiesPanelInformation("First release", package.FirstReleaseDate?.ToString("yyyy/MM/dd") ?? "N/A"), GetPropertiesPanelInformation("Authors", package.Authors), GetPropertiesPanelInformation("Version", package.Version), pnlTitle }); } }
public string GetPluginProjectUrlByFileName(string fileName) { XtbPlugin plugin = GetPluginByFileName(fileName); return(plugin?.ProjectUrl); }
private void AnalyzePackage(XtbPlugin plugin) { var files = plugin.Files; bool install = false, update = false, otherFilesFound = false; if (string.IsNullOrEmpty(plugin.MinimalXrmToolBoxVersion)) { plugin.Compatibilty = CompatibleState.Other; } else { plugin.Compatibilty = IsPluginDependencyCompatible(new Version(plugin.MinimalXrmToolBoxVersion)); } var currentVersion = new Version(int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue); var currentVersionFound = false; foreach (var file in files) { if (Path.GetFileName(file).Length == 0) { continue; } var directoryName = Path.GetDirectoryName(file); if (directoryName == null) { continue; } if (directoryName.ToLower().EndsWith("plugins")) { // Only check version of files in the Plugins folder var existingPluginFile = plugins.FirstOrDefault(p => file.ToLower().EndsWith(p.Name.ToLower())); if (existingPluginFile == null) { install = true; } else { // If a file is found, we check version only if the file // contains classes that implement IXrmToolBoxPlugin if (!existingPluginFile.ImplementsXrmToolBoxPlugin()) { otherFilesFound = true; continue; } var fileVersionInfo = FileVersionInfo.GetVersionInfo(existingPluginFile.FullName); var fileVersion = new Version(fileVersionInfo.FileMajorPart, fileVersionInfo.FileMinorPart, fileVersionInfo.FileBuildPart, fileVersionInfo.FilePrivatePart); var existingFileVersion = fileVersion; if (existingFileVersion < currentVersion) { currentVersion = existingFileVersion; currentVersionFound = true; } if (existingFileVersion < new Version(plugin.Version)) { update = true; } } } } if (currentVersionFound) { plugin.CurrentVersion = currentVersion; } if (otherFilesFound || update) { plugin.RequiresXtbRestart = true; } if (plugin.Compatibilty != CompatibleState.Compatible) { plugin.Action = PackageInstallAction.Unavailable; } else if (update) { plugin.Action = PackageInstallAction.Update; } else if (install) { plugin.Action = PackageInstallAction.Install; } else { plugin.Action = PackageInstallAction.None; } }