Beispiel #1
0
        private static BookmarkChange[] ParseChangesLog(string profileName)
        {
            IBookmarkService service =
                (IBookmarkService)Core.PluginLoader.GetPluginService(typeof(IBookmarkService));
            IResource profileRoot = service.GetProfileRoot(
                BookmarkService.NormalizeProfileName("Mozilla/" + profileName));

            if (profileRoot != null)
            {
                Trace.WriteLine("ParseChangesLog( " + profileName + " ) : profileRoot != null");
                MozillaBookmarkProfile profile =
                    service.GetOwnerProfile(profileRoot) as MozillaBookmarkProfile;
                if (profile != null)
                {
                    Trace.WriteLine("ParseChangesLog( " + profileName + " ) : profile != null");
                    profile.IsActive = true;
                    IStringList log = profileRoot.GetStringListProp(_propChangesLog);
                    if (log.Count > 0)
                    {
                        Trace.WriteLine("ParseChangesLog( " + profileName + " ) : log.Count > 0");
                        BookmarkChange[] result = new BookmarkChange[log.Count];
                        for (int i = 0; i < result.Length; ++i)
                        {
                            string[] changeFields = log[i].Split('\x01');
                            result[i].type         = Int32.Parse(changeFields[0]);
                            result[i].id           = Int32.Parse(changeFields[1]);
                            result[i].rdfid        = changeFields[2];
                            result[i].oldparent    = changeFields[3];
                            result[i].oldparent_id = Int32.Parse(changeFields[4]);
                            result[i].parent       = changeFields[5];
                            result[i].parent_id    = Int32.Parse(changeFields[6]);
                            result[i].name         = changeFields[7];
                            result[i].url          = changeFields[8];
                        }
                        profileRoot.DeleteProp(_propChangesLog);
                        return(result);
                    }
                }
            }
            return(null);
        }
Beispiel #2
0
        public void RemoteRefreshBookmarks(string profilePath)
        {
            string profileName = ProfilePath2Name(profilePath);

            if (profileName != null)
            {
                IBookmarkService service =
                    (IBookmarkService)Core.PluginLoader.GetPluginService(typeof(IBookmarkService));
                IResource profileRoot = service.GetProfileRoot(
                    BookmarkService.NormalizeProfileName("Mozilla/" + profileName));
                if (profileRoot != null)
                {
                    MozillaBookmarkProfile profile =
                        service.GetOwnerProfile(profileRoot) as MozillaBookmarkProfile;
                    if (profile != null)
                    {
                        profile.IsActive = true;
                        Core.ResourceAP.QueueJob(
                            "Refreshing bookmarks for " + profileName, new MethodInvoker(profile.StartImport));
                    }
                }
            }
        }