Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Launchpad.Launcher.Handlers.LauncherHandler"/> class.
        /// </summary>
        public LauncherHandler()
        {
            this.Patch = PatchProtocolProvider.GetHandler();

            this.Patch.ModuleDownloadProgressChanged += OnLauncherDownloadProgressChanged;
            this.Patch.ModuleInstallationFinished    += OnLauncherDownloadFinished;
        }
Пример #2
0
        private void LoadBanner()
        {
            var patchHandler = PatchProtocolProvider.GetHandler();

            // Load the game banner (if there is one)
            if (!patchHandler.CanProvideBanner())
            {
                return;
            }

            Task.Factory.StartNew
            (
                () =>
            {
                using (var bannerStream = new MemoryStream())
                {
                    // Fetch the banner from the server
                    patchHandler.GetBanner().Save(bannerStream, ImageFormat.Png);

                    // Load the image into a pixel buffer
                    bannerStream.Position = 0;
                    return(new Pixbuf(bannerStream));
                }
            }
            )
            .ContinueWith
            (
                async bannerTask => this.Banner.Pixbuf = await bannerTask
            );
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GameHandler"/> class.
        /// </summary>
        public GameHandler()
        {
            this.Patch = PatchProtocolProvider.GetHandler();
            if (this.Patch == null)
            {
                return;
            }

            this.Patch.ModuleDownloadProgressChanged += OnModuleInstallProgressChanged;
            this.Patch.ModuleVerifyProgressChanged   += OnModuleInstallProgressChanged;
            this.Patch.ModuleUpdateProgressChanged   += OnModuleInstallProgressChanged;

            this.Patch.ModuleInstallationFinished += OnModuleInstallationFinished;
            this.Patch.ModuleInstallationFailed   += OnModuleInstallationFailed;
        }
Пример #4
0
        private void LoadChangelog()
        {
            var protocol = PatchProtocolProvider.GetHandler();
            var markup   = protocol.GetChangelogMarkup();

            // Preprocess dot lists
            var dotRegex = new Regex("(?<=^\\s+)\\*", RegexOptions.Multiline);

            markup = dotRegex.Replace(markup, "•");

            // Preprocess line breaks
            var regex = new Regex("(?<!\n)\n(?!\n)(?!  )");

            markup = regex.Replace(markup, string.Empty);

            var startIter = this.ChangelogTextView.Buffer.StartIter;

            this.ChangelogTextView.Buffer.InsertMarkup(ref startIter, markup);
        }
Пример #5
0
        private void LoadBanner()
        {
            var patchHandler = PatchProtocolProvider.GetHandler();

            // Load the game banner (if there is one)
            if (!patchHandler.CanProvideBanner())
            {
                return;
            }

            Task.Factory.StartNew
            (
                () =>
            {
                // Fetch the banner from the server
                var bannerImage = patchHandler.GetBanner();

                bannerImage.Mutate(i => i.Resize(this.BannerImage.AllocatedWidth, 0));

                // Load the image into a pixel buffer
                return(new Pixbuf
                       (
                           Bytes.NewStatic(bannerImage.SavePixelData()),
                           Colorspace.Rgb,
                           true,
                           8,
                           bannerImage.Width,
                           bannerImage.Height,
                           4 * bannerImage.Width
                       ));
            }
            )
            .ContinueWith
            (
                async bannerTask => this.BannerImage.Pixbuf = await bannerTask
            );
        }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChecksHandler"/> class.
 /// </summary>
 public ChecksHandler()
 {
     this.Patch = PatchProtocolProvider.GetHandler();
 }