Example #1
0
        void LoadAssembly(System.Reflection.Assembly assembly)
        {
            if (assembly != null)
            {
                System.Type  [] types = assembly.GetTypes();

                foreach (System.Type T in types)
                {
                    ModuleAttribute ma = Attribute.GetCustomAttribute(T, typeof(ModuleAttribute)) as ModuleAttribute;
                    if (!Object.Equals(null, ma))
                    {
                        Module module = new Module();
                        module.Assembly    = MetaHelper.GetAssemblyString(T);
                        module.Type        = MetaHelper.GetTypeString(T);
                        module.Developer   = MetaHelper.GetDeveloperString(T);
                        module.Version     = MetaHelper.GetVersionString(T);
                        module.Name        = ma.Name;
                        module.Guid        = ma.Guid.ToString().ToUpper();
                        module.Description = ma.Description;
                        module.Attributes  = (int)GoComType.SilverUI;

                        WorkflowAddInAttribute wfa = Attribute.GetCustomAttribute(T, typeof(WorkflowAddInAttribute)) as WorkflowAddInAttribute;
                        if (!Object.Equals(null, wfa))
                        {
                            module.Attributes |= 0x1000;
                        }
                        this.modules.Add(module);
                    }
                }
            }
        }
Example #2
0
        WorkflowResult GetInstanceID(object wfAddIn)
        {
            WorkflowResult wfResult = new WorkflowResult();

            if (wfAddIn == null)
            {
                wfResult.Error = new ArgumentNullException("wfAddIn");
                return(wfResult);
            }

            System.Type            T   = wfAddIn.GetType();
            WorkflowAddInAttribute wfa = Attribute.GetCustomAttribute(T, typeof(WorkflowAddInAttribute)) as WorkflowAddInAttribute;

            if (Object.Equals(null, wfa))
            {
                wfResult.Error = new ArgumentException("wfAddIn");
                return(wfResult);
            }

            System.Reflection.PropertyInfo propertyInfo = null;
            foreach (System.Reflection.PropertyInfo item in T.GetProperties())
            {
                WorkflowInstanceIdAttribute wfai = Attribute.GetCustomAttribute(item, typeof(WorkflowInstanceIdAttribute)) as WorkflowInstanceIdAttribute;
                if (!Object.Equals(null, wfai))
                {
                    propertyInfo = item;
                    break;
                }
            }

            if (Object.Equals(null, propertyInfo))
            {
                wfResult.Error = new Exception("没有发现\"WorkflowInstanceId\"属性标记");
                return(wfResult);
            }

            wfResult.InstanceId = (Guid)propertyInfo.GetValue(wfAddIn, new object[] { });
            return(wfResult);
        }
Example #3
0
        WorkflowResult GetFlowID(object wfAddIn)
        {
            WorkflowResult wfResult = new WorkflowResult();

            if (wfAddIn == null)
            {
                wfResult.Error = new ArgumentNullException("wfAddIn");
                return(wfResult);
            }

            System.Type            T   = wfAddIn.GetType();
            WorkflowAddInAttribute wfa = Attribute.GetCustomAttribute(T, typeof(WorkflowAddInAttribute)) as WorkflowAddInAttribute;

            if (Object.Equals(null, wfa))
            {
                wfResult.Error = new ArgumentException("wfAddIn");
                //wfResult.Error = new Exception("wfAddIn");
                return(wfResult);
            }

            wfResult.FlowID = new Guid(wfa.FlowID);
            return(wfResult);
        }