Ejemplo n.º 1
0
        public FileIndexer()
        {
            DirectoryInfo mydir = new DirectoryInfo(@"../../../Nethereum.Worbooks.Tests");

            FileInfo[] f = mydir.GetFiles();
            foreach (FileInfo file in f)
            {
                if (file.Name.Contains("UnitTest"))
                {
                    Nugets.Add(new Nuget()
                    {
                        Path = file.DirectoryName
                    });
                    //for (int i = 0; i < Nugets.Count; i++)
                    //{
                    //    Nugets.Add(new Nuget() { Path = f[i].DirectoryName });
                    //}
                    System.Console.WriteLine("File Name: {0} Size: {1}", file.Name, file.DirectoryName);
                }
            }
            //for (int i = 0; i < Nugets.Count; i++)
            //{
            //    if (mydir.Name.Contains("UnitTest"))
            //    {
            //        Nugets.Add(new Nuget() { Path = f[i].DirectoryName });
            //        Console.WriteLine("File Name: {0} Size: {1}", f[1].Name, f[i].DirectoryName);
            //        Console.WriteLine(Nugets);
            //    }
            //}
            System.Console.ReadLine();
        }
Ejemplo n.º 2
0
        public async Task AddPackage(string name, Action <string>?statusCallback = null)
        {
            if (Nugets == null)
            {
                throw new InvalidOperationException("Packages can be only added to the global references collection");
            }

            var duration = Stopwatch.StartNew();

            var pkg = await Nugets.Add(name, statusCallback);

            AddAssemblies(Nugets.Assemblies.ToArray());

            duration.Stop();
            PackageLoaded?.Invoke(this, new PackageLoadedEventArgs(pkg.Id, pkg.Version.ToNormalizedString(), duration.Elapsed));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Adds the libraries from the given nuget package to the list of assemblies.
        /// If version is not provided. It automatically picks up the latest version.
        /// </summary>
        public async Task AddPackage(string name)
        {
            var duration = Stopwatch.StartNew();

            if (Nugets == null)
            {
                throw new InvalidOperationException("Packages can be only added to the global references collection");
            }

            var pkg = await Nugets.Add(name);

            Assemblies = Assemblies.Union(Nugets.Assemblies).ToImmutableArray();
            Reset();

            duration.Stop();
            PackageLoaded?.Invoke(this, new PackageLoadedEventArgs(pkg.Id, pkg.Version.ToNormalizedString(), duration.Elapsed));
        }