Esempio n. 1
0
File: Main.cs Progetto: znatz/Wox
 public Main()
 {
     _settingsStorage = new PluginJsonStorage <Settings>();
     _settings        = _settingsStorage.Load();
     _cacheStorage    = new BinaryStorage <ProgramIndexCache>();
     _cache           = _cacheStorage.Load();
 }
Esempio n. 2
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;
        }
Esempio n. 3
0
 public void Init(PluginInitContext context)
 {
     m_storage  = new PluginJsonStorage <Settings>();
     m_settings = LoadSettings();
     m_context  = context;
     m_index    = new Indexer(m_settings);
 }
Esempio n. 4
0
 public void Init(PluginInitContext context)
 {
     Context   = context;
     _storage  = new PluginJsonStorage <SwitcherooSettings>();
     _settings = _storage.Load();
     context.API.GlobalKeyboardEvent += API_GlobalKeyboardEvent;
 }
Esempio n. 5
0
 public FilePathSetting(Settings setting, PluginJsonStorage <Settings> storage)
 {
     InitializeComponent();
     _setting       = setting;
     Directory.Text = _setting.FolderPath;
     _storage       = storage;
 }
Esempio n. 6
0
        public Main()
        {
            _storage  = new PluginJsonStorage <Settings>();
            _settings = _storage.Load();

            cachedBookmarks = Bookmarks.LoadAllBookmarks();
        }
Esempio n. 7
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;
        }
Esempio 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;
        }
Esempio n. 9
0
        public SwitcherooSetting(SwitcherooSettings settings, PluginJsonStorage <SwitcherooSettings> storage)
        {
            _settings = settings;
            _storage  = storage;

            InitializeComponent();
        }
Esempio n. 10
0
 public Main()
 {
     _storage     = new PluginJsonStorage <UriSettings>();
     _uriSettings = _storage.Load();
     _uriParser   = new ExtendedUriParser();
     _uriResolver = new UriResolver();
 }
Esempio n. 11
0
File: Main.cs Progetto: danisein/Wox
 public Main()
 {
     _settingsStorage = new PluginJsonStorage<Settings>();
     _settings = _settingsStorage.Load();
     _cacheStorage = new BinaryStorage<ProgramIndexCache>();
     _cache = _cacheStorage.Load();
 }
Esempio n. 12
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;
                }
            });
        }
 public void Init(PluginInitContext context)
 {
     // initialize the context of the plugin
     _context           = context;
     _contextMenuLoader = new ContextMenuLoader(context);
     _storage           = new PluginJsonStorage <Settings>();
     _settings          = _storage.Load();
 }
Esempio n. 14
0
        public void Init(PluginInitContext context)
        {
            _context   = context;
            _storage   = new PluginJsonStorage <Settings>();
            _settings  = _storage.Load();
            _debouncer = new Debouncer(_settings.Delay);

            LoadData();
        }
        public SettingsControl()
        {
            InitializeComponent();

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

            apiKeyText.Text = settings.apiKey;
        }
Esempio n. 16
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());
 }
Esempio n. 17
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));
        }
Esempio n. 18
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);
        }
Esempio n. 19
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}>");
        }
Esempio n. 20
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);
        }
Esempio n. 21
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();
        }
Esempio n. 22
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);
        }
Esempio n. 23
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);
        }
Esempio n. 24
0
File: Main.cs Progetto: 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);
        }
        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);
        }
Esempio n. 26
0
File: Main.cs Progetto: 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);
        }
Esempio n. 27
0
File: Main.cs Progetto: 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);
        }
Esempio n. 28
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);
            });
        }
Esempio n. 29
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);
            });
        }
Esempio n. 30
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);
        }
Esempio n. 31
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.");
        }
Esempio n. 32
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;
        }
Esempio n. 33
0
 public CMD()
 {
     _storage  = new PluginJsonStorage <Settings>();
     _settings = _storage.Load();
 }
Esempio n. 34
0
 public Main()
 {
     _storage  = new PluginJsonStorage <ShellPluginSettings>();
     _settings = _storage.Load();
 }
Esempio n. 35
0
 public CMD()
 {
     _storage = new PluginJsonStorage<Settings>();
     _settings = _storage.Load();
 }
Esempio n. 36
0
 public Main()
 {
     _storage = new PluginJsonStorage<Settings>();
     _settings = _storage.Load();
     InitialDriverList();
 }