public async Task LoadSettingsFromLaunchParam(IReadOnlyDictionary <string, string> launchParams)
        {
            string param;

            if (launchParams.TryGetValue(dirLaunchParam, out param))
            {
                var di = new DirectoryInfo(param);
                DirPath = di.Exists ? di.FullName : Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            }
            else
            {
                ISetting savedir = await SettingFactory.GetSettingDbAsync(pathToDownload).ConfigureAwait(false);

                DirPath = savedir.Value;
                if (string.IsNullOrEmpty(DirPath))
                {
                    DirPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                }
            }

            if (launchParams.TryGetValue(mpcLaunchParam, out param))
            {
                var fn = new FileInfo(param);
                if (fn.Exists)
                {
                    MpcPath = fn.FullName;
                }
            }
            else
            {
                ISetting mpcdir = await SettingFactory.GetSettingDbAsync(pathToMpc).ConfigureAwait(false);

                MpcPath = mpcdir.Value;
            }

            if (launchParams.TryGetValue(youLaunchParam, out param))
            {
                var fn = new FileInfo(param);
                if (fn.Exists)
                {
                    YouPath = fn.FullName;
                }
            }
            else
            {
                ISetting youpath = await SettingFactory.GetSettingDbAsync(pathToYoudl).ConfigureAwait(false);

                YouPath = youpath.Value;
            }

            ISetting onstartup = await SettingFactory.GetSettingDbAsync(onstartupopen).ConfigureAwait(false);

            IsFilterOpen = onstartup.Value != "0";

            ISetting isFilterEnabled = await SettingFactory.GetSettingDbAsync(showVideoFiltration).ConfigureAwait(false);

            IsVideoFiltrationEnabled = isFilterEnabled.Value != "0";
        }
        private async Task SaveSettingsToDb()
        {
            ISetting savedir = await SettingFactory.GetSettingDbAsync(pathToDownload).ConfigureAwait(false);

            if (savedir.Value != DirPath)
            {
                await db.UpdateSettingAsync(savedir.Key, DirPath).ConfigureAwait(false);

                onSaveAction?.Invoke(DirPath);
            }

            ISetting mpcdir = await SettingFactory.GetSettingDbAsync(pathToMpc).ConfigureAwait(false);

            if (mpcdir.Value != MpcPath)
            {
                await db.UpdateSettingAsync(mpcdir.Key, MpcPath).ConfigureAwait(false);
            }

            ISetting youpath = await SettingFactory.GetSettingDbAsync(pathToYoudl).ConfigureAwait(false);

            if (youpath.Value != YouPath)
            {
                await db.UpdateSettingAsync(youpath.Key, YouPath).ConfigureAwait(false);
            }

            ISetting onstartup = await SettingFactory.GetSettingDbAsync(onstartupopen).ConfigureAwait(false);

            string res = IsFilterOpen ? "1" : "0";

            if (onstartup.Value != res)
            {
                await db.UpdateSettingAsync(onstartup.Key, res).ConfigureAwait(false);
            }

            ISetting videoFilterEnabled = await SettingFactory.GetSettingDbAsync(showVideoFiltration).ConfigureAwait(false);

            string result = IsVideoFiltrationEnabled ? "1" : "0";

            if (videoFilterEnabled.Value != result)
            {
                await db.UpdateSettingAsync(videoFilterEnabled.Key, result).ConfigureAwait(false);
            }

            foreach (ICred cred in SupportedCreds)
            {
                await db.UpdateLoginAsync(cred.SiteAdress, cred.Login).ConfigureAwait(false);

                await db.UpdatePasswordAsync(cred.SiteAdress, cred.Pass).ConfigureAwait(false);
            }

            foreach (ITag tag in SupportedTags)
            {
                await db.InsertTagAsync(tag).ConfigureAwait(false);
            }

            onSaveAction?.Invoke(null);
        }
        public async Task LoadSettingsFromDb()
        {
            ISetting savedir = await SettingFactory.GetSettingDbAsync(pathToDownload).ConfigureAwait(false);

            DirPath = savedir.Value;
            if (string.IsNullOrEmpty(DirPath))
            {
                DirPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            }

            ISetting mpcdir = await SettingFactory.GetSettingDbAsync(pathToMpc).ConfigureAwait(false);

            MpcPath = mpcdir.Value;

            ISetting youpath = await SettingFactory.GetSettingDbAsync(pathToYoudl).ConfigureAwait(false);

            YouPath = youpath.Value;

            ISetting videoFiltr = await SettingFactory.GetSettingDbAsync(showVideoFiltration).ConfigureAwait(false);

            IsVideoFiltrationEnabled = videoFiltr.Value != "0";

            if (string.IsNullOrEmpty(YouPath))
            {
                string path = AppDomain.CurrentDomain.BaseDirectory;
                string res  = Path.Combine(path, youtubeDl);
                var    fn   = new FileInfo(res);
                if (fn.Exists)
                {
                    YouPath = fn.FullName;
                }
            }

            ISetting onstartup = await SettingFactory.GetSettingDbAsync(onstartupopen).ConfigureAwait(false);

            IsFilterOpen = onstartup.Value != "0";
        }