public static void AddNewComponent(ComponentType componentType, string name, string description)
        {
            StreamReader streamReader = new StreamReader(Framework.Installation.ComponentDir.FullName + "\\templates\\" + (string)StrategyComponentManager.templates[componentType]);
            string       text         = streamReader.ReadToEnd();

            streamReader.Close();
            string newValue = string.Concat(new string[]
            {
                "\"{",
                Guid.NewGuid().ToString(),
                "}\", ComponentType.",
                componentType.ToString(),
                " , Name=\"",
                name,
                "\", Description=\"",
                description,
                "\""
            });

            text = text.Replace("$HEADER$", newValue);
            text = text.Replace("$ClassName$", name);
            FileInfo fileInfo = new FileInfo(Framework.Installation.ComponentDir.FullName + "\\data\\" + name + ".cs");

            if (fileInfo.Exists)
            {
                throw new IOException(string.Format("File {0} already exists.", fileInfo.Name));
            }
            StreamWriter streamWriter = fileInfo.CreateText();

            streamWriter.Write(text);
            streamWriter.Close();
            StrategyComponentManager.RegisterComponents(fileInfo);
        }
        private static void RegisterAllComponents(FileInfo[] files)
        {
            string text = "";
            Dictionary <string, FileInfo> dictionary = new Dictionary <string, FileInfo>();
            List <FileInfo> list  = new List <FileInfo>();
            List <FileInfo> list2 = new List <FileInfo>();
            int             num   = 1;

            for (int i = 0; i < files.Length; i++)
            {
                FileInfo fileInfo = files[i];
                if (StrategyComponentManager.builtComponents.Contains(fileInfo.Name))
                {
                    StreamReader streamReader = new StreamReader(fileInfo.FullName);
                    string       text2        = "__" + num;
                    dictionary[text2] = fileInfo;
                    list.Add(fileInfo);
                    string text3 = text;
                    text = string.Concat(new string[]
                    {
                        text3,
                        "namespace ",
                        text2,
                        Environment.NewLine,
                        "{",
                        Environment.NewLine
                    });
                    text += streamReader.ReadToEnd();
                    text  = text + Environment.NewLine + "}" + Environment.NewLine;
                    num++;
                    streamReader.Close();
                }
                else
                {
                    list2.Add(fileInfo);
                }
            }
            CompilerResults compilerResults = CompilingService.CompileSource(text);

            if (compilerResults.Errors.HasErrors)
            {
                for (int j = 0; j < files.Length; j++)
                {
                    FileInfo file = files[j];
                    StrategyComponentManager.RegisterComponents(file);
                }
                return;
            }
            Type[] types = compilerResults.CompiledAssembly.GetTypes();
            for (int k = 0; k < types.Length; k++)
            {
                Type type = types[k];
                if (type.IsPublic)
                {
                    string   key       = type.FullName.Substring(0, type.FullName.IndexOf("."));
                    FileInfo fileInfo2 = dictionary[key];
                    list.Remove(fileInfo2);
                    ComponentRecord componentRecord = StrategyComponentManager.CreateRecord(type, fileInfo2);
                    if (componentRecord != null)
                    {
                        StrategyComponentManager.components.Add(componentRecord);
                        StrategyComponentManager.EmitComponentAdded(componentRecord);
                    }
                }
            }
            foreach (FileInfo current in list)
            {
                ComponentRecord record = new ComponentRecord(Guid.Empty, ComponentType.Unknown, current.Name, "", current, null, new CompilerErrorCollection(new CompilerError[]
                {
                    new CompilerError(current.FullName, -1, -1, "-1", "No components found")
                }));
                StrategyComponentManager.components.Add(record);
                StrategyComponentManager.EmitComponentAdded(record);
            }
            foreach (FileInfo current2 in list2)
            {
                StrategyComponentManager.RegisterComponents(current2);
            }
        }
        public static void AddExistingComponent(FileInfo existingFile)
        {
            FileInfo file = existingFile.CopyTo(Framework.Installation.ComponentDir.FullName + "\\data\\" + existingFile.Name);

            StrategyComponentManager.RegisterComponents(file);
        }