示例#1
0
        //
        public Boolean Open()
        {
            Boolean database_ok = false;

            if (!File.Exists(C_Variables.DB_.file) && ((C_Variables.DB_.type == 0) || (C_Variables.DB_.type == 1)))
            {
                CreateNew();
                F_File.LogInformation("Create new database");
            }
            try
            {
                if (connection_db.State.Equals(ConnectionState.Closed))
                {
                    connection_db.Open();
                    database_ok = true;
                }
                else if (connection_db.State.Equals(ConnectionState.Open))
                {
                    database_ok = true;
                }
                else
                {
                    database_ok = false;
                }
            }
            catch
            {
                try
                {
                    connection_db.Open();
                    database_ok = true;
                }
                catch (Exception e) { F_File.LogError(e); database_ok = false; }
            }
            if (!database_ok)
            {
                F_Run.Exit();
            }
            return(database_ok);
        }
示例#2
0
 private void ServiceOutput(object sender, ServiceOutputEventArgs e)
 {
     F_File.LogInformation(e.Message);
 }