Mono.Zeroconf
/trunk/src/Mono.Zeroconf/Mono.Zeroconf.Providers/ProviderFactory.cs |
@@ -89,31 +89,20 @@ |
|
directories.Add(Path.Combine(new_path, "mono-zeroconf")); |
} |
|
try |
{ |
foreach (string directory in directories) |
{ |
foreach (string file in Directory.GetFiles(directory, "Mono.Zeroconf.Providers.*.dll")) |
{ |
if (Path.GetFileName(file) != Path.GetFileName(this_asm_path)) |
{ |
Assembly provider_asm = Assembly.LoadFile(file); |
foreach (Attribute attr in provider_asm.GetCustomAttributes(false)) |
{ |
if (attr is ZeroconfProviderAttribute) |
{ |
Type type = (attr as ZeroconfProviderAttribute).ProviderType; |
IZeroconfProvider provider = (IZeroconfProvider) Activator.CreateInstance(type); |
try |
{ |
provider.Initialize(); |
providers_list.Add(provider); |
} |
catch (Exception e) |
{ |
Console.WriteLine(e); |
} |
|
foreach(string directory in directories) { |
foreach(string file in Directory.GetFiles(directory, "Mono.Zeroconf.Providers.*.dll")) { |
if(Path.GetFileName(file) != Path.GetFileName(this_asm_path)) { |
Assembly provider_asm = Assembly.LoadFile(file); |
foreach(Attribute attr in provider_asm.GetCustomAttributes(false)) { |
if(attr is ZeroconfProviderAttribute) { |
Type type = (attr as ZeroconfProviderAttribute).ProviderType; |
IZeroconfProvider provider = (IZeroconfProvider)Activator.CreateInstance(type); |
try { |
provider.Initialize(); |
providers_list.Add(provider); |
} catch (Exception e) { |
Console.WriteLine (e); |
} |
} |
} |
@@ -120,11 +109,7 @@ |
} |
} |
} |
catch |
{ |
// Could not load a provider. |
} |
|
|
if(providers_list.Count == 0) { |
throw new Exception("No Zeroconf providers could be found or initialized. Necessary daemon may not be running."); |
} |
/trunk/src/Mono.Zeroconf/Mono.Zeroconf.csproj |
@@ -1,5 +1,5 @@ |
<?xml version="1.0" encoding="utf-8"?> |
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="15.0"> |
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
<PropertyGroup> |
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
@@ -12,11 +12,6 @@ |
<AssemblyName>Mono.Zeroconf</AssemblyName> |
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion> |
<FileAlignment>512</FileAlignment> |
<FileUpgradeFlags> |
</FileUpgradeFlags> |
<UpgradeBackupLocation> |
</UpgradeBackupLocation> |
<OldToolsVersion>2.0</OldToolsVersion> |
</PropertyGroup> |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
<DebugSymbols>true</DebugSymbols> |