Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/canneverbe/Ketarin into Mono
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Francis committed Jul 31, 2019
2 parents 916cbe9 + cba86e7 commit 0c8d7bb
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 26 deletions.
2 changes: 1 addition & 1 deletion DbManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
42 changes: 21 additions & 21 deletions ExternalServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/// <summary>
Expand Down Expand Up @@ -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;
}

/// <summary>
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand All @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion Forms/EditVariablesDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
5 changes: 5 additions & 0 deletions Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ public void Cancel()
{
continue;
}
catch (InvalidOperationException)
{
// ObjectDisposedException with FileWebRequest
continue;
}
}
m_Requests.Clear();
}
Expand Down

0 comments on commit 0c8d7bb

Please sign in to comment.