コード例 #1
0
ファイル: FrameSynchr.cs プロジェクト: TonyDongGuaPi/joework
        public override void Init()
        {
            FrameCommandFactory.PrepareRegisterCommand();
            Assembly assembly = typeof(FrameSynchr).get_Assembly();

            Type[] types = assembly.GetTypes();
            int    num   = 0;

            while (types != null && num < types.Length)
            {
                Type     type             = types[num];
                object[] customAttributes = type.GetCustomAttributes(typeof(FrameCommandClassAttribute), true);
                for (int i = 0; i < customAttributes.Length; i++)
                {
                    FrameCommandClassAttribute frameCommandClassAttribute = customAttributes[i] as FrameCommandClassAttribute;
                    if (frameCommandClassAttribute != null)
                    {
                        CreatorDelegate creator = this.GetCreator(type);
                        if (creator != null)
                        {
                            FrameCommandFactory.RegisterCommandCreator(frameCommandClassAttribute.get_ID(), type, creator);
                        }
                    }
                }
                object[] customAttributes2 = type.GetCustomAttributes(typeof(FrameCSSYNCCommandClassAttribute), true);
                for (int j = 0; j < customAttributes2.Length; j++)
                {
                    FrameCSSYNCCommandClassAttribute frameCSSYNCCommandClassAttribute = customAttributes2[j] as FrameCSSYNCCommandClassAttribute;
                    if (frameCSSYNCCommandClassAttribute != null)
                    {
                        CreatorCSSyncDelegate cSSyncCreator = this.GetCSSyncCreator(type);
                        if (cSSyncCreator != null)
                        {
                            FrameCommandFactory.RegisterCSSyncCommandCreator(frameCSSYNCCommandClassAttribute.get_ID(), type, cSSyncCreator);
                        }
                    }
                }
                object[] customAttributes3 = type.GetCustomAttributes(typeof(FrameSCSYNCCommandClassAttribute), true);
                for (int k = 0; k < customAttributes3.Length; k++)
                {
                    FrameSCSYNCCommandClassAttribute frameSCSYNCCommandClassAttribute = customAttributes3[k] as FrameSCSYNCCommandClassAttribute;
                    if (frameSCSYNCCommandClassAttribute != null)
                    {
                        FrameCommandFactory.RegisterSCSyncCommandCreator(frameSCSYNCCommandClassAttribute.get_ID(), type, null);
                    }
                }
                num++;
            }
            this.ResetSynchr();
        }
コード例 #2
0
 public override void Init()
 {
     FrameCommandFactory.PrepareRegisterCommand();
     System.Type[] types = typeof(FrameSynchr).Assembly.GetTypes();
     for (int i = 0; (types != null) && (i < types.Length); i++)
     {
         System.Type inType           = types[i];
         object[]    customAttributes = inType.GetCustomAttributes(typeof(FrameCommandClassAttribute), true);
         for (int j = 0; j < customAttributes.Length; j++)
         {
             FrameCommandClassAttribute attribute = customAttributes[j] as FrameCommandClassAttribute;
             if (attribute != null)
             {
                 CreatorDelegate creator = this.GetCreator(inType);
                 if (creator != null)
                 {
                     FrameCommandFactory.RegisterCommandCreator(attribute.ID, inType, creator);
                 }
             }
         }
         object[] objArray2 = inType.GetCustomAttributes(typeof(FrameCSSYNCCommandClassAttribute), true);
         for (int k = 0; k < objArray2.Length; k++)
         {
             FrameCSSYNCCommandClassAttribute attribute2 = objArray2[k] as FrameCSSYNCCommandClassAttribute;
             if (attribute2 != null)
             {
                 CreatorCSSyncDelegate cSSyncCreator = this.GetCSSyncCreator(inType);
                 if (cSSyncCreator != null)
                 {
                     FrameCommandFactory.RegisterCSSyncCommandCreator(attribute2.ID, inType, cSSyncCreator);
                 }
             }
         }
     }
     this.ResetSynchr();
 }