public void Covert(Sqlite2CsConfig config) { CleanupOutput(config.outputPath); SQLiteConnectionStringBuilder sqlitestring = new SQLiteConnectionStringBuilder(); sqlitestring.DataSource = config.databaseFilePath; mSqliteConn = new SQLiteConnection(sqlitestring.ToString()); mSqliteConn.Open(); //mSqliteConn.StateChange += MSqliteConn_StateChange; Dictionary <string, string> tableInfoMap = GetTableInfo(config.databaseName, config.filterName); foreach (KeyValuePair <string, string> tableInfo in tableInfoMap) { CSFileWriter csFile = ConvertTable(config.databaseName, tableInfo.Key, tableInfo.Value, config.CSdataClassImpledInterface); string filePath = config.outputPath + "/" + tableInfo.Key + ".cs"; if (File.Exists(filePath)) { Console.WriteLine("{0} already exists.", filePath); return; } using (StreamWriter sw = File.CreateText(filePath)) { sw.Write(csFile.GenerateFilsString()); sw.Close(); } } mSqliteConn.Close(); System.Windows.Forms.MessageBox.Show("写入完毕!!!"); }