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);
        }
        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);
        }