/// <summary>
        /// Imports data from an API serialization object provided by CCP
        /// </summary>
        /// <param name="serial"></param>
        internal void Import(SerializableImplantSet serial)
        {
            // Search whether the api infos are different from the ones currently stored.
            var newSet = new ImplantSet(m_owner, "temp");

            newSet.Import(serial);

            bool isDifferent = false;
            var  oldArray    = m_api.ToArray();
            var  newArray    = newSet.ToArray();

            for (int i = 0; i < oldArray.Length; i++)
            {
                isDifferent |= (oldArray[i] != newArray[i]);
            }

            // Imports the API and make a backup
            if (isDifferent)
            {
                m_oldAPI.Import(m_api.Export(), false);
            }
            m_api.Import(serial);

            EveClient.OnSettingsChanged();
        }
        /// <summary>
        /// Imports data from a deserialization object
        /// </summary>
        /// <param name="serial"></param>
        public void Import(SerializableImplantSetCollection serial)
        {
            m_api.Import(serial.API, false);
            m_oldAPI.Import(serial.API, false);

            m_customSets.Clear();
            foreach (var serialSet in serial.CustomSets)
            {
                var set = new ImplantSet(m_owner, serialSet.Name);
                set.Import(serialSet, true);
                m_customSets.Add(set);
            }

            // Imports selection
            m_current = Enumerate().ElementAt(serial.SelectedIndex);

            EveClient.OnSettingsChanged();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Updates from the provided serialization object
        /// </summary>
        /// <param name="serial">The serializable version of the new settings. May be null (acts as a reset)</param>
        /// <param name="preferencesOnly">When true, only the user preferences will be reimported, not plans, characters, accounts and such.</param>
        public static void Import(SerializableSettings serial, bool preferencesOnly)
        {
            // When null, we just reset
            if (serial == null)
            {
                Reset();
                return;
            }

            IsRestoringSettings = true;
            try
            {
                EveClient.Trace("Settings.Import() - begin");

                // Import the characters, accounts and plans
                if (!preferencesOnly)
                {
                    // The above check prevents the settings form to trigger a
                    // characters updates since the last queried infos would be lost.
                    EveClient.Characters.Import(serial.Characters);
                    EveClient.Characters.ImportPlans(serial.Plans);
                    EveClient.MonitoredCharacters.Import(serial.MonitoredCharacters);
                    EveClient.Accounts.Import(serial.Accounts);
                }

                // Global settings
                Settings.Compatibility = serial.Compatibility;

                // API providers
                EveClient.APIProviders.Import(serial.APIProviders);

                // Scheduler
                Scheduler.Import(serial.Scheduler);

                // User settings
                Settings.UI            = serial.UI.Clone();
                Settings.G15           = serial.G15.Clone();
                Settings.IGB           = serial.IGB.Clone();
                Settings.Proxy         = serial.Proxy.Clone();
                Settings.Updates       = serial.Updates.Clone();
                Settings.Notifications = serial.Notifications.Clone();
                Settings.Exportation   = serial.Exportation.Clone();
                Settings.Calendar      = serial.Calendar.Clone();

                // Trim the data
                OnImportCompleted();

                // Save
                SaveImmediate();

                // Updates the data right now
                EveClient.UpdateOnOneSecondTick();
                EveClient.OnSettingsChanged();

                EveClient.Trace("Settings.Import() - done");
            }
            finally
            {
                IsRestoringSettings = false;
            }
        }