Exemple #1
0
        public bool Load(string datPath, string sprPath, Core.Version version, ClientFeatures features)
        {
            if (datPath == null)
            {
                throw new ArgumentNullException(nameof(datPath));
            }

            if (sprPath == null)
            {
                throw new ArgumentNullException(nameof(sprPath));
            }

            if (version == null)
            {
                throw new ArgumentNullException(nameof(version));
            }

            this.Things = ThingTypeStorage.Load(datPath, version, features);
            if (this.Things == null)
            {
                return(false);
            }

            this.Sprites = SpriteStorage.Load(sprPath, version, features);
            if (this.Sprites == null)
            {
                return(false);
            }

            this.Things.ProgressChanged  += new ProgressHandler(this.StorageProgressChanged_Handler);
            this.Things.StorageChanged   += new ThingListChangedHandler(this.ThingListChanged_Handler);
            this.Things.StorageCompiled  += new StorageHandler(this.StorageCompiled_Handler);
            this.Things.StorageDisposed  += new StorageHandler(this.StorageDisposed_Handler);
            this.Sprites.StorageChanged  += new SpriteListChangedHandler(this.SpriteListChanged_Handler);
            this.Sprites.ProgressChanged += new ProgressHandler(this.StorageProgressChanged_Handler);
            this.Sprites.StorageCompiled += new StorageHandler(this.StorageCompiled_Handler);
            this.Sprites.StorageDisposed += new StorageHandler(this.StorageDisposed_Handler);

            if (this.Loaded && this.ClientLoaded != null)
            {
                this.ClientLoaded(this, new EventArgs());
            }

            return(this.Loaded);
        }