private bool Load()
 {
     try
     {
         this.data = ConfigData.FromFile(ApplicationPaths.ConfigFile);
         return true;
     }
     catch (Exception ex)
     {
         /*DialogResult r = ev.Dialog(ex.Message + "\n" + Application.CurrentInstance.StringData("ConfigErrorDial"), Application.CurrentInstance.StringData("ConfigErrorCapDial"), DialogButtons.Yes | DialogButtons.No, 600, true);
         if (r == DialogResult.Yes)
         {
             this.data = new ConfigData();
             Save();
             return true;
         }
         else*/
             return false;
     }
 }
 public void Reset()
 {
     lock (this)
     {
         this.data = new ConfigData();
         Save();
     }
 }
        private static MultiLogger GetDefaultLogger(ConfigData config)
        {
            var logger = new MultiLogger();

            if (config.EnableTraceLogging)
            {
                logger.AddLogger(new FileLogger(ApplicationPaths.AppLogPath));
            #if (!DEBUG)
                logger.AddLogger(new TraceLogger());
            #endif
            }
            #if DEBUG
            logger.AddLogger(new TraceLogger());
            #endif
            return logger;
        }
        public static void Init(ConfigData config)
        {
            lock (sync)
            {
                if (Logger.LoggerInstance != null)
                {
                    Logger.LoggerInstance.Dispose();
                }

                Logger.LoggerInstance = GetDefaultLogger(config);

                var kernel = GetDefaultKernel(config);
                Kernel.Instance = kernel;
            }
            Logger.ReportInfo("kernel loaded");
        }
        static Kernel GetDefaultKernel(ConfigData config)
        {
            var kernel = new Kernel()
            {
                Plugins = DefaultPlugins(),
                StringData = new LocalizedStrings(),
                ConfigData = config
            };
            foreach (var plugin in kernel.Plugins.ToList())
            {
                try
                {
                    plugin.Init(kernel);
                }
                catch
                {
                    kernel.Plugins.Remove(plugin);
                }
            }

            kernel.Plugins.Sort(delegate(IPlugin p1, IPlugin p2) { return p1.Options.Order.CompareTo(p2.Options.Order); });
            int index = 0;
            foreach (var plugin in kernel.Plugins.ToList())
            {
                if (plugin.Options.Order != index)
                {
                    plugin.Options.Order = index;
                    plugin.Save();
                }
                index++;
            }
            kernel.ItemCollection = new ItemCollection(config.RootFolders);
            kernel.Message = new GenerateMessage();

            return kernel;
        }