Beispiel #1
0
        public void TestDelete2()
        {
            XElement nav = XElement.Load(CaseFile("Delete2.xml"));

            SyncMLDelete f = SyncMLDelete.Create(nav);

            Assert.IsTrue(CompareXml(nav, f.Xml), f.Xml.ToString());
        }
Beispiel #2
0
        private void AddDeleteCommandsToCollection(IList <SyncMLCommand> commands)
        {
            IEnumerable <XElement> deleteNodes = XmlHelpers.SafeElementsQuery(sifcChangeLogXml,
                                                                              "Changes", "Delete", "D");

            foreach (XElement node in deleteNodes)
            {
                SyncMLDelete deleteCommand = SyncMLDelete.Create();
                SyncMLItem   item          = SyncMLItem.Create();
                item.Source.LocURI.Content = node.Attribute("ID").Value;
                deleteCommand.ItemCollection.Add(item);
                commands.Add(deleteCommand);
            }
        }
        private void PrepareCommands(IList <SyncMLCommand> commands)
        {
            IEnumerable <T> newContacts = outlookItems.GetNewItems(AnchorTime);

            if (forSlowSync)
            {
                foreach (T contact in newContacts)
                {
                    SyncMLReplace updateCommand = SyncMLReplace.Create();
                    AddContentToCommand(updateCommand, contact);
                    commands.Add(updateCommand);
                }
            }
            else
            {
                foreach (T contact in newContacts)
                {
                    SyncMLAdd addCommand = SyncMLAdd.Create();
                    AddContentToCommand(addCommand, contact);
                    commands.Add(addCommand);
                }
            }

            IEnumerable <T> updatedContacts = outlookItems.GetUpdatedItems(AnchorTime);

            foreach (T contact in updatedContacts)
            {
                SyncMLReplace updateCommand = SyncMLReplace.Create();
                AddContentToCommand(updateCommand, contact);
                commands.Add(updateCommand);
            }

            string[] ids = deletionLog.ReadAll();
            if (ids != null)
            {
                foreach (string id in ids)
                {
                    SyncMLDelete deleteCommand = SyncMLDelete.Create();
                    SyncMLItem   item          = SyncMLItem.Create();
                    item.Source.LocURI.Content = id;
                    deleteCommand.ItemCollection.Add(item);
                    commands.Add(deleteCommand);
                }
            }
        }