ArcGISCompare.frmMaster.CheckFieldProperties C# (CSharp) Метод

CheckFieldProperties() публичный Метод

public CheckFieldProperties ( TreeNode &N, FeatureData theS, FeatureData theD ) : void
N TreeNode
theS FeatureData
theD FeatureData
Результат void
        public void CheckFieldProperties(ref TreeNode N, FeatureData theS, FeatureData theD)
        {
            IFields theSF;
            IFields theDF;
            string theFName;

            theSF = theS.theFlds;
            theDF = theD.theFlds;

            if (theSF.FieldCount != theDF.FieldCount)
            {
                N.Nodes.Add(new Guid().ToString(), "Field Counts Mismatched between Template and Implementation", 1, 1);
            }
            else
            {
                TreeNode F = new TreeNode("Attributes");
                for (int C = 0; C < theSF.FieldCount; C++)
                {
                    theFName = theSF.get_Field(C).Name;
                    if (theDF.FindField(theFName) < 0) { F.Nodes.Add(new Guid().ToString(), "Field " + theFName + " missing from Implementation", 1, 1); }
                    else
                    {
                        if (theSF.get_Field(C).Type != theDF.get_Field(theDF.FindField(theFName)).Type) { F.Nodes.Add(new Guid().ToString(), "Field " + theFName + " mismatched Data Type", 1, 1); }
                        if (theSF.get_Field(C).Type == esriFieldType.esriFieldTypeString)
                        {
                            if (theSF.get_Field(C).Length != theDF.get_Field(theDF.FindField(theFName)).Length)
                            {
                                TreeNode OID = new TreeNode("Field " + theFName + " mismatched Character Length") { ImageIndex = 1, SelectedImageIndex = 1 };
                                //TODO: fix detection of implementation field length
                                //OID.Nodes.Add(new Guid().ToString(), "Template is " + theSF.get_Field(C).Length.ToString(), 1);
                                //OID.Nodes.Add(new Guid().ToString(), "Implementation is " + theDF.get_Field(C).Length.ToString(), 1);
                                F.Nodes.Add(OID);
                            }
                        }
                        if (theSF.get_Field(C).AliasName != theDF.get_Field(theDF.FindField(theFName)).AliasName)
                        {
                            TreeNode OID = new TreeNode("Field " + theFName + " mismatched Alias Name") { ImageIndex = 1, SelectedImageIndex = 1 };
                            //OID.Nodes.Add(new Guid().ToString(), "Template is " + theSF.get_Field(C).AliasName, 1);
                            //OID.Nodes.Add(new Guid().ToString(), "Implementation is " + theDF.get_Field(theDF.FindField(theFName)).AliasName, 1);
                            F.Nodes.Add(OID);
                        }
                    }
                }
                for (int C = 0; C < theDF.FieldCount; C++)
                {
                    theFName = theDF.get_Field(C).Name;
                    if (theSF.FindField(theFName) < 0) { F.Nodes.Add(new Guid().ToString(), "Field " + theFName + " missing from Template", 1, 1); }
                    else
                    {
                        if (theDF.get_Field(C).Type != theSF.get_Field(theSF.FindField(theFName)).Type) { F.Nodes.Add(new Guid().ToString(), "Field " + theFName + " mismatched Data Type", 1, 1); }
                        if (theDF.get_Field(C).AliasName != theDF.get_Field(theDF.FindField(theFName)).AliasName)
                        {
                            TreeNode OID = new TreeNode("Field " + theFName + " mismatched Alias Name") { ImageIndex = 1, SelectedImageIndex = 1 };
                           // OID.ImageIndex = 1;
                            OID.Nodes.Add(new Guid().ToString(), "Template is " + theSF.get_Field(C).AliasName, 1, 1);
                            OID.Nodes.Add(new Guid().ToString(), "Implementation is " + theDF.get_Field(theDF.FindField(theFName)).AliasName, 1, 1);
                            //OID.Nodes[0].ImageIndex = 1;
                            //OID.Nodes[1].ImageIndex = 1;
                            F.Nodes.Add(OID);
                        }
                    }
                }

                if (F.Nodes.Count == 0)
                {
                    F.Nodes.Add("All Fields Agree");
                }
                else
                {
                    N.ImageIndex = 1;
                    F.ImageIndex = 1;
                }

                N.Nodes.Add(F);
            }
        }