Ejemplo n.º 1
0
        public void AddOrUpdate(AvType avId, byte[] value)
        {
            var item = TargetInfos.Find(c =>
            {
                return(c.AvId == avId ? true : false);
            });

            if (item == null)
            {
                TargetInfos.Insert(TargetInfos.Count - 1, new AV_PAIR(avId, value));
            }
            else
            {
                item.SetValue(value);
            }
            Length += (ushort)value.Length;
        }
Ejemplo n.º 2
0
        public void SetScannerDoneUpdating(AvType scanner)
        {
            _threadSlower.WaitOne();
restart:
            EnsureConnected();
            try
            {
                MySqlCommand command = _db.CreateCommand();
                command.CommandText = "UPDATE settings SET " + scanner.ToString() + "='0'";
                command.ExecuteNonQuery();
            }
            catch (MySqlException ex)
            {
                Error.RecoverableError("MySQL Error in SetScannerDoneUpdating: " + ex.Message +
                                       "\nRetrying in " + DB_RETRY_TIME_SECONDS.ToString() + " seconds...");
                Thread.Sleep(DB_RETRY_TIME_SECONDS * 1000);
                goto restart;
            }
            _threadSlower.Release();
        }
Ejemplo n.º 3
0
        public void SetScanResult(int id, AvType type, string scanResult)
        {
            _threadSlower.WaitOne();
restart:
            EnsureConnected();
            try
            {
                MySqlCommand command = _db.CreateCommand();
                command.CommandText = "UPDATE queue SET " + type.ToString() + "='" + scanResult + "' WHERE id='" + id.ToString() + "'";;
                command.ExecuteNonQuery();
            }
            catch (MySqlException ex)
            {
                Error.RecoverableError("MySQL Error in SetScanResult: " + ex.Message +
                                       "\nRetrying in " + DB_RETRY_TIME_SECONDS.ToString() + " seconds...");
                Thread.Sleep(DB_RETRY_TIME_SECONDS * 1000);
                goto restart;
            }
            _threadSlower.Release();
        }