Exemple #1
0
        private async void ObjectCatalog_Shown(object sender, EventArgs e)
        {
            CircularProgress1.Start();
            await Task.Run(LoadCatalog);

            CircularProgress1.Stop();
            TableLayoutPanel_1.Visible = true;
        }
        private async void WarningBox_TweakUpdates_OptionsClick(object sender, EventArgs e)
        {
            WarningBox_TweakUpdates.Visible = false;
            Enabled = false;
            CircularProgress1.Start();
            bool res = await ExecuteUpdate();

            CircularProgress1.Stop();
            Enabled = true;
            if (res)
            {
                LoadTweaks();
                MessageBoxEx.Show(this, "Tweaks updated successfully!", "Tweak Updates", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBoxEx.Show(this, "Tweaks not updated (completly). There happened an error!", "Tweak Updates", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public async Task <bool> LoadROM()
        {
            var mgr = new RomManager(openrompath, lvlmgr);

            if (mgr.CheckROM())
            {
                openrom             = mgr;
                LabelX_Romfile.Text = System.IO.Path.GetFileName(mgr.RomFile);
                Enabled             = false;
                CircularProgress1.Start();
                await Task.Run(() => mgr.LoadLevels());

                CircularProgress1.Stop();
                Enabled = true;
                LoadLevels();
                return(true);
            }
            else
            {
                MessageBoxEx.Show("This ROM can't be used.", "Invalid ROM file", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
        private void LoadTweaks()
        {
            CircularProgress1.Start();
            string pathTweaks = General.MyTweaksPath;
            var    mgr        = new PatchingManager();

            myPatchs.Clear();

            var nullVersion = new Version("0.0.0.0");
            var appVersion  = new Version(Application.ProductVersion);

            foreach (string f in Directory.GetFiles(pathTweaks, "*.xml", SearchOption.AllDirectories).Concat(Directory.GetFiles(pathTweaks, "*.json", SearchOption.AllDirectories)))
            {
                var p = mgr.Read(f);
                if (p.MinVersion <= appVersion && (p.MaxVersion == nullVersion || p.MaxVersion >= appVersion))
                {
                    myPatchs.Add(p);
                }
            }

            myPatchs = myPatchs.OrderBy(n => n.Name).ToList();
            LoadTweakList();
            CircularProgress1.Stop();
        }