将资源文件中的数据写回磁盘
/// <summary> /// 将资源文件中的System.Data.SQLite.dll写回磁盘 /// </summary> public static void WriteSqliteDriverToDisk() { Assembly assembly = AppDomain.CurrentDomain.GetAssemblies()[0]; Stream stream = assembly.GetManifestResourceStream("XXX.System.Data.SQLite.dll"); byte[] data = new byte[stream.Length]; stream.Read(data, 0, data.Length); stream.Close(); FileStream fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + "System.Data.SQLite.dll", FileMode.CreateNew, FileAccess.Write); fs.Write(data, 0, data.Length); fs.Close(); }