This is not my code I just have to understand it. The original programmer cannot be reached. dobj is just an object type. My main question is: Why does he deserialize again when dobj was never changed? Please ignore all his goto's for right now they are everywhere in this program.
////////////////////////
//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]");
Edit I added the rest of the method