WriteToFile() public method

public WriteToFile ( int LogLevel, string LogText, string Source ) : bool
LogLevel int
LogText string
Source string
return bool
Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        public DatabaseConnector(Logger Logfacility)
        {
            LogInstance = Logfacility;
            LogInstance.WriteToFile(4, "Connecting to database with the following Connection-String: " + "ServerType=1;User=SYSDBA;Password=masterkey;Dialect=3;Database=database.fdb", LogSource);
            DBConnector = new FbConnection("ServerType=1;User=SYSDBA;Password=masterkey;Dialect=3;Database=database.fdb");

            //Check for existing database. If no avail., create a new one

            if (!System.IO.File.Exists("Database.fdb"))
            {
                LogInstance.WriteToFile(1, "No DB found! Creating database and initializing tables.", LogSource);
                FbConnection.CreateDatabase("ServerType=1;User=SYSDBA;Password=masterkey;Dialect=3;Database=database.fdb");
                //initialize the connection and create the tables
                this.InitializeDatabase();
            }
            else
            {
                if (!CheckTables)
                {
                    LogInstance.WriteToFile(1, "Backing up old database since the current one didn't pass the sanity checks.", LogSource);

                    if (File.Exists("database.fdb.backup"))
                    {
                        LogInstance.WriteToFile(2, "There is already a database backed up. I will move it to the Folder 'BACKUP' then.", LogSource);
                        if (!Directory.Exists("BACKUP"))
                            Directory.CreateDirectory("BACKUP");

                        File.Move("database.fdb.backup", "BACKUP\\database.fdb.backup." + DateTime.Now.ToFileTime());
                        LogInstance.WriteToFile(2, "New location for database.fdb.backup:\nBACKUP\\database.fdb.backup." + DateTime.Now.ToFileTime() + "\n", LogSource);
                        File.Move("database.fdb", "database.fdb.backup");
                    }
                    else
                        File.Move("database.fdb", "database.fdb.backup");

                    FbConnection.CreateDatabase("ServerType=1;User=SYSDBA;Password=masterkey;Dialect=3;Database=database.fdb");
                    //initialize the connection and create the tables
                    DBConnector = new FbConnection("ServerType=1;User=SYSDBA;Password=masterkey;Dialect=3;Database=database.fdb");
                    this.InitializeDatabase();
                }
            }
        }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
 public Searcher(Logger LogInstance)
 {
     SearchLog = LogInstance;
     SearchLog.WriteToFile(1, "Starting search for wanted games.", LogSource);
 }