Beispiel #1
0
 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;
 }
Beispiel #2
0
 /// <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;
         }
     }
 }
Beispiel #3
0
        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);
        }