public void Load() { if (mapAssemblies == null) { mapAssemblies = new Dictionary <string, MappingAssembly>(); } lock (mapAssemblies) { mapAssemblies.Clear(); try { foreach (var de in this.mappings) { MappingAssembly ma; if (mapAssemblies.ContainsKey(de.ScriptName)) { throw new AGIException(String.Format("Duplicate mapping name '{0}'", de.ScriptName)); } if (!string.IsNullOrEmpty(de.ScriptAssmebly)) { ma = new MappingAssembly() { ClassName = (string)de.ScriptClass, LoadedAssembly = Assembly.LoadFile(Path.Combine(this.AGIPath, de.ScriptAssmebly)) }; } else { ma = new MappingAssembly() { ClassName = (string)de.ScriptClass }; } mapAssemblies.Add(de.ScriptName, ma); } } catch (Exception ex) { throw new Exception("No mappings were added before 'Load' method called."); } } }
public void Load() { if (mapAssemblies == null) mapAssemblies = new Dictionary<string, MappingAssembly>(); lock (mapAssemblies) { mapAssemblies.Clear(); try { foreach (var de in this.mappings) { MappingAssembly ma; if (mapAssemblies.ContainsKey(de.ScriptName)) throw new AGIException(String.Format("Duplicate mapping name '{0}'", de.ScriptName)); if (!string.IsNullOrEmpty(de.ScriptAssmebly)) { ma = new MappingAssembly() { ClassName = (string)de.ScriptClass, LoadedAssembly = Assembly.LoadFile(Path.Combine(this.AGIPath, de.ScriptAssmebly)) }; } else { ma = new MappingAssembly() { ClassName = (string)de.ScriptClass }; } mapAssemblies.Add(de.ScriptName, ma); } } catch (Exception ex) { throw new Exception("No mappings were added before 'Load' method called."); } } }