Beispiel #1
0
        public FormArcPluginManager(FormMain mainLink)
        {
            this.mainLink = mainLink;
            var installedComponents = ArcDpsComponent.DeserialiseAll(ApplicationSettings.LocalDir);

            InitializeComponent();
            Icon = Properties.Resources.AppIcon;
            var availableComponents   = ArcDpsComponentHelperClass.All;
            var arcIsInstalled        = true;
            var arcInstalledComponent = installedComponents.Where(x => x.Type.Equals(ArcDpsComponentType.ArcDps) && x.RenderMode.Equals(ApplicationSettings.Current.ArcUpdate.RenderMode)).Any();

            if (arcInstalledComponent)
            {
                var arcdps = installedComponents.Where(x => x.Type.Equals(ArcDpsComponentType.ArcDps) && x.RenderMode.Equals(ApplicationSettings.Current.ArcUpdate.RenderMode)).First();
                if (!arcdps.IsInstalled())
                {
                    arcIsInstalled = false;
                    checkBoxModuleEnabled.Checked           = false;
                    ApplicationSettings.Current.GW2Location = string.Empty;
                    ApplicationSettings.Current.Save();
                }
            }
            else
            {
                arcIsInstalled = false;
                checkBoxModuleEnabled.Checked           = false;
                ApplicationSettings.Current.GW2Location = string.Empty;
                ApplicationSettings.Current.Save();
            }
            foreach (var component in availableComponents)
            {
                var installed = arcIsInstalled && installedComponents.Where(x => x.Type.Equals(component.Type) && x.RenderMode.Equals(ApplicationSettings.Current.ArcUpdate.RenderMode)).Any();
                if (installed)
                {
                    var installedComponent = installedComponents.Where(x => x.Type.Equals(component.Type) && x.RenderMode.Equals(ApplicationSettings.Current.ArcUpdate.RenderMode)).First();
                    if (!installedComponent.IsInstalled())
                    {
                        installed = false;
                        installedComponents.RemoveAll(x => x.Type.Equals(component.Type));
                    }
                }
                checkedListBoxArcDpsPlugins.Items.Add(component, installed);
            }
            itemCheckHandler    = new ItemCheckEventHandler(CheckedListBoxArcDpsPlugins_ItemCheck);
            checkChangedHandler = new EventHandler(CheckBoxEnableNotifications_CheckedChanged);
            checkedListBoxArcDpsPlugins.ItemCheck      += itemCheckHandler;
            checkBoxEnableNotifications.CheckedChanged += checkChangedHandler;
            radioButtonDX11.CheckedChanged             += new EventHandler(RadioButtonDX11_CheckedChanged);
            ArcDpsComponent.SerialiseAll(ApplicationSettings.LocalDir);
        }
Beispiel #2
0
        private async void ButtonChangeGW2Location_Click(object sender, EventArgs e)
        {
            using var dialog = new OpenFileDialog();
            dialog.Filter    = "Guild Wars 2|Gw2-64.exe;Gw2.exe;Guild Wars 2.exe";
            var result = dialog.ShowDialog();

            if (result.Equals(DialogResult.OK) && !string.IsNullOrWhiteSpace(dialog.FileName))
            {
                var location = Path.GetDirectoryName(dialog.FileName);
                ApplicationSettings.Current.GW2Location = location;
                ApplicationSettings.Current.Save();
                if (ArcDpsComponent.All.Where(x => x.Type.Equals(ArcDpsComponentType.ArcDps) && x.RenderMode.Equals(ApplicationSettings.Current.ArcUpdate.RenderMode)).Any())
                {
                    var component = ArcDpsComponent.All.Where(x => x.Type.Equals(ArcDpsComponentType.ArcDps) && x.RenderMode.Equals(ApplicationSettings.Current.ArcUpdate.RenderMode)).First();
                    if (!component.IsInstalled())
                    {
                        await component.DownloadComponent(httpController);

                        ArcDpsComponent.All.Where(x => x.RenderMode.Equals(ApplicationSettings.Current.ArcUpdate.RenderMode)).ToList().ForEach(async comp =>
                        {
                            if (!comp.IsInstalled())
                            {
                                await comp.DownloadComponent(httpController);
                            }
                        });
                    }
                }
                else
                {
                    var component = new ArcDpsComponent()
                    {
                        Type = ArcDpsComponentType.ArcDps, RenderMode = ApplicationSettings.Current.ArcUpdate.RenderMode, RelativeLocation = ApplicationSettings.Current.ArcUpdate.RenderMode.Equals(GameRenderMode.DX11) ? @"\d3d11.dll" : @"\bin64\d3d9.dll"
                    };
                    if (!component.IsInstalled())
                    {
                        await component.DownloadComponent(httpController);
                    }
                    ArcDpsComponent.All.Add(component);
                    ArcDpsComponent.SerialiseAll(ApplicationSettings.LocalDir);
                }
                await StartTimerAsync();
            }
            else
            {
                await StopTimerAsync();
            }
        }
Beispiel #3
0
 private void FormArcPluginManager_FormClosing(object sender, FormClosingEventArgs e)
 {
     e.Cancel = true;
     Hide();
     ArcDpsComponent.SerialiseAll(ApplicationSettings.LocalDir);
 }