Beispiel #1
0
 /// <summary>
 /// Logs a client's activity in the Client History table of the system's database.
 /// It silently ignores errors.
 /// </summary>
 /// <param name="ci">The <see cref="ClientInfo"/> of the client performing the action.</param>
 /// <param name="action">The <see cref="CWClientActions"/> action performed by the client.</param>
 public void LogClientAction(ClientInfo ci, CWClientActions action)
 {
     try
     {
         if ((settings.LogOptions & action) == action)
         {
             if (!ConnectToDatabase())
             {
                 throw new CWDBConnectionFailedException();
             }
             SqlCommand cmd = new SqlCommand("cw_insert_client_history", dbcon);
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.Add("@client_id", SqlDbType.UniqueIdentifier);
             cmd.Parameters.Add("@event_type", SqlDbType.Int);
             cmd.Parameters[0].Value = ci.ClientID;
             cmd.Parameters[1].Value = (int)action;
             cmd.ExecuteNonQuery();
             cmd.Dispose();
             if (!DisconnectFromDatabase())
             {
                 throw new CWDBConnectionFailedException("Disconnect from database failure.");
             }
         }
     }
     catch
     { }
 }
Beispiel #2
0
 /// <summary>
 /// Logs a client's activity in the Client History table of the system's database.
 /// It silently ignores errors.
 /// </summary>
 /// <param name="ci">The <see cref="ClientInfo"/> of the client performing the action.</param>
 /// <param name="action">The <see cref="CWClientActions"/> action performed by the client.</param>
 public void LogClientAction(ClientInfo ci, CWClientActions action)
 {
     try
     {
         if ((settings.LogOptions & action) == action)
         {
             if (!ConnectToDatabase())
             {
                 throw new CWDBConnectionFailedException();
             }
             SqlCommand cmd = new SqlCommand("cw_insert_client_history", dbcon);
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.Add("@client_id", SqlDbType.UniqueIdentifier);
             cmd.Parameters.Add("@event_type", SqlDbType.Int);
             cmd.Parameters[0].Value = ci.ClientID;
             cmd.Parameters[1].Value = (int)action;
             cmd.ExecuteNonQuery();
             cmd.Dispose();
             if (!DisconnectFromDatabase())
             {
                 throw new CWDBConnectionFailedException("Disconnect from database failure.");
             }
         }
     }
     catch
     { }
 }
Beispiel #3
0
 /// <summary>
 /// The constructor is private so that only the class itself can create an instance.
 /// </summary>
 private ServerSettings()
 {
     appName = "CrawlWave.Server";
     log = new SystemEventLogger(appName);
     logLevel = CWLogLevel.LogError; // by default assume only errors must be logged
     dbLogOptions = CWClientActions.LogNothing; //by default assume it's a production rel.
     dataFilesPath = String.Empty;
     connectionString = String.Empty;
     LoadSettings();
     robots = RobotsCache.Instance();
     robots.DBConnectionString = ProvideConnectionString();
 }
Beispiel #4
0
 /// <summary>
 /// The constructor is private so that only the class itself can create an instance.
 /// </summary>
 private ServerSettings()
 {
     appName          = "CrawlWave.Server";
     log              = new SystemEventLogger(appName);
     logLevel         = CWLogLevel.LogError;        // by default assume only errors must be logged
     dbLogOptions     = CWClientActions.LogNothing; //by default assume it's a production rel.
     dataFilesPath    = String.Empty;
     connectionString = String.Empty;
     LoadSettings();
     robots = RobotsCache.Instance();
     robots.DBConnectionString = ProvideConnectionString();
 }
Beispiel #5
0
 /// <summary>
 /// Loads the server's settings from the Web.config configuration file
 /// </summary>
 private void LoadSettings()
 {
     try
     {
         logLevel      = (CWLogLevel)(Properties.Settings.Default.LogLevel);
         dbLogOptions  = (CWClientActions)(Properties.Settings.Default.DBLogOptions);
         remotingPort  = Properties.Settings.Default.RemotingPort;
         dataFilesPath = Properties.Settings.Default.DataFilesPath;
         string sqlServer = Properties.Settings.Default.SQLServer;
         string sqlLogin  = Properties.Settings.Default.SQLLogin;
         string sqlPass   = Properties.Settings.Default.SQLPass;
         connectionString = "Password="******";Persist Security Info=True;User ID=" + sqlLogin + ";Initial Catalog=CrawlWave;Data Source=" + sqlServer + ";";
     }
     catch
     { }
 }
Beispiel #6
0
        /// <summary>
        /// Loads the server's settings from the Web.config configuration file
        /// </summary>
        private void LoadSettings()
        {
            try
            {

                logLevel = (CWLogLevel)(Properties.Settings.Default.LogLevel);
                dbLogOptions = (CWClientActions)(Properties.Settings.Default.DBLogOptions);
                remotingPort = Properties.Settings.Default.RemotingPort;
                dataFilesPath = Properties.Settings.Default.DataFilesPath;
                string sqlServer = Properties.Settings.Default.SQLServer;
                string sqlLogin = Properties.Settings.Default.SQLLogin;
                string sqlPass = Properties.Settings.Default.SQLPass;
                connectionString = "Password="******";Persist Security Info=True;User ID=" + sqlLogin + ";Initial Catalog=CrawlWave;Data Source=" + sqlServer + ";";
            }
            catch
            { }
        }