Esempio n. 1
0
        private static void ParsePlugInFiles()
        {
            PlugIn plugIn;

            foreach (string file in plugInFiles)
            {
                try
                {
                    plugIn = PlugIn.Load(file);
                }
                catch (Exception ex)
                {
                    log.ErrorFormat("Error loading PlugIn {0} :\n{1}", file, ex.Message);
                    plugIn = new PlugIn();

                    plugIn.PlugInFile     = file;
                    plugIn.CustomErrorMsg = ex.Message;
                }

                if (plugIn.CustomErrorMsg.IsNotNullOrEmpty())
                {
                    plugInsList.Add(plugIn);
                    continue;
                }

                plugIn.Enabled = true;

                if (disabledList != null && disabledList.Count > 0)
                {
                    foreach (string dir in disabledList)
                    {
                        if (plugIn.PlugInDir.IndexOf(dir) >= 0)
                        {
                            plugIn.Enabled = false;
                            break;
                        }
                    }
                }

                if (plugIn.Enabled)
                {
                    plugInsList.Add(plugIn);

                    foreach (ExtensionPath path in plugIn.Paths.Values)
                    {
                        PlugInTreeNode treePath = RootNode.CreatePath(path.Name);
                        treePath.AddCodons(path.Codons);
                    }

                    foreach (Runtime runtime in plugIn.Runtimes)
                    {
                        foreach (LazyDoozer doozer in runtime.DefinedDoozers)
                        {
                            if (Doozers.ContainsKey(doozer.Name))
                            {
                                throw new Exception("Duplicate doozer: " + doozer.Name);
                            }

                            Doozers.Add(doozer.Name, doozer);
                        }
                    }
                }
            }
        }