110,556
社区成员
发帖
与我相关
我的任务
分享
class xxxx
{
byte[] titlestr = new byte[] { 0x00, 0x01, 0x00, 0x00, 0x53, 0x74, 0x61, 0x6E, 0x64, 0x61, 0x72, 0x64, 0x20, 0x4A, 0x65, 0x74 };
byte[] titlestr2 = new byte[] { 0x48, 0x4A, 0x00, 0x58, 0x55, 0x43, 0x48, 0x41, 0x4E, 0x47, 0x59, 0x4F, 0x55, 0x00, 0x20, 0x20 };
public void EncrypMDB (string filename)
{
System.IO.FileStream F;
if (File.Exists(filename) == false)
{
return;
}
F = File.Open(filename, FileMode.OpenOrCreate, FileAccess.Write);
try
{
F.Seek(0x00, soFromBeginning);
F.Write(titlestr2, 0, 16);
}
catch
{
}
finally
{
F.Close();
}
}
public void uncrypMDB (string filename)
{
System.IO.FileStream F;
if (File.Exists(filename) == false)
{
return;
}
try
{
F.Seek(0x00, soFromBeginning);
F.Write(titlestr, 0, 16);
}
catch
{
}
finally
{
F.Close();
}
}
public void XXXXXXX()
{
uncrypMDB(App_path + "data\\temp.db");
File.Copy(App_path+"data\\temp.db", APP_path+"\\data\\account.db", false);
System.Data.OleDb.OleDbConnection adoconn = new System.Data.OleDb.OleDbConnection();
adoconn.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;Data Source="+App_path+"data\\account.db;Persist Security Info=false";
try
{
adoconn.Open();
}
catch
{
System.Windows.Forms.MessageBox.Show("打开数据库出现致命的错误!!!", "错误", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
}
File.Copy(App_path + "data\\account.db", APP_path + "\\data\\temp.db", false);
EncrypMDB(App_path + "data\\temp.db");
File.Copy(App_path + "data\\temp.db", APP_path + "\\data\\account.db", false);
File.Delete(App_path + "data\\temp.db");
Microsoft.Win32.RegistryKey reg
try
{
reg = Microsoft.Win32.Registry.ClassesRoot;
reg.OpenSubKey(".ldb");
reg.SetValue(""/*这里,你的源程序就不对,没法翻译*/, "tempfile");
}
catch
{
}
finally
{
reg.Close();
}
}
}