internal RuntimeAddin(AddinEngine addinEngine, RuntimeAddin parentAddin, ModuleDescription module) { this.addinEngine = addinEngine; this.parentAddin = parentAddin; this.module = module; id = parentAddin.id; baseDirectory = parentAddin.baseDirectory; privatePath = parentAddin.privatePath; ainfo = parentAddin.ainfo; localizer = parentAddin.localizer; module.RuntimeAddin = this; }
/// <summary> /// Sets the default localizer to be used for this add-in engine /// </summary> /// <param name="localizer"> /// The add-in localizer /// </param> public void InitializeDefaultLocalizer(IAddinLocalizer localizer) { CheckInitialized(); lock (LocalLock) { if (localizer != null) { defaultLocalizer = new AddinLocalizer(localizer); } else { defaultLocalizer = null; } } }
internal AddinDescription Load(Addin iad) { ainfo = iad; AddinDescription description = iad.Description; id = description.AddinId; baseDirectory = description.BasePath; module = description.MainModule; module.RuntimeAddin = this; // Load the assemblies if (description.Localizer != null) { string cls = description.Localizer.GetAttribute("type"); // First try getting one of the stock localizers. If none of found try getting the type. // They are not encoded as an assembly qualified name object fob = null; if (cls.IndexOf(',') == -1) { Type t = GetType().Assembly.GetType("Hyena.Addins.Localization." + cls + "Localizer", false); if (t != null) { fob = Activator.CreateInstance(t); } } if (fob == null) { fob = CreateInstance(cls, true); } IAddinLocalizerFactory factory = fob as IAddinLocalizerFactory; if (factory == null) { throw new InvalidOperationException("Localizer factory type '" + cls + "' must implement IAddinLocalizerFactory"); } localizer = new AddinLocalizer(factory.CreateLocalizer(this, description.Localizer)); } return(description); }