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

Commit

Permalink
A few minor bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDuffman85 authored and TheDuffman85 committed Jan 24, 2015
1 parent e5b93b9 commit 96e547c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
11 changes: 11 additions & 0 deletions Synology Download Station Adapter/Adapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ public static Dictionary<string, string> FileDownloads
}
}

public static string AssemblyDirectory
{
get
{
string codeBase = Assembly.GetExecutingAssembly().CodeBase;
UriBuilder uri = new UriBuilder(codeBase);
string path = Uri.UnescapeDataString(uri.Path);
return Path.GetDirectoryName(path);
}
}

#endregion

#region Static Methods
Expand Down
23 changes: 17 additions & 6 deletions Synology Download Station Adapter/frmDownloadStation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Data;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
Expand Down Expand Up @@ -60,14 +61,24 @@ private frmDownloadStation()
{
InitializeComponent();

// Add a WebSession.
webControl.WebSession = WebCore.CreateWebSession("Session", new WebPreferences()
{
AcceptLanguage = CultureInfo.CurrentCulture.Name + "," + CultureInfo.CurrentCulture.TwoLetterISOLanguageName
});

this.Width = Settings.Default.SizeX;
this.Height = Settings.Default.SizeY;

try
{
// Add a WebSession.
webControl.WebSession = WebCore.CreateWebSession(Path.Combine(Adapter.AssemblyDirectory, "Session"), new WebPreferences()
{
AcceptLanguage = CultureInfo.CurrentCulture.Name + "," + CultureInfo.CurrentCulture.TwoLetterISOLanguageName
});
}
catch (Exception ex)
{
Adapter.ShowBalloonTip(ex.Message, ToolTipIcon.Error);

pbLoadingIndicator.Image = pbLoadingIndicator.ErrorImage;
this.NewIntance();
}
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Synology Download Station Adapter/frmSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ private void addContainerToolStripMenuItem_Click(object sender, EventArgs e)
using (OpenFileDialog openFile = new OpenFileDialog())
{
openFile.Title = "Select a Container File";
openFile.Filter = "Container Files (" + string.Join(" ,*", Adapter.FILE_TYPES_ALL).Trim(" ,".ToCharArray()) + ")|" + string.Join(";*", Adapter.FILE_TYPES_ALL).Trim(";".ToCharArray()) + "|All files (*.*)|*.*";
openFile.Filter = "Container Files (*" + string.Join(" ,*", Adapter.FILE_TYPES_ALL).Trim(" ,".ToCharArray()) + ")|*" + string.Join(";*", Adapter.FILE_TYPES_ALL).Trim(";".ToCharArray()) + "|All files (*.*)|*.*";
openFile.Multiselect = false;

if (openFile.ShowDialog() == DialogResult.OK)
Expand Down

0 comments on commit 96e547c

Please sign in to comment.