Exemple #1
0
        public void Initialize()
        {
            try
            {
                string myDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                //AppDomain.CurrentDomain.SetupInformation.PrivateBinPath;

                Configuration config = ConfigurationManager.OpenExeConfiguration(Assembly.GetExecutingAssembly().Location);
                if (config == null)
                {
                    InitDefaults();
                }
                ViewerConfiguration viewerConfig = (ViewerConfiguration)config.GetSection("jsonViewer");
                InternalConfig(viewerConfig);
            }
            catch
            {
                InitDefaults();
            }
        }
Exemple #2
0
 private void InternalConfig(ViewerConfiguration viewerConfig)
 {
     if (viewerConfig != null)
     {
         foreach (KeyValueConfigurationElement keyValue in viewerConfig.Plugins)
         {
             string type       = keyValue.Value;
             Type   pluginType = Type.GetType(type, false);
             if (pluginType != null && typeof(IJsonViewerPlugin).IsAssignableFrom(pluginType))
             {
                 try
                 {
                     IJsonViewerPlugin plugin = (IJsonViewerPlugin)Activator.CreateInstance(pluginType);
                     AddPlugin(plugin);
                 }
                 catch
                 {
                     //Silently ignore any errors in plugin creation
                 }
             }
         }
     }
 }
 private void InternalConfig(ViewerConfiguration viewerConfig)
 {
     if (viewerConfig != null)
     {
         foreach (KeyValueConfigurationElement keyValue in viewerConfig.Plugins)
         {
             string type = keyValue.Value;
             Type pluginType = Type.GetType(type, false);
             if (pluginType != null && typeof(IJsonViewerPlugin).IsAssignableFrom(pluginType))
             {
                 try
                 {
                     IJsonViewerPlugin plugin = (IJsonViewerPlugin)Activator.CreateInstance(pluginType);
                     AddPlugin(plugin);
                 }
                 catch
                 {
                     //Silently ignore any errors in plugin creation
                 }
             }
         }
     }
 }