Пример #1
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();
            }
        }
Пример #2
0
        private async Task SwitchRenderMode(GameRenderMode mode)
        {
            if (ApplicationSettings.Current.ArcUpdate.RenderMode == mode)
            {
                return;
            }
            var processes = GetGW2Instances();

            if (processes.Count > 0)
            {
                ((mode == GameRenderMode.DX9) ? radioButtonDX11 : radioButtonDX9).Checked = true;
                MessageBox.Show("Please close Guild Wars 2 in order to switch DirectX versions.", "GW2 is running", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            ApplicationSettings.Current.ArcUpdate.RenderMode = mode;
            checkedListBoxArcDpsPlugins.ItemCheck           -= itemCheckHandler;
            checkBoxEnableNotifications.CheckedChanged      -= checkChangedHandler;
            checkedListBoxArcDpsPlugins.Items.Clear();
            foreach (var component in ArcDpsComponentHelperClass.All)
            {
                checkedListBoxArcDpsPlugins.Items.Add(component, false);
            }
            var existingComponents = ArcDpsComponent.All;

            foreach (var component in existingComponents)
            {
                File.Delete($"{ApplicationSettings.Current.GW2Location}{component.RelativeLocation}");
            }
            ArcDpsComponent.All.Clear();
            var arcdps = new ArcDpsComponent()
            {
                Type = ArcDpsComponentType.ArcDps, RenderMode = ApplicationSettings.Current.ArcUpdate.RenderMode, RelativeLocation = ApplicationSettings.Current.ArcUpdate.RenderMode.Equals(GameRenderMode.DX11) ? @"\d3d11.dll" : @"\bin64\d3d9.dll"
            };

            if (!arcdps.IsInstalled())
            {
                await arcdps.DownloadComponent(httpController);
            }
            ArcDpsComponent.All.Add(arcdps);
            checkedListBoxArcDpsPlugins.ItemCheck      += itemCheckHandler;
            checkBoxEnableNotifications.CheckedChanged += checkChangedHandler;
            ApplicationSettings.Current.Save();
        }