|
|
@ -6,6 +6,8 @@ using System.Collections.Generic; |
|
|
|
using System.Data; |
|
|
|
using System.Data.OleDb; |
|
|
|
using System.IO; |
|
|
|
using System.IO.Compression; |
|
|
|
using System.Reflection; |
|
|
|
using System.Text; |
|
|
|
using static Apewer.Source.SourceUtility; |
|
|
|
#endif
|
|
|
@ -536,6 +538,22 @@ namespace Apewer.Source |
|
|
|
Path = (connection as Access)?.Path; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>生成新的 Standard Jet DB 数据库。</summary>
|
|
|
|
public static byte[] NewJetDB() |
|
|
|
{ |
|
|
|
using (var resource = Assembly.GetExecutingAssembly().GetManifestResourceStream("Apewer.JETDB.gz")) |
|
|
|
{ |
|
|
|
using (var gzip = new GZipStream(resource, CompressionMode.Decompress, false)) |
|
|
|
{ |
|
|
|
using (var memory = new MemoryStream()) |
|
|
|
{ |
|
|
|
BytesUtility.Read(gzip, memory, null, 1024); |
|
|
|
return memory.ToArray(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>使用 Microsoft.ACE.OLEDB.12.0 访问 Access 2007 数据库文件。</summary>
|
|
|
@ -560,6 +578,22 @@ namespace Apewer.Source |
|
|
|
Path = (connection as Access)?.Path; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>生成新的 Standard ACE DB 数据库。</summary>
|
|
|
|
public static byte[] NewAceDB() |
|
|
|
{ |
|
|
|
using (var resource = Assembly.GetExecutingAssembly().GetManifestResourceStream("Apewer.ACEDB.gz")) |
|
|
|
{ |
|
|
|
using (var gzip = new GZipStream(resource, CompressionMode.Decompress, false)) |
|
|
|
{ |
|
|
|
using (var memory = new MemoryStream()) |
|
|
|
{ |
|
|
|
BytesUtility.Read(gzip, memory, null, 1024); |
|
|
|
return memory.ToArray(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endif
|
|
|
|