Esempio n. 1
0
        public void SyncWith(TCDSimulator simulator)
        {
            // Synchronise UserMachineName.
            string machineName = simulator.GetUserMachineName();

            if (simulator.HasUserMachineNameChanged())
            {
                m_userMachineName.Value = machineName;
                m_userMachineName.UpdateChangeMasks(NodeStateChangeMasks.Value);
            }
            else if (m_userMachineName.Value is string && (string)m_userMachineName.Value != machineName)
            {
                simulator.SetUserMachineName((string)m_userMachineName.Value, true);
            }

            // Synchronise LocationName.
            string locationName = simulator.GetLocationName();

            if (simulator.HasLocationNameChanged())
            {
                m_locationName.Value = locationName;
                m_locationName.UpdateChangeMasks(NodeStateChangeMasks.Value);
            }
            else if (m_locationName.Value is string && (string)m_locationName.Value != locationName)
            {
                simulator.SetLocationName((string)m_locationName.Value, true);
            }

            // Update TimeZoneOffset.
            if (m_timeZoneOffset.Value == null)
            {
                m_timeZoneOffset.Value = new TimeZoneDataType();
                m_timeZoneOffset.UpdateChangeMasks(NodeStateChangeMasks.Value);
            }
            if (m_timeZoneOffset.Value.offset != simulator.TimeZoneOffset)
            {
                m_timeZoneOffset.Value.offset = simulator.TimeZoneOffset;
                m_timeZoneOffset.UpdateChangeMasks(NodeStateChangeMasks.Value);
            }
            if (m_timeZoneOffset.Value.daylightSavingInOffset != simulator.DaylightSavingsInOffset)
            {
                m_timeZoneOffset.Value.daylightSavingInOffset = simulator.DaylightSavingsInOffset;
                m_timeZoneOffset.UpdateChangeMasks(NodeStateChangeMasks.Value);
            }
        }