Esempio n. 1
0
        public void Init(PluginInitContext context)
        {
            this.context = context;

            try
            {
                var fileTest = File.OpenRead(this.bookmarkFile);
            }
            catch (Exception e)
            {
                Console.WriteLine("{0} Exception caught.", e);
            }

            using (var file = File.OpenRead(this.bookmarkFile))
            {
                var reader = new ChromeBookmarksReader();

                this.bookmarks = reader.Read(file);

                foreach (var b in this.bookmarks.AllLinks)
                {
                    bookmarkList.Add(new Result
                    {
                        Title    = b.Title,
                        SubTitle = b.Url,
                        Action   = e =>
                        {
                            if (!b.Url.ToLower().StartsWith("http"))
                            {
                                b.Url = "http://" + b.Url;
                            }
                            try
                            {
                                Process.Start(b.Url);
                                return(true);
                            }
                            catch (Exception ex)
                            {
                                context.API.ShowMsg(string.Format(context.API.GetTranslation("wox_plugin_url_canot_open_url"), b.Url));
                                return(false);
                            }
                        }
                    });
                }
            }
        }
Esempio n. 2
0
 public ChromeReaderTest()
 {
     _basicJson = @"Ww0KICB7DQogICAgImNoaWxkcmVuIjogWw0KICAgICAgew0KICAgICAgICAiY2hpbGRyZW4iOiBbDQogICAgICAgICAgew0KICAgICAgICAgICAgImRhdGVBZGRlZCI6IDEzNzYzMzE0MjEyODAsDQogICAgICAgICAgICAiaWQiOiAiMTc2MSIsDQogICAgICAgICAgICAiaW5kZXgiOiAwLA0KICAgICAgICAgICAgInBhcmVudElkIjogIjE3NjQiLA0KICAgICAgICAgICAgInRpdGxlIjogIk9uZSBiaWxsaW9uIGRvbGxhciBleHRlbnNpb24hIiwNCiAgICAgICAgICAgICJ1cmwiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbSINCiAgICAgICAgICB9DQogICAgICAgIF0sDQogICAgICAgICJkYXRlQWRkZWQiOiAxMzc2OTg1MDc2MTQ0LA0KICAgICAgICAiZGF0ZUdyb3VwTW9kaWZpZWQiOiAxMzk5OTc5MzY2NDQ2LA0KICAgICAgICAiaWQiOiAiMTc2NCIsDQogICAgICAgICJpbmRleCI6IDEsDQogICAgICAgICJwYXJlbnRJZCI6ICIxIiwNCiAgICAgICAgInRpdGxlIjogIkFERE9uIGJ1Z2FpIg0KICAgICAgfSwNCiAgICAgIHsNCiAgICAgICAgImRhdGVBZGRlZCI6IDEzNTQ1NzQxMzUyNjUsDQogICAgICAgICJkYXRlR3JvdXBNb2RpZmllZCI6IDEzOTQxNzM1MTMzOTQsDQogICAgICAgICJpZCI6ICI5NDMiLA0KICAgICAgICAiaW5kZXgiOiAyLA0KICAgICAgICAicGFyZW50SWQiOiAiMSIsDQogICAgICAgICJ0aXRsZSI6ICItLU9OIEFJUi0tIg0KICAgICAgfQ0KICAgIF0sDQogICAgImRhdGVBZGRlZCI6IDEzNTE5Njk3NDk2MDAsDQogICAgImRhdGVHcm91cE1vZGlmaWVkIjogMTQwNTk1MTE0OTE2MCwNCiAgICAiaWQiOiAiMSIsDQogICAgImluZGV4IjogMCwNCiAgICAicGFyZW50SWQiOiAiMCIsDQogICAgInRpdGxlIjogIkJvb2ttYXJrcyBiYXIiDQogIH0sDQogIHsNCiAgICAiY2hpbGRyZW4iOiBbDQogICAgICB7DQogICAgICAgICJjaGlsZHJlbiI6IFsNCiAgICAgICAgICB7DQogICAgICAgICAgICAiZGF0ZUFkZGVkIjogMTM1MTk3MjExMzg4MywNCiAgICAgICAgICAgICJpZCI6ICI5MDQiLA0KICAgICAgICAgICAgImluZGV4IjogMCwNCiAgICAgICAgICAgICJwYXJlbnRJZCI6ICI5MDMiLA0KICAgICAgICAgICAgInRpdGxlIjogIkluY3JlZGlibGUgU3RhcnRQYWdlIFNldHRpbmdzIiwNCiAgICAgICAgICAgICJ1cmwiOiAiY2hyb21lLWV4dGVuc2lvbjovL3p6ei9vcHRpb25zLmh0bWwiDQogICAgICAgICAgfQ0KICAgICAgICBdLA0KICAgICAgICAiZGF0ZUFkZGVkIjogMTM1MTk3MjExMzg4MywNCiAgICAgICAgImRhdGVHcm91cE1vZGlmaWVkIjogMTM2MTUxNzE4NTg4NywNCiAgICAgICAgImlkIjogIjkwMyIsDQogICAgICAgICJpbmRleCI6IDAsDQogICAgICAgICJwYXJlbnRJZCI6ICI5MDIiLA0KICAgICAgICAidGl0bGUiOiAiRXh0ZW5zaW9uIFNldHRpbmdzIg0KICAgICAgfQ0KICAgIF0sDQogICAgImRhdGVBZGRlZCI6IDEzNTE5Njk3NDk2MDAsDQogICAgImRhdGVHcm91cE1vZGlmaWVkIjogMTM2MTUxNzE4NTg4NiwNCiAgICAiaWQiOiAiOTAyIiwNCiAgICAiaW5kZXgiOiAxLA0KICAgICJwYXJlbnRJZCI6ICIwIiwNCiAgICAidGl0bGUiOiAiT3RoZXIgYm9va21hcmtzIg0KICB9LA0KICB7DQogICAgImNoaWxkcmVuIjogWw0KICAgICAgew0KICAgICAgICAiZGF0ZUFkZGVkIjogMTM5NDg3NjE0MDUzMywNCiAgICAgICAgImlkIjogIjI0OTgiLA0KICAgICAgICAiaW5kZXgiOiAwLA0KICAgICAgICAicGFyZW50SWQiOiAiOTA1IiwNCiAgICAgICAgInRpdGxlIjogImV4YW1wbGUubmV0IiwNCiAgICAgICAgInVybCI6ICJodHRwOi8vZXhhbXBsZS5udW1iZXIudHdvIg0KICAgICAgfQ0KICAgIF0sDQogICAgImRhdGVBZGRlZCI6IDEzNTE5Njk3NDk2MDAsDQogICAgImRhdGVHcm91cE1vZGlmaWVkIjogMTM5NDg3NjE0MDUzMywNCiAgICAiaWQiOiAiOTA1IiwNCiAgICAiaW5kZXgiOiAyLA0KICAgICJwYXJlbnRJZCI6ICIwIiwNCiAgICAidGl0bGUiOiAiTW9iaWxlIGJvb2ttYXJrcyINCiAgfQ0KXQ==";
     _basicJson = Encoding.UTF8.GetString(Convert.FromBase64String(_basicJson));
     _reader    = new ChromeBookmarksReader();
 }
 public ChromeReaderTest()
 {
     _basicJson = @"Ww0KICB7DQogICAgImNoaWxkcmVuIjogWw0KICAgICAgew0KICAgICAgICAiY2hpbGRyZW4iOiBbDQogICAgICAgICAgew0KICAgICAgICAgICAgImRhdGVBZGRlZCI6IDEzNzYzMzE0MjEyODAsDQogICAgICAgICAgICAiaWQiOiAiMTc2MSIsDQogICAgICAgICAgICAiaW5kZXgiOiAwLA0KICAgICAgICAgICAgInBhcmVudElkIjogIjE3NjQiLA0KICAgICAgICAgICAgInRpdGxlIjogIk9uZSBiaWxsaW9uIGRvbGxhciBleHRlbnNpb24hIiwNCiAgICAgICAgICAgICJ1cmwiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbSINCiAgICAgICAgICB9DQogICAgICAgIF0sDQogICAgICAgICJkYXRlQWRkZWQiOiAxMzc2OTg1MDc2MTQ0LA0KICAgICAgICAiZGF0ZUdyb3VwTW9kaWZpZWQiOiAxMzk5OTc5MzY2NDQ2LA0KICAgICAgICAiaWQiOiAiMTc2NCIsDQogICAgICAgICJpbmRleCI6IDEsDQogICAgICAgICJwYXJlbnRJZCI6ICIxIiwNCiAgICAgICAgInRpdGxlIjogIkFERE9uIGJ1Z2FpIg0KICAgICAgfSwNCiAgICAgIHsNCiAgICAgICAgImRhdGVBZGRlZCI6IDEzNTQ1NzQxMzUyNjUsDQogICAgICAgICJkYXRlR3JvdXBNb2RpZmllZCI6IDEzOTQxNzM1MTMzOTQsDQogICAgICAgICJpZCI6ICI5NDMiLA0KICAgICAgICAiaW5kZXgiOiAyLA0KICAgICAgICAicGFyZW50SWQiOiAiMSIsDQogICAgICAgICJ0aXRsZSI6ICItLU9OIEFJUi0tIg0KICAgICAgfQ0KICAgIF0sDQogICAgImRhdGVBZGRlZCI6IDEzNTE5Njk3NDk2MDAsDQogICAgImRhdGVHcm91cE1vZGlmaWVkIjogMTQwNTk1MTE0OTE2MCwNCiAgICAiaWQiOiAiMSIsDQogICAgImluZGV4IjogMCwNCiAgICAicGFyZW50SWQiOiAiMCIsDQogICAgInRpdGxlIjogIkJvb2ttYXJrcyBiYXIiDQogIH0sDQogIHsNCiAgICAiY2hpbGRyZW4iOiBbDQogICAgICB7DQogICAgICAgICJjaGlsZHJlbiI6IFsNCiAgICAgICAgICB7DQogICAgICAgICAgICAiZGF0ZUFkZGVkIjogMTM1MTk3MjExMzg4MywNCiAgICAgICAgICAgICJpZCI6ICI5MDQiLA0KICAgICAgICAgICAgImluZGV4IjogMCwNCiAgICAgICAgICAgICJwYXJlbnRJZCI6ICI5MDMiLA0KICAgICAgICAgICAgInRpdGxlIjogIkluY3JlZGlibGUgU3RhcnRQYWdlIFNldHRpbmdzIiwNCiAgICAgICAgICAgICJ1cmwiOiAiY2hyb21lLWV4dGVuc2lvbjovL3p6ei9vcHRpb25zLmh0bWwiDQogICAgICAgICAgfQ0KICAgICAgICBdLA0KICAgICAgICAiZGF0ZUFkZGVkIjogMTM1MTk3MjExMzg4MywNCiAgICAgICAgImRhdGVHcm91cE1vZGlmaWVkIjogMTM2MTUxNzE4NTg4NywNCiAgICAgICAgImlkIjogIjkwMyIsDQogICAgICAgICJpbmRleCI6IDAsDQogICAgICAgICJwYXJlbnRJZCI6ICI5MDIiLA0KICAgICAgICAidGl0bGUiOiAiRXh0ZW5zaW9uIFNldHRpbmdzIg0KICAgICAgfQ0KICAgIF0sDQogICAgImRhdGVBZGRlZCI6IDEzNTE5Njk3NDk2MDAsDQogICAgImRhdGVHcm91cE1vZGlmaWVkIjogMTM2MTUxNzE4NTg4NiwNCiAgICAiaWQiOiAiOTAyIiwNCiAgICAiaW5kZXgiOiAxLA0KICAgICJwYXJlbnRJZCI6ICIwIiwNCiAgICAidGl0bGUiOiAiT3RoZXIgYm9va21hcmtzIg0KICB9LA0KICB7DQogICAgImNoaWxkcmVuIjogWw0KICAgICAgew0KICAgICAgICAiZGF0ZUFkZGVkIjogMTM5NDg3NjE0MDUzMywNCiAgICAgICAgImlkIjogIjI0OTgiLA0KICAgICAgICAiaW5kZXgiOiAwLA0KICAgICAgICAicGFyZW50SWQiOiAiOTA1IiwNCiAgICAgICAgInRpdGxlIjogImV4YW1wbGUubmV0IiwNCiAgICAgICAgInVybCI6ICJodHRwOi8vZXhhbXBsZS5udW1iZXIudHdvIg0KICAgICAgfQ0KICAgIF0sDQogICAgImRhdGVBZGRlZCI6IDEzNTE5Njk3NDk2MDAsDQogICAgImRhdGVHcm91cE1vZGlmaWVkIjogMTM5NDg3NjE0MDUzMywNCiAgICAiaWQiOiAiOTA1IiwNCiAgICAiaW5kZXgiOiAyLA0KICAgICJwYXJlbnRJZCI6ICIwIiwNCiAgICAidGl0bGUiOiAiTW9iaWxlIGJvb2ttYXJrcyINCiAgfQ0KXQ==";
     _basicJson = Encoding.UTF8.GetString(Convert.FromBase64String(_basicJson));
     _reader = new ChromeBookmarksReader();
 }