示例#1
0
        // Token: 0x0600032B RID: 811 RVA: 0x00011FD4 File Offset: 0x000101D4
        internal static AmLastKnownGoodConfig ConstructLastKnownGoodConfigFromPersistentState()
        {
            AmLastKnownGoodConfig amLastKnownGoodConfig = null;
            string fromRegistry = AmLastKnownGoodConfig.GetFromRegistry();

            amLastKnownGoodConfig = new AmLastKnownGoodConfig();
            if (!string.IsNullOrEmpty(fromRegistry))
            {
                try
                {
                    AmLastKnownConfigSerializable amLastKnownConfigSerializable = (AmLastKnownConfigSerializable)SerializationUtil.XmlToObject(fromRegistry, typeof(AmLastKnownConfigSerializable));
                    amLastKnownGoodConfig.Role = (AmRole)amLastKnownConfigSerializable.Role;
                    amLastKnownGoodConfig.AuthoritativeServer = new AmServerName(amLastKnownConfigSerializable.AuthoritativeServer);
                    amLastKnownGoodConfig.Members             = (from serverNameFqdn in amLastKnownConfigSerializable.Members
                                                                 select new AmServerName(serverNameFqdn)).ToArray <AmServerName>();
                    amLastKnownGoodConfig.m_prevObjectXml = fromRegistry;
                    string text = string.Empty;
                    if (amLastKnownGoodConfig.Members != null)
                    {
                        string[] value = (from server in amLastKnownGoodConfig.Members
                                          select server.NetbiosName).ToArray <string>();
                        text = string.Join(",", value);
                    }
                    ReplayCrimsonEvents.LastKnownGoodConfigInitialized.Log <AmRole, AmServerName, string>(amLastKnownGoodConfig.Role, amLastKnownGoodConfig.AuthoritativeServer, text);
                }
                catch (Exception ex)
                {
                    ReplayCrimsonEvents.LastKnownGoodConfigSerializationError.Log <string, string>("Deserialize", ex.ToString());
                }
            }
            return(amLastKnownGoodConfig);
        }
示例#2
0
        // Token: 0x0600032D RID: 813 RVA: 0x0001219C File Offset: 0x0001039C
        private void Persist()
        {
            AmLastKnownConfigSerializable amLastKnownConfigSerializable = new AmLastKnownConfigSerializable();

            amLastKnownConfigSerializable.Role = (int)this.Role;
            amLastKnownConfigSerializable.AuthoritativeServer = this.AuthoritativeServer.Fqdn;
            amLastKnownConfigSerializable.Members             = (from server in this.Members
                                                                 select server.Fqdn).ToArray <string>();
            string text = string.Empty;

            try
            {
                text = SerializationUtil.ObjectToXml(amLastKnownConfigSerializable);
                if (!SharedHelper.StringIEquals(text, this.m_prevObjectXml))
                {
                    this.SaveToRegistry(text);
                    this.m_prevObjectXml = text;
                }
            }
            catch (Exception ex)
            {
                ReplayCrimsonEvents.LastKnownGoodConfigSerializationError.Log <string, string>("Serialize", ex.ToString());
            }
        }