diff --git a/DanTup.BrowserSelector/BrowserSelector.ini b/DanTup.BrowserSelector/BrowserSelector.ini
index 0f81a25..d70f47a 100644
--- a/DanTup.BrowserSelector/BrowserSelector.ini
+++ b/DanTup.BrowserSelector/BrowserSelector.ini
@@ -1,10 +1,11 @@
; Default browser is first in list
-; Micrsoft Edge is a UWP app and requires no path
+; Use `{url}` to specify UWP app browser details
[browsers]
chrome = C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
ff = C:\Program Files (x86)\Mozilla Firefox\firefox.exe
-edge =
+edge = microsoft-edge:{url}
ie = iexplore.exe
+chrome_prof8 = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --profile-directory="Profile 8"
; Url preferences.
; Only * is treated as a special character (wildcard).
@@ -13,3 +14,13 @@ ie = iexplore.exe
[urls]
microsoft.com = ie
*.microsoft.com = ie
+
+; Use my project-based Chrome profile
+myproject.live = chrome_prof8
+myproject.local = chrome_prof8
+
+; if the key is wrapped in /'s, it is treated as a regex.
+/sites\.google\.com/a/myproject.live\.com/ = chrome_prof8
+
+google.com = chrome
+visualstudio.com = edge
\ No newline at end of file
diff --git a/DanTup.BrowserSelector/ConfigReader.cs b/DanTup.BrowserSelector/ConfigReader.cs
index 841d8a1..78adb67 100644
--- a/DanTup.BrowserSelector/ConfigReader.cs
+++ b/DanTup.BrowserSelector/ConfigReader.cs
@@ -3,6 +3,8 @@
using System.IO;
using System.Linq;
using System.Reflection;
+using System.Text;
+using System.Windows.Forms;
namespace DanTup.BrowserSelector
{
@@ -11,7 +13,7 @@ static class ConfigReader
///
/// Config lives in the same folder as the EXE, name "BrowserSelector.ini".
///
- static string ConfigPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "BrowserSelector.ini");
+ public static string ConfigPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "BrowserSelector.ini");
static internal IEnumerable GetUrlPreferences()
{
@@ -62,6 +64,58 @@ static KeyValuePair SplitConfig(string configLine)
var parts = configLine.Split(new[] { '=' }, 2);
return new KeyValuePair(parts[0].Trim(), parts[1].Trim());
}
+
+ public static void CreateSampleIni()
+ {
+ Assembly assembly;
+ Stream stream;
+ StringBuilder result;
+
+ assembly = Assembly.GetExecutingAssembly();
+ //stream = assembly.GetManifestResourceStream("DanTup.BrowserSelector.BrowserSelector.ini");
+ stream = assembly.GetManifestResourceStream(assembly.GetManifestResourceNames()[0]);
+ if (stream == null)
+ {
+ return;
+ }
+
+ result = new StringBuilder();
+
+ using (StreamReader reader = new StreamReader(stream))
+ {
+ result.Append(reader.ReadToEnd());
+ reader.Close();
+ }
+
+ if (result.Length > 0)
+ {
+ if (File.Exists(ConfigPath))
+ {
+ string newName = GetBackupFileName(ConfigPath);
+ File.Move(ConfigPath, newName);
+ }
+
+ File.WriteAllText(ConfigPath, result.ToString());
+ }
+ }
+
+ static string GetBackupFileName(string fileName)
+ {
+ string newName;
+ string fname;
+ string fext;
+ int index = 0;
+
+ fname = Path.GetDirectoryName(fileName) + "\\" + Path.GetFileNameWithoutExtension(fileName);
+ fext = Path.GetExtension(fileName);
+
+ do
+ {
+ newName = string.Format("{0}.{1:0000}{2}", fname, ++index, fext);
+ } while (File.Exists(newName));
+
+ return newName;
+ }
}
class Browser
diff --git a/DanTup.BrowserSelector/DanTup.BrowserSelector.csproj b/DanTup.BrowserSelector/DanTup.BrowserSelector.csproj
index 23b4efc..6fa8c39 100644
--- a/DanTup.BrowserSelector/DanTup.BrowserSelector.csproj
+++ b/DanTup.BrowserSelector/DanTup.BrowserSelector.csproj
@@ -38,6 +38,9 @@
Browser.ico
+
+ OnOutputUpdated
+
@@ -57,14 +60,18 @@
-
+
PreserveNewest
-
+
+
+
+
+