private void AddPartialNames(MAPIProperty Property, string PartialNames)
 {
     string[] aNames = PartialNames.Split(',');
     foreach (string sName in aNames)
     {
         Property.PartialNames.Add(sName.Trim());
     }
 }
 private void AddExactNames(MAPIProperty Property, string ExactNames)
 {
     string[] aNames = ExactNames.Split(',');
     foreach (string sName in aNames)
     {
         Property.ExactNames.Add(sName.Trim());
     }
 }
Exemplo n.º 3
0
        private void ShowPropertiesThatAreIdentical()
        {
            listBoxProperties.Items.Clear();

            // Work out the identical properties
            foreach (MAPIProperty oProperty in _msg1.Properties)
            {
                if (_msg2.ContainsProperty(oProperty.Tag))
                {
                    MAPIProperty oProperty2 = _msg2.Property(oProperty.Tag);
                    if (oProperty.StringValue == oProperty2.StringValue)
                    {
                        listBoxProperties.Items.Add(oProperty);
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void listBoxProperties_SelectedIndexChanged(object sender, EventArgs e)
        {
            // Show the selected property
            MAPIProperty oProperty = (MAPIProperty)listBoxProperties.SelectedItem;

            if (oProperty == null)
            {
                return;
            }

            // Show property definition
            textBoxTag.Text           = oProperty.TagString;
            textBoxType.Text          = oProperty.StringType;
            textBoxNamedPropName.Text = oProperty.NamedPropName;

            // Show exact names
            listBoxExactNames.Items.Clear();
            foreach (string sExactName in oProperty.ExactNames)
            {
                listBoxExactNames.Items.Add(sExactName.Trim());
            }

            // Show partial names
            listBoxPartialNames.Items.Clear();
            foreach (string sPartialName in oProperty.PartialNames)
            {
                listBoxPartialNames.Items.Add(sPartialName.Trim());
            }

            // Show value
            textBoxValue1.Text = "";
            textBoxValue2.Text = "";

            if (_msg1.ContainsProperty(oProperty.Tag))
            {
                // Show comparitive property value
                textBoxValue1.Text = _msg1.Property(oProperty.Tag).StringValue;
            }
            if (_msg2.ContainsProperty(oProperty.Tag))
            {
                // Show comparitive property value
                textBoxValue2.Text = _msg2.Property(oProperty.Tag).StringValue;
            }
        }
Exemplo n.º 5
0
        private void ShowPropertiesThatDiffer()
        {
            listBoxProperties.Items.Clear();

            // Work out the differences
            foreach (MAPIProperty oProperty in _msg1.Properties)
            {
                if (_msg2.ContainsProperty(oProperty.Tag))
                {
                    MAPIProperty oProperty2 = _msg2.Property(oProperty.Tag);
                    if (!oProperty.StringValue.Equals(oProperty2.StringValue))
                    {
                        string prop1 = oProperty.StringValue;
                        string prop2 = oProperty2.StringValue;
                        listBoxProperties.Items.Add(oProperty);
                    }
                }
            }
        }
        public void ReadXML(MSG TargetMSG)
        {
            // Read/parse the XML and add all the properties to the MSG
            //XmlTextReader oReader=new XmlTextReader(_xmlFile);
            XmlReaderSettings oXmlSettings = new XmlReaderSettings();

            oXmlSettings.CheckCharacters = false;
            oXmlSettings.ValidationFlags = System.Xml.Schema.XmlSchemaValidationFlags.None;
            oXmlSettings.ValidationType  = ValidationType.None;

            XmlReader oReader = XmlReader.Create(_xmlFile, oXmlSettings);

            while (oReader.Read())
            {
                switch (oReader.NodeType)
                {
                case XmlNodeType.Element:
                    if (oReader.Name == "property")
                    {
                        MAPIProperty oProperty = new MAPIProperty();
                        // Read the property - first of all, the tag
                        while (oReader.MoveToNextAttribute())
                        {
                            switch (oReader.Name)
                            {
                            case "tag":
                                oProperty.TagString = oReader.Value;
                                break;

                            default:         // Do nothing
                                break;
                            }
                        }

                        // Now read the property information
                        bool   bReadComplete = false;
                        string sElement      = "";
                        while (!bReadComplete)
                        {
                            bool bReadSuccess = false;
                            try
                            {
                                oReader.Read();
                                bReadSuccess = true;
                            }
                            catch
                            {
                                bReadComplete = true;
                            }

                            if (bReadSuccess)
                            {
                                switch (oReader.NodeType)
                                {
                                case XmlNodeType.EndElement:
                                    if (oReader.Name == "property")
                                    {
                                        bReadComplete = true;
                                    }
                                    sElement = "";
                                    break;

                                case XmlNodeType.Element:         // Read the element
                                    sElement = oReader.Name;
                                    break;

                                case XmlNodeType.CDATA:         // Commonly used for PT_STRING8
                                    switch (sElement)
                                    {
                                    case "Value":
                                        if (String.IsNullOrEmpty(oProperty.StringValue))
                                        {
                                            oProperty.StringValue = oReader.Value;
                                        }
                                        break;

                                    case "AltValue":
                                        if (String.IsNullOrEmpty(oProperty.AltValue))
                                        {
                                            oProperty.AltValue = oReader.Value;
                                        }
                                        break;

                                    default:
                                        break;
                                    }
                                    break;

                                case XmlNodeType.Text:         // Read the value
                                    if (!String.IsNullOrEmpty(sElement))
                                    {
                                        switch (sElement)
                                        {
                                        case "ExactNames":
                                            AddExactNames(oProperty, oReader.Value);
                                            break;

                                        case "OtherNames":
                                            AddPartialNames(oProperty, oReader.Value);
                                            break;

                                        case "NamedPropName":
                                            oProperty.NamedPropName = oReader.Value;
                                            break;

                                        case "Name":
                                            AddExactNames(oProperty, oReader.Value);
                                            break;

                                        case "PartialNames":
                                            AddPartialNames(oProperty, oReader.Value);
                                            break;

                                        case "Value":
                                            oProperty.StringValue = oReader.Value;
                                            break;

                                        case "AltValue":
                                            oProperty.AltValue = oReader.Value;
                                            break;

                                        default:             // Do nothing
                                            break;
                                        }
                                    }
                                    break;

                                default:         // Do nothing
                                    break;
                                }
                            }
                        }
                        TargetMSG.Properties.Add(oProperty);
                    }
                    break;

                default:     // Do nothing
                    break;
                }
            }
        }