Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit bcea4d7

Browse files
committed
Fix broken things
1 parent 21052c2 commit bcea4d7

File tree

3 files changed

+25
-19
lines changed

3 files changed

+25
-19
lines changed

AUTHORS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
Daniel Aleksandersen (da2x)
2-
Mark Young (tip2tail)
2+
Mark Young (tip2tail)
3+
4+
Search Engine Functionality:
5+
RadialApps (radialapps)

EdgeDeflector/EdgeDeflector.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
<Reference Include="System" />
6262
<Reference Include="System.Core" />
6363
<Reference Include="System.Web" />
64+
<Reference Include="System.Windows.Forms" />
6465
<Reference Include="System.Xml.Linq" />
6566
<Reference Include="System.Data.DataSetExtensions" />
6667
<Reference Include="Microsoft.CSharp" />

EdgeDeflector/Program.cs

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -164,24 +164,9 @@ static string RewriteMsEdgeUriSchema(string uri)
164164
Regex rgx = new Regex(msedge_protocol_pattern);
165165
string new_uri = rgx.Replace(uri, string.Empty);
166166

167-
if (engine == "Google")
168-
{
169-
int index = new_uri.IndexOf("&");
170-
if (index > 0)
171-
new_uri = new_uri.Substring(0, index);
172-
new_uri = new_uri.Replace("bing.com/search?q=", "google.com/search?q=");
173-
}
174-
else if (engine == "DuckDuckGo")
175-
{
176-
int index = new_uri.IndexOf("&");
177-
if (index > 0)
178-
new_uri = new_uri.Substring(0, index);
179-
new_uri = new_uri.Replace("bing.com/search?q=", "duckduckgo.com/?q=");
180-
}
181-
182167
if (IsHttpUri(new_uri))
183168
{
184-
return new_uri;
169+
return replaceSearchEngine(new_uri, engine);
185170
}
186171

187172
// May be new-style Cortana URI - try and split out
@@ -191,12 +176,29 @@ static string RewriteMsEdgeUriSchema(string uri)
191176
if (IsHttpUri(cortanaUri))
192177
{
193178
// Correctly form the new URI before returning
194-
return cortanaUri;
179+
return replaceSearchEngine(cortanaUri, engine);
195180
}
196181
}
197182

198183
// defer fallback to web browser
199-
return "http://" + new_uri;
184+
return "http://" + replaceSearchEngine(new_uri, engine);
185+
}
186+
187+
static string replaceSearchEngine(string new_uri, string engine)
188+
{
189+
int index = new_uri.IndexOf("&");
190+
if (index > 0) new_uri = new_uri.Substring(0, index);
191+
192+
if (engine == "Google")
193+
{
194+
return new_uri.Replace("bing.com/search?q=", "google.com/search?q=");
195+
}
196+
else if (engine == "DuckDuckGo")
197+
{
198+
return new_uri.Replace("bing.com/search?q=", "duckduckgo.com/?q=");
199+
}
200+
201+
return new_uri;
200202
}
201203

202204
static void OpenUri(string uri)

0 commit comments

Comments
 (0)