예제 #1
0
        private static void sLsRSGwrU3([In] FileInfo obj0)
        {
            CompilerResults compilerResults = CompilingService.Compile(obj0.FullName, false);

            if (compilerResults.Errors.HasErrors)
            {
                ComponentRecord componentRecord = new ComponentRecord(Guid.Empty, ComponentType.Unknown, obj0.Name, "", obj0, (Type)null, compilerResults.Errors);
                StrategyComponentManager.wcrRFbhwry.ROm6C46rfm(componentRecord);
                StrategyComponentManager.H13R1k6g2K(componentRecord);
            }
            else
            {
                bool flag = false;
                foreach (Type type in compilerResults.CompiledAssembly.GetTypes())
                {
                    ComponentRecord componentRecord = StrategyComponentManager.cN2R9Xa8LN(type, obj0);
                    if (componentRecord != null)
                    {
                        StrategyComponentManager.wcrRFbhwry.ROm6C46rfm(componentRecord);
                        StrategyComponentManager.H13R1k6g2K(componentRecord);
                        flag = true;
                    }
                }
                if (flag)
                {
                    return;
                }
                ComponentRecord componentRecord1 = new ComponentRecord(Guid.Empty, ComponentType.Unknown, obj0.Name, "", obj0, (Type)null, new CompilerErrorCollection(new CompilerError[1]
                {
                    new CompilerError(obj0.FullName, -1, -1, "dfdfs", "fdsdfs")
                }));
                StrategyComponentManager.wcrRFbhwry.ROm6C46rfm(componentRecord1);
                StrategyComponentManager.H13R1k6g2K(componentRecord1);
            }
        }
예제 #2
0
        private static TesterComponentRecord[] rAdPWPX1l([In] FileInfo obj0)
        {
            CompilerResults compilerResults = CompilingService.Compile(new string[1]
            {
                obj0.FullName
            }, new string[2]
            {
                "dffds",
                "fdsdf"
            }, 0 != 0);
            ArrayList arrayList = new ArrayList();

            foreach (Type type in compilerResults.CompiledAssembly.GetTypes())
            {
                object[] customAttributes = type.GetCustomAttributes(typeof(TesterComponentAttribute), false);
                string   name;
                string   description;
                if (customAttributes.Length > 0)
                {
                    TesterComponentAttribute componentAttribute = customAttributes[0] as TesterComponentAttribute;
                    name        = componentAttribute.Name == null ? type.Name : componentAttribute.Name;
                    description = componentAttribute.Description == null ? "" : componentAttribute.Description;
                }
                else
                {
                    name        = type.Name;
                    description = "";
                }
                TesterComponentRecord testerComponentRecord = new TesterComponentRecord(name, description, obj0, type);
                TesterComponentManager.G1d22oBB0.x1QyU3cJOi(testerComponentRecord);
                arrayList.Add((object)testerComponentRecord);
            }
            return(arrayList.ToArray(typeof(TesterComponentRecord)) as TesterComponentRecord[]);
        }
        private static void RegisterComponents(FileInfo file)
        {
            CompilerResults compilerResults = CompilingService.Compile(file.FullName, false);

            if (compilerResults.Errors.HasErrors)
            {
                ComponentRecord record = new ComponentRecord(Guid.Empty, ComponentType.Unknown, file.Name, "", file, null, compilerResults.Errors);
                StrategyComponentManager.components.Add(record);
                StrategyComponentManager.EmitComponentAdded(record);
                return;
            }
            bool flag = false;

            Type[] types = compilerResults.CompiledAssembly.GetTypes();
            for (int i = 0; i < types.Length; i++)
            {
                Type            type            = types[i];
                ComponentRecord componentRecord = StrategyComponentManager.CreateRecord(type, file);
                if (componentRecord != null)
                {
                    StrategyComponentManager.components.Add(componentRecord);
                    StrategyComponentManager.EmitComponentAdded(componentRecord);
                    flag = true;
                }
            }
            if (!flag)
            {
                ComponentRecord record2 = new ComponentRecord(Guid.Empty, ComponentType.Unknown, file.Name, "", file, null, new CompilerErrorCollection(new CompilerError[]
                {
                    new CompilerError(file.FullName, -1, -1, "-1", "No components found")
                }));
                StrategyComponentManager.components.Add(record2);
                StrategyComponentManager.EmitComponentAdded(record2);
            }
        }
예제 #4
0
        public static IComponentBase GetComponent(Guid guid, object issuer)
        {
            ComponentRecord record1 = StrategyComponentManager.wcrRFbhwry.FindRecord(guid);

            if (record1 == null)
            {
                return((IComponentBase)null);
            }
            if (record1.IsChanged)
            {
                StrategyComponentManager.gLhRsqD2VZ.Remove((object)record1);
                CompilerResults compilerResults = CompilingService.Compile(record1.File.FullName, false);
                if (compilerResults.Errors.HasErrors)
                {
                    record1.HrjA5j3PaA(compilerResults.Errors);
                    return((IComponentBase)null);
                }
                else
                {
                    record1.VnhAiVxt7S(false);
                    foreach (Type type in compilerResults.CompiledAssembly.GetTypes())
                    {
                        ComponentRecord componentRecord = StrategyComponentManager.cN2R9Xa8LN(type, record1.File);
                        if (componentRecord != null)
                        {
                            record1.X8yAQiuh7R(componentRecord.RuntimeType);
                            break;
                        }
                    }
                }
            }
            Hashtable hashtable = StrategyComponentManager.gLhRsqD2VZ[(object)record1] as Hashtable;

            if (hashtable == null)
            {
                hashtable = new Hashtable();
                StrategyComponentManager.gLhRsqD2VZ.Add((object)record1, (object)hashtable);
            }
            IComponentBase componentBase = hashtable[issuer] as IComponentBase;

            if (componentBase == null)
            {
                ComponentRecord record2 = StrategyComponentManager.wcrRFbhwry.FindRecord(guid);
                componentBase             = Activator.CreateInstance(record2.RuntimeType) as IComponentBase;
                componentBase.Name        = record2.Name;
                componentBase.Description = record2.Description;
                hashtable.Add(issuer, (object)componentBase);
            }
            return(componentBase);
        }
        public static IComponentBase GetComponent(Guid guid, object issuer)
        {
            ComponentRecord componentRecord = StrategyComponentManager.components.FindRecord(guid);

            if (componentRecord == null)
            {
                return(null);
            }
            if (componentRecord.IsChanged)
            {
                StrategyComponentManager.componentCache.Remove(componentRecord);
                CompilerResults compilerResults = CompilingService.Compile(componentRecord.File.FullName, false);
                if (compilerResults.Errors.HasErrors)
                {
                    componentRecord.SetErrors(compilerResults.Errors);
                    return(null);
                }
                componentRecord.SetIsChanged(false);
                Type[] types = compilerResults.CompiledAssembly.GetTypes();
                for (int i = 0; i < types.Length; i++)
                {
                    Type            type             = types[i];
                    ComponentRecord componentRecord2 = StrategyComponentManager.CreateRecord(type, componentRecord.File);
                    if (componentRecord2 != null)
                    {
                        componentRecord.SetRuntimeType(componentRecord2.RuntimeType);
                        break;
                    }
                }
            }
            Hashtable hashtable = StrategyComponentManager.componentCache[componentRecord] as Hashtable;

            if (hashtable == null)
            {
                hashtable = new Hashtable();
                StrategyComponentManager.componentCache.Add(componentRecord, hashtable);
            }
            IComponentBase componentBase = hashtable[issuer] as IComponentBase;

            if (componentBase == null)
            {
                ComponentRecord componentRecord3 = StrategyComponentManager.components.FindRecord(guid);
                componentBase             = (Activator.CreateInstance(componentRecord3.RuntimeType) as IComponentBase);
                componentBase.Name        = componentRecord3.Name;
                componentBase.Description = componentRecord3.Description;
                hashtable.Add(issuer, componentBase);
            }
            return(componentBase);
        }
예제 #6
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);
                }
            }
        }
예제 #7
0
        public static bool RebuildComponent(FileInfo file)
        {
            ComponentRecord[] records = StrategyComponentManager.wcrRFbhwry.FindRecords(file);
            foreach (ComponentRecord componentRecord in records)
            {
                componentRecord.HrjA5j3PaA(new CompilerErrorCollection());
                StrategyComponentManager.gLhRsqD2VZ.Remove((object)componentRecord);
            }
            CompilerResults compilerResults = CompilingService.Compile(file.FullName, false);

            if (compilerResults.Errors.HasErrors)
            {
                foreach (ComponentRecord componentRecord in records)
                {
                    componentRecord.HrjA5j3PaA(compilerResults.Errors);
                    StrategyComponentManager.TXQRKdObj1(componentRecord);
                }
                return(false);
            }
            else
            {
                ArrayList arrayList1 = new ArrayList();
                foreach (Type type in compilerResults.CompiledAssembly.GetTypes())
                {
                    ComponentRecord componentRecord = StrategyComponentManager.cN2R9Xa8LN(type, file);
                    if (componentRecord != null)
                    {
                        arrayList1.Add((object)componentRecord);
                    }
                }
                ArrayList arrayList2 = new ArrayList((ICollection)records);
                foreach (ComponentRecord componentRecord1 in arrayList1)
                {
                    bool flag = false;
                    foreach (ComponentRecord componentRecord2 in arrayList2)
                    {
                        if (componentRecord2.GUID == componentRecord1.GUID)
                        {
                            componentRecord2.lfVAUUDxYN(componentRecord1.Name);
                            componentRecord2.x63AOXlRIK(componentRecord1.Description);
                            componentRecord2.CvyAHpcreG(componentRecord1.ComponentType);
                            componentRecord2.X8yAQiuh7R(componentRecord1.RuntimeType);
                            componentRecord2.VnhAiVxt7S(false);
                            flag = true;
                            arrayList2.Remove((object)componentRecord2);
                            StrategyComponentManager.TXQRKdObj1(componentRecord2);
                            break;
                        }
                    }
                    if (!flag)
                    {
                        StrategyComponentManager.wcrRFbhwry.ROm6C46rfm(componentRecord1);
                        StrategyComponentManager.H13R1k6g2K(componentRecord1);
                    }
                }
                foreach (ComponentRecord componentRecord in arrayList2)
                {
                    if (componentRecord.GUID == Guid.Empty)
                    {
                        StrategyComponentManager.wcrRFbhwry.fc56KRbFEA(componentRecord);
                        StrategyComponentManager.IP7RCltgOJ(componentRecord);
                    }
                }
                return(true);
            }
        }
        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 bool RebuildComponent(FileInfo file)
        {
            ComponentRecord[] array  = StrategyComponentManager.components.FindRecords(file);
            ComponentRecord[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                ComponentRecord componentRecord = array2[i];
                componentRecord.SetErrors(new CompilerErrorCollection());
                StrategyComponentManager.componentCache.Remove(componentRecord);
            }
            CompilerResults compilerResults = CompilingService.Compile(file.FullName, false);

            if (compilerResults.Errors.HasErrors)
            {
                ComponentRecord[] array3 = array;
                for (int j = 0; j < array3.Length; j++)
                {
                    ComponentRecord componentRecord2 = array3[j];
                    componentRecord2.SetErrors(compilerResults.Errors);
                    StrategyComponentManager.EmitComponentReconstructed(componentRecord2);
                }
                return(false);
            }
            ArrayList arrayList = new ArrayList();

            Type[] types = compilerResults.CompiledAssembly.GetTypes();
            for (int k = 0; k < types.Length; k++)
            {
                Type            type             = types[k];
                ComponentRecord componentRecord3 = StrategyComponentManager.CreateRecord(type, file);
                if (componentRecord3 != null)
                {
                    arrayList.Add(componentRecord3);
                }
            }
            ArrayList arrayList2 = new ArrayList(array);

            foreach (ComponentRecord componentRecord4 in arrayList)
            {
                bool flag = false;
                foreach (ComponentRecord componentRecord5 in arrayList2)
                {
                    if (componentRecord5.GUID == componentRecord4.GUID)
                    {
                        componentRecord5.SetName(componentRecord4.Name);
                        componentRecord5.SetDescription(componentRecord4.Description);
                        componentRecord5.SetComponentType(componentRecord4.ComponentType);
                        componentRecord5.SetRuntimeType(componentRecord4.RuntimeType);
                        componentRecord5.SetIsChanged(false);
                        flag = true;
                        arrayList2.Remove(componentRecord5);
                        StrategyComponentManager.EmitComponentReconstructed(componentRecord5);
                        break;
                    }
                }
                if (!flag)
                {
                    StrategyComponentManager.components.Add(componentRecord4);
                    StrategyComponentManager.EmitComponentAdded(componentRecord4);
                }
            }
            foreach (ComponentRecord componentRecord6 in arrayList2)
            {
                if (componentRecord6.GUID == Guid.Empty)
                {
                    StrategyComponentManager.components.Remove(componentRecord6);
                    StrategyComponentManager.EmitComponentRemoved(componentRecord6);
                }
            }
            return(true);
        }