Ejemplo n.º 1
0
        public Main()
        {
            _storage  = new PluginJsonStorage <Settings>();
            _settings = _storage.Load();

            cachedBookmarks = Bookmarks.LoadAllBookmarks();
        }
Ejemplo n.º 2
0
 public Main()
 {
     _storage     = new PluginJsonStorage <UriSettings>();
     _uriSettings = _storage.Load();
     _uriParser   = new ExtendedUriParser();
     _uriResolver = new UriResolver();
 }
Ejemplo n.º 3
0
        public Main()
        {
            _settingsStorage = new PluginJsonStorage <Settings>();
            _settings        = _settingsStorage.Load();

            Stopwatch.Normal("|Flow.Launcher.Plugin.Program.Main|Preload programs cost", () =>
            {
                _win32Storage = new BinaryStorage <Win32[]>("Win32");
                _win32s       = _win32Storage.TryLoad(new Win32[] { });
                _uwpStorage   = new BinaryStorage <UWP.Application[]>("UWP");
                _uwps         = _uwpStorage.TryLoad(new UWP.Application[] { });
            });
            Log.Info($"|Flow.Launcher.Plugin.Program.Main|Number of preload win32 programs <{_win32s.Length}>");
            Log.Info($"|Flow.Launcher.Plugin.Program.Main|Number of preload uwps <{_uwps.Length}>");

            var a = Task.Run(() =>
            {
                if (IsStartupIndexProgramsRequired || !_win32s.Any())
                {
                    Stopwatch.Normal("|Flow.Launcher.Plugin.Program.Main|Win32Program index cost", IndexWin32Programs);
                }
            });

            var b = Task.Run(() =>
            {
                if (IsStartupIndexProgramsRequired || !_uwps.Any())
                {
                    Stopwatch.Normal("|Flow.Launcher.Plugin.Program.Main|Win32Program index cost", IndexUWPPrograms);
                }
            });

            Task.WaitAll(a, b);

            _settings.LastIndexTime = DateTime.Today;
        }
Ejemplo n.º 4
0
Archivo: Main.cs Proyecto: danisein/Wox
 public Main()
 {
     _settingsStorage = new PluginJsonStorage<Settings>();
     _settings = _settingsStorage.Load();
     _cacheStorage = new BinaryStorage<ProgramIndexCache>();
     _cache = _cacheStorage.Load();
 }
Ejemplo n.º 5
0
        public Main()
        {
            _storage  = new PluginJsonStorage <Settings>();
            _settings = _storage.Load();

            //TODO: Let the user select which browser's bookmarks are displayed
            var chromeBookmarks = new ChromeBookmarks().GetBookmarks().Distinct().ToList();

            lock (_updateLock)
            {
                cachedBookmarks = chromeBookmarks;
            }

            Task.Run(() =>
            {
                // firefox bookmarks is slow, since it nened open sqlite connection.
                // use lazy load
                var mozBookmarks = new FirefoxBookmarks().GetBookmarks();
                var cached       = mozBookmarks.Concat(cachedBookmarks).Distinct().ToList();
                lock (_updateLock)
                {
                    cachedBookmarks = cached;
                }
            });
        }
Ejemplo n.º 6
0
 public void Init(PluginInitContext context)
 {
     Context   = context;
     _storage  = new PluginJsonStorage <SwitcherooSettings>();
     _settings = _storage.Load();
     context.API.GlobalKeyboardEvent += API_GlobalKeyboardEvent;
 }
Ejemplo n.º 7
0
        public Main()
        {
            _settingsStorage = new PluginJsonStorage <Settings>();
            _settings        = _settingsStorage.Load();

            Stopwatch.Normal("|Microsoft.Plugin.Program.Main|Preload programs cost", () =>
            {
                _win32Storage = new BinaryStorage <Programs.Win32[]>("Win32");
                _win32s       = _win32Storage.TryLoad(new Programs.Win32[] { });

                _packageRepository.Load();
            });
            Log.Info($"|Microsoft.Plugin.Program.Main|Number of preload win32 programs <{_win32s.Length}>");

            var a = Task.Run(() =>
            {
                if (IsStartupIndexProgramsRequired || !_win32s.Any())
                {
                    Stopwatch.Normal("|Microsoft.Plugin.Program.Main|Win32Program index cost", IndexWin32Programs);
                }
            });

            var b = Task.Run(() =>
            {
                if (IsStartupIndexProgramsRequired || !_packageRepository.Any())
                {
                    Stopwatch.Normal("|Microsoft.Plugin.Program.Main|Win32Program index cost", _packageRepository.IndexPrograms);
                }
            });


            Task.WaitAll(a, b);

            _settings.LastIndexTime = DateTime.Today;
        }
Ejemplo n.º 8
0
        public Main()
        {
            _settingsStorage = new PluginJsonStorage <ProgramPluginSettings>();
            Settings         = _settingsStorage.Load();

            // This helper class initializes the file system watchers based on the locations to watch
            _win32ProgramRepositoryHelper = new Win32ProgramFileSystemWatchers();

            // Initialize the Win32ProgramRepository with the settings object
            _win32ProgramRepository = new Win32ProgramRepository(_win32ProgramRepositoryHelper.FileSystemWatchers.Cast <IFileSystemWatcherWrapper>().ToList(), new BinaryStorage <IList <Programs.Win32Program> >("Win32"), Settings, _win32ProgramRepositoryHelper.PathsToWatch);

            var a = Task.Run(() =>
            {
                Stopwatch.Normal("|Microsoft.Plugin.Program.Main|Win32Program index cost", _win32ProgramRepository.IndexPrograms);
            });

            var b = Task.Run(() =>
            {
                Stopwatch.Normal("|Microsoft.Plugin.Program.Main|Win32Program index cost", _packageRepository.IndexPrograms);
            });

            Task.WaitAll(a, b);

            Settings.LastIndexTime = DateTime.Today;
        }
Ejemplo n.º 9
0
Archivo: Main.cs Proyecto: znatz/Wox
 public Main()
 {
     _settingsStorage = new PluginJsonStorage <Settings>();
     _settings        = _settingsStorage.Load();
     _cacheStorage    = new BinaryStorage <ProgramIndexCache>();
     _cache           = _cacheStorage.Load();
 }
 public void Init(PluginInitContext context)
 {
     // initialize the context of the plugin
     _context           = context;
     _contextMenuLoader = new ContextMenuLoader(context);
     _storage           = new PluginJsonStorage <Settings>();
     _settings          = _storage.Load();
 }
        public SettingsControl()
        {
            InitializeComponent();

            storage  = new PluginJsonStorage <Settings>();
            settings = storage.Load();

            apiKeyText.Text = settings.apiKey;
        }
Ejemplo n.º 12
0
        public void Init(PluginInitContext context)
        {
            _context   = context;
            _storage   = new PluginJsonStorage <Settings>();
            _settings  = _storage.Load();
            _debouncer = new Debouncer(_settings.Delay);

            LoadData();
        }
Ejemplo n.º 13
0
        // 网络请求
        public JObject Request(string baseCode)
        {
            PluginJsonStorage <Settings> storage = new PluginJsonStorage <Settings>();
            Settings settings       = storage.Load();
            var      request        = (HttpWebRequest)WebRequest.Create("https://v6.exchangerate-api.com/v6/" + settings.apiKey + "/latest/" + baseCode);
            var      response       = (HttpWebResponse)request.GetResponse();
            var      responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();

            return(Str2Json(responseString));
        }
Ejemplo n.º 14
0
 public void Init(PluginInitContext context)
 {
     // initialize the context of the plugin
     _context                   = context;
     _contextMenuLoader         = new ContextMenuLoader(context);
     _storage                   = new PluginJsonStorage <IndexerSettings>();
     _settings                  = _storage.Load();
     _context.API.ThemeChanged += OnThemeChanged;
     UpdateIconPath(_context.API.GetCurrentTheme());
 }
Ejemplo n.º 15
0
        public Main()
        {
            _settingsStorage = new PluginJsonStorage <Settings>();
            _settings        = _settingsStorage.Load();

            Stopwatch.Normal("|Wox.Plugin.Program.Main|Preload programs cost", () => {
                _win32Storage = new BinaryStorage <Win32[]>("Win32");
                _win32s       = _win32Storage.TryLoad(new Win32[] { });
            });
            Log.Info($"|Wox.Plugin.Program.Main|Number of preload win32 programs <{_win32s.Length}>");
        }
Ejemplo n.º 16
0
        public Main()
        {
            _settingsStorage = new PluginJsonStorage <ProgramPluginSettings>();
            Settings         = _settingsStorage.Load();

            // This helper class initializes the file system watchers based on the locations to watch
            _win32ProgramRepositoryHelper = new Win32ProgramFileSystemWatchers();

            // Initialize the Win32ProgramRepository with the settings object
            _win32ProgramRepository = new Win32ProgramRepository(_win32ProgramRepositoryHelper.FileSystemWatchers.Cast <IFileSystemWatcherWrapper>().ToList(), new BinaryStorage <IList <Programs.Win32Program> >("Win32"), Settings, _win32ProgramRepositoryHelper.PathsToWatch);
        }
Ejemplo n.º 17
0
        static Utilities()
        {
            Storage = new PluginJsonStorage <Settings>();

            FileSystem      = new FileSystem();
            Path            = FileSystem.Path;
            File            = FileSystem.File;
            Directory       = FileSystem.Directory;
            PluginDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            Settings = Storage.Load();
        }
Ejemplo n.º 18
0
        public void Init(PluginInitContext context)
        {
            Context = context;

            _storage  = new PluginJsonStorage <Settings>();
            _settings = _storage.Load();

            var pluginDirectory        = context.CurrentPluginMetadata.PluginDirectory;
            var bundledImagesDirectory = Path.Combine(pluginDirectory, Images);

            Helper.ValidateDataDirectory(bundledImagesDirectory, ImagesDirectory);
        }
Ejemplo n.º 19
0
        public Main()
        {
            _settingsStorage = new PluginJsonStorage <Settings>();
            _settings        = _settingsStorage.Load();

            Stopwatch.Debug("Preload programs", () =>
            {
                _cacheStorage = new BinaryStorage <ProgramIndexCache>();
                _cache        = _cacheStorage.Load();
                _win32s       = _cache.Programs;
            });
            Log.Info($"Preload {_win32s.Length} programs from cache");
            Stopwatch.Debug("Program Index", IndexPrograms);
        }
Ejemplo n.º 20
0
        public Main()
        {
            _settingsStorage = new PluginJsonStorage<Settings>();
            _settings = _settingsStorage.Load();

            Stopwatch.Debug("Preload programs", () =>
            {
                _cacheStorage = new BinaryStorage<ProgramIndexCache>();
                _cache = _cacheStorage.Load();
                _win32s = _cache.Programs;
            });
            Log.Info($"Preload {_win32s.Length} programs from cache");
            Stopwatch.Debug("Program Index", IndexPrograms);
        }
Ejemplo n.º 21
0
Archivo: Main.cs Proyecto: danisein/Wox
        public void Init(PluginInitContext context)
        {
            _context = context;
            _storage = new PluginJsonStorage<Settings>();
            _settings = _storage.Load();

            var pluginDirectory = context.CurrentPluginMetadata.PluginDirectory;
            const string sdk = "EverythingSDK";
            var bundledSDKDirectory = Path.Combine(pluginDirectory, sdk, CpuType());
            var sdkDirectory = Path.Combine(_storage.DirectoryPath, sdk, CpuType());
            Helper.ValidateDataDirectory(bundledSDKDirectory, sdkDirectory);

            var sdkPath = Path.Combine(sdkDirectory, DLL);
            LoadLibrary(sdkPath);
        }
Ejemplo n.º 22
0
        public void Init(PluginInitContext context)
        {
            var s = Utilities.GetInstalledPath();

            if (string.IsNullOrEmpty(s))
            {
                Task.Run(async delegate
                {
                    context.API.ShowMsg(context.API.GetTranslation("flowlauncher_plugin_everything_installing_title"),
                                        context.API.GetTranslation("flowlauncher_plugin_everything_installing_subtitle"), "", useMainWindowAsOwner: false);

                    await DroplexPackage.Drop(App.Everything1_3_4_686).ConfigureAwait(false);

                    context.API.ShowMsg(context.API.GetTranslation("flowlauncher_plugin_everything_installing_title"),
                                        context.API.GetTranslation("flowlauncher_plugin_everything_installationsuccess_subtitle"), "", useMainWindowAsOwner: false);

                    SharedCommands.FilesFolders.OpenPath(installationFilePath);
                }).ContinueWith(t =>
                {
                    Log.Exception("Main", $"Failed to install Everything service", t.Exception.InnerException, "DroplexPackage.Drop");
                    MessageBox.Show(context.API.GetTranslation("flowlauncher_plugin_everything_installationfailed_subtitle"),
                                    context.API.GetTranslation("flowlauncher_plugin_everything_installing_title"));
                }, TaskContinuationOptions.OnlyOnFaulted);
            }
            else
            {
                installationFilePath = s;
            }

            _context  = context;
            _storage  = new PluginJsonStorage <Settings>();
            _settings = _storage.Load();
            if (_settings.MaxSearchCount <= 0)
            {
                _settings.MaxSearchCount = Settings.DefaultMaxSearchCount;
            }

            var          pluginDirectory     = context.CurrentPluginMetadata.PluginDirectory;
            const string sdk                 = "EverythingSDK";
            var          bundledSDKDirectory = Path.Combine(pluginDirectory, sdk, CpuType());
            var          sdkDirectory        = Path.Combine(_storage.DirectoryPath, sdk, CpuType());

            Helper.ValidateDataDirectory(bundledSDKDirectory, sdkDirectory);

            var sdkPath = Path.Combine(sdkDirectory, DLL);

            _api.Load(sdkPath);
        }
Ejemplo n.º 23
0
        public async Task InitAsync(PluginInitContext context)
        {
            _context = context;

            await Task.Run(() =>
            {
                _settings = _settingsStorage.Load();

                Stopwatch.Normal("|Flow.Launcher.Plugin.Program.Main|Preload programs cost", () =>
                {
                    _win32Storage = new BinaryStorage <Win32[]>("Win32");
                    _win32s       = _win32Storage.TryLoad(new Win32[] { });
                    _uwpStorage   = new BinaryStorage <UWP.Application[]>("UWP");
                    _uwps         = _uwpStorage.TryLoad(new UWP.Application[] { });
                });
                Log.Info($"|Flow.Launcher.Plugin.Program.Main|Number of preload win32 programs <{_win32s.Length}>");
                Log.Info($"|Flow.Launcher.Plugin.Program.Main|Number of preload uwps <{_uwps.Length}>");
            });

            bool indexedWinApps = false;
            bool indexedUWPApps = false;

            var a = Task.Run(() =>
            {
                if (IsStartupIndexProgramsRequired || !_win32s.Any())
                {
                    Stopwatch.Normal("|Flow.Launcher.Plugin.Program.Main|Win32Program index cost", IndexWin32Programs);
                    indexedWinApps = true;
                }
            });

            var b = Task.Run(() =>
            {
                if (IsStartupIndexProgramsRequired || !_uwps.Any())
                {
                    Stopwatch.Normal("|Flow.Launcher.Plugin.Program.Main|Win32Program index cost", IndexUwpPrograms);
                    indexedUWPApps = true;
                }
            });

            await Task.WhenAll(a, b);

            if (indexedWinApps && indexedUWPApps)
            {
                _settings.LastIndexTime = DateTime.Today;
            }
        }
Ejemplo n.º 24
0
Archivo: Main.cs Proyecto: znatz/Wox
        public void Init(PluginInitContext context)
        {
            _context  = context;
            _storage  = new PluginJsonStorage <Settings>();
            _settings = _storage.Load();

            var          pluginDirectory     = context.CurrentPluginMetadata.PluginDirectory;
            const string sdk                 = "EverythingSDK";
            var          bundledSDKDirectory = Path.Combine(pluginDirectory, sdk, CpuType());
            var          sdkDirectory        = Path.Combine(_storage.DirectoryPath, sdk, CpuType());

            Helper.ValidateDataDirectory(bundledSDKDirectory, sdkDirectory);

            var sdkPath = Path.Combine(sdkDirectory, DLL);

            LoadLibrary(sdkPath);
        }
Ejemplo n.º 25
0
Archivo: Main.cs Proyecto: yzx2001/Wox
        public void Init(PluginInitContext context)
        {
            _context  = context;
            _storage  = new PluginJsonStorage <Settings>();
            _settings = _storage.Load();
            if (_settings.MaxSearchCount <= 0)
            {
                _settings.MaxSearchCount = Settings.DefaultMaxSearchCount;
            }

            var          pluginDirectory = context.CurrentPluginMetadata.PluginDirectory;
            const string sdk             = "EverythingSDK";
            var          sdkDirectory    = Path.Combine(pluginDirectory, sdk, CpuType());
            var          sdkPath         = Path.Combine(sdkDirectory, DLL);

            Logger.WoxInfo("Everything", $"sdk path {sdkPath}");
            Constant.EverythingSDKPath = sdkPath;
            _api.Load(sdkPath);
        }
Ejemplo n.º 26
0
        public Main()
        {
            _settingsStorage = new PluginJsonStorage <Settings>();
            _settings        = _settingsStorage.Load();

            Stopwatch.Normal("|Wox.Plugin.Program.Main|Preload programs cost", () =>
            {
                _win32Storage = new BinaryStorage <Win32[]>("Win32");
                _win32s       = _win32Storage.TryLoad(new Win32[] { });
                _uwpStorage   = new BinaryStorage <UWP.Application[]>("UWP");
                _uwps         = _uwpStorage.TryLoad(new UWP.Application[] { });
            });
            Log.Info($"|Wox.Plugin.Program.Main|Number of preload win32 programs <{_win32s.Length}>");
            Log.Info($"|Wox.Plugin.Program.Main|Number of preload uwps <{_uwps.Length}>");
            Task.Run(() =>
            {
                Stopwatch.Normal("|Wox.Plugin.Program.Main|Program index cost", IndexPrograms);
            });
        }
Ejemplo n.º 27
0
        public Main()
        {
            _settingsStorage = new PluginJsonStorage<Settings>();
            _settings = _settingsStorage.Load();

            Stopwatch.Normal("Preload programs", () =>
            {
                _win32Storage = new BinaryStorage<Win32[]>("Win32Cache");
                _win32s = _win32Storage.TryLoad(new Win32[] { });
                _uwpStorage = new BinaryStorage<UWP.Application[]>("UWPCache");
                _uwps = _uwpStorage.TryLoad(new UWP.Application[] { });

            });
            Log.Info($"Preload {_win32s.Length} win32 programs from cache");
            Log.Info($"Preload {_uwps.Length} uwps from cache");
            Task.Run(() =>
            {
                Stopwatch.Normal("Program Index", IndexPrograms);
            });
        }
Ejemplo n.º 28
0
        public void Init(PluginInitContext context)
        {
            _context  = context;
            _storage  = new PluginJsonStorage <Settings>();
            _settings = _storage.Load();
            if (_settings.MaxSearchCount <= 0)
            {
                _settings.MaxSearchCount = Settings.DefaultMaxSearchCount;
            }

            var          pluginDirectory     = context.CurrentPluginMetadata.PluginDirectory;
            const string sdk                 = "EverythingSDK";
            var          bundledSDKDirectory = Path.Combine(pluginDirectory, sdk, CpuType());
            var          sdkDirectory        = Path.Combine(_storage.DirectoryPath, sdk, CpuType());

            Helper.ValidateDataDirectory(bundledSDKDirectory, sdkDirectory);

            var sdkPath = Path.Combine(sdkDirectory, DLL);

            Constant.EverythingSDKPath = sdkPath;
            _api.Load(sdkPath);
        }
Ejemplo n.º 29
0
        public void Init(PluginInitContext context)
        {
            Log.Info($"|Wox.Plugin.MigemoSearch|Init started.");
            _context  = context;
            _storage  = new PluginJsonStorage <Settings>();
            _settings = _storage.Load();

            var          pluginDirectory     = context.CurrentPluginMetadata.PluginDirectory;
            const string sdk                 = "EverythingSDK";
            var          bundledSDKDirectory = Path.Combine(pluginDirectory, sdk, CpuType());
            var          sdkDirectory        = Path.Combine(_storage.DirectoryPath, sdk, CpuType());

            Helper.ValidateDataDirectory(bundledSDKDirectory, sdkDirectory);

            var sdkPath = Path.Combine(sdkDirectory, EVERYTHING_DLL);

            Constant.EverythingSDKPath = sdkPath;
            LoadLibrary(sdkPath);

            // Migemo
            pluginDirectory = context.CurrentPluginMetadata.PluginDirectory;
            const string migemoSdk = "MigemoSDK";

            bundledSDKDirectory = Path.Combine(pluginDirectory, migemoSdk, CpuType());
            sdkDirectory        = Path.Combine(_storage.DirectoryPath, migemoSdk, CpuType());
            Helper.ValidateDataDirectory(bundledSDKDirectory, sdkDirectory);
            sdkPath = Path.Combine(sdkDirectory, "migemo.dll");
            Log.Info($"|Wox.Plugin.MigemoSearch|pluginDirectory=<{pluginDirectory}>, bundledSDKDirectory=<{bundledSDKDirectory}>, sdkDirectory=<{sdkDirectory}>, sdkPath=<{sdkPath}>");
            LoadLibrary(sdkPath);

            bundledSDKDirectory = Path.Combine(pluginDirectory, migemoSdk, "dict/cp932");
            sdkDirectory        = Path.Combine(_storage.DirectoryPath, migemoSdk, "dict/cp932");
            Helper.ValidateDataDirectory(bundledSDKDirectory, sdkDirectory);
            Log.Info($"|Wox.Plugin.MigemoSearch|dict=<{Path.Combine(_storage.DirectoryPath, migemoSdk, "dict/cp932/migemo-dict")}>");

            _migemo_api = new Migemo(Path.Combine(_storage.DirectoryPath, migemoSdk, "dict/cp932/migemo-dict"));
            //_migemo_api.OperatorNewLine = @"\s*";
            Log.Info($"|Wox.Plugin.MigemoSearch|Init complated.");
        }
Ejemplo n.º 30
0
        public Main()
        {
            _settingsStorage = new PluginJsonStorage <Settings>();
            _settings        = _settingsStorage.Load();
            // This helper class initializes the file system watchers based on the locations to watch
            _win32ProgramRepositoryHelper = new Win32ProgramFileSystemWatchers();

            // Initialize the Win32ProgramRepository with the settings object
            _win32ProgramRepository = new Win32ProgramRepository(_win32ProgramRepositoryHelper._fileSystemWatchers.Cast <IFileSystemWatcherWrapper>().ToList(), new BinaryStorage <IList <Programs.Win32> >("Win32"), _settings, _win32ProgramRepositoryHelper._pathsToWatch);

            Stopwatch.Normal("|Microsoft.Plugin.Program.Main|Preload programs cost", () =>
            {
                _win32ProgramRepository.Load();
                _packageRepository.Load();
            });
            Log.Info($"|Microsoft.Plugin.Program.Main|Number of preload win32 programs <{_win32ProgramRepository.Count()}>");

            var a = Task.Run(() =>
            {
                if (IsStartupIndexProgramsRequired || !_win32ProgramRepository.Any())
                {
                    Stopwatch.Normal("|Microsoft.Plugin.Program.Main|Win32Program index cost", _win32ProgramRepository.IndexPrograms);
                }
            });

            var b = Task.Run(() =>
            {
                if (IsStartupIndexProgramsRequired || !_packageRepository.Any())
                {
                    Stopwatch.Normal("|Microsoft.Plugin.Program.Main|Win32Program index cost", _packageRepository.IndexPrograms);
                }
            });


            Task.WaitAll(a, b);

            _settings.LastIndexTime = DateTime.Today;
        }
Ejemplo n.º 31
0
 public CMD()
 {
     _storage  = new PluginJsonStorage <Settings>();
     _settings = _storage.Load();
 }
Ejemplo n.º 32
0
 public Main()
 {
     _storage  = new PluginJsonStorage <ShellPluginSettings>();
     _settings = _storage.Load();
 }
Ejemplo n.º 33
0
 public void loadSettings()
 {
     _settingsStorage = new PluginJsonStorage <Settings>();
     _settings        = _settingsStorage.Load();
 }
 public SettingsViewModel()
 {
     _storage = new PluginJsonStorage <Settings>();
     Settings = _storage.Load();
 }
Ejemplo n.º 35
0
 public CMD()
 {
     _storage = new PluginJsonStorage<Settings>();
     _settings = _storage.Load();
 }
Ejemplo n.º 36
0
 public Main()
 {
     _storage = new PluginJsonStorage<Settings>();
     _settings = _storage.Load();
     InitialDriverList();
 }