Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MissingTexturesForm"/> class.
        /// </summary>
        /// <param name="hashCollection">The <see cref="TextureHashCollection"/>.</param>
        /// <param name="missingTextures">The <see cref="IEnumerable{T}"/> containing the missing textures.</param>
        /// <param name="cm">The <see cref="IContentManager"/> to use to load content.</param>
        /// <exception cref="ArgumentNullException"><paramref name="hashCollection" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="missingTextures" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="cm" /> is <c>null</c>.</exception>
        public MissingTexturesForm(TextureHashCollection hashCollection, IEnumerable<GrhData> missingTextures, IContentManager cm)
        {
            if (hashCollection == null)
                throw new ArgumentNullException("hashCollection");
            if (missingTextures == null)
                throw new ArgumentNullException("missingTextures");
            if (cm == null)
                throw new ArgumentNullException("cm");

            InitializeComponent();

            _cm = cm;
            _hashCollection = hashCollection;

            // Get the missing GrhDatas
            _missingTextures = CreateTextureDict(missingTextures);
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MissingTexturesForm"/> class.
        /// </summary>
        /// <param name="hashCollection">The <see cref="TextureHashCollection"/>.</param>
        /// <param name="missingTextures">The <see cref="IEnumerable{T}"/> containing the missing textures.</param>
        /// <param name="cm">The <see cref="IContentManager"/> to use to load content.</param>
        /// <exception cref="ArgumentNullException"><paramref name="hashCollection" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="missingTextures" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="cm" /> is <c>null</c>.</exception>
        public MissingTexturesForm(TextureHashCollection hashCollection, IEnumerable <GrhData> missingTextures, IContentManager cm)
        {
            if (hashCollection == null)
            {
                throw new ArgumentNullException("hashCollection");
            }
            if (missingTextures == null)
            {
                throw new ArgumentNullException("missingTextures");
            }
            if (cm == null)
            {
                throw new ArgumentNullException("cm");
            }

            InitializeComponent();

            _cm             = cm;
            _hashCollection = hashCollection;

            // Get the missing GrhDatas
            _missingTextures = CreateTextureDict(missingTextures);
        }
Esempio n. 3
0
        /// <summary>
        /// Checks for any missing textures, and displays the <see cref="MissingTexturesForm"/> if any are missing.
        /// </summary>
        void CheckForMissingTextures()
        {
            // We must create the hash collection since its constructor has the updating goodies, and we want
            // to make sure that is called
            var hashCollection = new TextureHashCollection();

            // Get the GrhDatas with missing textures
            var missing = GrhInfo.FindMissingTextures();

            if (missing.IsEmpty())
            {
                return;
            }

            // Display a form showing which textures need to be fixed
            // The GrhTreeView will be disabled until the MissingTexturesForm is closed
            Enabled = false;
            try
            {
                var frm = new MissingTexturesForm(hashCollection, missing, _contentManager);
                frm.FormClosed += delegate
                {
                    RebuildTree();
                    Enabled = true;
                };
                frm.Show();
            }
            catch (Exception)
            {
                // If there is an exception creating the form, make sure this control is re-enabled first
                Enabled = true;

                // Then re-throw the exception
                throw;
            }
        }