Exemplo n.º 1
0
        /***** ENABLE *****/
        //TODO: add stuff for buildpad
        public static void enable(AddonInfoFromYaml addon_info)
        {
            UserConfig info = Configuration.getConfigAsYAML();

            if (info.installed.ContainsKey(addon_info.folder_name) && info.installed[addon_info.folder_name] != null)
            {
                if (info.disabled.ContainsKey(addon_info.folder_name) && info.disabled[addon_info.folder_name])
                {
                    if (addon_info.install_mode != "arc")
                    {
                        Directory.Move(
                            Path.Combine("Disabled Plugins", addon_info.folder_name),
                            Path.Combine(Path.Combine(info.game_path, "addons"), addon_info.folder_name)
                            );
                    }
                    else
                    {
                        if (!Directory.Exists(Path.Combine(Path.Combine(info.game_path, "addons"), "arcdps")))
                        {
                            Directory.CreateDirectory(Path.Combine(Path.Combine(info.game_path, "addons"), "arcdps"));
                        }

                        File.Move(
                            Path.Combine(Path.Combine("Disabled Plugins", addon_info.folder_name), addon_info.plugin_name),
                            Path.Combine(Path.Combine(Path.Combine(info.game_path, "addons"), "arcdps"), addon_info.plugin_name)
                            );
                    }

                    info.disabled[addon_info.folder_name] = false;
                    Configuration.setConfigAsYAML(info);
                }
            }
        }
Exemplo n.º 2
0
        /***** UPDATE button *****/
        private void update_button_clicked(object sender, RoutedEventArgs e)
        {
            //If bin folder doesn't exist then LoaderSetup intialization will fail.
            if (_configurationManager.UserConfig.BinFolder == null)
            {
                MessageBox.Show("Unable to locate Guild Wars 2 /bin/ or /bin64/ folder." + Environment.NewLine + "Please verify Game Path is correct.",
                                "Unable to Update", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            List <AddonInfoFromYaml> selectedAddons = new List <AddonInfoFromYaml>();

            //the d3d9 wrapper is installed by default and hidden from the list displayed to the user, so it has to be added to this list manually
            AddonInfoFromYaml wrapper = AddonYamlReader.getAddonInInfo("d3d9_wrapper");

            wrapper.folder_name = "d3d9_wrapper";
            selectedAddons.Add(wrapper);

            foreach (AddonInfoFromYaml addon in OpeningViewModel.GetInstance.AddonList.Where(add => add.IsSelected == true))
            {
                selectedAddons.Add(addon);
            }

            Application.Current.Properties["Selected"] = selectedAddons;

            this.NavigationService.Navigate(new Uri("UI/UpdatingPage/UpdatingView.xaml", UriKind.Relative));
        }
        private void ChangeAddonStatus(AddonInfoFromYaml addon)
        {
            var addonConfig =
                _configurationManager.UserConfig.AddonsList[addon.folder_name];

            var newStatus = string.Empty;

            if (addonConfig.Installed)
            {
                if (addon.folder_name == "arcdps" || addon.folder_name == "buildPad" || addonConfig.Version.Length > 10)
                {
                    newStatus += "(installed)";
                }
                else
                {
                    newStatus += "(" + addonConfig.Version + " installed)";
                }
            }

            if (addonConfig.Disabled)
            {
                newStatus += "(disabled)";
            }

            if (addon.Status != newStatus)
            {
                addon.Status = newStatus;
            }
        }
        /***** ENABLE *****/
        public static void enable(AddonInfoFromYaml addon_info)
        {
            UserConfig info = Configuration.getConfigAsYAML();

            if (info.installed.ContainsKey(addon_info.folder_name) && info.installed[addon_info.folder_name] != null)
            {
                if (info.disabled.ContainsKey(addon_info.folder_name) && info.disabled[addon_info.folder_name])
                {
                    if (addon_info.install_mode != "arc")
                    {
                        //non-arc
                        Directory.Move(
                            Path.Combine("Disabled Plugins", addon_info.folder_name),
                            Path.Combine(Path.Combine(info.game_path, "addons"), addon_info.folder_name)
                            );
                    }
                    else
                    {
                        //arc
                        if (!Directory.Exists(Path.Combine(Path.Combine(info.game_path, "addons"), "arcdps")))
                        {
                            Directory.CreateDirectory(Path.Combine(Path.Combine(info.game_path, "addons"), "arcdps"));
                        }

                        //buildpad compatibility check
                        if (!addon_info.addon_name.Contains("BuildPad"))
                        {
                            //non-buildpad
                            File.Move(
                                Path.Combine(Path.Combine("Disabled Plugins", addon_info.folder_name), addon_info.plugin_name),
                                Path.Combine(Path.Combine(Path.Combine(info.game_path, "addons"), "arcdps"), addon_info.plugin_name)
                                );
                        }
                        else
                        {
                            //buildpad
                            string   buildPadFileName = "";
                            string[] buildPadFiles    = Directory.GetFiles(Path.Combine("Disabled Plugins", addon_info.folder_name));

                            foreach (string someFileName in buildPadFiles)
                            {
                                if (someFileName.Contains("buildpad"))
                                {
                                    buildPadFileName = Path.GetFileName(someFileName);
                                }
                            }

                            File.Move(
                                Path.Combine(Path.Combine("Disabled Plugins", addon_info.folder_name), buildPadFileName),
                                Path.Combine(Path.Combine(Path.Combine(info.game_path, "addons"), "arcdps"), buildPadFileName)
                                );
                        }
                    }

                    info.disabled[addon_info.folder_name] = false;
                    Configuration.setConfigAsYAML(info);
                }
            }
        }
Exemplo n.º 5
0
        /***** DELETE *****/
        public static void delete(AddonInfoFromYaml addon_info)
        {
            UserConfig info = Configuration.getConfigAsYAML();

            if (info.installed.ContainsKey(addon_info.folder_name) && info.installed[addon_info.folder_name] != null)
            {
                if (info.disabled.ContainsKey(addon_info.folder_name) && info.disabled[addon_info.folder_name])
                {
                    FileSystem.DeleteDirectory(Path.Combine("Disabled Plugins", addon_info.folder_name), UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                    info.disabled.Remove(addon_info.folder_name);
                    info.installed.Remove(addon_info.folder_name);
                    info.version.Remove(addon_info.folder_name);
                    Configuration.setConfigAsYAML(info);
                }
                else
                {
                    if (addon_info.install_mode != "arc")
                    {
                        FileSystem.DeleteDirectory(Path.Combine(Path.Combine(info.game_path, "addons"), addon_info.folder_name), UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                        if (info.disabled.ContainsKey(addon_info.folder_name))
                        {
                            info.disabled.Remove(addon_info.folder_name);
                        }
                        info.installed.Remove(addon_info.folder_name);
                        info.version.Remove(addon_info.folder_name);

                        //deleting arcdps will delete other addons as well
                        if (addon_info.folder_name == "arcdps")
                        {
                            foreach (AddonInfoFromYaml adj_info in ApprovedList.GenerateAddonList())
                            {
                                if (adj_info.install_mode == "arc")
                                {
                                    //if arc-dependent plugin is disabled, it won't get deleted since it's not in the /addons/arcdps folder
                                    if (info.disabled.ContainsKey(adj_info.folder_name) && !info.disabled[adj_info.folder_name])
                                    {
                                        info.disabled.Remove(adj_info.folder_name);
                                        info.installed.Remove(adj_info.folder_name);
                                        info.version.Remove(adj_info.folder_name);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        FileSystem.DeleteFile(Path.Combine(Path.Combine(Path.Combine(info.game_path, "addons"), "arcdps"), addon_info.plugin_name), UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                        if (info.disabled.ContainsKey(addon_info.folder_name))
                        {
                            info.disabled.Remove(addon_info.folder_name);
                        }
                        info.installed.Remove(addon_info.folder_name);
                        info.version.Remove(addon_info.folder_name);
                    }

                    Configuration.setConfigAsYAML(info);
                }
            }
        }
        public GenericUpdater(AddonInfoFromYaml addon)
        {
            addon_name = addon.folder_name;
            addon_info = addon;
            viewModel  = UpdatingViewModel.GetInstance;
            userConfig = Configuration.getConfigAsYAML();

            addon_expanded_path = Path.Combine(Path.GetTempPath(), addon_name);
            addon_install_path  = Path.Combine(Configuration.getConfigAsYAML().game_path, "addons\\");
        }
Exemplo n.º 7
0
        /**** What Add-On Is Selected ****/
        /// <summary>
        /// Takes care of description page text updating
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void addOnList_SelectedIndexChanged(object sender, SelectionChangedEventArgs e)
        {
            AddonInfoFromYaml selected = OpeningViewModel.GetInstance.AddonList[addons.SelectedIndex];

            OpeningViewModel.GetInstance.DescriptionText  = selected.description;
            OpeningViewModel.GetInstance.DeveloperText    = selected.developer;
            OpeningViewModel.GetInstance.AddonWebsiteLink = selected.website;

            OpeningViewModel.GetInstance.DeveloperVisibility = Visibility.Visible;
        }
Exemplo n.º 8
0
        public GenericUpdater(AddonInfoFromYaml addon, IConfigurationManager configurationManager)
        {
            addon_name            = addon.folder_name;
            addon_info            = addon;
            _configurationManager = configurationManager;
            viewModel             = UpdatingViewModel.GetInstance;

            addon_expanded_path = Path.Combine(Path.GetTempPath(), addon_name);
            addon_install_path  = Path.Combine(configurationManager.UserConfig.GamePath, "addons\\");
        }
Exemplo n.º 9
0
        /*****************************   ***   *****************************/



        /***** UPDATE button *****/
        private void update_button_clicked(object sender, RoutedEventArgs e)
        {
            List <AddonInfoFromYaml> selectedAddons = new List <AddonInfoFromYaml>();

            AddonInfoFromYaml wrapper = AddonYamlReader.getAddonInInfo("d3d9_wrapper");

            wrapper.folder_name = "d3d9_wrapper";
            selectedAddons.Add(wrapper);

            foreach (AddonInfoFromYaml addon in OpeningViewModel.GetInstance.AddonList.Where(add => add.IsSelected == true))
            {
                selectedAddons.Add(addon);
            }

            Application.Current.Properties["Selected"] = selectedAddons;

            this.NavigationService.Navigate(new Uri("UI/UpdatingPage/UpdatingView.xaml", UriKind.Relative));
        }
Exemplo n.º 10
0
        /***** DISABLE *****/
        public static void Disable(AddonInfoFromYaml addon_info)
        {
            UserConfig info = Configuration.getConfigAsYAML();

            if (info.installed.ContainsKey(addon_info.folder_name) && info.installed[addon_info.folder_name] != null)
            {
                if (info.disabled.ContainsKey(addon_info.folder_name) && !info.disabled[addon_info.folder_name])
                {
                    if (addon_info.install_mode != "arc")
                    {
                        Directory.Move(
                            Path.Combine(Path.Combine(info.game_path, "addons"), addon_info.folder_name),
                            Path.Combine("Disabled Plugins", addon_info.folder_name)
                            );
                    }
                    else
                    {
                        //probably broken
                        if (!Directory.Exists(Path.Combine("Disabled Plugins", addon_info.folder_name)))
                        {
                            Directory.CreateDirectory(Path.Combine("Disabled Plugins", addon_info.folder_name));
                        }

                        if (addon_info.addon_name == "BuildPad (Installed)")
                        {
                            File.Move(
                                Path.Combine(Path.Combine(Path.Combine(info.game_path, "addons"), "arcdps"), Configuration.getConfigAsYAML().version["buildPad"]),
                                Path.Combine(Path.Combine("Disabled Plugins", addon_info.folder_name), Configuration.getConfigAsYAML().version["buildPad"])
                                );
                        }
                        else
                        {
                            File.Move(
                                Path.Combine(Path.Combine(Path.Combine(info.game_path, "addons"), "arcdps"), addon_info.plugin_name),
                                Path.Combine(Path.Combine("Disabled Plugins", addon_info.folder_name), addon_info.plugin_name)
                                );
                        }
                    }

                    info.disabled[addon_info.folder_name] = true;
                    Configuration.setConfigAsYAML(info);
                }
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Scans resources/addons directory to populate a collection used for displaying the list of available addons on the UI.
        /// </summary>
        /// <returns>A list of AddonInfo objects representing all approved add-ons.</returns>
        public static ObservableCollection <AddonInfoFromYaml> GenerateAddonList()
        {
            UserConfig userConfig = Configuration.getConfigAsYAML();

            FetchListFromRepo(userConfig);
            ObservableCollection <AddonInfoFromYaml> Addons = new ObservableCollection <AddonInfoFromYaml>(); //List of AddonInfo objects

            string[] AddonDirectories = Directory.GetDirectories(AddonFolder);                                //Names of addon subdirectories in /resources/addons
            foreach (string addonFolderName in AddonDirectories)
            {
                if (addonFolderName != "resources\\addons\\d3d9_wrapper")
                {
                    AddonInfoFromYaml temp = AddonYamlReader.getAddonInInfo(addonFolderName.Replace(AddonFolder + "\\", ""));
                    temp.folder_name = addonFolderName.Replace(AddonFolder + "\\", "");
                    if (userConfig.default_configuration.ContainsKey(temp.folder_name) && userConfig.default_configuration[temp.folder_name])
                    {
                        temp.IsSelected = true;
                    }
                    Addons.Add(temp);       //retrieving info from each addon subdirectory's update.yaml file and adding it to the list
                }
            }

            return(Addons);
        }
Exemplo n.º 12
0
        /***** DELETE *****/
        public static void delete(AddonInfoFromYaml addon_info)
        {
            UserConfig info = Configuration.getConfigAsYAML();

            if (info.installed.ContainsKey(addon_info.folder_name) && info.installed[addon_info.folder_name] != null)
            {
                if (info.disabled.ContainsKey(addon_info.folder_name) && info.disabled[addon_info.folder_name])
                {
                    FileSystem.DeleteDirectory(Path.Combine("Disabled Plugins", addon_info.folder_name), UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                    info.disabled.Remove(addon_info.folder_name);
                    info.installed.Remove(addon_info.folder_name);
                    info.version.Remove(addon_info.folder_name);
                    Configuration.setConfigAsYAML(info);
                }
                else
                {
                    if (addon_info.install_mode != "arc")
                    {
                        FileSystem.DeleteDirectory(Path.Combine(Path.Combine(info.game_path, "addons"), addon_info.folder_name), UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                        if (info.disabled.ContainsKey(addon_info.folder_name))
                        {
                            info.disabled.Remove(addon_info.folder_name);
                        }
                        info.installed.Remove(addon_info.folder_name);
                        info.version.Remove(addon_info.folder_name);

                        //deleting arcdps will delete other addons as well
                        if (addon_info.folder_name == "arcdps")
                        {
                            foreach (AddonInfoFromYaml adj_info in ApprovedList.GenerateAddonList())
                            {
                                if (adj_info.install_mode == "arc")
                                {
                                    //if arc-dependent plugin is disabled, it won't get deleted since it's not in the /addons/arcdps folder
                                    if (info.disabled.ContainsKey(adj_info.folder_name) && !info.disabled[adj_info.folder_name])
                                    {
                                        info.disabled.Remove(adj_info.folder_name);
                                        info.installed.Remove(adj_info.folder_name);
                                        info.version.Remove(adj_info.folder_name);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        //buildpad check
                        if (!addon_info.addon_name.Contains("BuildPad"))
                        {
                            FileSystem.DeleteFile(Path.Combine(Path.Combine(Path.Combine(info.game_path, "addons"), "arcdps"), addon_info.plugin_name), UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                        }
                        else
                        {
                            string   buildPadFileName = "";
                            string[] arcFiles         = Directory.GetFiles(Path.Combine(Path.Combine(info.game_path, "addons"), "arcdps"));

                            //search for plugin name in arc folder
                            //TODO: Should break out of operation and give message if the plugin is not found.
                            foreach (string arcFileName in arcFiles)
                            {
                                if (arcFileName.Contains("buildpad"))
                                {
                                    buildPadFileName = Path.GetFileName(arcFileName);
                                }
                            }

                            FileSystem.DeleteFile(Path.Combine(Path.Combine(Path.Combine(info.game_path, "addons"), "arcdps"), buildPadFileName), UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                        }


                        if (info.disabled.ContainsKey(addon_info.folder_name))
                        {
                            info.disabled.Remove(addon_info.folder_name);
                        }
                        info.installed.Remove(addon_info.folder_name);
                        info.version.Remove(addon_info.folder_name);
                    }

                    Configuration.setConfigAsYAML(info);
                }
            }
        }
Exemplo n.º 13
0
        /***** DISABLE *****/
        //TODO: Note to self May 1 2020: consider making some vanity methods to clean up all the Path.Combine()s in here; the code's a bit of a chore to read.
        public static void Disable(AddonInfoFromYaml addon_info)
        {
            UserConfig info = Configuration.getConfigAsYAML();

            if (info.installed.ContainsKey(addon_info.folder_name) && info.installed[addon_info.folder_name] != null)
            {
                if (!Directory.Exists("Disabled Plugins"))
                {
                    Directory.CreateDirectory("Disabled Plugins");
                }

                if (info.disabled.ContainsKey(addon_info.folder_name) && !info.disabled[addon_info.folder_name])
                {
                    if (addon_info.install_mode != "arc")
                    {
                        Directory.Move(
                            Path.Combine(Path.Combine(info.game_path, "addons"), addon_info.folder_name),
                            Path.Combine("Disabled Plugins", addon_info.folder_name)
                            );
                    }
                    else
                    {
                        //probably broken
                        if (!Directory.Exists(Path.Combine("Disabled Plugins", addon_info.folder_name)))
                        {
                            Directory.CreateDirectory(Path.Combine("Disabled Plugins", addon_info.folder_name));
                        }

                        if (addon_info.addon_name.Contains("BuildPad"))
                        {
                            string   buildPadFileName = "";
                            string[] arcFiles         = Directory.GetFiles(Path.Combine(Path.Combine(info.game_path, "addons"), "arcdps"));

                            //search for plugin name in arc folder
                            //TODO: Should break out of operation and give message if the plugin is not found.
                            foreach (string arcFileName in arcFiles)
                            {
                                if (arcFileName.Contains("buildpad"))
                                {
                                    buildPadFileName = Path.GetFileName(arcFileName);
                                }
                            }

                            File.Move(
                                Path.Combine(Path.Combine(Path.Combine(info.game_path, "addons"), "arcdps"), buildPadFileName),
                                Path.Combine(Path.Combine("Disabled Plugins", addon_info.folder_name), buildPadFileName)
                                );
                        }
                        else
                        {
                            File.Move(
                                Path.Combine(Path.Combine(Path.Combine(info.game_path, "addons"), "arcdps"), addon_info.plugin_name),
                                Path.Combine(Path.Combine("Disabled Plugins", addon_info.folder_name), addon_info.plugin_name)
                                );
                        }
                    }

                    info.disabled[addon_info.folder_name] = true;
                    Configuration.setConfigAsYAML(info);
                }
            }
        }