Exemple #1
0
        private static void faQRIM6nIU([In] FileInfo[] obj0)
        {
            string source = "";
            Dictionary <string, FileInfo> dictionary = new Dictionary <string, FileInfo>();
            List <FileInfo> list1 = new List <FileInfo>();
            List <FileInfo> list2 = new List <FileInfo>();
            int             num   = 1;

            foreach (FileInfo fileInfo in obj0)
            {
                if (StrategyComponentManager.yNoRLNTZ2P.Contains(fileInfo.Name))
                {
                    StreamReader streamReader = new StreamReader(fileInfo.FullName);
                    string       index        = num.ToString();
                    dictionary[index] = fileInfo;
                    list1.Add(fileInfo);
                    source = source + index + Environment.NewLine + Environment.NewLine + streamReader.ReadToEnd() + Environment.NewLine + Environment.NewLine;
                    ++num;
                    streamReader.Close();
                }
                else
                {
                    list2.Add(fileInfo);
                }
            }
            CompilerResults compilerResults = CompilingService.CompileSource(source);

            if (compilerResults.Errors.HasErrors)
            {
                foreach (FileInfo fileInfo in obj0)
                {
                    StrategyComponentManager.sLsRSGwrU3(fileInfo);
                }
            }
            else
            {
                foreach (Type type in compilerResults.CompiledAssembly.GetTypes())
                {
                    if (type.IsPublic)
                    {
                        string   index    = type.FullName.Substring(0, type.FullName.IndexOf(""));
                        FileInfo fileInfo = dictionary[index];
                        list1.Remove(fileInfo);
                        ComponentRecord componentRecord = StrategyComponentManager.cN2R9Xa8LN(type, fileInfo);
                        if (componentRecord != null)
                        {
                            StrategyComponentManager.wcrRFbhwry.ROm6C46rfm(componentRecord);
                            StrategyComponentManager.H13R1k6g2K(componentRecord);
                        }
                    }
                }
                foreach (FileInfo file in list1)
                {
                    ComponentRecord componentRecord = new ComponentRecord(Guid.Empty, ComponentType.Unknown, file.Name, "", file, (Type)null, new CompilerErrorCollection(new CompilerError[1]
                    {
                        new CompilerError(file.FullName, -1, -1, "fddfs", "trtr")
                    }));
                    StrategyComponentManager.wcrRFbhwry.ROm6C46rfm(componentRecord);
                    StrategyComponentManager.H13R1k6g2K(componentRecord);
                }
                foreach (FileInfo fileInfo in list2)
                {
                    StrategyComponentManager.sLsRSGwrU3(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);
            }
        }