コード例 #1
0
        /**
         * Imports a single buddy group.
         */

        private void ImportBuddyGroup(TrillianBuddyGroup group)
        {
            foreach (TrillianBuddy buddy in group.Buddies)
            {
                IResource account = FindOrCreateTrillianAccount(buddy.Protocol, buddy.Address, buddy.Nick);
                IResource contact = account.GetLinkProp(_propTrillianAcct);

                _trillianAB.AddContact(contact);
            }
            foreach (TrillianBuddyGroup childGroup in group.Groups)
            {
                ImportBuddyGroup(childGroup);
            }
        }
コード例 #2
0
        /**
         * Loads and parses the buddy.xml file.
         */

        private void LoadBuddies()
        {
            string buddyFile = Path.Combine(_profileDir, "Buddies.xml");

            Trace.WriteLine("Loading buddy file " + buddyFile);
            try
            {
                var doc = new XmlDocument();
                doc.Load(buddyFile);
                _buddies = new TrillianBuddyGroup(doc.SelectSingleNode("/buddies/section"));
            }
            catch (Exception ex)
            {
                Trace.WriteLine("Failed to load Buddies.xml: " + ex);
            }
        }