Beispiel #1
0
        private void InstallModsFromDialog()
        {
            var dialog = new System.Windows.Forms.OpenFileDialog();

            dialog.Title = "Select the packed mod(s) for installing.";
            var result = dialog.ShowDialog();

            if (result != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            var files = dialog.FileNames;

            var extractor = new ModExtracter();
            var extracted = extractor.Unpack(files);

            LoadAllMods();

            if (extracted.Count > 0)
            {
                MessageBox.Show("Extracted mods: " + String.Join(", ", extracted.ToArray()));
            }
            else
            {
                MessageBox.Show("No mods extracted (either the archive did not contain any mods, or they are already installed.");
            }
        }
Beispiel #2
0
        private void DownloadModCallback(byte[] data)
        {
            IsIndeterminate = true;

            var dispatcher = Dispatcher.CurrentDispatcher;
            var worker     = new BackgroundWorker();

            worker.DoWork += (o, e) =>
            {
                var file = saver.Save(this.mod, data);
                extractor.Unpack(file.FullName);

                IsIndeterminate      = false;
                IsDownloading        = false;
                ModHasBeenDownloaded = true;

                if (ModInstalled != null)
                {
                    dispatcher.Invoke(new Action(() => ModInstalled(this)), DispatcherPriority.DataBind);
                }

                timer.Start(); //This will cause the donwload completed to go away in 5 seconds.
            };

            worker.RunWorkerAsync();
        }
        private void InstallModsFromDialog()
        {
            var dialog = new System.Windows.Forms.OpenFileDialog();
            dialog.Title = "Select the packed mod(s) for installing.";
            var result = dialog.ShowDialog();

            if (result != System.Windows.Forms.DialogResult.OK)
                return;

            var files = dialog.FileNames;

            var extractor = new ModExtracter();
            var extracted = extractor.Unpack(files);

            LoadAllMods();

            if (extracted.Count > 0)
            {
                MessageBox.Show("Extracted mods: " + String.Join(", ", extracted.ToArray()));
            }
            else
            {
                MessageBox.Show("No mods extracted (either the archive did not contain any mods, or they are already installed.");
            }
        }