I have an application called AirFoil. I contacted their support because I need to access functions of their program in my application. They have a API based on out-of-process COM. How can I interact with this COM objects throug C#?
They sent me a Javascript sample:
// This script sample demonstrates how to enumerate the list of recent sources
// and the list of running sources that Airfoil for Windows sees.
// You can run this from the command line using cscript.exe.
function endsWith(str, suffix)
{
return str.indexOf(suffix, str.length - suffix.length) !== -1;
}
var airfoilApp = WScript.CreateObject("RogueAmoeba.Airfoil");
var recentSources = airfoilApp.GetRecentSources();
for(var i = 0; i < recentSources.Count(); i++)
{
var audioSource = recentSources.Item(i);
WScript.Echo("Recent source " + i + " is " + audioSource.Name());
}
var runningSources = airfoilApp.GetRunningSources();
for(var i = 0; i < runningSources.Count(); i++)
{
var audioSource = runningSources.Item(i);
WScript.Echo("Running source " + i + " is " + audioSource.Name());
if(endsWith(audioSource.Id().toLowerCase(),"firefox.exe"))
{
airfoilApp.SetCurrentSource(audioSource);
}
}
So how can I do the same in C#? How to instantiate the object? What references do I need?
var airfoilApp = WScript.CreateObject("RogueAmoeba.Airfoil");
Sorry but I haven't more information about the API.
Thanks for you're reply.