/// <summary> /// Get a binary version for the executing assembly /// </summary> /// <returns>A BinaryVersion</returns> internal static BinaryVersion GetCurrentBinaryVersion() { // If we're looking at dailies, latest build version will simply be // the current build version without a build or revision, ex. 0.6 var v = Assembly.GetExecutingAssembly().GetName().Version; return(BinaryVersion.FromString(string.Format("{0}.{1}.{2}", v.Major, v.Minor, v.Build))); }
private void SetUpdateInfo(BinaryVersion latestBuildVersion, string latestBuildDownloadUrl, string signatureUrl) { UpdateInfo = new AppVersionInfo() { Version = latestBuildVersion, VersionInfoURL = Configuration.DownloadSourcePath, InstallerURL = latestBuildDownloadUrl, SignatureURL = signatureUrl }; }
public static BinaryVersion GetProductVersion() { if (null != productVersion) { return(productVersion); } var executingAssemblyName = Assembly.GetExecutingAssembly().GetName(); productVersion = BinaryVersion.FromString(executingAssemblyName.Version.ToString()); return(productVersion); }
private BinaryVersion GetLatestInstallVersion() { var dynamoInstallations = GetDynamoInstallLocations(); if (null == dynamoInstallations) { return(null); } var latestVersion = dynamoInstallations.Select(GetDynamoVersion).OrderBy(s => s).LastOrDefault(); return(latestVersion == null ? null : BinaryVersion.FromString(latestVersion.ToString())); }
/// <summary> /// Get a BinaryVersion from a file path. /// </summary> /// <param name="installNameBase">The base install name.</param> /// <param name="filePath">The path name of the file.</param> /// <returns>A BinaryVersion or null if one can not be parse from the file path.</returns> internal static BinaryVersion GetBinaryVersionFromFilePath(string installNameBase, string filePath) { // Filename format is DynamoInstall0.7.1.YYYYMMDDT0000.exe var index = filePath.IndexOf(installNameBase, StringComparison.Ordinal); if (index < 0) { return(null); } // Skip past the 'installNameBase' since we are only interested // in getting the version numbers that come after the base name. var fileName = Path.GetFileNameWithoutExtension(filePath); var version = fileName.Substring(index + installNameBase.Length); var splits = version.Split(new [] { "." }, StringSplitOptions.RemoveEmptyEntries); if (splits.Count() < 3) // This can be 4 if it includes revision number. { return(null); } ushort major, minor, build; if (!ushort.TryParse(splits[0], out major)) { return(null); } if (!ushort.TryParse(splits[1], out minor)) { return(null); } if (!ushort.TryParse(splits[2], out build)) { return(null); } return(BinaryVersion.FromString(string.Format("{0}.{1}.{2}.0", major, minor, build))); }
/// <summary> /// Async call to request downloading a file from web. /// This call raises UpdateDownloaded event notification. /// </summary> /// <param name="url">Web URL for file to download.</param> /// <param name="version">The version of package that is to be downloaded.</param> /// <param name="tempPath">Temp folder path where the update package /// to be downloaded.</param> /// <returns>Request status, it may return false if invalid URL was passed.</returns> private bool DownloadUpdatePackageAsynchronously(string url, BinaryVersion version, string tempPath) { currentDownloadProgress = -1; if (string.IsNullOrEmpty(url) || (null == version)) { versionCheckInProgress = false; return(false); } UpdateFileLocation = string.Empty; string downloadedFileName = string.Empty; string downloadedFilePath = string.Empty; try { downloadedFileName = Path.GetFileName(url); downloadedFilePath = Path.Combine(tempPath, downloadedFileName); if (File.Exists(downloadedFilePath)) { File.Delete(downloadedFilePath); } } catch (Exception) { versionCheckInProgress = false; return(false); } var client = new WebClient(); client.DownloadProgressChanged += client_DownloadProgressChanged; client.DownloadFileCompleted += new AsyncCompletedEventHandler(OnDownloadFileCompleted); client.DownloadFileAsync(new Uri(url), downloadedFilePath, downloadedFilePath); return(true); }
private void SetUpdateInfo(BinaryVersion latestBuildVersion, string latestBuildDownloadUrl, string signatureUrl) { UpdateInfo = new AppVersionInfo() { Version = latestBuildVersion, VersionInfoURL = Configuration.DownloadSourcePath, InstallerURL = latestBuildDownloadUrl, SignatureURL = signatureUrl }; }
public static BinaryVersion GetProductVersion() { if (null != productVersion) return productVersion; var executingAssemblyName = Assembly.GetExecutingAssembly().GetName(); productVersion = BinaryVersion.FromString(executingAssemblyName.Version.ToString()); return productVersion; }
/// <summary> /// Async call to request downloading a file from web. /// This call raises UpdateDownloaded event notification. /// </summary> /// <param name="url">Web URL for file to download.</param> /// <param name="version">The version of package that is to be downloaded.</param> /// <param name="tempPath">Temp folder path where the update package /// to be downloaded.</param> /// <returns>Request status, it may return false if invalid URL was passed.</returns> private bool DownloadUpdatePackageAsynchronously(string url, BinaryVersion version, string tempPath) { currentDownloadProgress = -1; if (string.IsNullOrEmpty(url) || (null == version)) { versionCheckInProgress = false; return false; } UpdateFileLocation = string.Empty; string downloadedFileName = string.Empty; string downloadedFilePath = string.Empty; try { downloadedFileName = Path.GetFileName(url); downloadedFilePath = Path.Combine(tempPath, downloadedFileName); if (File.Exists(downloadedFilePath)) File.Delete(downloadedFilePath); } catch (Exception) { versionCheckInProgress = false; return false; } var client = new WebClient(); client.DownloadProgressChanged += client_DownloadProgressChanged; client.DownloadFileCompleted += new AsyncCompletedEventHandler(OnDownloadFileCompleted); client.DownloadFileAsync(new Uri(url), downloadedFilePath, downloadedFilePath); return true; }