Exemplo n.º 1
0
        /// <summary>
        /// Loads the static data.
        /// </summary>
        public static async Task LoadAsync()
        {
            // Quit if the client has been shut down
            if (EveMonClient.Closed)
            {
                return;
            }

            // This is the time optimal loading order
            // (min order to follow :
            // skills before anything else,
            // properties before items,
            // items before blueprints, reprocessing and certificates,
            // certs before masteries)

            EveMonClient.Trace("Datafiles.Load - begin", printMethod: false);

            // Must always run first
            // It will have finished loading until static skills finish
            Task properties = TaskHelper.RunIOBoundTaskAsync(() => StaticProperties.Load());

            // Must always run before items
            Task skills = TaskHelper.RunIOBoundTaskAsync(() => StaticSkills.Load());

            await Task.WhenAll(skills, properties);

            // Must always run synchronously as blueprints, reprocessing and certificates depend on it
            await TaskHelper.RunIOBoundTaskAsync(() => StaticItems.Load());

            // Must always run synchronously as masteries depend on it
            await TaskHelper.RunIOBoundTaskAsync(() => StaticCertificates.Load());

            // Must always run synchronously as ID to name depends on it
            await TaskHelper.RunIOBoundTaskAsync(() => StaticGeography.Load());

            // Non critical loadings as all dependencies have been loaded
            Task blueprints   = TaskHelper.RunIOBoundTaskAsync(() => StaticBlueprints.Load());
            Task reprocessing = TaskHelper.RunIOBoundTaskAsync(() => StaticReprocessing.Load());
            await TaskHelper.RunIOBoundTaskAsync(() => StaticMasteries.Load());

            EveMonClient.Trace("Datafiles.Load - done", printMethod: false);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes paths, static objects, check and load datafiles, etc.
        /// </summary>
        /// <remarks>May be called more than once without causing redundant operations to occur.</remarks>
        public static void Initialize()
        {
            lock (s_initializationLock)
            {
                if (s_initialized)
                {
                    return;
                }

                s_initialized = true;

                Trace("EveClient.Initialize() - begin");

                // Members instantiations
                HttpWebService      = new HttpWebService();
                APIProviders        = new GlobalAPIProviderCollection();
                MonitoredCharacters = new GlobalMonitoredCharacterCollection();
                CharacterIdentities = new GlobalCharacterIdentityCollection();
                Notifications       = new GlobalNotificationCollection();
                Characters          = new GlobalCharacterCollection();
                Datafiles           = new GlobalDatafileCollection();
                Accounts            = new GlobalAccountCollection();
                EVEServer           = new EveServer();

                // Load static datas (min order to follow : skills before anything else, items before certs)
                Trace("Load Datafiles - begin");
                StaticProperties.Load();
                StaticSkills.Load();
                StaticItems.Load();
                StaticCertificates.Load();
                StaticBlueprints.Load();
                Trace("Load Datafiles - done");

                // Network monitoring (connection availability changes)
                NetworkMonitor.Initialize();

                Trace("EveClient.Initialize() - done");
            }
        }