Favalias application enables you :
- To manage your favorite websites' URLs. It is independent from a browser since the favorite URLs are stored in an XML file. You could launch a favorite website by clicking in the status area.
- To launch your favorite application using aliases (typing iis will launch the IIS manager, word will launch MS Word). Thus, you can manage your entire app shortcuts in one application, and you can launch them very quickly (for example: type Win+S to activate Favalias, then type excel to launch MS Excel).
- To make your own add-ins to call your own code. Your code can be written in any MS .NET language (like VB.NET or C#). For example, typing md5 will call C# code that computes hash codes for file, or typing pwd will call a strong password generator.
- To do Internet searches. Typing gg will launch a Google search.
Favalias is written in C#, but add-ins can be written in any .NET language. Favalias will run on all MS Windows platforms. It's a WinForm application that uses many powerful features of the .NET platform.
I developed this application first to demonstrate the use of XML and XSL in an application, during my training. Then I added an example of asynchronous web requests (to download the favicons),
Regex and added log4net framework. I added a progress bar to show the use of delegates with WinForms, and a
UserPreferences class to show how to serialize data. Finally, I added the Genghis '
CompletionCombo that enables the launch of applications using aliases (like "query" to launch the MS SQL Query Analyzer), and enables add-ins (with dynamic loading of assemblies). This application is like a Swiss army knife for me and I think it could be the same for you!
Using the code
The aliases are stored in an XML file by using a
DataSet, since it is very easy to read and write an XML file using
WriteXml. Using this aliases file, I can detect if I have to launch a command or to do a Google search (any text which is not recognized as an alias will launch your browser to google). The built-in commands are :
run anApplication withArguments
Run an application, you could transmit some arguments.
aURL starts with www. or http:// or https://, it will launch your browser to see the specified URL. You can hit Ctrl + Enter to complete the URL (it will add automatically www. and .com like the IE address bar).
To clear this history.
You can drag'n drop some text from another application.
Ctrl-J and Ctrl-N enable you to navigate in the command history.
Favalias uses an auto-complete combobox, so it will show you all your aliases, and you can quickly complete a command by pressing the "tab" key.
The Favalias application is shipped with a demo file, examine it to see how to add your own aliases (go to "Options-Edit aliases"). You can use environment variables (like %ProgramFiles% or %SystemRoot%) and %BROWSER% to launch the browser you have configured in the "preferences" menu.
You can also launch your aliases using the "aliases" menu.
Go to "Options-Edit aliases" to choose the addins you want to use. This form displays the applications available in the 'addins' directory.
Addins available with Favalias :
gg [keywords] [/lang] [/file] [/cat] [/lucky] [/num] [/site]
[/stock] [/link] [/group] [/news]
Perform a Google search.
alarm <message> /ts:timeSpan
Display a message after the specified timespan.
Generate a strong password of the given length (for example : "pwd 10" could generate "khN9P%4je1").
Generate an MD5 hash value for the specified file.
Display the environment variables set on your machine.
<FONT color=#000000>htmlenc/htmldec [string]</FONT>
Encode/decode strings in html strings.
<FONT color=#000000>urlenc/urldec [string]</FONT>
Encode/decode strings in URL-encoded strings.
<FONT color=#000000>lingo en fr [someTextToTranslate or aURL]</FONT>
Translate words using the WorldLingo web site
A SQL Server ConnectionString builder :
You can develop your own functions to extend the Favalias application. To do such addins, follow these instructions :
Create a class (with your favorite .NET language) ; this class must implement the "Favalias.Interfaces.IFavaliasAddin" interface. To do that you have to reference the FavaliasInterfaces.dll.
Implement the following method : public void Execute(string args, Hashtable parameters). "args" will contain the arguments transmitted with the alias, and "parameters" will contain : the alias name used to called this addin ("aliasName" key), the user's browser ("browser" key), the proxy IP and port ("proxyIP" and "proxyPort" keys), the application folder ("appFolder"), the user's favalias application data folder ("appDataFolder"), the addins folder ("addinsFolder").
Create a file named "aliases.xml" and add xml configuration for your addin (see the Addins project to see an example). The most important XmlElement is "Command" where you must type "dll assemblyName className". "assemblyName" is the name of your dll (without the .dll extension), and "className" is the full name of your class (with the namespace). You can specify an icon for your addin, use the "icon" element to reference your icon that must be embedded in the dll.
Compile your class in a dll and embed the "aliases.xml" file in it (in VS.NET choose "Embedded resource" for the "Build Action" property of the file, or use /resource with your compiler).
Copy this dll in the [AppFolder]\Addins folder ([AppFolder] is [ProgramFilesFolder]\Magnon\Favalias by default).
Launch Favalias, go to "options-edit addins", select your addin command(s) and try it !
New in v0.5 : you can develop ".exe" addin and specify whether you want to launch it in a new process (use "exe yourExeName /p") or in the same process as Favalias (in a new AppDomain, don't specify /p).
(If you want some examples, see the Addins and SystemInfoAddin projects that are shipped with the source code).
It's quite easy to use addins with Reflection. Just load the assembly and the type, and call the
Execute method of the
IFavaliasAddin interface :
a = Assembly.Load(assemblyName);
Type t = a.GetType(asssemblyName, true, true);
IFavaliasAddin addin = (IFavaliasAddin)Activator.CreateInstance(t);
Your favorite URLs are also stored in an XML file. I use it to generate the favorites menu. I sort the favorites using an XSLT style sheet. You can quickly add a favorite by drag'n drop (with the Ctrl key pressed) a link from your browser onto the Favalias form. To manage your favorites, go to "Options-Edit favorites".
To load the favicons (if the web sites provide one), click "Options-Load favicons". It will launch asynchronous web requests to retrieve them. To do that I have used the
PriorityThreadPool developed by Stephen Toub. This is a managed
ThreadPool which works far better than the .NET framework
ThreadPool (which is quite buggy when you attempt to do asynchronous web requests). First I look for a
<link rel="shortcut icon"> (using
Regex) because some web sites don't use the name favicon.ico. Then I do a second web request to download the favicon ; it's so simple in C# :
WebRequest requestIcon = WebRequest.Create(TheURL);
requestIcon.Timeout = 15000;
using(WebResponse response = requestIcon.GetResponse())
Stream myStream = response.GetResponseStream();
using(Image img = Image.FromStream(myStream))
saveFavicon method saves the icon in a
Hashtable to use it during the menu creation.
There are two skins available (classic and Matrix). In the next version you will be able to add your own skins to Favalias.
I have added a system hotkey to allow the activation of Favalias using shortcuts (Win+S by default). See the SystemHotKey project for more information. I also added the
<A href="http://www.codeproject.com/useritems/singleinstance.asp?target=singleinstance">SingleApplication</A> class to avoid multiple instances of Favalias in memory.
Help Wanted !
If you are interested by developing addins for Favalias or if you'd like to be a beta tester, you're welcome ! Send an email to : firstname.lastname@example.org and I will add you to The Favalias Group (on :http://sourceforge.net/projects/favalias).
Points of interest
I think that
DataSets are a very powerful feature of .NET, even if you don't have a database. I have used them to store the aliases and they are very useful to edit data, and load/save this data in XML. I could have used one to manage favorites (I used
XmlDocument for them) but I wanted to try different techniques.
The asynchronous features of the .NET framework are also very powerful even if I am quite disappointed by the
- 1 Aug 2003 - update downloads