public void Restore(Sim sim) { try { bool dnpUpdated = false; if (mDnPExportData != null) { sim.NullDnPManager(); DreamsAndPromisesManager.CreateFromExportData(sim, mDnPExportData); sim.SimDescription.DnPExportData = null; dnpUpdated = true; } else if (mDnpManager != null) { sim.NullDnPManager(); sim.mDreamsAndPromisesManager = mDnpManager; dnpUpdated = true; } if ((dnpUpdated) && (sim.DreamsAndPromisesManager != null)) { OnLoadFixup(sim, mInitialStore); sim.DreamsAndPromisesManager.SetToUpdate(true, true); } if (mOpportunityManager != null) { if (sim.mOpportunityManager != null) { sim.mOpportunityManager.CancelAllOpportunities(); sim.mOpportunityManager.TearDownLocationBasedOpportunities(); } sim.mOpportunityManager = mOpportunityManager; } else if (sim.mOpportunityManager == null) { sim.mOpportunityManager = new OpportunityManager(sim); sim.mOpportunityManager.SetupLocationBasedOpportunities(); if (sim.mOpportunitiesAlarmHandle == AlarmHandle.kInvalidHandle) { sim.ScheduleOpportunityCall(); } } try { if (mOppStore != null) { mOppStore.Dispose(); } if (sim.OpportunityManager != null) { sim.OpportunityManager.Fixup(); } } catch (Exception e) { Common.Exception(sim, e); } // Remove the opportunity alarm for inactive sims, as there is no check for selectability within it if (sim.CelebrityManager != null) { sim.CelebrityManager.RemoveOppotunityAlarm(); } } catch (Exception e) { Common.DebugException(sim, e); } }
public void Restore(Sim sim) { try{ bool dnpUpdated = (false); if (mDnPExportData != null) { sim.NullDnPManager(); DreamsAndPromisesManager.CreateFromExportData(sim, mDnPExportData); sim.SimDescription.DnPExportData = null; dnpUpdated = (true); } else if (mDnpManager != null) { sim.NullDnPManager(); sim.mDreamsAndPromisesManager = mDnpManager; dnpUpdated = (true); } if ((dnpUpdated) && (sim.DreamsAndPromisesManager != null)) { OnLoadFixup(sim, mInitialStore); sim.DreamsAndPromisesManager.SetToUpdate(true, true); } if (mOpportunityManager != null) { if (sim.mOpportunityManager != null) { sim.mOpportunityManager.CancelAllOpportunities(); sim.mOpportunityManager.TearDownLocationBasedOpportunities(); } sim.mOpportunityManager = mOpportunityManager; } else if (sim.mOpportunityManager == null) { sim.mOpportunityManager = new OpportunityManager(sim); sim.mOpportunityManager.SetupLocationBasedOpportunities(); if (sim.mOpportunitiesAlarmHandle == AlarmHandle.kInvalidHandle) { sim.ScheduleOpportunityCall(); } } try{ if (mOppStore != null) { mOppStore.Dispose(); } if (sim.OpportunityManager != null) { sim.OpportunityManager.Fixup(); } }catch (Exception exception) { // Get stack trace for the exception. with source file information var st = new StackTrace(exception, true); // Get the top stack frame var frame = st.GetFrame(0); // Get the line number from the stack frame var line = frame.GetFileLineNumber(); Alive.WriteLog(exception.Message + "\n\n" + exception.StackTrace + "\n\n" + exception.Source + "\n\n" + line); }finally{ } // [NRaas:]Remove the opportunity alarm for inactive sims, as there is no check for selectability within it if (sim.CelebrityManager != null) { sim.CelebrityManager.RemoveOppotunityAlarm(); } }catch (Exception exception) { // Get stack trace for the exception. with source file information var st = new StackTrace(exception, true); // Get the top stack frame var frame = st.GetFrame(0); // Get the line number from the stack frame var line = frame.GetFileLineNumber(); Alive.WriteLog(exception.Message + "\n\n" + exception.StackTrace + "\n\n" + exception.Source + "\n\n" + line); }finally{ } }