public void ParseOfflineApplicationVersioning(ApplicationVersioning onlineVersion) { var strApplicationNames = onlineVersion.ApplicationUrl.Split('/'); var strApplicationName = strApplicationNames[strApplicationNames.Length - 1]; strApplicationName = strApplicationName.DecodeUrlString(); var strDownloadManagerNames = onlineVersion.DownloadManagerUrl.Split('/'); var strDownloadManagerName = strDownloadManagerNames[strDownloadManagerNames.Length - 1]; strDownloadManagerName = strDownloadManagerName.DecodeUrlString(); if (Path.GetFileName(Application.ExecutablePath) != strApplicationName) ApplicationUrl = Path.Combine(Application.StartupPath, strApplicationName); else ApplicationUrl = Application.ExecutablePath; if (Path.GetFileName(Application.ExecutablePath) != strDownloadManagerName) DownloadManagerUrl = Path.Combine(Application.StartupPath, strDownloadManagerName); else DownloadManagerUrl = Application.ExecutablePath; if (File.Exists(ApplicationUrl)) ApplicationVersion = new Version(FileVersionInfo.GetVersionInfo(ApplicationUrl).FileVersion); if (File.Exists(DownloadManagerUrl)) DownloadManagerVersion = new Version(FileVersionInfo.GetVersionInfo(DownloadManagerUrl).FileVersion); //Get local dlls and get the names var localLibraries = Directory.GetFiles(Application.StartupPath, "*.dll"); foreach (var dll in onlineVersion.DynamicLinkLibraries) { foreach (var localLibrary in localLibraries) { var localLibraryName = Path.GetFileNameWithoutExtension(localLibrary); if (localLibraryName == dll.DllName) { var localLibraryVersion = FileVersionInfo.GetVersionInfo(localLibrary).FileVersion; var localDll = new DynamicLinkLibrary(localLibraryName, localLibrary, localLibraryVersion); DynamicLinkLibraries.Add(localDll); break; } } } }
public void ParseOfflineApplicationVersioning(ApplicationVersioning onlineVersion) { var strApplicationNames = onlineVersion.ApplicationUrl.Split('/'); var strApplicationName = strApplicationNames[strApplicationNames.Length - 1]; strApplicationName = strApplicationName.DecodeUrlString(); var strDownloadManagerNames = onlineVersion.DownloadManagerUrl.Split('/'); var strDownloadManagerName = strDownloadManagerNames[strDownloadManagerNames.Length - 1]; strDownloadManagerName = strDownloadManagerName.DecodeUrlString(); if (Path.GetFileName(Application.ExecutablePath) != strApplicationName) { ApplicationUrl = Path.Combine(Application.StartupPath, strApplicationName); } else { ApplicationUrl = Application.ExecutablePath; } if (Path.GetFileName(Application.ExecutablePath) != strDownloadManagerName) { DownloadManagerUrl = Path.Combine(Application.StartupPath, strDownloadManagerName); } else { DownloadManagerUrl = Application.ExecutablePath; } if (File.Exists(ApplicationUrl)) { ApplicationVersion = new Version(FileVersionInfo.GetVersionInfo(ApplicationUrl).FileVersion); } if (File.Exists(DownloadManagerUrl)) { DownloadManagerVersion = new Version(FileVersionInfo.GetVersionInfo(DownloadManagerUrl).FileVersion); } //Get local dlls and get the names var localLibraries = Directory.GetFiles(Application.StartupPath, "*.dll"); foreach (var dll in onlineVersion.DynamicLinkLibraries) { foreach (var localLibrary in localLibraries) { var localLibraryName = Path.GetFileNameWithoutExtension(localLibrary); if (localLibraryName == dll.DllName) { var localLibraryVersion = FileVersionInfo.GetVersionInfo(localLibrary).FileVersion; var localDll = new DynamicLinkLibrary(localLibraryName, localLibrary, localLibraryVersion); DynamicLinkLibraries.Add(localDll); break; } } } }