private void SaveToDisk2()
{
//
string basedir = System.AppDomain.CurrentDomain.BaseDirectory;
this.BKStoreFileName = String.Format("{0} {1} {2} {3}.bin",
m_ExecItemCreateTime.ToString("yyyy-MM-dd HH-mm-ss"),
this.m_ExecItemMethed,
m_Op,
m_ItemState.ToString());
IFormatter formatter = new BinaryFormatter();
Stream stream = new FileStream(BkExecManager.DataPath + BKStoreFileName,
FileMode.Create, FileAccess.Write, FileShare.None);
formatter.Serialize(stream, this);
stream.Close();
}
public static ExecItem GetObject(string s)
{
IFormatter formatter = new BinaryFormatter();
Stream stream = new FileStream(s, FileMode.Open, FileAccess.Read, FileShare.None);
ExecItem e = (ExecItem) formatter.Deserialize(stream);
stream.Close();
return e;
}
public void FinishBkExec(bool DoneOk, string Msg)
{
string FileName = BkExecManager.DataPath + BKStoreFileName;
m_ExecItemExecTime = DateTime.Now;
if (File.Exists(FileName))
File.Delete(FileName);
if (!DoneOk)
{
m_ItemState = BKExecItemState.出错;
ErrMsg = Msg;
SaveToDisk2();
MakeMail();