/// <summary> /// 开始工作写入数据库 /// </summary> public void Start() { stop = new ManualResetEvent(false); //初始化数据库的配置 string databaseConfigurationPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, MySQLConfiguration.FILENAME); string databaseConfigurationDefaultPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, MySQLConfiguration.DEFAULT_FILENAME); if (!File.Exists(databaseConfigurationPath) && File.Exists(databaseConfigurationDefaultPath)) { File.Copy(databaseConfigurationDefaultPath, databaseConfigurationPath); } if (MySQLDatabase.Initialize(databaseConfigurationPath)) { log.Info("initialize Database successful"); } //新建一个线程执行写入数据库的操作 thread = new Thread(new ThreadStart(Worker)); thread.Start(); }