Example #1
0
        public override NodeStatus Analyze()
        {
            m_nodeStatus = base.Analyze();

            PropertyInfo piMono = (PropertyInfo)mInfoMono;
            PropertyInfo piMS   = (PropertyInfo)mInfoMS;

            MemberInfo miGetMono, miSetMono;

            if (piMono == null)
            {
                miGetMono = miSetMono = null;
            }
            else
            {
                miGetMono = piMono.GetGetMethod();
                miSetMono = piMono.GetSetMethod();
            }

            MemberInfo miGetMS, miSetMS;

            if (piMS == null)
            {
                miGetMS = miSetMS = null;
            }
            else
            {
                miGetMS = piMS.GetGetMethod();
                miSetMS = piMS.GetSetMethod();
            }

            if (miGetMono != null || miGetMS != null)
            {
                mmGet = new MissingMethod(miGetMono, miGetMS);
                m_nodeStatus.AddChildren(mmGet.Analyze());
            }
            if (miSetMono != null || miSetMS != null)
            {
                mmSet = new MissingMethod(miSetMono, miSetMS);
                m_nodeStatus.AddChildren(mmSet.Analyze());
            }

            if (piMono != null && piMS != null)
            {
                string strTypeMono = piMono.PropertyType.FullName;
                string strTypeMS   = piMS.PropertyType.FullName;
                if (strTypeMono != strTypeMS)
                {
                    Status.AddWarning("Invalid type: is '" + strTypeMono + "', should be '" + strTypeMS + "'");
                }
            }

            return(m_nodeStatus);
        }
Example #2
0
        public override NodeStatus Analyze()
        {
            base.Analyze();

            if (mInfoMono != null && mInfoMS != null)
            {
                var fiMono = (FieldInfo)mInfoMono;
                var fiMS   = (FieldInfo)mInfoMS;

                AddFakeAttribute(fiMono.IsNotSerialized, fiMS.IsNotSerialized, "System.NonSerializedAttribute");
                AddFakeAttribute(fiMono.IsPinvokeImpl, fiMS.IsPinvokeImpl, "System.PInvokeImplAttribute");

                AddFlagWarning(fiMono.IsStatic, fiMS.IsStatic, "static");
                AddFlagWarning(fiMono.IsLiteral, fiMS.IsLiteral, "const");
                AddFlagWarning(fiMono.IsInitOnly, fiMS.IsInitOnly, "readonly");

                string strTypeMono = fiMono.FieldType.FullName;
                string strTypeMS   = fiMS.FieldType.FullName;
                if (strTypeMono != strTypeMS)
                {
                    Status.AddWarning("Invalid type: is '" + strTypeMono + "', should be '" + strTypeMS + "'");
                }

                try
                {
                    if (fiMono.IsStatic && fiMS.IsStatic &&
                        fiMono.IsLiteral && fiMS.IsLiteral)
                    {
                        object objMono = fiMono.GetValue(null);
                        object objMS   = fiMS.GetValue(null);
                        long   lMono   = Convert.ToInt64(objMono);
                        long   lMS     = Convert.ToInt64(objMS);

                        if (lMono != lMS)
                        {
                            string strValMono = ((lMono < 0) ? "-0x" : "0x") + lMono.ToString("x");
                            string strValMS   = ((lMS < 0) ? "-0x" : "0x") + lMS.ToString("x");
                            Status.AddWarning("Invalid value: is '" + strValMono + "', should be '" + strValMS + "'");
                        }
                    }
                }
                catch (Exception) {}
            }
            return(m_nodeStatus);
        }
Example #3
0
        public override NodeStatus Analyze()
        {
            if (!Status.IsMissing)
            {
                rgAttributes = new ArrayList();
                nsAttributes = MissingAttribute.AnalyzeAttributes(
                    (mInfoMono == null) ? null : mInfoMono.GetCustomAttributes(false),
                    (mInfoMS == null) ? null :   mInfoMS.GetCustomAttributes(false),
                    rgAttributes);

                if (mInfoMono != null && mInfoMS != null)
                {
                    Accessibility acMono = GetAccessibility(mInfoMono);
                    Accessibility acMS   = GetAccessibility(mInfoMS);
                    if (acMono != acMS)
                    {
                        Status.AddWarning("Should be " + AccessibilityToString(acMS));
                    }
                }

                m_nodeStatus.Add(nsAttributes);
            }
            return(m_nodeStatus);
        }