|
|
|
@ -1,5 +1,6 @@ |
|
|
|
|
using System.Security ; |
|
|
|
|
using System ; |
|
|
|
|
using System.Text ; |
|
|
|
|
using System.Security ; |
|
|
|
|
using System.Windows.Forms ; |
|
|
|
|
using System.Collections.Generic ; |
|
|
|
|
|
|
|
|
@ -19,6 +20,29 @@ public static partial class Program |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void loadPredefinedSearchQueries( string fname ) |
|
|
|
|
{ |
|
|
|
|
// load the pre-defined search queries |
|
|
|
|
JsonConfig jsonConfig = new JsonConfig( "pre-defined search queries", fname ) ; |
|
|
|
|
ILog logger = LogManager.GetLogger( "shortcuts" ) ; |
|
|
|
|
foreach( dynamic entry in jsonConfig.data ) { |
|
|
|
|
string queryString = entry["query"] ?? "" ; |
|
|
|
|
if ( queryString == "" ) { |
|
|
|
|
Program.logStartupMsg( "bad-shortcut", $"{entry["shortcut"]}: Missing query string" ) ; |
|
|
|
|
continue ; |
|
|
|
|
} |
|
|
|
|
string shortcutString = entry["shortcut"] ?? "" ; |
|
|
|
|
Keys? keys = Shortcut.parseShortcutString( (string) shortcutString ) ; |
|
|
|
|
if ( keys == null ) { |
|
|
|
|
Program.logStartupMsg( "bad-shortcut", $"{queryString}: {shortcutString}" ) ; |
|
|
|
|
continue ; |
|
|
|
|
} |
|
|
|
|
Shortcut shortcut = new SearchQueryShortcut( keys.Value, queryString ) ; |
|
|
|
|
logger.Info( $"Registering search query shortcut: {shortcut} => {queryString}" ) ; |
|
|
|
|
Shortcut.registerShortcut( shortcut ) ; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void logStartupMsg( string key, string msg ) |
|
|
|
|
{ |
|
|
|
|
// log the startup message |
|
|
|
|