Added "search" architecture
[WebThing.git] / plugins / GoogleSearch.cs
diff --git a/plugins/GoogleSearch.cs b/plugins/GoogleSearch.cs
new file mode 100644 (file)
index 0000000..7b1b542
--- /dev/null
@@ -0,0 +1,10 @@
+using System;
+using bytex64.WebThing;
+using System.Text.RegularExpressions;
+
+public class GoogleSearch : WebThingPlugin, ISearchPlugin {
+    public string SearchTransform(string search) {
+        string[] words = Regex.Split(search, @"\s+");
+        return String.Format("http://google.com/search?q={0}", String.Join("%20", words));
+    }
+}