public ModifyGame(int GameID, Logger Logfacility) { InitializeComponent(); LogInstance = Logfacility; DBConnection = new DatabaseConnector(LogInstance); LogInstance.WriteToFile(1, "Modify game with the ID " + GameID, "Database:Connector"); GameToModify = DBConnection.GetGame(GameID); lblmod_GameName.Text = GameToModify.Name; if (GameToModify.Snatched) chkmod_Snatched.Checked = true; else chkmod_Snatched.Checked = false; if (GameToModify.Wanted) chkmod_Wanted.Checked = true; else chkmod_Wanted.Checked = false; if (GameToModify.Downloaded) chkmod_Downloaded.Checked = true; else chkmod_Downloaded.Checked = false; if (GameToModify.InstallPath != null) txtmod_InstallPath.Text = GameToModify.InstallPath; }
public Nintendo64_PostProcess(string DirectoryToProcess, char SpaceChar, bool MetaEnabled, bool RenamingEnabled, bool MovingEnabled, DatabaseConnector DBConnection) { MetaEnabled = true; RenamingEnabled = true; MovingEnabled = true; string[] FilesToProcess = System.IO.Directory.GetFiles(@DirectoryToProcess); Progress ProgressForm = new Progress(); ProgressForm.Show(); ProgressForm.Step = ProgressForm.CalculateStep(FilesToProcess.Length); foreach (string SingleFile in FilesToProcess) { ProgressForm.UpdateProcessingName = SingleFile; //Get the Directory including the file string FileDirectory = System.IO.Directory.GetParent(SingleFile).FullName; //Get the filename without the path string Filename = SingleFile.Replace(FileDirectory + "\\", ""); string Searchname = Filename; //Strip and Save the extension Regex FileExtensionRegex = new Regex("\\.(...)$"); string Extension = FileExtensionRegex.Match(Searchname).Value; Searchname = FileExtensionRegex.Replace(Searchname, ""); //Replace "SpaceChar" with actual spaces for our search Searchname = Searchname.Replace(SpaceChar, " ".ToCharArray()[0]); LogFacility.WriteToFile(4, "Title to search: " + Searchname, LogSource); //Initiate scraper Scraper.TheGamesDB InfoScraper = new Scraper.TheGamesDB(LogFacility); List<Game> Results = InfoScraper.Search(Searchname, "Nintendo 64"); //We will only take the first result, let's hope that it's the best one... if (Results != null) DBConnection.InsertGame(InfoScraper.GetGameByID(Results[0].scraper_gdb_id)); else LogFacility.WriteToFile(1, "Could not find an item for " + Searchname, LogSource); if (Results != null) { Filename = Results[0].Name.Replace(" ".ToCharArray()[0], SpaceChar); Filename += Extension; LogFacility.WriteToFile(4, "Resulted Filename: " + FileDirectory + "\\" + Filename, LogSource); if (RenamingEnabled && !MovingEnabled) System.IO.File.Move(SingleFile, FileDirectory + "\\" + Filename); if (MovingEnabled) System.IO.File.Move(SingleFile, FileDirectory + "\\" + Filename); } ProgressForm.UpdateProgressBar(); } ProgressForm.Close(); }
public MainWin(bool debug) { LogInstance = new Logger(debug); DBConnection = new DatabaseConnector(LogInstance); SearchInstance = new Searcher(LogInstance); LogInstance.WriteToFile(1, "Starting Application", LogSource); LogInstance.WriteToFile(1, "Initializing Cache", LogSource); DBConnection.InitializeCache(); LogInstance.WriteToFile(1, "Fetching all PC-games from the DB", LogSource); CurGameList = DBConnection.AllGamesByPlatform("PC"); //Start the searcher in it's own thread, it shouldn't interfere with anything LogInstance.WriteToFile(1, "Starting Searcher-Thread", LogSource); SearchThread = new Thread(() => { SearchInstance.IntervallSearchFromDB(30); }); SearchThread.Start(); LogInstance.WriteToFile(1, "Loading Form", LogSource); InitializeComponent(); LogInstance.WriteToFile(1, "Welcome To FreakOut!", LogSource); btAddGame.Enabled = false; btAddGame.Visible = false; cBSearchResultPicker.Enabled = false; cBSearchResultPicker.Visible = false; bs_games.DataSource = DBConnection.FillDataTable(); dataGridView1.DataSource = bs_games; dataGridView1.Refresh(); if (CurGameList != null) { for (int x = 0; x < CurGameList.Count; x++) { if (CurGameList[x] != null) lboxGameList.Items.Add((x+1) + ". " + CurGameList[x].Name.Replace(":", "-") + " (ID: " + CurGameList[x].ID + ")"); } } else { lblNameOfGame.Visible = false; lblPublisher.Visible = false; lblPlayers.Visible = false; lblCoOp.Visible = false; lblRelease.Visible = false; lblContent.Visible = false; lblYoutube.Visible = false; lblGenres.Visible = false; pbGamePic.Hide(); lboxGameList.Items.Add("No games currently to display."); } this.FillPlatformBox(); lboxGameList.SelectedIndex = 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); } }
public ProviderInterface(List<string> Providerlist, Logger LogFacility) { Loginstance = LogFacility; DBConnector = new DatabaseConnector(Loginstance); _Providerlist = Providerlist; }
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 }