diff --git a/DbManager.cs b/DbManager.cs index 14222ad..127d062 100644 --- a/DbManager.cs +++ b/DbManager.cs @@ -193,7 +193,7 @@ public static SQLiteConnection NewConnection connString += "New=True;"; } - SQLiteConnection connection = new SQLiteConnection(connString); + SQLiteConnection connection = new SQLiteConnection(connString, true); connection.Open(); return connection; diff --git a/ExternalServices.cs b/ExternalServices.cs index 58e9dea..43fcd06 100644 --- a/ExternalServices.cs +++ b/ExternalServices.cs @@ -45,10 +45,10 @@ public static string GetFileHippoBaseDownloadUrl(string fileId) if (fileId.Contains(":")) { string[] splitData = fileId.Split(':'); - return string.Format("http://filehippo.com/{0}/download_{1}/", splitData); + return string.Format("https://filehippo.com/{0}/download_{1}/", splitData); } - return string.Format("http://filehippo.com/download_{0}/", fileId); + return string.Format("https://filehippo.com/download_{0}/", fileId); } /// @@ -99,30 +99,30 @@ public static string FileHippoDownloadUrl(string fileId, bool avoidBeta) overviewPage = GetNonBetaPageContent(overviewPage, fileId, false); } - string findUrl = string.Format("/download_{0}/download/", GetFileHippoCleanFileId(fileId)); - int pos = overviewPage.IndexOf(findUrl); - if (pos < 0) + try + { + using (WebClient client = new WebClient()) + { + overviewPage = client.DownloadString($"https://filehippo.com/download_{GetFileHippoCleanFileId(fileId)}/post_download/"); + } + } + catch (Exception) { throw new WebException("FileHippo ID '" + fileId + "' does not exist.", WebExceptionStatus.ReceiveFailure); } - pos += findUrl.Length; - string downloadUrl = GetFileHippoBaseDownloadUrl(fileId) + string.Format("download/{0}/", overviewPage.Substring(pos, 32)) + "?direct"; - // Now on the download page, find the link which redirects to the latest file - string downloadPage; - using (WebClient client = new WebClient()) + // setTimeout(function() { downloadIframe.src = 'https://filehippo.com/launch_download/?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... + string searchText = "downloadIframe.src"; + int pos = overviewPage.IndexOf(searchText); + int urlEndPos = overviewPage.IndexOf("'", pos + 30); + if (pos < 0) { - downloadPage = client.DownloadString(downloadUrl); + throw new WebException("Download URL for FileHippo ID '" + fileId + "' cannot be found.", WebExceptionStatus.ReceiveFailure); } - findUrl = "/download/file/"; - pos = downloadPage.IndexOf(findUrl); - if (pos < 0) return string.Empty; - pos += findUrl.Length; - string redirectUrl = string.Format("http://www.filehippo.com/download/file/{0}", downloadPage.Substring(pos, 64)); - - return redirectUrl; + string downloadUrl = overviewPage.Substring(pos + searchText.Length, urlEndPos - pos - searchText.Length).Trim().Trim('\'', '=', ' '); + return downloadUrl; } /// @@ -164,7 +164,7 @@ public static string FileHippoVersion(string fileId, bool avoidBeta) { if (string.IsNullOrEmpty(fileId)) return null; - string url = GetFileHippoBaseDownloadUrl(fileId) + "tech/"; + string url = GetFileHippoBaseDownloadUrl(fileId); string overviewPage; using (WebClient client = new WebClient()) @@ -216,7 +216,7 @@ public static string FileHippoAppName(string fileId) public static string FileHippoMd5(string fileId, bool avoidBeta) { fileId = fileId.ToLower(); - string url = GetFileHippoBaseDownloadUrl(fileId) + "tech/"; + string url = GetFileHippoBaseDownloadUrl(fileId); string md5Page; using (WebClient client = new WebClient()) @@ -227,7 +227,7 @@ public static string FileHippoMd5(string fileId, bool avoidBeta) if (client.ResponseUri != null) { string newId = GetFileHippoIdFromUrl(client.ResponseUri.ToString()); - if (!string.IsNullOrEmpty(newId) && GetFileHippoBaseDownloadUrl(newId) + "tech/" != url && newId != client.ResponseUri.ToString()) + if (!string.IsNullOrEmpty(newId) && GetFileHippoBaseDownloadUrl(newId) != url && newId != client.ResponseUri.ToString()) { return FileHippoMd5(newId, avoidBeta); } diff --git a/Forms/EditVariablesDialog.cs b/Forms/EditVariablesDialog.cs index 57d884b..9667495 100644 --- a/Forms/EditVariablesDialog.cs +++ b/Forms/EditVariablesDialog.cs @@ -232,7 +232,7 @@ private void UpdateInterface() try { - // Uodate controls which belong to the variable + // Update controls which belong to the variable using (new ControlRedrawLock(this)) { #if !MONO diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index f7842e9..408cd33 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -32,6 +32,6 @@ // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.8.10.1")] -[assembly: AssemblyFileVersion("1.8.10.1")] -[assembly: AssemblyInformationalVersion("1.0.1")] +[assembly: AssemblyVersion("1.8.11.1")] +[assembly: AssemblyFileVersion("1.8.11.1")] +[assembly: AssemblyInformationalVersion("1.0.2")] diff --git a/Updater.cs b/Updater.cs index 13fd530..71bef9e 100644 --- a/Updater.cs +++ b/Updater.cs @@ -227,6 +227,11 @@ public void Cancel() { continue; } + catch (InvalidOperationException) + { + // ObjectDisposedException with FileWebRequest + continue; + } } m_Requests.Clear(); }