Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
Version 1.2.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDuffman85 authored and TheDuffman85 committed Mar 1, 2015
1 parent 3c1b6d1 commit 7eac3ac
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 89 deletions.
68 changes: 14 additions & 54 deletions Synology Download Station Adapter/Adapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ public class Adapter
private const string REG_KEY_NAME = "SynologyDownloadStationAdapter";
public static readonly string[] FILE_TYPES_ALL = new string[] { ".dlc", ".ccf", ".rsdf", ".torrent", ".nzb" };
public static readonly string[] FILE_TYPES_NO_DECRYPT = new string[] { ".torrent", ".nzb" };

private const string LASTEST_RELEASE_URL = "https://github.com/TheDuffman85/SynologyDownloadStationAdapter/releases/latest";

public const string RELEASE_URL = "https://github.com/TheDuffman85/SynologyDownloadStationAdapter/releases";
public const string LASTEST_RELEASE_URL = "https://github.com/TheDuffman85/SynologyDownloadStationAdapter/releases/latest";

private const int MAX_PORTION_CHAR_SIZE = 1900;
private const int MAX_PORTION_LINK_COUNT = 50;
Expand All @@ -42,7 +43,6 @@ public class Adapter

private static HttpListener _httpListener;
private static Dictionary<string, string> _fileDownloads;
//private static WebRequest _checkNewReleaseRequest;
private static System.Timers.Timer _checkNewReleaseTimer;

#endregion
Expand All @@ -68,34 +68,6 @@ public static string AssemblyDirectory
}
}

public static Form VisibleForm
{
get
{

return (Form)frmSettings.Instance.Invoke(new Func<Form>(
delegate
{
if (frmDownloadStation.Instance.Visible)
{
return frmDownloadStation.Instance;
}
else if (frmSelectHoster.Instance.Visible)
{
return frmSelectHoster.Instance;
}
else if (frmAddLinks.Instance.Visible)
{
return frmAddLinks.Instance;
}
else
{
return frmSettings.Instance;
}
}));
}
}

#endregion

#region Static Methods
Expand Down Expand Up @@ -299,18 +271,12 @@ private static void WebRequestCallback(IAsyncResult result)

if (Properties.Settings.Default.ShowDecryptedLinks)
{
if (Adapter.VisibleForm.InvokeRequired)
{
Adapter.VisibleForm.Invoke((MethodInvoker)(() =>
{
frmAddLinks.ShowInstance(decrypter.Links);
}
));
}
else
frmSettings.Instance.Invoke((MethodInvoker)(() =>
{
// Run on UI thread
frmAddLinks.ShowInstance(decrypter.Links);
}
));
}
else
{
Expand Down Expand Up @@ -547,19 +513,13 @@ public static bool AddLinksToDownloadStation(List<string> links)
}

if (validHostLinks.Keys.Count > 1)
{
if (Adapter.VisibleForm.InvokeRequired)
{
Adapter.VisibleForm.Invoke((MethodInvoker)(() =>
{
frmSelectHoster.Instance.SelectHoster(validHostLinks);
}
));
}
else
{
frmSettings.Instance.Invoke((MethodInvoker)(() =>
{
// Run on UI thread
frmSelectHoster.Instance.SelectHoster(validHostLinks);
}
));
}

// Get total link count
Expand Down Expand Up @@ -597,11 +557,11 @@ public static bool AddLinksToDownloadStation(List<string> links)
{
if (result.Error.Code == 406)
{
throw new Exception("Couldn't add link. You have to choose a download folder for your Download Station.");
throw new Exception("Couldn't add link(s). You have to choose a download folder for your Download Station.");
}
else
{
throw new Exception("While adding links the error code " + result.Error.Code + " occurred");
throw new Exception("While adding link(s) the error code " + result.Error.Code + " occurred");
}
}
}
Expand Down Expand Up @@ -681,7 +641,7 @@ public static bool AddFileToDownloadStation(string path)
{
if (result.Error.Code == 406)
{
throw new Exception("Couldn't add link. You have to choose a download folder for your Download Station.");
throw new Exception("Couldn't add link(s). You have to choose a download folder for your Download Station.");
}
else
{
Expand Down Expand Up @@ -795,7 +755,7 @@ private static void CheckUpdate()
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(LASTEST_RELEASE_URL);
request.Referer = "http://SynologyDownloadStationAdapte.update";
request.Referer = "UpdateCheck";

WebResponse response = request.GetResponse();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.2.0.8")]
[assembly: AssemblyFileVersion("1.2.0.9")]
1 change: 0 additions & 1 deletion Synology Download Station Adapter/frmAddLinks.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 1 addition & 10 deletions Synology Download Station Adapter/frmDownloadStation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,7 @@ private void Awesomium_Windows_Forms_WebControl_CertificateError(object sender,
e.Handled = Awesomium.Core.EventHandling.Modal;
e.Ignore = true;
}

private void frmDownloadStation_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing)
{
e.Cancel = true;
this.Visible = false;
}
}


private void webControl_DocumentReady(object sender, DocumentReadyEventArgs e)
{
if (e.Url.Segments.Length == 3 &&
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 14 additions & 4 deletions Synology Download Station Adapter/frmSettings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 9 additions & 17 deletions Synology Download Station Adapter/frmSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
Expand Down Expand Up @@ -93,6 +94,7 @@ private frmSettings()
AddClipboardFormatListener(this.Handle);

this.btnFileAssociation.Text = string.Format(this.btnFileAssociation.Text, string.Join(",", Adapter.FILE_TYPES_ALL) );
this.lblVersion.Text = string.Format(this.lblVersion.Text, FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion);
}

#endregion
Expand Down Expand Up @@ -138,10 +140,7 @@ protected override void WndProc(ref Message m)
{
frmAddLinks.ShowInstance();
}
}



}
}
}
}
Expand Down Expand Up @@ -322,21 +321,14 @@ private void contextMenuStrip_Opening(object sender, CancelEventArgs e)

private void notifyIcon_MouseDoubleClick(object sender, MouseEventArgs e)
{
if (Adapter.VisibleForm.InvokeRequired)
{
Adapter.VisibleForm.Invoke((MethodInvoker)(() =>
{
Adapter.OpenDownloadStation();
}
));
}
else
{
Adapter.OpenDownloadStation();
}
Adapter.OpenDownloadStation();
}

#endregion
private void lblVersion_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process.Start(Adapter.RELEASE_URL);
}

#endregion
}
}

0 comments on commit 7eac3ac

Please sign in to comment.