void InternalRegister (string foundryName, Foundry foundry) { object f = foundries [foundryName]; if (f is CompoundFoundry) { ((CompoundFoundry) f).Add (foundry); } else if (f == null || (f is AssemblyFoundry && foundry is AssemblyFoundry)) { // If more than 1 namespace/assembly specified, the last one is used. foundries [foundryName] = foundry; } else if (f != null) { CompoundFoundry compound = new CompoundFoundry (foundryName); compound.Add ((Foundry) f); compound.Add (foundry); foundries [foundryName] = compound; } }
void InternalRegister(string foundryName, Foundry foundry, bool fromConfig) { object f = foundries [foundryName]; Foundry newFoundry = null; if (f is CompoundFoundry) { ((CompoundFoundry)f).Add(foundry); return; } else if (f == null || f is ArrayList || (f is AssemblyFoundry && foundry is AssemblyFoundry)) { newFoundry = foundry; } else if (f != null) { CompoundFoundry compound = new CompoundFoundry(foundryName); compound.Add((Foundry)f); compound.Add(foundry); newFoundry = foundry; newFoundry.FromConfig = fromConfig; } if (newFoundry == null) { return; } if (f == null) { foundries [foundryName] = newFoundry; return; } ArrayList af = f as ArrayList; if (af == null) { af = new ArrayList(2); af.Add(f); foundries [foundryName] = af; } if (newFoundry is AssemblyFoundry) { object o; for (int i = 0; i < af.Count; i++) { o = af [i]; if (o is AssemblyFoundry) { af.Insert(i, newFoundry); return; } } af.Add(newFoundry); } else { af.Insert(0, newFoundry); } }
void InternalRegister (string foundryName, Foundry foundry, bool fromConfig) { object f = foundries [foundryName]; Foundry newFoundry = null; if (f is CompoundFoundry) { ((CompoundFoundry) f).Add (foundry); return; } else if (f == null || f is ArrayList || (f is AssemblyFoundry && foundry is AssemblyFoundry)) { newFoundry = foundry; } else if (f != null) { CompoundFoundry compound = new CompoundFoundry (foundryName); compound.Add ((Foundry) f); compound.Add (foundry); newFoundry = foundry; newFoundry.FromConfig = fromConfig; } if (newFoundry == null) return; if (f == null) { foundries [foundryName] = newFoundry; return; } ArrayList af = f as ArrayList; if (af == null) { af = new ArrayList (2); af.Add (f); foundries [foundryName] = af; } if (newFoundry is AssemblyFoundry) { object o; for (int i = 0; i < af.Count; i++) { o = af [i]; if (o is AssemblyFoundry) { af.Insert (i, newFoundry); return; } } af.Add (newFoundry); } else af.Insert (0, newFoundry); }