コード例 #1
0
 public void MarkProcessed(LogFileRow LogFileRow)
 {
     MySqlCommand Cmd;
     if (m_LogTable.ContainsKey(LogFileRow.Filename)) {
         AppLog.WriteLine(5, "STATUS", "Entered IRCStatistician.NetworkProcessor.MarkProcessed(). Updating Entry...");
         Cmd = new MySqlCommand("UPDATE `" + Config.SQLTablePrefix + "logfiles` SET `LastReadSize` = @lastreadsize, `ProductVer` = @productver WHERE `id` = @id", Program.MyDBConn.Connection);
         Cmd.Prepare();
         Cmd.Parameters.AddWithValue("@id", LogFileRow.Id);
     } else {
         AppLog.WriteLine(5, "STATUS", "Entered IRCStatistician.NetworkProcessor.MarkProcessed(). Creating Entry...");
         Cmd = new MySqlCommand("INSERT INTO `" + Config.SQLTablePrefix + "logfiles` (`Filename`, `LastReadSize`, `ProductVer`) VALUES (@filename, @lastreadsize, @productver)", Program.MyDBConn.Connection);
         Cmd.Prepare();
         Cmd.Parameters.AddWithValue("@filename", LogFileRow.Filename);
     }
     Cmd.Parameters.AddWithValue("@lastreadsize", LogFileRow.LastReadSize);
     Cmd.Parameters.AddWithValue("@productver", LogFileRow.ProductVer);
     int ReturnVal = Cmd.ExecuteNonQuery();
 }
コード例 #2
0
 public static Dictionary<string, LogFileRow> ReadLogTable()
 {
     Dictionary<string, LogFileRow> returnDict = new Dictionary<string, LogFileRow>();
     AppLog.WriteLine(5, "STATUS", "Entered IRCStatistician.NetworkProcessor.ReadLogTable().");
     MySqlCommand Cmd = new MySqlCommand("SELECT * FROM " + Config.SQLTablePrefix + "logfiles ORDER BY id", Program.MyDBConn.Connection);
     MySqlDataReader DataReader = Cmd.ExecuteReader();
     DataTable LogFileTable = new DataTable();
     LogFileTable.Load(DataReader);
     DataReader.Close();
     foreach (DataRow CurNetwork in LogFileTable.Rows) {
         LogFileRow Temp = new LogFileRow();
         Temp.Id = Convert.ToInt32(CurNetwork["Id"]);
         Temp.Filename = CurNetwork["Filename"].ToString();
         Temp.ProductVer = CurNetwork["ProductVer"].ToString();
         Temp.LastReadSize = Convert.ToInt32(CurNetwork["LastReadSize"]);
         returnDict.Add(Temp.Filename, Temp);
     }
     return returnDict;
 }
コード例 #3
0
 private LogFileRow CreateLFR(string Filename)
 {
     LogFileRow Temp = new LogFileRow();
     Temp.Filename = Filename;
     Temp.LastReadSize = (new FileInfo(Filename)).Length;
     Temp.ProductVer = Assembly.GetExecutingAssembly().GetName().Version.ToString();
     return Temp;
 }