public static async Task InstallAssembly(AssemblyEntry assembly, bool silent)
        {
            if (Config.Instance.SelectedProfile.InstalledAssemblies.Any(a => a.Name == assembly.Name))
            {
                return;
            }

            try
            {
                var projectName     = Path.GetFileNameWithoutExtension(new Uri(assembly.GithubUrl).AbsolutePath);
                var repositoryMatch = Regex.Match(assembly.GithubUrl, @"^(http[s]?)://(?<host>.*?)/(?<author>.*?)/(?<repo>.*?)(/{1}|$)");
                var repositoryUrl   = $"https://{repositoryMatch.Groups["host"]}/{repositoryMatch.Groups["author"]}/{repositoryMatch.Groups["repo"]}";

                var installer = new InstallerWindow {
                    Owner = MainWindow.Instance
                };

                if (silent)
                {
                    await installer.ListAssemblies(repositoryUrl, true, true, HttpUtility.UrlDecode(projectName));

                    installer.Close();
                    return;
                }

                installer.ShowProgress(repositoryUrl, true, HttpUtility.UrlDecode(projectName));
                installer.ShowDialog();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #2
0
        public static void InstallAssembly(Match m)
        {
            var gitHubUser     = m.Groups[2].ToString();
            var repositoryName = m.Groups[3].ToString();
            var assemblyName   = m.Groups[4].ToString();

            var w = new InstallerWindow {
                Owner = MainWindow.Instance
            };

            w.ShowProgress($"https://github.com/{gitHubUser}/{repositoryName}", true, assemblyName != string.Empty ? m.Groups[4].ToString() : null);
            w.ShowDialog();
        }
Example #3
0
        private void GithubAssembliesItem_OnClick(object sender, RoutedEventArgs e)
        {
            if (this.InstalledAssembliesDataGrid.SelectedItems.Count <= 0)
            {
                return;
            }
            var selectedAssembly = (LeagueSharpAssembly)this.InstalledAssembliesDataGrid.SelectedItems[0];

            if (selectedAssembly.SvnUrl != "")
            {
                var window = new InstallerWindow {
                    Owner = this
                };
                window.ShowProgress(selectedAssembly.SvnUrl, true);
                window.ShowDialog();
            }
        }
Example #4
0
        public static async Task InstallAssembly(AssemblyEntry assembly, bool silent)
        {
            if (Config.Instance.SelectedProfile.InstalledAssemblies.Any(a => a.Name == assembly.Name))
            {
                return;
            }

            try
            {
                var projectName     = Path.GetFileNameWithoutExtension(new Uri(assembly.GithubUrl).AbsolutePath).WebDecode();
                var repositoryMatch = Regex.Match(assembly.GithubUrl, @"^(http[s]?)://(?<host>.*?)/(?<author>.*?)/(?<repo>.*?)(/{1}|$)");
                var repositoryUrl   = $"https://{repositoryMatch.Groups["host"]}/{repositoryMatch.Groups["author"]}/{repositoryMatch.Groups["repo"]}";

                // HACK: :^)
                var redirect = Config.Instance.BlockedRepositories.Where(r => r.HasRedirect).FirstOrDefault(r => repositoryUrl.StartsWith(r.Url));
                if (redirect != null)
                {
                    repositoryUrl = redirect.Redirect;
                }

                var installer = new InstallerWindow {
                    Owner = MainWindow.Instance
                };

                if (silent)
                {
                    await installer.ListAssemblies(repositoryUrl, true, true, projectName);

                    installer.Close();
                    return;
                }

                installer.ShowProgress(repositoryUrl, true, projectName);
                installer.ShowDialog();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public static async Task InstallAssembly(AssemblyEntry assembly, bool silent)
        {
            if (Config.Instance.SelectedProfile.InstalledAssemblies.Any(a => a.Name == assembly.Name))
            {
                return;
            }

            try
            {
                var projectName = Path.GetFileNameWithoutExtension(new Uri(assembly.GithubUrl).AbsolutePath);
                var repositoryMatch = Regex.Match(assembly.GithubUrl, @"^(http[s]?)://(?<host>.*?)/(?<author>.*?)/(?<repo>.*?)(/{1}|$)");
                var repositoryUrl = $"https://{repositoryMatch.Groups["host"]}/{repositoryMatch.Groups["author"]}/{repositoryMatch.Groups["repo"]}";

                var installer = new InstallerWindow { Owner = MainWindow.Instance };

                if (silent)
                {
                    await installer.ListAssemblies(repositoryUrl, true, true, HttpUtility.UrlDecode(projectName));
                    installer.Close();
                    return;
                }

                installer.ShowProgress(repositoryUrl, true, HttpUtility.UrlDecode(projectName));
                installer.ShowDialog();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public static void InstallAssembly(Match m)
        {
            var gitHubUser = m.Groups[2].ToString();
            var repositoryName = m.Groups[3].ToString();
            var assemblyName = m.Groups[4].ToString();

            var w = new InstallerWindow { Owner = MainWindow.Instance };
            w.ShowProgress($"https://github.com/{gitHubUser}/{repositoryName}", true, assemblyName != "" ? m.Groups[4].ToString() : null);
            w.ShowDialog();
        }