// a user wants to add or update a version information entry within the remote database.. private void MnuAddUpdateAssembly_Click(object sender, EventArgs e) { Assembly assembly = null; if ((sender.Equals(mnuAddUpdateAssembly) || sender.Equals(tsbUpdateEntry)) && odAssembly.ShowDialog() == DialogResult.OK) { assembly = Assembly.LoadFile(odAssembly.FileName); } else if (sender.Equals(mnuThisAssemblyVersion)) { // ..just use the entry assembly.. assembly = Assembly.GetEntryAssembly(); } if (assembly != null) { var info = FormDialogAddUpdateAssemblyVersion.ShowDialog(assembly.Location, assembly, out bool archivePreviousEntry, out bool previousLocalizedData); var version = gvSoftwareVersions.CurrentRow?.Cells[colVersion.Index].Value.ToString(); if (info != null) { if (info.ID != -1) { if (archivePreviousEntry) { VersionCheck.ArchiveVersion(info.ID); if (previousLocalizedData && version != null) { VersionCheck.PreservePreviousVersionData(version, info.SoftwareVersion, info.ID); } else { VersionCheck.ArchiveVersionHistoryByApplicationId(info.ID, true); } } else { VersionCheck.DeleteVersionHistoryByApplicationId(info.ID); } } VersionCheck.UpdateVersion(assembly, info.DownloadLink, info.IsDirectDownload, info.ReleaseDate, info.MetaData); ListVersions(); } } }
private void mnuUpdateVersionManually_Click(object sender, EventArgs e) { var assemblyName = gvSoftwareVersions.CurrentRow?.Cells[colApp.Index].Value.ToString(); var versionNew = FormDialogUpdateVersion.ShowDialog(); var info = FormDialogAddUpdateAssemblyVersion.ShowDialog(assemblyName, versionNew, out bool archivePreviousEntry, out bool previousLocalizedData); var version = gvSoftwareVersions.CurrentRow?.Cells[colVersion.Index].Value.ToString(); if (info != null) { if (info.ID != -1) { if (archivePreviousEntry) { VersionCheck.ArchiveVersion(info.ID); if (previousLocalizedData && version != null) { VersionCheck.PreservePreviousVersionData(version, info.SoftwareVersion, info.ID); } else { VersionCheck.ArchiveVersionHistoryByApplicationId(info.ID, true); } } else { VersionCheck.DeleteVersionHistoryByApplicationId(info.ID); } } VersionCheck.UpdateVersion(assemblyName, versionNew, info.DownloadLink, info.IsDirectDownload, info.ReleaseDate, info.MetaData); ListVersions(); } }