Example #1
0
        private void LoadInstalled(bool loadInfo = false)
        {
            InstalledPackages = new List <IPackage>();
            if (vs == null)
            {
                return;
            }

            dg.Controls.Clear();
            dg.Refresh();
            ArrayList L = vs.GetReferences();

            foreach (string p in L)
            {
                string hint = vs.GetPathHint(p);
                if (String.IsNullOrEmpty(hint))
                {
                    continue;
                }
                string folder = vs.vs.SolutionPath + hint;

                if (File.Exists(folder))
                {
                }

                string pp = "";

                string bg = vs.GetProjectFolder() + "\\" + hint;

                string[] cc = bg.Split("\\".ToCharArray());

                List <string> bb = new List <string>(cc);

                int i = bb.IndexOf("packages");

                int j = 0;
                foreach (string s in bb)
                {
                    if (j != 0)
                    {
                        pp += "\\" + s;
                    }
                    else
                    {
                        pp = s;
                    }

                    if (j > i)
                    {
                        break;
                    }
                    j++;
                }

                if (!Directory.Exists(pp))
                {
                    continue;
                }

                string[] dd = Directory.GetFiles(pp);

                IPackage package = null;

                foreach (string d in dd)
                {
                    if (d.EndsWith(".nupkg"))
                    {
                        package = NuGets.ReadNuSpec(d);

                        break;
                    }
                }

                if (package == null)
                {
                    continue;
                }

                InstalledPackages.Add(package);
                if (loadInfo == true)
                {
                    IPackage packages = NuGets.GetNuGetPackage(package.Id, package.Version.ToFullString());
                    if (packages != null)
                    {
                        AddNugetPackageInfo(packages);
                    }
                }
            }
        }
Example #2
0
        private void labelEx2_Click(object sender, EventArgs e)
        {
            EmptyNuGetInfo();
            InstalledPackages = new List <IPackage>();
            if (repo == null)
            {
                NuGets nuget = new NuGets();
                repo = nuget.GetRepository();
            }
            if (vs == null)
            {
                return;
            }
            tasks = task.installed;
            UnloadUpdate(tasks);

            dg.Controls.Clear();
            dg.Refresh();
            ArrayList L = vs.GetReferences();

            foreach (string p in L)
            {
                string hint = vs.GetPathHint(p);
                if (String.IsNullOrEmpty(hint))
                {
                    continue;
                }
                string folder = vs.vs.SolutionPath + hint;

                if (File.Exists(folder))
                {
                }

                string pp = "";

                string bg = vs.GetProjectFolder() + "\\" + hint;

                string[] cc = bg.Split("\\".ToCharArray());

                List <string> bb = new List <string>(cc);

                int i = bb.IndexOf("packages");

                int j = 0;
                foreach (string s in bb)
                {
                    if (j != 0)
                    {
                        pp += "\\" + s;
                    }
                    else
                    {
                        pp = s;
                    }

                    if (j > i)
                    {
                        break;
                    }
                    j++;
                }

                pp = Path.GetFullPath(pp);

                if (!Directory.Exists(pp))
                {
                    continue;
                }

                string[] dd = Directory.GetFiles(pp);

                IPackage package = null;

                foreach (string d in dd)
                {
                    if (d.EndsWith(".nupkg"))
                    {
                        package = NuGets.ReadNuSpec(d);

                        break;
                    }
                }

                if (package == null)
                {
                    continue;
                }

                InstalledPackages.Add(package);

                {
                    IPackage packages = NuGets.GetNuGetPackage(package.Id, package.Version.ToFullString());
                    if (packages != null)
                    {
                        AddNugetPackageInfo(packages);
                    }
                }
            }
        }