这不是我的代码,我只需要理解它。无法联系到原始程序员。dobj 只是一个对象类型。我的主要问题是:为什么当 dobj 从未更改时他再次反序列化? 请忽略他所有的 goto,因为现在它们在这个程序中无处不在。
////////////////////////
//Deserialize Original//
////////////////////////
dobj = Generics.IO.BinarySerializer.Open(g_PathToTMP);
if (dobj == null)
{
///////
//LOG//
///////
goto Label_Done;
}
dccmcaltered = dobj as ASM001.MatSettings;
if (dccmcaltered == null)
goto Label_Done;
//
//////////////////////////////////////////
//Apply Changes To Deserialized Original//
//////////////////////////////////////////
dccmcaltered.ObjectLocation = wpuiobj.ObjectLocation;
dccmcaltered.ObjectOffset = wpuiobj.ObjectOffset;
dccmcaltered.UserDefinedLocation = wpuiobj.UserDefinedLocation;
dccmcaltered.Locked = wpuiobj.Locked;
dccmcaltered.RinseLocation = wpuiobj.RinseLocation;
dccmcaltered.RinseDepth = wpuiobj.RinseDepth;
dccmcaltered.DrainLocation = wpuiobj.DrainLocation;
dccmcaltered.DrainDepth = wpuiobj.DrainDepth;
//
////////////////////////
//Deserialize Original//Why did we need to Deserialize again
////////////////////////
dobj = Generics.IO.BinarySerializer.Open(g_PathToTMP);
if (dobj == null)
{
///////
//LOG//
///////
goto Label_Done;
}
dccmcoriginal = dobj as ASM001.MatSettings;
if (dccmcoriginal == null)
goto Label_Done;
//
bResult = Generics.IO.SerializerPlus.IsBinaryEqual(dccmcoriginal, dccmcaltered);
Label_Done:
;
bCurrent = bResult;
///////////
//Cleanup//
///////////
FileInfo fInfo = new FileInfo(g_PathToTMP);
if (fInfo.Exists)
fInfo.Delete();
//
System.Diagnostics.Debug.WriteLineIf(!bCurrent && g_bVerbose, "[Main] Mat is not Current [ASM = 1]!");
System.Diagnostics.Debug.WriteLineIf(bCurrent && g_bVerbose, "[Main] Mat is Current! [ASM = 0]");
编辑我添加了其余的方法