GetSettingByName() public method

public GetSettingByName ( string SettingName ) : string
SettingName string
return string
Beispiel #1
0
        public void IntervallSearchFromDB(int Intervall)
        {
            DatabaseConnector SearchConnector = new DatabaseConnector(SearchLog);
            List<string> providerlist = SearchConnector.GetProviderList;
            ProviderInterface RSSSearch = new ProviderInterface(providerlist, SearchLog);
            bool sabenabled;

            if (SearchConnector.GetSettingByName("sabnzbdenabled") == "True")
                sabenabled = true;
            else
                sabenabled = false;

            nzbhandler sabnzbd = new nzbhandler(SearchLog);
            bool exc = false;

            while (!_stopped)
            {
                List<Game> Result = SearchConnector.AllGames();

                if (Result != null && providerlist != null)
                {
                    foreach (Game GameToSearch in Result)
                    {
                        if (GameToSearch == null)
                            break;

                        List<string> RSSResults = RSSSearch.Search(GameToSearch, 1000);

                        if (RSSResults == null)
                            break;

                        #region Checking
                        for (int i = 0; i < RSSResults.Count; i++)
                        {
                            string ResultName = RSSResults[i].Split(new Char[] {';'})[0];
                            string ResultLink = RSSResults[i].Split(new Char[]{';'})[1];

                            if (ResultName.Contains(GameToSearch.Name.Replace(" ", ".")) && !ResultName.Contains("Update") && !ResultName.Contains("Patch") && !SearchConnector.GameIsDownloaded(GameToSearch.ID))
                            {
                                if (SearchConnector.GetExceptions != null)
                                {
                                    foreach (string exception in SearchConnector.GetExceptions)
                                    {
                                        if (ResultName.Contains(exception))
                                        {
                                            exc = true;
                                            SearchLog.WriteToFile(1, "Found exception for " + GameToSearch.Name + "! Exception match: " + exception, LogSource);
                                        }
                                    }

                                    if (!exc)
                                    {
                                        SearchConnector.MarkGameSnatched(GameToSearch.ID);
                                        SearchConnector.MarkGameUnwanted(GameToSearch.ID);
                                        if (sabenabled)
                                        {
                                            SearchLog.WriteToFile(1, "Downloading game " + GameToSearch.Name + " via sabnzbd.", LogSource);
                                            sabnzbd.SendNZB(ResultLink, SearchConnector.GetSettingByName("sabnzbdurl"), SearchConnector.GetSettingByName("sabnzbdapi"));
                                            break;
                                        }
                                        else
                                        {
                                            SearchLog.WriteToFile(1, "Not sending DL for " + GameToSearch.Name + " to sabnzbd. Check your config!", LogSource);
                                            break;
                                        }
                                    }
                                }
                                else
                                {
                                    if (sabenabled)
                                    {
                                        SearchLog.WriteToFile(1, "Downloading game " + GameToSearch.Name + " via sabnzbd.", LogSource);
                                        sabnzbd.SendNZB(ResultLink, SearchConnector.GetSettingByName("sabnzbdurl"), SearchConnector.GetSettingByName("sabnzbdapi"));
                                        break;
                                    }
                                    else
                                    {
                                        SearchLog.WriteToFile(1, "Not sending DL for " + GameToSearch.Name + " to sabnzbd. Check your config!", LogSource);
                                        break;
                                    }
                                }

                                exc = false;
                            }
                        }
                        #endregion
                    }
                }
                System.Threading.Thread.Sleep(Intervall * 60000);
            }
        }
Beispiel #2
0
        public SettingsEditor(Logger Logfacility)
        {
            InitializeComponent();
            LogInstance = Logfacility;
            DBConnection = new DatabaseConnector(LogInstance);

            //Provider-Section
            #region Provider
            if (DBConnection.GetSettingByName("nzbsorgenabled").ToLower() == "true")
            {
                txtNZBSorgHash.Text = DBConnection.GetSettingByName("nzbsorghash");
                txtNZBSorgID.Text = DBConnection.GetSettingByName("nzbsorgid");
                cBNZBSorgEnable.Checked = true;
            }
            else
            {
                cBNZBSorgEnable.Checked = false;
                txtNZBSorgID.Enabled = false;
                txtNZBSorgHash.Enabled = false;
                lblNZBSorgHash.Enabled = false;
                lblNZBSorgID.Enabled = false;
            }

            if (DBConnection.GetSettingByName("nzbmatrixenabled").ToLower() == "true")
            {
                cBNZBMatrixEnable.Checked = true;
                txtNZBMatrixUsername.Text = DBConnection.GetSettingByName("nzbmatrixapi");
                txtNZBMatrixAPI.Text = DBConnection.GetSettingByName("nzbmatrixusername");
            }
            else
            {
                cBNZBMatrixEnable.Checked = false;
                txtNZBMatrixAPI.Enabled = false;
                txtNZBMatrixUsername.Enabled = false;
                lblNZBMatrixAPI.Enabled = false;
                lblNZBMatrixUsername.Enabled = false;
            }

            if (DBConnection.GetSettingByName("nzbclubenabled").ToLower() == "true")
            {
                cBNZBClubEnable.Checked = true;
            }
            else
                cBNZBClubEnable.Checked = false;
            #endregion
            //General
            #region General
            Fanartfolder = DBConnection.GetSettingByName("Fanartfolder");
            if (Fanartfolder != null)
                txtFanart.Text = Fanartfolder;

            Posterfolder = DBConnection.GetSettingByName("Posterfolder");
            if (Posterfolder != null)
                txtPoster.Text = Posterfolder;

            Shortcutfolder = DBConnection.GetSettingByName("Shortcutfolder");
            if (Shortcutfolder != null)
                txtShortcut.Text = Shortcutfolder;

            NFOFolder = DBConnection.GetSettingByName("NFOFolder");
            if (NFOFolder != null)
                txtNFO.Text = NFOFolder;

            Launchersxml = DBConnection.GetSettingByName("AL_Launchers.xml_Location");
            if (Launchersxml != null)
                txtLauncherxml.Text = Launchersxml;
            #endregion
            //sabnzbd
            #region sabnzbd

            if (DBConnection.GetSettingByName("sabnzbdenabled").ToLower() == "true")
            {
                cBSABenable.Checked = true;
                txtSABUrl.Text = DBConnection.GetSettingByName("sabnzbdurl");
                txtSABApi.Text = DBConnection.GetSettingByName("sabnzbdapi");

                if (DBConnection.GetSettingByName("sabnzbdusername") != null && DBConnection.GetSettingByName("sabnzbdpassword") != null)
                {
                    txtSABUsername.Text = DBConnection.GetSettingByName("sabnzbdusername");
                    txtSABPasword.Text = DBConnection.GetSettingByName("sabnzbdpassword");
                }
            }
            else
            {
                cBSABenable.Checked = false;
                txtSABApi.Enabled = false;
                txtSABPasword.Enabled = false;
                txtSABUrl.Enabled = false;
                txtSABUsername.Enabled = false;
                lblSABApi.Enabled = false;
                lblSABExample.Enabled = false;
                lblSABPassword.Enabled = false;
                lblSABUrl.Enabled = false;
                lblSABUsername.Enabled = false;
            }

            #endregion
            //Platforms
            #region Platforms
            lblStatus.Visible = false;
            lblEnableStatus.Visible = false;
            this.FillPlatformBoxes();
            #endregion
            //N64
            #region N64
            N64Romfolder = DBConnection.GetSettingByName("N64Romfolder");
            if (N64Romfolder != null)
                txtN64_RomPath.Text = N64Romfolder;

            N64Downloadfolder = DBConnection.GetSettingByName("N64Downloadfolder");
            if (N64Downloadfolder != null)
            {
                txtN64_Downloadfolder.Text = N64Downloadfolder;

                if (!Directory.Exists(N64Downloadfolder))
                    Directory.CreateDirectory(N64Downloadfolder);
            }

            if (DBConnection.GetSettingByName("N64PPEnabled").ToLower() == "true")
            {
                cBN64_EnablePP.Checked = true;
                cBN64_EnableMeta.Enabled = true;
                cBN64_Renaming.Enabled = true;
                cBN64_EnableMoving.Enabled = true;

                if (DBConnection.GetSettingByName("N64MetaEnabled").ToLower() == "true")
                    cBN64_EnableMeta.Checked = true;
                else
                    cBN64_EnableMeta.Checked = false;

                if (DBConnection.GetSettingByName("N64RenamingEnabled").ToLower() == "true")
                    cBN64_Renaming.Checked = true;
                else
                    cBN64_Renaming.Checked = false;

                if (DBConnection.GetSettingByName("N64MovingEnabled").ToLower() == "true")
                    cBN64_EnableMoving.Checked = true;
                else
                    cBN64_EnableMoving.Checked = false;
            }
            else
            {
                cBN64_EnablePP.Checked = false;
                cBN64_EnableMeta.Enabled = false;
                cBN64_Renaming.Enabled = false;
                cBN64_EnableMoving.Enabled = false;
            }
            #endregion
        }