Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Commit

Permalink
Modified: Allow running with partial plug-ins configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy committed Jun 9, 2016
1 parent f491cf9 commit c188a59
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions DocumentPagingUtils/FrmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,24 @@ public static IEnumerable<Type> GetImplementations(Type interfaceType, String pa
from assembly in AppDomain.CurrentDomain.GetAssemblies()
select assembly.Location;

var assemblies =
(
from path_temp in paths_assemblies
let path = Path.GetFullPath(path_temp)
where !paths_assemblies_loaded.Contains(path)
select Assembly.LoadFile(path)
).ToArray();
var assemblies = new List<Assembly>();
foreach (var path_temp in paths_assemblies)
{
var path = Path.GetFullPath(path_temp);
if (!paths_assemblies_loaded.Contains(path))
{
try
{
assemblies.Add(Assembly.LoadFile(path));
}
catch (Exception e)
{
MessageBox.Show(
string.Format("Skipping assembly (Its OK): {0}\n\nException:\n{1}", path, e.ToString())
);
}
}
}

return GetImplementations(interfaceType, assemblies);
//return GetImplementations(interfaceType, AppDomain.CurrentDomain.GetAssemblies());
Expand Down Expand Up @@ -351,7 +362,16 @@ private void FrmMain_Load(object sender, EventArgs e)
);

foreach (var implementation in GetImplementations(typeof(DocumentUtilsBase), "Plugins"))
cmbDocType.Items.Add(Activator.CreateInstance(implementation));
try
{
cmbDocType.Items.Add(Activator.CreateInstance(implementation));
}
catch (Exception exception)
{
MessageBox.Show(
string.Format("Skipping Plugin (Its OK): {0}\n\nException:\n{1}", implementation.ToString(), exception.ToString())
);
}

if(cmbDocType.Items.Count > 0)
cmbDocType.SelectedIndex = 0;
Expand Down

0 comments on commit c188a59

Please sign in to comment.